This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
appcat
/
sonist
Archived
1
0
Fork 0

更新6.x的API

2.x
宇天 2019-09-09 00:56:32 +08:00
parent d1dcba7711
commit b72a8d4780
3 changed files with 19 additions and 11 deletions

View File

@ -25,15 +25,14 @@ const log = console.log
const fs = require('iofs') const fs = require('iofs')
const path = require('path') const path = require('path')
const { remote, ipcRenderer, screen } = require('electron') const { remote, ipcRenderer } = require('electron')
const { createDesktopLrcWindow, createMiniWindow } = remote.require( const { createDesktopLrcWindow, createMiniWindow } = remote.require(
'./tools/windows' './tools/windows'
) )
const MAIN_SCREEN = screen.getPrimaryDisplay()
const WIN = remote.getCurrentWindow() const WIN = remote.getCurrentWindow()
const __LRC__ = createDesktopLrcWindow(MAIN_SCREEN) const __LRC__ = createDesktopLrcWindow(screen)
const __MINI__ = createMiniWindow(MAIN_SCREEN) const __MINI__ = createMiniWindow(screen)
const PLAY_MODE = { const PLAY_MODE = {
0: 'all', 0: 'all',

View File

@ -41,7 +41,9 @@ const ROOT = __dirname
app.commandLine.appendSwitch('--lang', 'zh-CN') app.commandLine.appendSwitch('--lang', 'zh-CN')
app.commandLine.appendSwitch('--autoplay-policy', 'no-user-gesture-required') app.commandLine.appendSwitch('--autoplay-policy', 'no-user-gesture-required')
protocol.registerStandardSchemes(['app'], { secure: true }) protocol.registerSchemesAsPrivileged([
{ scheme: 'app', privileges: { secure: true, standard: true } }
])
/* ----------------------------------------------------- */ /* ----------------------------------------------------- */

View File

@ -22,7 +22,8 @@ exports.createMainWindow = function(icon) {
icon, icon,
webPreferences: { webPreferences: {
webSecurity: false, webSecurity: false,
experimentalFeatures: true experimentalFeatures: true,
nodeIntegration: true
}, },
show: false show: false
}) })
@ -74,12 +75,15 @@ exports.createDesktopLrcWindow = function(screen) {
resizable: false, resizable: false,
alwaysOnTop: true, alwaysOnTop: true,
skipTaskbar: true, skipTaskbar: true,
x: (screen.size.width - 1024) / 2, x: (screen.width - 1024) / 2,
y: screen.size.height - 100, y: screen.height - 100,
transparent: true, transparent: true,
hasShadow: false, hasShadow: false,
thickFrame: false, thickFrame: false,
show: false show: false,
webPreferences: {
nodeIntegration: true
}
}) })
win.loadURL('app://local/desktop-lrc.html') win.loadURL('app://local/desktop-lrc.html')
@ -98,10 +102,13 @@ exports.createMiniWindow = function(screen) {
resizable: false, resizable: false,
alwaysOnTop: true, alwaysOnTop: true,
skipTaskbar: true, skipTaskbar: true,
x: screen.size.width - 320, x: screen.width - 320,
y: 0, y: 0,
thickFrame: false, thickFrame: false,
show: false show: false,
webPreferences: {
nodeIntegration: true
}
}) })
win.loadURL('app://local/mini-win.html') win.loadURL('app://local/mini-win.html')