Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async onReady() {
if (isDevelopment && !process.env.IS_TEST) {
// Install Vue Devtools
try {
await installVueDevtools()
} catch (e) {
console.error('Vue Devtools failed to install:', e.toString())
}
}
if (!process.env.WEBPACK_DEV_SERVER_URL) createProtocol('app')
Timeline.ready()
Streaming.ready()
Auth.ready()
ipcMain.on('dark-theme', (e: Event) => e.returnValue = this.isDarkMode)
ipcMain.on('is-startup', (e: Event) => {
// 初回起動かどうかをここで判断させる。timeline.dbかaccount.dbがあれば初回起動じゃない扱いでもいいか?
e.returnValue = true
})
Window.Main()
}
private async onReady() {
if (isDevelopment && !process.env.IS_TEST) {
// Install Vue Devtools
try {
await installVueDevtools()
} catch (e) {
console.error('Vue Devtools failed to install:', e.toString())
}
}
if (!process.env.WEBPACK_DEV_SERVER_URL) createProtocol('app')
Timeline.ready()
Streaming.ready()
Auth.ready()
ipcMain.on('dark-theme', (e: Event) => e.returnValue = this.isDarkMode)
ipcMain.on('is-startup', (e: Event) => {
// 初回起動かどうかをここで判断させる。timeline.dbかaccount.dbがあれば初回起動じゃない扱いでもいいか?
e.returnValue = true
})
width: 800,
height: 500,
minWidth: 800,
minHeight: 500,
webPreferences: {
nodeIntegration: true
}
})
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
// 控制台
if (!process.env.IS_TEST) win.webContents.openDevTools()
} else {
createProtocol('app')
// Load the index.html when not in development
win.loadURL('app://./index.html')
}
win.on('closed', () => {
win = null
})
}
webPreferences: {
nodeIntegration: false,
sandbox: true,
enableRemoteModule: false,
contextIsolation: true,
preload: path.join(__dirname, 'preload.js')
}
});
if (process.env.WEBPACK_DEV_SERVER_URL) {
pyHandler.setCorsURL(process.env.WEBPACK_DEV_SERVER_URL);
// Load the url of the dev server if in development mode
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL);
if (!process.env.IS_TEST) win.webContents.openDevTools();
} else {
createProtocol('app');
// Load the index.html when not in development
pyHandler.setCorsURL('app://*');
win.loadURL('app://./index.html');
}
const menuTemplate: MenuItemConstructorOptions[] = defaultMenuTemplate as MenuItemConstructorOptions[];
Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplate));
// Register and deregister listeners to window events (resize, move, close) so that window state is saved
mainWindowState.manage(win);
win.on('closed', async () => {
win = null;
});
pyHandler.createPyProc(win);
width: 1400,
height: 900,
center: true,
show: false,
});
win.once('ready-to-show', () => {
win.show();
});
if (isDevelopment) {
// Load the url of the dev server if in development mode
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string);
if (!process.env.IS_TEST) {
win.webContents.openDevTools();
}
} else {
createProtocol('app');
// Load the index.html when not in development
win.loadFile('index.html');
}
win.on('closed', () => {
win = null;
});
}
win = new BrowserWindow({
width: isDevelopment ? 900 : 650,
height: 520,
frame: false,
show: false,
webPreferences: {
nodeIntegration: true
}
});
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL);
if (!process.env.IS_TEST) win.webContents.openDevTools();
} else {
createProtocol('app');
// Load the index.html when not in development
win.loadURL('app://./index.html');
}
win.once('ready-to-show', win.show);
win.on('close', event => {
if (!isSaved) {
event.preventDefault();
win.webContents.send('save');
}
});
win.on('closed', () => {
win = null;
});
function createWindow () {
// Create the browser window.
win = new BrowserWindow({ width: 800, height: 600 })
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
if (!process.env.IS_TEST) win.webContents.openDevTools()
} else {
createProtocol('app')
// Load the index.html when not in development
win.loadURL('app://./index.html')
}
win.on('closed', () => {
win = null
})
}
titleBarStyle: 'hiddenInset' as ('hidden' | 'default' | 'hiddenInset' | 'customButtonsOnHover' | undefined),
}
if (process.platform !== 'darwin') {
winOption.icon = `${__dirname}/app-icons/gridea.png`
}
win = new BrowserWindow(winOption)
win.setTitle('Gridea')
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string)
if (!process.env.IS_TEST) { win.webContents.openDevTools() }
} else {
createProtocol('app')
// Load the index.html when not in development
win.loadURL('app://./index.html')
autoUpdater.checkForUpdatesAndNotify()
}
win.on('closed', () => {
win = null
})
const locale: string = app.getLocale() || 'zh-CN'
const menuLabels = messages[locale] || messages['zh-CN']
// menu
const template: any = [
{
label: menuLabels.edit,
submenu: [
function createWindow() {
// Create the browser window.
focusWin = new BrowserWindow({
width: 800,
height: 600,
// transparent: true,
frame: false,
});
focusWin.setAlwaysOnTop(true);
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
focusWin.loadURL(process.env.WEBPACK_DEV_SERVER_URL);
if (!process.env.IS_TEST) focusWin.webContents.openDevTools();
} else {
createProtocol("app");
// Load the index.html when not in development
focusWin.loadURL("app://./index.html");
}
focusWin.on("closed", () => {
focusWin = null;
});
}
// Create the browser window.
win = new BrowserWindow({
width: 1500, height: 800, webPreferences: {
nodeIntegration: true,
}
});
app.dock.show();
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL);
if (!process.env.IS_TEST) win.webContents.openDevTools()
} else {
createProtocol('app');
// Load the index.html when not in development
win.loadURL('app://./index.html')
}
win.on('closed', () => {
win = null;
app.dock.hide();
})
}