diff options
author | RaindropsSys <raindrops@equestria.dev> | 2023-11-26 17:10:11 +0100 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2023-11-26 17:10:11 +0100 |
commit | 417c403ba8e46dd97ffe656fc8761cb8c6380652 (patch) | |
tree | 208c8d5aa23ca4b8ddc35d2b37159ab4ab07b901 /desktop | |
parent | e1fe55e82cc4af07a5e4544de1629b9d25c9ce2b (diff) | |
download | mist-417c403ba8e46dd97ffe656fc8761cb8c6380652.tar.gz mist-417c403ba8e46dd97ffe656fc8761cb8c6380652.tar.bz2 mist-417c403ba8e46dd97ffe656fc8761cb8c6380652.zip |
Updated 13 files and added app/studio.php (automated)
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/main.js | 48 | ||||
-rw-r--r-- | desktop/preload.js | 1 |
2 files changed, 45 insertions, 4 deletions
diff --git a/desktop/main.js b/desktop/main.js index 1d0b322..02f153d 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -229,7 +229,6 @@ function getCopyrightYear() { } } -app.setName("Mist"); app.setAsDefaultProtocolClient("mist"); app.setAboutPanelOptions({ applicationName: "Mist", @@ -239,10 +238,12 @@ app.setAboutPanelOptions({ website: "https://mist.equestria.horse/app/" }); -const gotTheLock = app.requestSingleInstanceLock(); +if (app.getName() !== "Electron") { + const gotTheLock = app.requestSingleInstanceLock(); -if (!gotTheLock) { - app.quit(); + if (!gotTheLock) { + app.quit(); + } } let loggedIn = false; @@ -337,6 +338,40 @@ const createWindow = () => { }); } +const studioMode = () => { + if (global.studioWindow) return; + + global.studioWindow = new BrowserWindow({ + width: require('electron').screen.getPrimaryDisplay().workAreaSize.width, + minWidth: 1280, + height: require('electron').screen.getPrimaryDisplay().workAreaSize.height, + minHeight: 720, + autoHideMenuBar: true, + title: "Mist Studio", + backgroundColor: "#111111", + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + scrollBounce: true, + enableWebSQL: false + } + }); + + updateMenu(studioWindow); + + studioWindow.webContents.setUserAgent(studioWindow.webContents.getUserAgent() + " MistNative/" + process.platform); + studioWindow.loadURL("https://mist.equestria.horse/app/studio.php"); + + studioWindow.webContents.setWindowOpenHandler((details) => { + shell.openExternal(details.url); + return { action: "deny" }; + }); + + studioWindow.on('close', () => { + global.studioWindow = null; + }); +} + ipcMain.handle('auth', () => { shell.openExternal("https://mist.equestria.horse/oauth/native/"); }); @@ -345,6 +380,11 @@ ipcMain.handle('about', () => { app.showAboutPanel(); }); +ipcMain.handle('studio', () => { + studioMode(); + mainWindow.close(); +}); + ipcMain.handle('userInfo', (e, userInfo) => { global.userInfo = JSON.parse(userInfo); updateMenu(mainWindow); diff --git a/desktop/preload.js b/desktop/preload.js index 2b37f60..4c85000 100644 --- a/desktop/preload.js +++ b/desktop/preload.js @@ -6,4 +6,5 @@ contextBridge.exposeInMainWorld('MistNative', { about: () => ipcRenderer.invoke('about'), notification: (song, img) => ipcRenderer.invoke('notification', song, img), userInfo: (ui) => ipcRenderer.invoke('userInfo', ui), + studio: () => ipcRenderer.invoke('studio') })
\ No newline at end of file |