mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
merge
This commit is contained in:
commit
93ab1d453a
682 changed files with 3546 additions and 803 deletions
26
electron.js
26
electron.js
|
@ -3,17 +3,17 @@
|
|||
const { app, BrowserWindow, session, nativeTheme, ipcMain, powerMonitor, dialog } = require('electron');
|
||||
const { is, fixPathForAsarUnpack } = require('electron-util');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
const storage = require('electron-json-storage');
|
||||
const port = process.env.SERVER_PORT;
|
||||
const protocol = 'anytype';
|
||||
const remote = require('@electron/remote/main');
|
||||
const { installNativeMessagingHost } = require('./electron/js/lib/installNativeMessagingHost.js');
|
||||
|
||||
const userPath = app.getPath('userData');
|
||||
const logPath = path.join(userPath, 'logs');
|
||||
const binPath = fixPathForAsarUnpack(path.join(__dirname, 'dist', `anytypeHelper${is.windows ? '.exe' : ''}`));
|
||||
|
||||
if (is.development) {
|
||||
app.setPath('userData', path.join(app.getPath('userData'), '_dev'));
|
||||
};
|
||||
|
||||
const Api = require('./electron/js/api.js');
|
||||
const ConfigManager = require('./electron/js/config.js');
|
||||
const UpdateManager = require('./electron/js/update.js');
|
||||
|
@ -21,8 +21,10 @@ const MenuManager = require('./electron/js/menu.js');
|
|||
const WindowManager = require('./electron/js/window.js');
|
||||
const Server = require('./electron/js/server.js');
|
||||
const Util = require('./electron/js/util.js');
|
||||
|
||||
const Cors = require('./electron/json/cors.json');
|
||||
|
||||
const userPath = Util.userPath();
|
||||
const logPath = Util.logPath();
|
||||
const csp = [];
|
||||
|
||||
for (let i in Cors) {
|
||||
|
@ -94,13 +96,10 @@ nativeTheme.on('updated', () => {
|
|||
});
|
||||
|
||||
function createWindow () {
|
||||
mainWindow = WindowManager.createMain({ route: Util.getRouteFromUrl(deeplinkingUrl), isChild: false });
|
||||
Util.log('info', 'CreateWindow: ' + deeplinkingUrl + ' ' + JSON.stringify(process.argv));
|
||||
|
||||
if (process.env.ELECTRON_DEV_EXTENSIONS) {
|
||||
BrowserWindow.addDevToolsExtension(
|
||||
path.join(os.homedir(), '/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/4.6.0_0')
|
||||
);
|
||||
};
|
||||
|
||||
mainWindow = WindowManager.createMain({ route: Util.getRouteFromUrl(deeplinkingUrl), isChild: false });
|
||||
|
||||
mainWindow.on('close', (e) => {
|
||||
Util.log('info', 'closeMain: ' + app.isQuiting);
|
||||
|
@ -129,6 +128,7 @@ function createWindow () {
|
|||
|
||||
installNativeMessagingHost();
|
||||
|
||||
ipcMain.removeHandler('Api');
|
||||
ipcMain.handle('Api', (e, id, cmd, args) => {
|
||||
const Api = require('./electron/js/api.js');
|
||||
const win = BrowserWindow.fromId(id);
|
||||
|
@ -144,6 +144,8 @@ function createWindow () {
|
|||
console.error('[Api] method not defined:', cmd);
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
app.on('ready', () => {
|
||||
|
@ -198,6 +200,8 @@ app.on('activate', () => {
|
|||
app.on('open-url', (e, url) => {
|
||||
e.preventDefault();
|
||||
|
||||
deeplinkingUrl = url;
|
||||
|
||||
if (mainWindow) {
|
||||
Util.send(mainWindow, 'route', Util.getRouteFromUrl(url));
|
||||
mainWindow.show();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue