mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-18 17:56:55 +08:00
Merge branch 'master' of https://github.com/clouDr-f2e/rubick into master
This commit is contained in:
commit
ad5d8b45d6
@ -3,4 +3,5 @@ module.exports = () => ({
|
||||
separator: require("./separate")(),
|
||||
capture: require("./capture")(),
|
||||
superPanel: require("./superPanel")(),
|
||||
main: require("./main")(),
|
||||
});
|
||||
|
53
src/main/browsers/main.js
Normal file
53
src/main/browsers/main.js
Normal file
@ -0,0 +1,53 @@
|
||||
const { BrowserWindow, protocol } = require("electron");
|
||||
module.exports = () => {
|
||||
let win;
|
||||
|
||||
let init = (opts) => {
|
||||
createWindow(opts);
|
||||
};
|
||||
|
||||
let createWindow = (opts) => {
|
||||
const winURL = process.env.NODE_ENV === 'development'
|
||||
? `http://localhost:9080`
|
||||
: `file://${__dirname}/index.html`
|
||||
|
||||
win = new BrowserWindow({
|
||||
height: 60,
|
||||
useContentSize: true,
|
||||
width: 800,
|
||||
frame: false,
|
||||
title: '拉比克',
|
||||
show: false,
|
||||
webPreferences: {
|
||||
webSecurity: false,
|
||||
enableRemoteModule: true,
|
||||
backgroundThrottling: false,
|
||||
webviewTag: true,
|
||||
nodeIntegration: true // 在网页中集成Node
|
||||
}
|
||||
})
|
||||
|
||||
win.loadURL(winURL)
|
||||
|
||||
protocol.interceptFileProtocol('image', (req, callback) => {
|
||||
const url = req.url.substr(8);
|
||||
callback(decodeURI(url));
|
||||
}, (error) => {
|
||||
if (error) {
|
||||
console.error('Failed to register protocol');
|
||||
}
|
||||
});
|
||||
|
||||
win.once('ready-to-show', () => win.show());
|
||||
win.on("closed", () => {
|
||||
win = undefined;
|
||||
});
|
||||
};
|
||||
|
||||
let getWindow = () => win;
|
||||
|
||||
return {
|
||||
init: init,
|
||||
getWindow: getWindow,
|
||||
};
|
||||
};
|
@ -1,9 +1,9 @@
|
||||
import { app, BrowserWindow, protocol } from 'electron'
|
||||
import { app } from 'electron'
|
||||
import '../renderer/store'
|
||||
import init from './common/common';
|
||||
import {autoUpdate} from './common/autoUpdate';
|
||||
import createTray from './tray';
|
||||
const {capture} = require("./browsers")();
|
||||
const {capture, main} = require("./browsers")();
|
||||
/**
|
||||
* Set `__static` path to static files in production
|
||||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
|
||||
@ -13,50 +13,17 @@ if (process.env.NODE_ENV !== 'development') {
|
||||
}
|
||||
// to fix https://github.com/electron/electron/issues/18397
|
||||
app.allowRendererProcessReuse = false;
|
||||
let mainWindow
|
||||
const winURL = process.env.NODE_ENV === 'development'
|
||||
? `http://localhost:9080`
|
||||
: `file://${__dirname}/index.html`
|
||||
app.dock.hide();
|
||||
|
||||
function createWindow () {
|
||||
/**
|
||||
* Initial window options
|
||||
*/
|
||||
capture.useCapture()
|
||||
mainWindow = new BrowserWindow({
|
||||
height: 60,
|
||||
useContentSize: true,
|
||||
width: 800,
|
||||
frame: false,
|
||||
title: '拉比克',
|
||||
webPreferences: {
|
||||
webSecurity: false,
|
||||
enableRemoteModule: true,
|
||||
backgroundThrottling: false,
|
||||
webviewTag: true,
|
||||
nodeIntegration: true // 在网页中集成Node
|
||||
}
|
||||
})
|
||||
|
||||
mainWindow.loadURL(winURL)
|
||||
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = null
|
||||
});
|
||||
protocol.interceptFileProtocol('image', (req, callback) => {
|
||||
const url = req.url.substr(8);
|
||||
callback(decodeURI(url));
|
||||
}, (error) => {
|
||||
if (error) {
|
||||
console.error('Failed to register protocol');
|
||||
}
|
||||
});
|
||||
init(mainWindow);
|
||||
function createWindow() {
|
||||
capture.useCapture();
|
||||
main.init();
|
||||
init(main.getWindow());
|
||||
}
|
||||
|
||||
app.on('ready', () => {
|
||||
createWindow()
|
||||
createTray(mainWindow);
|
||||
createTray(main.getWindow());
|
||||
autoUpdate();
|
||||
})
|
||||
|
||||
@ -67,27 +34,6 @@ app.on('window-all-closed', () => {
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (mainWindow === null) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
createWindow()
|
||||
});
|
||||
|
||||
/**
|
||||
* Auto Updater
|
||||
*
|
||||
* Uncomment the following code below and install `electron-updater` to
|
||||
* support auto updating. Code Signing with a valid certificate is required.
|
||||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-builder.html#auto-updating
|
||||
*/
|
||||
|
||||
/*
|
||||
import { autoUpdater } from 'electron-updater'
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
autoUpdater.quitAndInstall()
|
||||
})
|
||||
|
||||
app.on('ready', () => {
|
||||
if (process.env.NODE_ENV === 'production') autoUpdater.checkForUpdates()
|
||||
})
|
||||
*/
|
||||
|
@ -74,7 +74,7 @@ const sysFile = {
|
||||
},
|
||||
getUserPlugins() {
|
||||
try {
|
||||
return store.get('user-plugins').devPlugins;
|
||||
return store.get('user-plugins');
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
@ -97,15 +97,20 @@ function mergePlugins(plugins) {
|
||||
})
|
||||
]
|
||||
|
||||
return result.filter((item, i) => {
|
||||
let targetIndex;
|
||||
result.forEach((tg, j) => {
|
||||
const target = [];
|
||||
|
||||
result.forEach((item, i) => {
|
||||
let targetIndex = -1;
|
||||
target.forEach((tg, j) => {
|
||||
if (tg.tag === item.tag && tg.type === 'system') {
|
||||
targetIndex = j
|
||||
}
|
||||
});
|
||||
return i === targetIndex;
|
||||
if (targetIndex === -1) {
|
||||
target.push(item)
|
||||
}
|
||||
});
|
||||
return target
|
||||
}
|
||||
|
||||
function find(p, target = 'plugin.json') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user