add: base module

This commit is contained in:
2025-03-10 16:29:47 +08:00
parent 8b59a8e21a
commit 3a583a3619
40 changed files with 2698 additions and 218 deletions

4
.gitignore vendored
View File

@@ -1,3 +1,5 @@
node_modules node_modules
dist dist
app-dist app-dist
build
.DS_Store

BIN
icons/app-512x512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
icons/app.icns Normal file

Binary file not shown.

BIN
icons/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
icons/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
icons/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

@@ -1,14 +1,19 @@
{ {
"name": "silky-assistant", "name": "silky-assistant",
"version": "0.0.1", "version": "0.0.1",
"description": "", "description": "Silky Assistant",
"main": "dist/main/main.js", "main": "app-dist/main.js",
"scripts": { "scripts": {
"dev": "vite --config vite.config.ts", "dev": "vite --config vite.config.ts",
"build": "vite build --config vite.config.ts", "build": "cross-env NODE_ENV=production vite build --config vite.config.ts",
"build:watch": "vite build --config vite.config.ts -w", "build:watch": "cross-env NODE_ENV=development vite build --config vite.config.ts -w",
"build:electron": "vite build --config vite.config.ts", "build:mac": "electron-builder --mac --win",
"start": "electron ." "build:win": "electron-builder --win",
"build:linux": "electron-builder --linux",
"watch:electron": "electron app-dist/main.js --watch",
"start": "electron .",
"html": "tsx scripts/clear-directory.ts",
"pub": "ev deploy ./build -k silky-assistant -v 0.0.1 -u -o root"
}, },
"keywords": [], "keywords": [],
"author": "abearxiong <xiongxiao@xiongxiao.me>", "author": "abearxiong <xiongxiao@xiongxiao.me>",
@@ -17,6 +22,9 @@
"devDependencies": { "devDependencies": {
"@types/electron": "^1.6.12", "@types/electron": "^1.6.12",
"@types/node": "^22.13.9", "@types/node": "^22.13.9",
"cross-env": "^7.0.3",
"electron": "^35.0.0",
"electron-builder": "^25.1.8",
"electron-log": "^5.3.2", "electron-log": "^5.3.2",
"electron-updater": "^6.3.9", "electron-updater": "^6.3.9",
"typescript": "^5.8.2", "typescript": "^5.8.2",
@@ -27,6 +35,43 @@
"dependencies": { "dependencies": {
"@kevisual/assistant-module": "^0.0.3", "@kevisual/assistant-module": "^0.0.3",
"@kevisual/router": "^0.0.9", "@kevisual/router": "^0.0.9",
"electron": "^35.0.0" "@kevisual/use-config": "^1.0.9"
},
"build": {
"appId": "cn.silkeyai.assistant",
"productName": "Silky Assistant",
"copyright": "Copyright © 2025 ${author}",
"icon": "icons/app-512x512.png",
"directories": {
"output": "build"
},
"extraResources": [
{
"from": "./dist/",
"to": "dist"
}
],
"files": [
"app-dist/**/*",
"node_modules/**/*",
"package.json",
"icons"
],
"win": {
"target": [
"nsis"
]
},
"mac": {
"target": "dmg"
},
"nsis": {
"oneClick": false,
"perMachine": true,
"allowToChangeInstallationDirectory": true
},
"linux": {
"target": "AppImage"
}
} }
} }

2290
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,35 @@
import path from 'path';
import fs from 'fs';
const root = process.cwd();
const buildPath = path.join(root, 'build');
export const main = () => {
//列出buildPath目录下的所有文件夹并删除
const files = fs.readdirSync(buildPath);
files.forEach((file) => {
const filePath = path.join(buildPath, file);
if (fs.statSync(filePath).isDirectory()) {
fs.rmdirSync(filePath, { recursive: true });
}
});
// 获取目录下的所有文件生成一个文件列表生成一个index.html包函下载列表相对路径
const _files = fs.readdirSync(buildPath);
let html = `
<html>
<body>
<ul>
`;
_files.forEach((file) => {
html += `<li><a href="./${file}">${file}</a></li>`;
});
html += `
</ul>
</body>
</html>
`;
fs.writeFileSync(path.join(buildPath, 'index.html'), html);
};
main()

3
src/main/app.ts Normal file
View File

@@ -0,0 +1,3 @@
import { useContextKey } from '@kevisual/use-config/context';
export { log, getLogPath } from './logger.ts';

View File

@@ -1,7 +1,7 @@
import { ipcMain } from 'electron'; import { ipcMain } from 'electron';
import { getAppList, getCacheAssistantConfig, setConfig } from '@/modules/config'; import { getAppList, getCacheAssistantConfig, setConfig } from '@/modules/config/index.ts';
import { installApp, uninstallApp } from '../proxy/install'; import { installApp, uninstallApp } from '../proxy/install.ts';
import { relunch } from '../window/relunch'; import { relunch } from '../window/relunch.ts';
export const handle = () => { export const handle = () => {
ipcMain.handle('get-app-list', (event, data) => { ipcMain.handle('get-app-list', (event, data) => {

View File

@@ -1,18 +1,23 @@
import { app, BrowserWindow, ipcMain, session } from 'electron'; import { app, BrowserWindow } from 'electron';
import * as path from 'path'; import * as path from 'path';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import { LocalElectronAppUrl } from '../modules/config'; import { createSession } from './session/index.ts';
import { createSession } from './session'; import { handle } from './handle/index.ts';
import { handle } from './handle'; import { loadMenu } from './menu/index.ts';
import { loadMenu } from './menu'; import { getLogPath, log } from './app.ts';
import { checkShowPage } from './window/page'; import { checkShowPage } from './window/page/index.ts';
import { createIntroducePage } from './window/page/introduce'; import { closeProcess, createProcess } from './process/index.ts';
import { getElectronResourcePath } from './system/env.ts';
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename); const __dirname = path.dirname(__filename);
let mainWindow: BrowserWindow | null; let mainWindow: BrowserWindow | null;
async function createWindow() { async function createWindow() {
const resourcePath = getElectronResourcePath();
log.info('resourcePath', resourcePath);
log.info('createWindow');
log.info('path', getLogPath());
const _session = createSession(); const _session = createSession();
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
width: 800, width: 800,
@@ -20,6 +25,7 @@ async function createWindow() {
webPreferences: { webPreferences: {
preload: path.join(__dirname, 'preload.js'), // 如果有 preload 脚本 preload: path.join(__dirname, 'preload.js'), // 如果有 preload 脚本
session: _session, session: _session,
webSecurity: false,
}, },
}); });
loadMenu(); loadMenu();
@@ -30,12 +36,16 @@ async function createWindow() {
}); });
} }
app.on('ready', createWindow); app.on('ready', async () => {
await createProcess();
createWindow();
});
app.on('window-all-closed', () => { app.on('window-all-closed', () => {
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
app.quit(); app.quit();
} }
closeProcess();
}); });
app.on('activate', () => { app.on('activate', () => {

View File

@@ -1,10 +1,11 @@
import { createEnterPage } from '../window/page/enter'; import { createEnterPage } from '../window/page/enter.ts';
import { BrowserWindow, Menu, app } from 'electron'; import { BrowserWindow, Menu, app } from 'electron';
import path from 'path'; import path from 'path';
import { getLogPath, log } from '../logger'; import { getLogPath, log } from '../logger.ts';
import { createAppPackagesPage } from '../window/page/app-packages'; import { createAppPackagesPage } from '../window/page/app-packages.ts';
import { relunch } from '../window/relunch'; import { relunch } from '../window/relunch.ts';
import { checkShowPage } from '../window/page/index.ts';
export const loadMenu = () => { export const loadMenu = () => {
const template = [ const template = [
{ {
@@ -32,11 +33,40 @@ export const loadMenu = () => {
// }, // },
], ],
}, },
{
label: '打开应用',
submenu: [
{
label: '首页',
click: () => {
// 获取当前window
const mainWindow = BrowserWindow.getFocusedWindow();
if (mainWindow) {
checkShowPage(mainWindow);
}
},
},
{
label: '打开配置',
click: async () => {
createEnterPage();
},
},
{
label: '打开应用市场',
click: async () => {
createAppPackagesPage();
},
},
],
},
{ {
label: '编辑', label: '编辑',
submenu: [ submenu: [
{ label: '复制', accelerator: 'CmdOrCtrl+C', selector: 'copy:' }, { label: '复制', accelerator: 'CmdOrCtrl+C', selector: 'copy:' },
{ label: '粘贴', accelerator: 'CmdOrCtrl+V', selector: 'paste:' }, { label: '粘贴', accelerator: 'CmdOrCtrl+V', selector: 'paste:' },
{ label: '撤销', accelerator: 'CmdOrCtrl+Z', selector: 'undo:' },
{ label: '全选', accelerator: 'CmdOrCtrl+A', selector: 'selectAll:' },
], ],
}, },
{ {
@@ -72,13 +102,6 @@ export const loadMenu = () => {
label: '帮助', label: '帮助',
role: 'help', role: 'help',
submenu: [ submenu: [
{
label: '文档',
click: async () => {
const { shell } = require('electron');
// shell.openExternal('http://adstudio.nisar.ai/docs/');
},
},
{ {
label: '打开日志', label: '打开日志',
click: async () => { click: async () => {
@@ -87,18 +110,6 @@ export const loadMenu = () => {
shell.openExternal('file://' + path.join(getLogPath())); shell.openExternal('file://' + path.join(getLogPath()));
}, },
}, },
{
label: '打开配置',
click: async () => {
createEnterPage();
},
},
{
label: '打开应用市场',
click: async () => {
createAppPackagesPage();
},
},
], ],
}, },
]; ];

82
src/main/process/index.ts Normal file
View File

@@ -0,0 +1,82 @@
// import { AssistantProcess } from '@kevisual/assistant-module/assistant-process';
import path from 'path';
import { fork } from 'child_process';
import { log } from '../app.ts';
import { isMac, isDev, getElectronResourcePath } from '../system/env.ts';
import { setProcessPid, getProcessPid, removeProcessPid } from '../../modules/config/process-pid.ts';
export const getAssistantCenterPath = () => {
const resourcePath = getElectronResourcePath();
if (isDev) {
return path.join(resourcePath, '../dist');
}
if (isMac()) {
return path.join(resourcePath, 'dist');
}
return path.join(resourcePath, 'dist');
};
// export const assistantCenterPath = path.join(__dirname, '../dist');
export const assistantCenterPath = getAssistantCenterPath();
export const assistantProcessPath = path.join(assistantCenterPath, 'dist/app.mjs');
// export const assistantProcess = new AssistantProcess(assistantPath);
export const processConfig = {
assistantCenterPath,
assistantProcessPath,
port: 51015,
process: null,
};
export const getOrigin = () => {
return `https://localhost:${processConfig.port}`;
};
export const createProcess = async () => {
log.info('createProcess', assistantProcessPath, 'cwd', assistantCenterPath);
const pid = getProcessPid();
if (pid) {
removeProcessPid();
await new Promise((resolve) => setTimeout(resolve, 1000));
}
return new Promise((resolve, reject) => {
// const signal = new AbortSignal();
try {
const assistantProcess = fork(assistantProcessPath, {
cwd: assistantCenterPath,
// signal,
stdio: 'inherit',
env: {
...process.env,
// KEVISUAL_URL: 'https://kevisual.xiongxiao.me',
KEVISUAL_URL: 'https://kevisual.silkyai.cn',
NODE_ENV_PARENT: 'fork',
},
});
assistantProcess.on('message', (message) => {
log.log('assistantProcess message', typeof message, message);
// if (message.toString().includes(checkString)) {
// resolve(assistantProcess);
// }
if (typeof message === 'object') {
const msg = message as { type: string; data?: { port?: number } };
if (msg.type === 'fork') {
resolve({ process: assistantProcess, port: msg.data?.port || processConfig.port });
}
}
});
assistantProcess.on('error', (error) => {
log.error(error);
});
processConfig.process = assistantProcess;
setProcessPid(assistantProcess.pid);
return assistantProcess;
} catch (error) {
log.error(error);
reject(error);
}
});
};
export const closeProcess = () => {
log.info('closeProcess');
removeProcessPid();
};

View File

@@ -1,6 +1,6 @@
import path from 'path'; import path from 'path';
import fs from 'fs'; import fs from 'fs';
import { appDir, kevisualUrl, addAppConfig, getAppConfig, setAppConfig, getCacheAssistantConfig, setConfig } from '../../modules/config'; import { appDir, kevisualUrl, addAppConfig, getAppConfig, setAppConfig, getCacheAssistantConfig, setConfig } from '../../modules/config/index.ts';
export const demoData = { export const demoData = {
id: '471ee96f-d7d8-4da1-b84f-4a34f4732f16', id: '471ee96f-d7d8-4da1-b84f-4a34f4732f16',

View File

@@ -1,57 +1,19 @@
import { app, BrowserWindow, ipcMain, session } from 'electron'; import { session } from 'electron';
import { getCacheAssistantConfig, appDir, LocalElectronAppUrl } from '../../modules/config';
import { net } from 'electron';
import path from 'path';
import * as url from 'url';
import { checkFileExists } from '../../modules/file';
import { apiProxyList } from '../proxy/api-proxy';
let _session: Electron.Session; let _session: Electron.Session;
export const createSession = () => { export const createSession = () => {
if (_session) { if (_session) {
return _session; return _session;
} }
// 创建一个持久化的会话
_session = session.fromPartition('persist:app'); _session = session.fromPartition('persist:app');
// Ignore certificate errors (for development only)
_session.protocol.handle('https', async (req) => { _session.webRequest.onBeforeSendHeaders((details, callback) => {
const requrl = req.url; details.requestHeaders['User-Agent'] = 'silky-assistant';
const newReqUrl = new URL(requrl); callback({ cancel: false, requestHeaders: details.requestHeaders });
const localOrigin = new URL(LocalElectronAppUrl).origin; });
if (newReqUrl.origin !== localOrigin) { _session.setCertificateVerifyProc((request, callback) => {
// 不拦截 callback(0); // 0 means trust the certificate
return net.fetch(req.url, { bypassCustomProtocolHandlers: true });
}
const apiProxy = apiProxyList.find((_proxy: any) => newReqUrl.pathname.startsWith(_proxy.path));
if (apiProxy) {
const pageApi = getCacheAssistantConfig().pageApi || '';
if (!pageApi) {
return new Response(`App Page Api Not Set, please set it first`);
}
const newPageUrl = new URL(req.url, pageApi);
return net.fetch(newPageUrl.toString(), { bypassCustomProtocolHandlers: true });
}
const [user, key] = newReqUrl.pathname.split('/').slice(1);
const proxyList = getCacheAssistantConfig().proxy || [];
const proxy = proxyList.find((_proxy: any) => newReqUrl.pathname.startsWith(_proxy.path));
if (proxy) {
try {
const relativePath = path.join(appDir, newReqUrl.pathname);
const indexHtml = path.join(appDir, user, key, 'index.html');
console.log('relativePath', relativePath);
if (checkFileExists(relativePath, true)) {
const res = await net.fetch(url.pathToFileURL(relativePath).toString());
return res;
} else {
const res = await net.fetch(url.pathToFileURL(indexHtml).toString());
return res;
}
} catch (error) {
console.error(error);
}
return new Response('App is Running Error, please reinstall it or refresh the page');
}
return new Response(`App Not Install, please install it first,user/app: [${user}/${key}]`);
}); });
return _session; return _session;
}; };

21
src/main/system/env.ts Normal file
View File

@@ -0,0 +1,21 @@
import { app } from 'electron';
export const isDev = () => {
return process.env.NODE_ENV === 'development';
};
export const isMac = () => {
return process.platform === 'darwin';
};
export const isWin = () => {
return process.platform === 'win32';
};
export const isLinux = () => {
return process.platform === 'linux';
};
export const getElectronResourcePath = () => {
return app.getAppPath();
};

View File

@@ -1,19 +1,10 @@
import { BrowserWindow } from 'electron'; import { BrowserWindow } from 'electron';
import path from 'path'; import { getOrigin } from '@/main/process/index.ts';
import { fileURLToPath } from 'url'; import { createWinodw } from './create-window.ts';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export const createAppPackagesPage = (window?: BrowserWindow) => { export const createAppPackagesPage = (window?: BrowserWindow) => {
const mainWindow = const mainWindow = createWinodw(window);
window || const url = new URL('/root/assistant-base-app/?link=packages', getOrigin());
new BrowserWindow({ mainWindow.loadURL(url.toString());
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'), // 如果有 preload 脚本
},
});
mainWindow.loadFile(path.join(__dirname, '../renderer/packages/index.html')); // Vite 构建后的文件
return mainWindow; return mainWindow;
}; };

View File

@@ -0,0 +1,22 @@
import { BrowserWindow } from 'electron';
import { fileURLToPath } from 'url';
import path from 'path';
import { createSession } from '../../session/index.ts';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export const createWinodw = (window: BrowserWindow, opts?: any) => {
if (window) return window;
const _session = createSession();
return new BrowserWindow({
width: 800,
height: 600,
...opts,
webPreferences: {
preload: path.join(__dirname, 'preload.js'), // 如果有 preload 脚本
session: _session,
webSecurity: false,
...opts?.webPreferences,
},
});
};

View File

@@ -1,19 +1,10 @@
import { BrowserWindow } from 'electron'; import { BrowserWindow } from 'electron';
import path from 'path'; import { getOrigin } from '@/main/process/index.ts';
import { fileURLToPath } from 'url'; import { createWinodw } from './create-window.ts';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export const createEnterPage = (window?: BrowserWindow) => { export const createEnterPage = (window?: BrowserWindow) => {
const mainWindow = const mainWindow = createWinodw(window);
window || const url = new URL('/root/assistant-base-app/?link=enter', getOrigin());
new BrowserWindow({ mainWindow.loadURL(url.toString());
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'), // 如果有 preload 脚本
},
});
mainWindow.loadFile(path.join(__dirname, '../renderer/enter/index.html')); // Vite 构建后的文件
return mainWindow; return mainWindow;
}; };

View File

@@ -1,18 +1,36 @@
import { getCacheAssistantConfig, LocalElectronAppUrl } from '@/modules/config'; import { getCacheAssistantConfig } from '@/modules/config/index.ts';
import { createEnterPage } from './enter'; import { createEnterPage } from './enter.ts';
import { createAppPackagesPage } from './app-packages'; import { createAppPackagesPage } from './app-packages.ts';
import { BrowserWindow } from 'electron'; import { BrowserWindow } from 'electron';
import { getOrigin } from '@/main/process/index.ts';
import { createWinodw } from './create-window.ts';
export const checkShowPage = async (window?: BrowserWindow) => { export const checkShowPage = async (window?: BrowserWindow) => {
const assistantConfig = getCacheAssistantConfig(); const assistantConfig = getCacheAssistantConfig();
const { pageApi, proxy } = assistantConfig; const { pageApi, proxy, loadURL } = assistantConfig;
if (!pageApi) { if (!pageApi) {
createEnterPage(window); return createEnterPage(window);
return;
} }
if (!proxy || proxy.length === 0) { if (!proxy || proxy.length === 0) {
createAppPackagesPage(window); return createAppPackagesPage(window);
return;
} }
return window?.loadURL(LocalElectronAppUrl); window = createWinodw(window);
let defaultURL = getOrigin() + '/web/note/';
if (loadURL) {
const url = new URL(loadURL, getOrigin());
const urls = url.pathname.split('/');
const [_, user, app] = urls;
let _loadURL = url.toString();
if (!user && !app) {
_loadURL = defaultURL;
}
if (app && urls.length === 3) {
_loadURL = url.toString() + '/';
}
console.log('url loadURL', _loadURL);
window?.loadURL(_loadURL);
return window;
}
window?.loadURL(defaultURL);
return window;
}; };

View File

@@ -1,14 +1,13 @@
import path from 'path'; import path from 'path';
import { homedir } from 'os'; import { homedir } from 'os';
import fs from 'fs'; import fs from 'fs';
import { checkFileExists, createDir } from '../file'; import { checkFileExists, createDir } from '../file/index.ts';
export const kevisualUrl = 'https://kevisual.xiongxiao.me'; export const kevisualUrl = 'https://kevisual.xiongxiao.me';
const configDir = createDir(path.join(homedir(), '.config/envision')); export const configDir = createDir(path.join(homedir(), '.config/envision'));
export const configPath = path.join(configDir, 'assistant-config.json'); export const configPath = path.join(configDir, 'assistant-config.json');
export const appConfigPath = path.join(configDir, 'assistant-app-config.json'); export const appConfigPath = path.join(configDir, 'assistant-app-config.json');
export const appDir = createDir(path.join(configDir, 'assistant-app/frontend')); export const appDir = createDir(path.join(configDir, 'assistant-app/frontend'));
export const LocalElectronAppUrl = 'https://assistant.app/user/tiptap/';
type AssistantConfig = { type AssistantConfig = {
pageApi?: string; // https://kevisual.silkyai.cn pageApi?: string; // https://kevisual.silkyai.cn
@@ -21,7 +20,7 @@ export const getConfig = () => {
if (!checkFileExists(configPath)) { if (!checkFileExists(configPath)) {
fs.writeFileSync(configPath, JSON.stringify({ proxy: [] }, null, 2)); fs.writeFileSync(configPath, JSON.stringify({ proxy: [] }, null, 2));
return { return {
loadURL: LocalElectronAppUrl, loadURL: '',
pageApi: '', pageApi: '',
proxy: [], proxy: [],
}; };
@@ -31,7 +30,7 @@ export const getConfig = () => {
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return { return {
loadURL: LocalElectronAppUrl, loadURL: '',
pageApi: '', pageApi: '',
proxy: [], proxy: [],
}; };

View File

@@ -0,0 +1,29 @@
import { configDir } from './index.ts';
import path from 'path';
import fs from 'fs';
import { checkFileExists } from '../file/index.ts';
export const processPidPath = path.join(configDir, 'process.pid');
export const getProcessPid = () => {
if (checkFileExists(processPidPath)) {
return fs.readFileSync(processPidPath, 'utf-8');
}
return null;
};
export const setProcessPid = (pid: string | number) => {
fs.writeFileSync(processPidPath, pid + '', 'utf-8');
};
export const removeProcessPid = () => {
const pid = getProcessPid();
if (pid) {
try {
process.kill(parseInt(pid));
fs.unlinkSync(processPidPath);
} catch (error) {
console.error(error);
}
}
};

0
src/renderer/.gitignore vendored Normal file
View File

Binary file not shown.

View File

@@ -21,7 +21,8 @@
"dev:watch": "cross-env NODE_ENV=development concurrently -n \"Watch,Dev\" -c \"green,blue\" \"npm run watch\" \"sleep 1 && npm run dev\" ", "dev:watch": "cross-env NODE_ENV=development concurrently -n \"Watch,Dev\" -c \"green,blue\" \"npm run watch\" \"sleep 1 && npm run dev\" ",
"clean": "rm -rf dist", "clean": "rm -rf dist",
"prepub": "envision switch root", "prepub": "envision switch root",
"pub": "npm run build && envision pack -p -u" "pub": "npm run build && envision pack -p -u",
"download": "ev app download -i root/assistant-base-app"
}, },
"keywords": [], "keywords": [],
"author": "abearxiong <xiongxiao@xiongxiao.me>", "author": "abearxiong <xiongxiao@xiongxiao.me>",
@@ -40,6 +41,7 @@
"cookie": "^1.0.2", "cookie": "^1.0.2",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"formidable": "^3.5.2", "formidable": "^3.5.2",
"get-port": "^7.1.0",
"json5": "^2.2.3", "json5": "^2.2.3",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"ws": "^8.18.1" "ws": "^8.18.1"

View File

@@ -0,0 +1,9 @@
import{u as h,r as i,j as e}from"./index-Cfi-lFTd.js";const m=()=>{const{config:o,getConfig:r,saveConfig:d}=h();i.useEffect(()=>{c(),r()},[]),i.useEffect(()=>{if(o.pageApi){const a=document.getElementById("pageApi");a.value=o.pageApi;const l=document.getElementById("loadURL");l.value=o.loadURL||"/web/note/"}},[o]);const c=()=>{const a=document.getElementById("particles"),l=20;if(a)for(let s=0;s<l;s++){const t=document.createElement("div");t.className="particle",t.innerHTML=`
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/>
<path d="M5 3v4"/>
<path d="M19 17v4"/>
<path d="M3 5h4"/>
<path d="M17 19h4"/>
</svg>
`;const n=10+Math.random()*20;t.style.width=`${n}px`,t.style.height=`${n}px`,t.style.left=`${Math.random()*100}%`,t.style.top=`${Math.random()*100}%`,t.style.animationDuration=`${5+Math.random()*5}s`,t.style.animationDelay=`${Math.random()*5}s`,a.appendChild(t)}},p=()=>{const a=document.getElementById("pageApi"),l=document.getElementById("loadURL");d({pageApi:a.value,loadURL:l.value})};return e.jsxs("div",{className:"h-full w-full p-4 pt-10",children:[e.jsx("div",{className:"particles",id:"particles"}),e.jsxs("div",{className:"container",children:[e.jsxs("div",{className:"header",children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),e.jsx("h1",{children:"Page Enter Configuration"})]}),e.jsxs("div",{className:"form-container",children:[e.jsxs("form",{id:"configForm",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"pageApi",children:"Page Enter Api"}),e.jsx("input",{type:"text",id:"pageApi",placeholder:"Enter page api configuration"})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"loadURL",children:"Page Index"}),e.jsx("input",{type:"text",id:"loadURL",placeholder:"首页,例如: /web/note/"})]}),e.jsxs("button",{type:"submit",id:"save-button",onClick:p,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e.jsx("polyline",{points:"17 21 17 13 7 13 7 21"}),e.jsx("polyline",{points:"7 3 7 8 15 8"})]}),"Save Configuration"]})]}),e.jsx("div",{id:"save-result"})]})]})]})};export{m as default};

