mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-17 17:16:57 +08:00
feat: 废弃对 uTools 生态支持能力,重写 API
This commit is contained in:
parent
12962a737b
commit
ffb6ac96dc
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rubick2",
|
||||
"version": "0.0.2-beta.2",
|
||||
"version": "0.0.3-beta.1",
|
||||
"author": "muwoo <2424880409@qq.com>",
|
||||
"description": "An electron-vue project",
|
||||
"license": null,
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="market">
|
||||
<a-carousel arrows>
|
||||
<a-carousel v-if="bannerList && !!bannerList.length" arrows>
|
||||
<div
|
||||
slot="prevArrow"
|
||||
slot-scope="props"
|
||||
@ -16,7 +16,7 @@
|
||||
<img width="100%" :src="banner.src" />
|
||||
</div>
|
||||
</a-carousel>
|
||||
<a-divider></a-divider>
|
||||
<a-divider v-if="bannerList && !!bannerList.length"></a-divider>
|
||||
<h2>插件</h2>
|
||||
<a-list item-layout="horizontal" style="width: 100%" :grid="{ gutter: 16, column: 2 }" :data-source="pluginList">
|
||||
<a-list-item slot="renderItem" slot-scope="item, index">
|
||||
|
@ -46,7 +46,7 @@ function convertImgToBase64(url, callback, outputFormat){
|
||||
img.src = url;
|
||||
}
|
||||
|
||||
window.utools = window.rubick = {
|
||||
window.rubick = {
|
||||
// 事件
|
||||
onPluginEnter(cb) {
|
||||
ipcRenderer.on('onPluginEnter', (e, message) => {
|
||||
@ -240,78 +240,6 @@ window.utools = window.rubick = {
|
||||
removeFeature(code) {
|
||||
ipcRenderer.sendToHost('removeFeature', {code});
|
||||
},
|
||||
ubrowser: {
|
||||
winId: '',
|
||||
async goto(md, opts) {
|
||||
const objExp = new RegExp(/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/);
|
||||
let winId;
|
||||
let win;
|
||||
win = new BrowserWindow({
|
||||
show: false,
|
||||
title: typeof opts === 'object' ? '' : opts,
|
||||
webPreferences: {
|
||||
webSecurity: false,
|
||||
enableRemoteModule: true,
|
||||
backgroundThrottling: false,
|
||||
webviewTag: true,
|
||||
nodeIntegration: true // 在网页中集成Node
|
||||
}
|
||||
});
|
||||
if(objExp.test(md) && md.indexOf('http') === 0) {
|
||||
await win.loadURL(md);
|
||||
winId = win.id;
|
||||
} else {
|
||||
marked.setOptions({
|
||||
renderer: rendererMD,
|
||||
gfm: true,
|
||||
tables: true,
|
||||
breaks: false,
|
||||
pedantic: false,
|
||||
sanitize: false,
|
||||
smartLists: true,
|
||||
smartypants: false
|
||||
});
|
||||
const htmlContent = marked(md);
|
||||
win.loadURL('data:text/html;charset=UTF-8,' + encodeURIComponent(htmlContent))
|
||||
win.once('ready-to-show', () => win.show());
|
||||
winId = win.id;
|
||||
}
|
||||
return {
|
||||
value(selector, value) {
|
||||
ipcRenderer.send('msg-trigger', {
|
||||
type: 'ubrowser.value',
|
||||
winId,
|
||||
selector, value
|
||||
});
|
||||
return new Promise(resolve => {
|
||||
ipcRenderer.once(`msg-back-ubrowser.value`, (e, result) => {
|
||||
resolve(this)
|
||||
});
|
||||
})
|
||||
},
|
||||
click(selector) {
|
||||
ipcRenderer.send('msg-trigger', {
|
||||
type: 'ubrowser.click',
|
||||
winId,
|
||||
selector,
|
||||
});
|
||||
return new Promise(resolve => {
|
||||
ipcRenderer.once(`msg-back-ubrowser.click`, (e, result) => {
|
||||
resolve(this)
|
||||
});
|
||||
})
|
||||
},
|
||||
run(options) {
|
||||
ipcRenderer.send('msg-trigger', {
|
||||
type: 'ubrowser.run',
|
||||
winId,
|
||||
...options
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// 系统
|
||||
shellOpenExternal(url) {
|
||||
shell.openExternal(url);
|
||||
|
Loading…
x
Reference in New Issue
Block a user