feat: support google cloud login in client (#1822)

Co-authored-by: Himself65 <himself65@outlook.com>
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
Horus
2023-04-12 02:42:36 +08:00
committed by GitHub
parent 024c469a2c
commit c0669359ed
17 changed files with 252 additions and 42 deletions
+17 -2
View File
@@ -1,11 +1,21 @@
import './security-restrictions';
import { app } from 'electron';
import path from 'path';
import { registerHandlers } from './app-state';
import { restoreOrCreateWindow } from './main-window';
import { registerProtocol } from './protocol';
if (process.defaultApp) {
if (process.argv.length >= 2) {
app.setAsDefaultProtocolClient('affine', process.execPath, [
path.resolve(process.argv[1]),
]);
}
} else {
app.setAsDefaultProtocolClient('affine');
}
/**
* Prevent multiple instances
*/
@@ -15,7 +25,13 @@ if (!isSingleInstance) {
process.exit(0);
}
app.on('second-instance', restoreOrCreateWindow);
app.on('second-instance', (event, argv) => {
restoreOrCreateWindow();
});
app.on('open-url', async (_, url) => {
// todo: handle `affine://...` urls
});
/**
* Disable Hardware Acceleration for more power-save
@@ -45,7 +61,6 @@ app
.then(registerHandlers)
.then(restoreOrCreateWindow)
.catch(e => console.error('Failed create window:', e));
/**
* Check new app version in production mode only
*/