View File

@@ -0,0 +1,31 @@
import{c as N,y as d,a as f,q as C,r as u,u as $,j as n}from"./index-Cfi-lFTd.js";const I=N((t,i)=>({installedPackages:[],shopPackages:[],setInstalledPackages:s=>t({installedPackages:s}),setShopPackages:s=>t({shopPackages:s}),getInstalledPackages:async()=>{const s=await f.post({path:"shop",key:"list-installed"});return s.code===200&&t({installedPackages:s.data}),s.data},getShopPackages:async()=>{const s=await C.post({path:"app",key:"public-list"});return s.code===200&&t({shopPackages:s.data}),s.data},uninstallPackage:async s=>{const c=await f.post({path:"shop",key:"uninstall",data:{pkg:s}});c.code===200?(i().getInstalledPackages(),d.success("Package uninstalled successfully")):d.error(c.message||"Failed to uninstall package"),console.log("uninstallPackage",c)},installPackage:async s=>{const c=d.loading("Installing package..."),o=await f.post({path:"shop",key:"install",data:{pkg:s}});d.dismiss(c),o.code===200?(i().getInstalledPackages(),d.success("Package installed successfully")):d.error(o.message||"Failed to install package"),console.log("installPackage",o)}}));/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const A=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),x=(...t)=>t.filter((i,s,c)=>!!i&&i.trim()!==""&&c.indexOf(i)===s).join(" ").trim();/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var S={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const U=u.forwardRef(({color:t="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:c,className:o="",children:r,iconNode:h,...p},k)=>u.createElement("svg",{ref:k,...S,width:i,height:i,stroke:t,strokeWidth:c?Number(s)*24/Number(i):s,className:x("lucide",o),...p},[...h.map(([g,m])=>u.createElement(g,m)),...Array.isArray(r)?r:[r]]));/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const b=(t,i)=>{const s=u.forwardRef(({className:c,...o},r)=>u.createElement(U,{ref:r,iconNode:i,className:x(`lucide-${A(t)}`,c),...o}));return s.displayName=`${t}`,s};/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const q=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],R=b("Link2",q);/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const E=[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]],L=b("SquareArrowOutUpRight",E),_=()=>{const{shopPackages:t,installedPackages:i,getInstalledPackages:s,getShopPackages:c,uninstallPackage:o,installPackage:r}=I(),{pageApi:h,pageStoreApi:p}=$();u.useEffect(()=>{s(),c()},[]);const k=e=>{const a=i.find(l=>l.user===e.user&&l.key===e.key);return a?a.version!==e.version?"update-available":"installed":"not-installed"},g=e=>{const a=t.find(l=>l.id===e);a&&r(a)},m=e=>{const a=t.find(l=>l.id===e);a&&r(a)},y=e=>{const a=t.find(l=>l.id===e);a&&r(a)},P=e=>{const a=t.find(l=>l.id===e);a&&o(a)},w=(e,a)=>{switch(e){case"not-installed":return n.jsx("button",{className:"button button-install",onClick:()=>g(a.id),children:"Install"});case"update-available":return n.jsx("button",{className:"button button-update",onClick:()=>m(a.id),children:"Update"});case"installed":return n.jsx("button",{className:"button button-reinstall",onClick:()=>y(a.id),children:"Reinstall"})}},j=e=>{const a=p||"https://kevisual.silkyai.cn",l=`/${e.user}/${e.key}`;window.open(`${a}${l}`,"_blank")},v=e=>{if(!h)return;const a=h,l=`/${e.user}/${e.key}`;window.open(`${a}${l}`,"_blank")};return n.jsxs("div",{id:"app",children:[n.jsx("h1",{children:"Package Manager"}),n.jsx("div",{className:"package-list",children:t.map(e=>{const a=k(e),l=a!=="not-installed";return n.jsxs("div",{className:"package-card",children:[n.jsx("h2",{children:e.title}),n.jsx("p",{className:"description",children:e.description}),n.jsxs("div",{className:"package-info",children:[n.jsxs("span",{children:["Version: ",e.version]}),n.jsxs("span",{children:["User: ",e.user]})]}),n.jsxs("div",{className:"actions",children:[w(a,e),a!=="not-installed"&&n.jsx("button",{className:"button button-uninstall",onClick:()=>P(e.id),children:"Uninstall"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("div",{className:"cursor-pointer p-2 rounded-md bg-amber-500 text-white",children:n.jsx(L,{onClick:()=>j(e)})}),h&&l&&n.jsx("div",{className:"cursor-pointer p-2 rounded-md bg-amber-500 text-white",children:n.jsx(R,{onClick:()=>v(e)})})]})]})]},e.id)})})]})};export{_ as PackageManager,_ as default};

View File

@@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Assistant Base App</title> <title>Assistant Base App</title>
<script type="module" crossorigin src="/root/assistant-base-app/assets/index-OAiiq-Mf.js"></script> <script type="module" crossorigin src="/root/assistant-base-app/assets/index-Cfi-lFTd.js"></script>
<link rel="stylesheet" crossorigin href="/root/assistant-base-app/assets/index-CyYNi-ro.css"> <link rel="stylesheet" crossorigin href="/root/assistant-base-app/assets/index-CyYNi-ro.css">
</head> </head>
<body> <body>

1
src/renderer/download.sh Normal file
View File

@@ -0,0 +1 @@
ev micro-app download -i assistant-center-0.0.1.tgz -o release/assistant-center.tgz -x assistant-center

View File

@@ -1,9 +0,0 @@
import{u as h,r as o,j as e}from"./index-OAiiq-Mf.js";const m=()=>{const{config:s,getConfig:l,saveConfig:r}=h();o.useEffect(()=>{c(),l()},[]),o.useEffect(()=>{if(s.pageApi){const a=document.getElementById("pageApi");a.value=s.pageApi}},[s]);const c=()=>{const a=document.getElementById("particles"),p=20;if(a)for(let i=0;i<p;i++){const t=document.createElement("div");t.className="particle",t.innerHTML=`
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/>
<path d="M5 3v4"/>
<path d="M19 17v4"/>
<path d="M3 5h4"/>
<path d="M17 19h4"/>
</svg>
`;const n=10+Math.random()*20;t.style.width=`${n}px`,t.style.height=`${n}px`,t.style.left=`${Math.random()*100}%`,t.style.top=`${Math.random()*100}%`,t.style.animationDuration=`${5+Math.random()*5}s`,t.style.animationDelay=`${Math.random()*5}s`,a.appendChild(t)}},d=()=>{const a=document.getElementById("pageApi");r(a.value)};return e.jsxs("div",{className:"h-full w-full p-4 pt-10",children:[e.jsx("div",{className:"particles",id:"particles"}),e.jsxs("div",{className:"container",children:[e.jsxs("div",{className:"header",children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),e.jsx("h1",{children:"Page Enter Configuration"})]}),e.jsxs("div",{className:"form-container",children:[e.jsxs("form",{id:"configForm",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"pageApi",children:"Page Enter Api"}),e.jsx("input",{type:"text",id:"pageApi",placeholder:"Enter page api configuration"})]}),e.jsxs("button",{type:"submit",id:"save-button",onClick:d,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e.jsx("polyline",{points:"17 21 17 13 7 13 7 21"}),e.jsx("polyline",{points:"7 3 7 8 15 8"})]}),"Save Configuration"]})]}),e.jsx("div",{id:"save-result"})]})]})]})};export{m as default};

