Compare commits
11 Commits
530d675985
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 7200252d2e | |||
| c7d7951273 | |||
| 33f1f2603a | |||
| 712b98e338 | |||
| c3034e7866 | |||
| 74b4beb56d | |||
| 4097ed47f8 | |||
| 5dacb966b0 | |||
| 21a2a7407e | |||
| 27ac19a045 | |||
| b6e0b142d8 |
54
.github/workflows/electron-build.yml
vendored
Normal file
54
.github/workflows/electron-build.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
name: Build and Release Electron App
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22.15.0'
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Build Electron app
|
||||
run: npm run build
|
||||
|
||||
- name: Package Electron app (macOS)
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: npm run build:mac
|
||||
|
||||
- name: Package Electron app (Windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: npm run build:win
|
||||
|
||||
- name: Upload release assets
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: Release ${{ github.ref_name }}
|
||||
files: |
|
||||
build/*.dmg
|
||||
build/*.exe
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,5 +3,3 @@ dist
|
||||
app-dist
|
||||
build
|
||||
.DS_Store
|
||||
|
||||
src/**/dist/**
|
||||
|
||||
54
package.json
54
package.json
@@ -1,45 +1,46 @@
|
||||
{
|
||||
"name": "silky-assistant",
|
||||
"version": "0.0.1",
|
||||
"description": "Silky Assistant",
|
||||
"name": "aura-keep",
|
||||
"version": "0.0.3",
|
||||
"description": "Aura Keep Desktop Application",
|
||||
"main": "app-dist/main.js",
|
||||
"scripts": {
|
||||
"dev": "vite --config vite.config.ts",
|
||||
"build": "cross-env NODE_ENV=production vite build --config vite.config.ts",
|
||||
"build:watch": "cross-env NODE_ENV=development vite build --config vite.config.ts -w",
|
||||
"build:mac": "electron-builder --mac --win",
|
||||
"build:mac": "electron-builder --mac --universal",
|
||||
"build:win": "electron-builder --win",
|
||||
"build:linux": "electron-builder --linux",
|
||||
"watch:electron": "electron app-dist/main.js --watch",
|
||||
"watch": "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"
|
||||
"prepub": "pnpm html",
|
||||
"pub": "ev deploy ./build -k aura-keep -v 0.0.3 -u -o root"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "abearxiong <xiongxiao@xiongxiao.me>",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@types/electron": "^1.6.12",
|
||||
"@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-updater": "^6.3.9",
|
||||
"typescript": "^5.8.2",
|
||||
"vite": "^6.2.1",
|
||||
"@kevisual/cli": "^0.0.59",
|
||||
"@rollup/plugin-commonjs": "^28.0.6",
|
||||
"@rollup/plugin-node-resolve": "^16.0.3",
|
||||
"@types/node": "^24.7.2",
|
||||
"cross-env": "^10.1.0",
|
||||
"electron": "^38.2.2",
|
||||
"electron-builder": "^26.0.12",
|
||||
"electron-log": "^5.4.3",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^7.1.9",
|
||||
"vite-plugin-electron": "^0.29.0",
|
||||
"vite-plugin-static-copy": "^2.3.0"
|
||||
"vite-plugin-static-copy": "^3.1.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kevisual/assistant-module": "^0.0.3",
|
||||
"@kevisual/router": "^0.0.9",
|
||||
"@kevisual/use-config": "^1.0.9"
|
||||
"@kevisual/use-config": "^1.0.19",
|
||||
"electron-updater": "^6.6.2"
|
||||
},
|
||||
"build": {
|
||||
"appId": "cn.silkeyai.assistant",
|
||||
"productName": "Silky Assistant",
|
||||
"appId": "cn.kevisual.aura-keep",
|
||||
"productName": "Aura Keep",
|
||||
"copyright": "Copyright © 2025 ${author}",
|
||||
"icon": "icons/app-512x512.png",
|
||||
"directories": {
|
||||
@@ -72,6 +73,13 @@
|
||||
},
|
||||
"linux": {
|
||||
"target": "AppImage"
|
||||
}
|
||||
}
|
||||
},
|
||||
"publish": [
|
||||
{
|
||||
"provider": "generic",
|
||||
"url": "https://kevisual.cn/root/aura-keep/"
|
||||
}
|
||||
]
|
||||
},
|
||||
"packageManager": "pnpm@10.18.2"
|
||||
}
|
||||
1721
pnpm-lock.yaml
generated
1721
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
3
pnpm-workspace.yaml
Normal file
3
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
onlyBuiltDependencies:
|
||||
- electron
|
||||
- esbuild
|
||||
@@ -1,3 +1 @@
|
||||
import { useContextKey } from '@kevisual/use-config/context';
|
||||
|
||||
export { log, getLogPath } from './logger.ts';
|
||||
|
||||
35
src/main/browsers/trans.ts
Normal file
35
src/main/browsers/trans.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { BrowserWindow } from 'electron';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
// 创建透明窗口
|
||||
export const createTransWindow = () => {
|
||||
const window = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 1000,
|
||||
transparent: true,
|
||||
frame: false,
|
||||
});
|
||||
window.loadURL(process?.env?.ASSISTANT_HOME ?? 'https://kevisual.cn/root/center/');
|
||||
setTimeout(() => {
|
||||
window.setPosition(0, 0, true);
|
||||
}, 1000);
|
||||
return window;
|
||||
};
|
||||
|
||||
export const createDemoWinodw = (window?: BrowserWindow, opts?: any) => {
|
||||
if (window) return window;
|
||||
window = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
...opts,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js'), // 如果有 preload 脚本
|
||||
webSecurity: false,
|
||||
...opts?.webPreferences,
|
||||
},
|
||||
});
|
||||
window.loadURL(process?.env?.ASSISTANT_HOME ?? 'https://kevisual.cn/root/center/');
|
||||
return window;
|
||||
};
|
||||
25
src/main/hot-keys/index.ts
Normal file
25
src/main/hot-keys/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
// 注册快捷键 ctrl+q
|
||||
import { globalShortcut } from 'electron';
|
||||
|
||||
export const registerHotKeys = (app: Electron.App) => {
|
||||
const ret = globalShortcut.register('CommandOrControl+Q', () => {
|
||||
console.log('CommandOrControl+Q is pressed');
|
||||
app.quit();
|
||||
});
|
||||
|
||||
if (!ret) {
|
||||
console.log('registration failed');
|
||||
}
|
||||
|
||||
// Check whether a shortcut is registered.
|
||||
console.log(globalShortcut.isRegistered('CommandOrControl+Q'));
|
||||
};
|
||||
|
||||
export const unregisterHotKeys = () => {
|
||||
globalShortcut.unregisterAll();
|
||||
};
|
||||
|
||||
// Unregister a shortcut.
|
||||
export const unregisterHotKey = (key: string) => {
|
||||
globalShortcut.unregister(key);
|
||||
};
|
||||
@@ -1,15 +1,11 @@
|
||||
import { app, BrowserWindow } from 'electron';
|
||||
import * as path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { createSession } from './session/index.ts';
|
||||
import { handle } from './handle/index.ts';
|
||||
import { loadMenu } from './menu/index.ts';
|
||||
import { getLogPath, log } from './app.ts';
|
||||
import { checkShowPage } from './window/page/index.ts';
|
||||
import { closeProcess, createProcess } from './process/index.ts';
|
||||
import { getElectronResourcePath } from './system/env.ts';
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
import { createDemoWinodw } from './browsers/trans.ts';
|
||||
import { registerHotKeys } from "./hot-keys/index.ts";
|
||||
|
||||
let mainWindow: BrowserWindow | null;
|
||||
|
||||
@@ -18,27 +14,17 @@ async function createWindow() {
|
||||
log.info('resourcePath', resourcePath);
|
||||
log.info('createWindow');
|
||||
log.info('path', getLogPath());
|
||||
const _session = createSession();
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js'), // 如果有 preload 脚本
|
||||
session: _session,
|
||||
webSecurity: false,
|
||||
},
|
||||
});
|
||||
loadMenu();
|
||||
await checkShowPage(mainWindow);
|
||||
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = null;
|
||||
let transWindow = createDemoWinodw();
|
||||
transWindow.on('closed', () => {
|
||||
transWindow = null;
|
||||
});
|
||||
}
|
||||
|
||||
app.on('ready', async () => {
|
||||
await createProcess();
|
||||
// await createProcess();
|
||||
createWindow();
|
||||
registerHotKeys(app);
|
||||
});
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createEnterPage } from '../window/page/enter.ts';
|
||||
import { BrowserWindow, Menu, app } from 'electron';
|
||||
|
||||
import { shell } from 'electron';
|
||||
import path from 'path';
|
||||
import { getLogPath, log } from '../logger.ts';
|
||||
import { createAppPackagesPage } from '../window/page/app-packages.ts';
|
||||
@@ -33,53 +33,53 @@ export const loadMenu = () => {
|
||||
// },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '打开应用',
|
||||
submenu: [
|
||||
{
|
||||
label: '首页',
|
||||
click: () => {
|
||||
// 获取当前window
|
||||
const mainWindow = BrowserWindow.getFocusedWindow();
|
||||
if (mainWindow) {
|
||||
checkShowPage(mainWindow);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'note',
|
||||
click: () => {
|
||||
// 获取当前window
|
||||
const mainWindow = BrowserWindow.getFocusedWindow();
|
||||
if (mainWindow) {
|
||||
checkShowPage(mainWindow, '/web/note');
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'root-center',
|
||||
click: () => {
|
||||
// 获取当前window
|
||||
const mainWindow = BrowserWindow.getFocusedWindow();
|
||||
if (mainWindow) {
|
||||
checkShowPage(mainWindow, '/root/center');
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '打开配置',
|
||||
click: async () => {
|
||||
createEnterPage();
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '打开应用市场',
|
||||
click: async () => {
|
||||
createAppPackagesPage();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
// {
|
||||
// label: '打开应用',
|
||||
// submenu: [
|
||||
// {
|
||||
// label: '首页',
|
||||
// click: () => {
|
||||
// // 获取当前window
|
||||
// const mainWindow = BrowserWindow.getFocusedWindow();
|
||||
// if (mainWindow) {
|
||||
// checkShowPage(mainWindow);
|
||||
// }
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// label: 'note',
|
||||
// click: () => {
|
||||
// // 获取当前window
|
||||
// const mainWindow = BrowserWindow.getFocusedWindow();
|
||||
// if (mainWindow) {
|
||||
// checkShowPage(mainWindow, '/web/note');
|
||||
// }
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// label: 'root-center',
|
||||
// click: () => {
|
||||
// // 获取当前window
|
||||
// const mainWindow = BrowserWindow.getFocusedWindow();
|
||||
// if (mainWindow) {
|
||||
// checkShowPage(mainWindow, '/root/center');
|
||||
// }
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// label: '打开配置',
|
||||
// click: async () => {
|
||||
// createEnterPage();
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// label: '打开应用市场',
|
||||
// click: async () => {
|
||||
// createAppPackagesPage();
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
label: '编辑',
|
||||
submenu: [
|
||||
@@ -125,7 +125,6 @@ export const loadMenu = () => {
|
||||
{
|
||||
label: '打开日志',
|
||||
click: async () => {
|
||||
const { shell } = require('electron');
|
||||
log.transports.file.fileName;
|
||||
shell.openExternal('file://' + path.join(getLogPath()));
|
||||
},
|
||||
|
||||
@@ -47,7 +47,7 @@ export const createProcess = async () => {
|
||||
env: {
|
||||
...process.env,
|
||||
// KEVISUAL_URL: 'https://kevisual.xiongxiao.me',
|
||||
KEVISUAL_URL: 'https://kevisual.silkyai.cn',
|
||||
KEVISUAL_URL: 'https://kevisual.cn',
|
||||
NODE_ENV_PARENT: 'fork',
|
||||
},
|
||||
});
|
||||
|
||||
21
src/main/terminal/pty.ts
Normal file
21
src/main/terminal/pty.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as pty from 'node-pty';
|
||||
|
||||
export function createPty(cmd: string) {
|
||||
const ptyProcess = pty.spawn(cmd, [], {
|
||||
name: 'xterm-color',
|
||||
cols: 80,
|
||||
rows: 30,
|
||||
cwd: process.env.HOME,
|
||||
env: process.env,
|
||||
});
|
||||
|
||||
ptyProcess.onData((data) => {
|
||||
process.stdout.write(data);
|
||||
});
|
||||
|
||||
ptyProcess.write('ls\r');
|
||||
ptyProcess.resize(100, 40);
|
||||
ptyProcess.write('ls\r');
|
||||
}
|
||||
|
||||
createPty('ls');
|
||||
10
src/main/updater/index.ts
Normal file
10
src/main/updater/index.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { autoUpdater } from 'electron-updater';
|
||||
|
||||
autoUpdater.setFeedURL({
|
||||
provider: 'generic',
|
||||
url: 'https://kevisual.silkyai.cn/root/silky-assistant/',
|
||||
});
|
||||
|
||||
export const checkForUpdates = () => {
|
||||
autoUpdater.checkForUpdatesAndNotify();
|
||||
};
|
||||
6
src/main/utils/current-path.ts
Normal file
6
src/main/utils/current-path.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
// @ts-ignore
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
13
src/main/utils/run-cli.ts
Normal file
13
src/main/utils/run-cli.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import {spawn} from 'child_process';
|
||||
|
||||
export const runCli =async () =>{
|
||||
|
||||
const cli = 'ev -h';
|
||||
const cmd = spawn(cli, { shell: true, stdio: 'inherit', cwd: process.cwd() });
|
||||
cmd.on('close', (code) => {
|
||||
console.log(`child process exited with code ${code}`);
|
||||
});
|
||||
cmd.on('error', (err) => {
|
||||
console.error('Failed to start subprocess.', err);
|
||||
});
|
||||
}
|
||||
1
src/renderer/.gitignore
vendored
1
src/renderer/.gitignore
vendored
@@ -0,0 +1 @@
|
||||
!dist
|
||||
33639
src/renderer/assistant-center/dist/app.mjs
vendored
Normal file
33639
src/renderer/assistant-center/dist/app.mjs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
import{u as h,r as i,j as e}from"./index-CGYlhUn4.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=`
|
||||
import{u as h,r as i,j as e}from"./index-DFSA4dSC.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"/>
|
||||
@@ -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-DFSA4dSC.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"},{url:"https://kevisual.silkyai.cn/api/router"});return s.code===200&&t({shopPackages:s.data}),s.data},uninstallPackage:async s=>{const o=await f.post({path:"shop",key:"uninstall",data:{pkg:s}});o.code===200?(i().getInstalledPackages(),d.success("Package uninstalled successfully")):d.error(o.message||"Failed to uninstall package"),console.log("uninstallPackage",o)},installPackage:async s=>{const o=d.loading("Installing package..."),c=await f.post({path:"shop",key:"install",data:{pkg:s}});d.dismiss(o),c.code===200?(i().getInstalledPackages(),d.success("Package installed successfully")):d.error(c.message||"Failed to install package"),console.log("installPackage",c)}}));/**
|
||||
* @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,o)=>!!i&&i.trim()!==""&&o.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 U={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 S=u.forwardRef(({color:t="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:c="",children:r,iconNode:h,...p},k)=>u.createElement("svg",{ref:k,...U,width:i,height:i,stroke:t,strokeWidth:o?Number(s)*24/Number(i):s,className:x("lucide",c),...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 y=(t,i)=>{const s=u.forwardRef(({className:o,...c},r)=>u.createElement(S,{ref:r,iconNode:i,className:x(`lucide-${A(t)}`,o),...c}));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 R=[["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=y("Link2",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 L=[["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=y("SquareArrowOutUpRight",L),_=()=>{const{shopPackages:t,installedPackages:i,getInstalledPackages:s,getShopPackages:o,uninstallPackage:c,installPackage:r}=I(),{pageApi:h,pageStoreApi:p}=$();u.useEffect(()=>{s(),o()},[]);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)},b=e=>{const a=t.find(l=>l.id===e);a&&r(a)},w=e=>{const a=t.find(l=>l.id===e);a&&c(a)},P=(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:()=>b(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=>{const a=new URL(window.location.href).origin,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:[P(a,e),a!=="not-installed"&&n.jsx("button",{className:"button button-uninstall",onClick:()=>w(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:()=>j(e)})}),h&&l&&n.jsx("div",{className:"cursor-pointer p-2 rounded-md bg-amber-500 text-white",children:n.jsx(q,{onClick:()=>v(e)})})]})]})]},e.id)})})]})};export{_ as PackageManager,_ as default};
|
||||
File diff suppressed because one or more lines are too long
@@ -1,31 +0,0 @@
|
||||
import{c as N,y as d,a as f,q as C,r as u,u as $,j as n}from"./index-CGYlhUn4.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"},{url:"https://kevisual.silkyai.cn/api/router"});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 y=(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=y("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=y("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)},b=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:()=>b(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};
|
||||
@@ -4,7 +4,7 @@
|
||||
<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-CGYlhUn4.js"></script>
|
||||
<script type="module" crossorigin src="/root/assistant-base-app/assets/index-DFSA4dSC.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/root/assistant-base-app/assets/index-CyYNi-ro.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "NodeNext",
|
||||
"module": "nodenext",
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"outDir": "app-dist",
|
||||
@@ -21,7 +21,7 @@
|
||||
"declaration": true,
|
||||
"strict": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "NodeNext",
|
||||
"moduleResolution": "Node",
|
||||
"isolatedModules": false,
|
||||
"resolveJsonModule": true,
|
||||
"types": []
|
||||
|
||||
@@ -3,7 +3,8 @@ import path from 'path';
|
||||
import { defineConfig } from 'vite';
|
||||
import electron from 'vite-plugin-electron';
|
||||
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
electron({
|
||||
@@ -24,21 +25,23 @@ export default defineConfig({
|
||||
output: {
|
||||
format: 'esm', // 设置输出格式为 ESM
|
||||
},
|
||||
// external: ['electron-updater', 'electron-log'],
|
||||
// external: ['electron-updater'],
|
||||
},
|
||||
outDir: 'app-dist', // 主进程输出目录
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
viteStaticCopy({
|
||||
targets: [
|
||||
{ src: 'src/renderer/assistant-center/*', dest: '../dist' },
|
||||
{
|
||||
src: 'src/main/preload.js',
|
||||
dest: '../app-dist',
|
||||
},
|
||||
],
|
||||
}),
|
||||
// viteStaticCopy({
|
||||
// targets: [
|
||||
// { src: 'src/renderer/assistant-center/*', dest: '../dist' },
|
||||
// {
|
||||
// src: 'src/main/preload.js',
|
||||
// dest: '../app-dist',
|
||||
// },
|
||||
// ],
|
||||
// }),
|
||||
],
|
||||
define: {},
|
||||
build: {
|
||||
|
||||
Reference in New Issue
Block a user