mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-11 23:40:24 +00:00
chore: webui
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
//LiteLoader需要提供部分IPC接口,以便于其他插件调用
|
||||
const electron = require('electron');
|
||||
const { ipcMain } = require('electron');
|
||||
const fs = require('fs');
|
||||
ipcMain.handle("napcat_get_webtoken", async (event, arg) => {
|
||||
return "http://127.0.0.1:6099/webui/?token=" + JSON.parse(fs.readFileSync(__dirname + '/config/webui.json', 'utf-8').toString()).token;
|
||||
});
|
||||
require('./napcat.cjs');
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
const { contextBridge } = require('electron')
|
||||
const { ipcRenderer } = require('electron')
|
||||
|
||||
const napcat = {
|
||||
getWebUiUrl: async () => {
|
||||
return ipcRenderer.invoke("napcat_get_webtoken")
|
||||
}
|
||||
}
|
||||
// 在window对象下导出只读对象
|
||||
contextBridge.exposeInMainWorld('napcat', napcat)
|
||||
@@ -1,2 +1,13 @@
|
||||
export const onSettingWindowCreated = (view) => {
|
||||
export const onSettingWindowCreated = async (view) => {
|
||||
view.style.width = "100%";
|
||||
view.style.height = "100%";
|
||||
//添加iframe
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.src = await window.napcat.getWebUiUrl();
|
||||
iframe.width = "100%";
|
||||
iframe.height = "100%";
|
||||
iframe.style.border = "none";
|
||||
//去掉iframe滚动条
|
||||
iframe.scrolling = "no";
|
||||
view.appendChild(iframe);
|
||||
};
|
||||
Reference in New Issue
Block a user