View File

@@ -1 +0,0 @@
*{box-sizing:border-box}body{min-height:100vh;background:linear-gradient(135deg,#fef3c7,#fffbeb);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;position:relative;overflow-x:hidden}.container{max-width:42rem;margin:0 auto}.header{display:flex;align-items:center;gap:.75rem;margin-bottom:2rem}.header svg{width:2rem;height:2rem;color:#d97706;animation:spin 8s linear infinite}.header h1{font-size:1.875rem;font-weight:700;color:#92400e}.form-container{background:#fffc;backdrop-filter:blur(8px);border-radius:1rem;box-shadow:0 4px 6px #d977061a;padding:2rem;transition:all .3s ease}.form-container:hover{box-shadow:0 8px 12px #d9770626}.form-group{margin-bottom:1.5rem}label{display:block;font-size:.875rem;font-weight:500;color:#92400e;margin-bottom:.25rem}input[type=text]{width:100%;padding:.75rem 1rem;border:1px solid #fbbf24;border-radius:.5rem;font-size:1rem;transition:all .2s}input[type=text]:focus{outline:none;border-color:#d97706;box-shadow:0 0 0 3px #d9770633}button{width:100%;display:flex;align-items:center;justify-content:center;gap:.5rem;background-color:#d97706;color:#fff;padding:.75rem 1.5rem;border:none;border-radius:.5rem;font-size:1rem;font-weight:500;cursor:pointer;transition:background-color .2s}button:hover{background-color:#b45309}.particles{position:absolute;inset:0;pointer-events:none;overflow:hidden}.particle{position:absolute;color:#fbbf24;opacity:.3;animation:float 5s ease-in-out infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes float{0%,to{transform:translateY(0) rotate(0)}50%{transform:translateY(-20px) rotate(10deg)}}

View File

@@ -1,31 +0,0 @@
import{c as v,y as d,a as f,q as N,r as u,u as C,j as n}from"./index-OAiiq-Mf.js";const $=v((t,i)=>({installedPackages:[],shopPackages:[],setInstalledPackages:s=>t({installedPackages:s}),setShopPackages:s=>t({shopPackages:s}),getInstalledPackages:async()=>{const s=await f.post({path:"shop",key:"list-installed"});return s.code===200&&t({installedPackages:s.data}),s.data},getShopPackages:async()=>{const s=await N.post({path:"app",key:"public-list"});return s.code===200&&t({shopPackages:s.data}),s.data},uninstallPackage:async s=>{const c=await f.post({path:"shop",key:"uninstall",data:{pkg:s}});c.code===200?(i().getInstalledPackages(),d.success("Package uninstalled successfully")):d.error(c.message||"Failed to uninstall package"),console.log("uninstallPackage",c)},installPackage:async s=>{const c=d.loading("Installing package..."),o=await f.post({path:"shop",key:"install",data:{pkg:s}});d.dismiss(c),o.code===200?(i().getInstalledPackages(),d.success("Package installed successfully")):d.error(o.message||"Failed to install package"),console.log("installPackage",o)}}));/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const I=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),x=(...t)=>t.filter((i,s,c)=>!!i&&i.trim()!==""&&c.indexOf(i)===s).join(" ").trim();/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var A={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const U=u.forwardRef(({color:t="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:c,className:o="",children:r,iconNode:h,...p},k)=>u.createElement("svg",{ref:k,...A,width:i,height:i,stroke:t,strokeWidth:c?Number(s)*24/Number(i):s,className:x("lucide",o),...p},[...h.map(([g,m])=>u.createElement(g,m)),...Array.isArray(r)?r:[r]]));/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const b=(t,i)=>{const s=u.forwardRef(({className:c,...o},r)=>u.createElement(U,{ref:r,iconNode:i,className:x(`lucide-${I(t)}`,c),...o}));return s.displayName=`${t}`,s};/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const S=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],q=b("Link2",S);/**
* @license lucide-react v0.479.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const R=[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]],E=b("SquareArrowOutUpRight",R),M=()=>{const{shopPackages:t,installedPackages:i,getInstalledPackages:s,getShopPackages:c,uninstallPackage:o,installPackage:r}=$(),{pageApi:h}=C();u.useEffect(()=>{s(),c()},[]);const p=e=>{const a=i.find(l=>l.user===e.user&&l.key===e.key);return a?a.version!==e.version?"update-available":"installed":"not-installed"},k=e=>{const a=t.find(l=>l.id===e);a&&r(a)},g=e=>{const a=t.find(l=>l.id===e);a&&r(a)},m=e=>{const a=t.find(l=>l.id===e);a&&r(a)},y=e=>{const a=t.find(l=>l.id===e);a&&o(a)},P=(e,a)=>{switch(e){case"not-installed":return n.jsx("button",{className:"button button-install",onClick:()=>k(a.id),children:"Install"});case"update-available":return n.jsx("button",{className:"button button-update",onClick:()=>g(a.id),children:"Update"});case"installed":return n.jsx("button",{className:"button button-reinstall",onClick:()=>m(a.id),children:"Reinstall"})}},w=e=>{const a="https://kevisual.silkyai.cn",l=`/${e.user}/${e.key}`;window.open(`${a}${l}`,"_blank")},j=e=>{if(!h)return;const a=h,l=`/${e.user}/${e.key}`;window.open(`${a}${l}`,"_blank")};return n.jsxs("div",{id:"app",children:[n.jsx("h1",{children:"Package Manager"}),n.jsx("div",{className:"package-list",children:t.map(e=>{const a=p(e),l=a!=="not-installed";return n.jsxs("div",{className:"package-card",children:[n.jsx("h2",{children:e.title}),n.jsx("p",{className:"description",children:e.description}),n.jsxs("div",{className:"package-info",children:[n.jsxs("span",{children:["Version: ",e.version]}),n.jsxs("span",{children:["User: ",e.user]})]}),n.jsxs("div",{className:"actions",children:[P(a,e),a!=="not-installed"&&n.jsx("button",{className:"button button-uninstall",onClick:()=>y(e.id),children:"Uninstall"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("div",{className:"cursor-pointer p-2 rounded-md bg-amber-500 text-white",children:n.jsx(E,{onClick:()=>w(e)})}),h&&l&&n.jsx("div",{className:"cursor-pointer p-2 rounded-md bg-amber-500 text-white",children:n.jsx(q,{onClick:()=>j(e)})})]})]})]},e.id)})})]})};export{M as PackageManager,M as default};

View File

@@ -1 +0,0 @@
:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;background-color:#fff8e1;color:#213547}body{margin:0;min-width:320px;min-height:100vh}#app{max-width:1280px;margin:0 auto;padding:2rem}h1{text-align:center;color:#ff8f00}.package-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1rem;padding:1rem}.package-card{background:#fff;border-radius:8px;padding:1.5rem;box-shadow:0 2px 4px #ff8f001a;border:1px solid #ffe0b2}.package-card h2{margin:0 0 .5rem;color:#f57c00}.package-card .description{color:#666;margin-bottom:1rem;font-size:.9rem;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;line-height:1.5;max-height:6em}.package-info{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem;font-size:.9rem;color:#666}.actions{display:flex;gap:.5rem}.button{padding:.5rem 1rem;border-radius:4px;border:none;cursor:pointer;font-weight:500;transition:background-color .2s}.button-install{background-color:#ffa000;color:#fff}.button-update{background-color:#ff8f00;color:#fff}.button-reinstall{background-color:#ffb300;color:#fff}.button-uninstall{background-color:#ff6f00;color:#fff}.button:hover{opacity:.9}.button:disabled{background-color:#ffe0b2;cursor:not-allowed}.error-message{text-align:center;color:#ff6f00;padding:2rem;background:#fff;border-radius:8px;box-shadow:0 2px 4px #ff8f001a;grid-column:1 / -1}

File diff suppressed because one or more lines are too long

View File

@@ -1,13 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Assistant Base App</title>
<script type="module" crossorigin src="/root/assistant-base-app/assets/index-OAiiq-Mf.js"></script>
<link rel="stylesheet" crossorigin href="/root/assistant-base-app/assets/index-CyYNi-ro.css">
</head>
<body>
<div id="root"></div>
</body>
</html>

View File

@@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"module": "commonjs", "module": "NodeNext",
"noImplicitAny": false, "noImplicitAny": false,
"sourceMap": false, "sourceMap": false,
"outDir": "app-dist", "outDir": "app-dist",
@@ -15,9 +15,13 @@
"skipLibCheck": true, "skipLibCheck": true,
"esModuleInterop": true, "esModuleInterop": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"allowImportingTsExtensions": true,
"noEmit": true,
"emitDeclarationOnly": true,
"declaration": true,
"strict": false, "strict": false,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"moduleResolution": "Node", "moduleResolution": "NodeNext",
"isolatedModules": false, "isolatedModules": false,
"resolveJsonModule": true, "resolveJsonModule": true,
"types": [] "types": []

View File

@@ -25,17 +25,17 @@ export default defineConfig({
format: 'esm', // 设置输出格式为 ESM format: 'esm', // 设置输出格式为 ESM
}, },
}, },
outDir: 'dist/main', // 主进程输出目录 outDir: 'app-dist', // 主进程输出目录
}, },
}, },
}), }),
viteStaticCopy({ viteStaticCopy({
targets: [ targets: [
{ src: 'src/renderer', dest: '' }, { src: 'src/renderer/assistant-center/*', dest: '../dist' },
{ {
src: 'src/main/preload.js', src: 'src/main/preload.js',
dest: 'main', dest: '../app-dist',
}, },
], ],
}), }),