Skip to content

Commit 94b13f4

Browse files
authored
build: prepare v6.0.0 release (#1806)
* 6.0.0 * fix build Signed-off-by: Adam Setch <[email protected]> * fix: attempt to fix windows sso login. increase logging Signed-off-by: Adam Setch <[email protected]> * fix margin multi accounts Signed-off-by: Adam Setch <[email protected]> * fix linux permissions Signed-off-by: Adam Setch <[email protected]> * fix linux permissions Signed-off-by: Adam Setch <[email protected]> * change pack scripts Signed-off-by: Adam Setch <[email protected]> * change pack scripts Signed-off-by: Adam Setch <[email protected]> * change pack scripts Signed-off-by: Adam Setch <[email protected]> * change pack scripts Signed-off-by: Adam Setch <[email protected]> * change pack scripts Signed-off-by: Adam Setch <[email protected]> * change pack scripts Signed-off-by: Adam Setch <[email protected]> --------- Signed-off-by: Adam Setch <[email protected]>
1 parent 617305b commit 94b13f4

File tree

7 files changed

+74
-19
lines changed

7 files changed

+74
-19
lines changed

.github/workflows/release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
name: Tests
1515
uses: ./.github/workflows/test.yml
1616
needs: lint
17+
secrets: inherit
1718

1819
publish:
1920
name: Publish

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gitify",
3-
"version": "5.18.0",
3+
"version": "6.0.0",
44
"description": "GitHub notifications on your menu bar.",
55
"main": "build/main.js",
66
"scripts": {
@@ -129,7 +129,7 @@
129129
"repo": "gitify"
130130
},
131131
"afterSign": "scripts/notarize.js",
132-
"afterPack": "scripts/remove-unused-locales.js"
132+
"afterPack": "scripts/afterPack.js"
133133
},
134134
"dependencies": {
135135
"@electron/remote": "2.1.2",

scripts/remove-unused-locales.js scripts/afterPack.js

+20-4
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,31 @@ const electronLanguages = packageJson.build.electronLanguages;
88
/**
99
* @param {AfterPackContext} context
1010
*/
11-
const removeLocales = async (context) => {
11+
const afterPack = async (context) => {
12+
// biome-ignore lint/suspicious/noConsoleLog: disabled
13+
console.log('[afterPack]: Starting...');
14+
1215
const appName = context.packager.appInfo.productFilename;
1316
const appOutDir = context.appOutDir;
1417
const platform = context.electronPlatformName;
1518

16-
if (platform !== 'darwin') {
17-
return;
19+
if (platform === 'darwin') {
20+
removeUnusedLocales(appOutDir, appName);
1821
}
1922

23+
// biome-ignore lint/suspicious/noConsoleLog: disabled
24+
console.log('[afterPack]: Completed');
25+
};
26+
27+
/**
28+
* Removes unused locales for macOS builds.
29+
* @param {string} appOutDir
30+
* @param {string} appName
31+
*/
32+
const removeUnusedLocales = (appOutDir, appName) => {
33+
// biome-ignore lint/suspicious/noConsoleLog: disabled
34+
console.log('[afterPack]: removing unused locales');
35+
2036
const resourcesPath = path.join(
2137
appOutDir,
2238
`${appName}.app`,
@@ -44,4 +60,4 @@ const removeLocales = async (context) => {
4460
}
4561
};
4662

47-
exports.default = removeLocales;
63+
exports.default = afterPack;

src/main/main.ts

+36-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { menubar } from 'menubar';
44

55
import { APPLICATION } from '../shared/constants';
66
import { namespacedEvent } from '../shared/events';
7-
import { isMacOS, isWindows } from '../shared/platform';
7+
import { logInfo, logWarn } from '../shared/logger';
8+
import { isLinux, isMacOS, isWindows } from '../shared/platform';
89
import { onFirstRunMaybe } from './first-run';
910
import { TrayIcons } from './icons';
1011
import MenuBuilder from './menu';
@@ -90,6 +91,31 @@ app.whenReady().then(async () => {
9091
});
9192
});
9293

94+
/** Prevent second instances */
95+
if (isWindows() || isLinux()) {
96+
const gotTheLock = app.requestSingleInstanceLock();
97+
98+
if (!gotTheLock) {
99+
logWarn('main:gotTheLock', 'Second instance detected, quitting');
100+
app.quit(); // Quit the second instance
101+
return;
102+
}
103+
104+
app.on('second-instance', (_event, commandLine, _workingDirectory) => {
105+
logInfo(
106+
'main:second-instance',
107+
'Second instance was launched. extracting command to forward',
108+
);
109+
110+
// Get the URL from the command line arguments
111+
const url = commandLine.find((arg) => arg.startsWith(`${protocol}://`));
112+
113+
if (url) {
114+
handleURL(url);
115+
}
116+
});
117+
}
118+
93119
/**
94120
* Gitify custom IPC events
95121
*/
@@ -183,5 +209,13 @@ ipc.handle(namespacedEvent('safe-storage-decrypt'), (_, settings) => {
183209
// Handle gitify:// custom protocol URL events for OAuth 2.0 callback
184210
app.on('open-url', (event, url) => {
185211
event.preventDefault();
186-
mb.window.webContents.send(namespacedEvent('auth-callback'), url);
212+
logInfo('main:open-url', `URL received ${url}`);
213+
handleURL(url);
187214
});
215+
216+
const handleURL = (url: string) => {
217+
if (url.startsWith(`${protocol}://`)) {
218+
logInfo('main:handleUrl', `forwarding URL ${url} to renderer process`);
219+
mb.window.webContents.send(namespacedEvent('auth-callback'), url);
220+
}
221+
};

src/renderer/routes/Accounts.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export const AccountsRoute: FC = () => {
121121
return (
122122
<Box
123123
key={accountUUID}
124-
className="rounded-md p-2 bg-gitify-accounts"
124+
className="rounded-md p-2 mb-4 bg-gitify-accounts"
125125
>
126126
<Stack direction="vertical" align="stretch">
127127
<Stack direction="horizontal" align="start">

src/renderer/routes/__snapshots__/Accounts.test.tsx.snap

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/utils/auth/utils.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import semver from 'semver';
44
import { ipcRenderer } from 'electron';
55
import { APPLICATION } from '../../../shared/constants';
66
import { namespacedEvent } from '../../../shared/events';
7-
import { logError, logWarn } from '../../../shared/logger';
7+
import { logError, logInfo, logWarn } from '../../../shared/logger';
88
import type {
99
Account,
1010
AuthCode,
@@ -62,6 +62,10 @@ export function authGitHub(
6262
ipcRenderer.on(
6363
namespacedEvent('auth-callback'),
6464
(_, callbackUrl: string) => {
65+
logInfo(
66+
'renderer:auth-callback',
67+
`received authentication callback URL ${callbackUrl}`,
68+
);
6569
handleCallback(callbackUrl);
6670
},
6771
);

0 commit comments

Comments
 (0)