mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-28 15:50:27 +00:00
Introduce tools and UI to read, write, backup and restore QQ Registry20 GUIDs using Windows DPAPI. Adds a Python CLI (guid_tool.py) for local Registry20 operations and a new TypeScript package napcat-dpapi with native bindings for DPAPI. Implements Registry20Utils in the webui-backend to protect/unprotect Registry20, plus backup/restore/delete helpers. Exposes new backend API handlers and routes (get/set GUID, backups, restore, reset, restart) and integrates frontend GUIDManager component and qq_manager controller methods. Propagates QQ data path via WebUiDataRuntime (setter/getter) and wires it up in framework/shell; updates Vite alias and package.json to include the new dpapi workspace. Includes native addon binaries for win32 x64/arm64 and basic tsconfig/readme/license for the new package.
83 lines
2.8 KiB
TypeScript
83 lines
2.8 KiB
TypeScript
import cp from 'vite-plugin-cp';
|
|
import { defineConfig, PluginOption, UserConfig } from 'vite';
|
|
import path, { resolve } from 'path';
|
|
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
import { builtinModules } from 'module';
|
|
import napcatVersion from 'napcat-vite/vite-plugin-version.js';
|
|
import { autoIncludeTSPlugin } from 'napcat-vite/vite-auto-include.js';
|
|
import react from '@vitejs/plugin-react-swc';
|
|
|
|
// 依赖排除
|
|
const external = [
|
|
'ws',
|
|
'express',
|
|
'electron'
|
|
];
|
|
|
|
const nodeModules = [...builtinModules, builtinModules.map((m) => `node:${m}`)].flat();
|
|
const ShellBaseConfigPlugin: PluginOption[] = [
|
|
react({ tsDecorators: true }),
|
|
autoIncludeTSPlugin({
|
|
entries: [
|
|
{ entry: 'napcat.ts', dir: path.resolve(__dirname, '../napcat-core/protocol') },
|
|
{ entry: 'napcat.ts', dir: path.resolve(__dirname, '../napcat-onebot/action/test') },
|
|
],
|
|
}),
|
|
cp({
|
|
targets: [
|
|
{ src: '../napcat-native/', dest: 'dist/native', flatten: false },
|
|
{ src: '../napcat-webui-frontend/dist/', dest: 'dist/static/', flatten: false },
|
|
{ src: '../napcat-webui-backend/src/assets/sw_template.js', dest: 'dist/static/' },
|
|
{ src: '../napcat-core/external/napcat.json', dest: 'dist/config/' },
|
|
{ src: '../../package.json', dest: 'dist' },
|
|
{ src: '../napcat-shell-loader', dest: 'dist' },
|
|
],
|
|
}),
|
|
nodeResolve(),
|
|
napcatVersion(),
|
|
];
|
|
const ShellBaseConfig = (source_map: boolean = false) =>
|
|
defineConfig({
|
|
resolve: {
|
|
conditions: ['node', 'default'],
|
|
alias: {
|
|
'@/napcat-core': resolve(__dirname, '../napcat-core'),
|
|
'@/napcat-common': resolve(__dirname, '../napcat-common'),
|
|
'@/napcat-onebot': resolve(__dirname, '../napcat-onebot'),
|
|
'@/napcat-pty': resolve(__dirname, '../napcat-pty'),
|
|
'@/napcat-dpapi': resolve(__dirname, '../napcat-dpapi'),
|
|
'@/napcat-webui-backend': resolve(__dirname, '../napcat-webui-backend'),
|
|
'@/napcat-image-size': resolve(__dirname, '../napcat-image-size'),
|
|
'@/napcat-protocol': resolve(__dirname, '../napcat-protocol'),
|
|
},
|
|
},
|
|
build: {
|
|
sourcemap: source_map,
|
|
target: 'esnext',
|
|
minify: false,
|
|
lib: {
|
|
entry: {
|
|
napcat: path.resolve(__dirname, 'napcat.ts'),
|
|
'worker/conoutSocketWorker': path.resolve(__dirname, '../napcat-pty/worker/conoutSocketWorker.ts'),
|
|
},
|
|
formats: ['es'],
|
|
fileName: (_, entryName) => `${entryName}.mjs`,
|
|
},
|
|
rollupOptions: {
|
|
external: [...nodeModules, ...external],
|
|
},
|
|
},
|
|
});
|
|
export default defineConfig(({ mode }): UserConfig => {
|
|
if (mode === 'development') {
|
|
return {
|
|
...ShellBaseConfig(true),
|
|
plugins: [...ShellBaseConfigPlugin],
|
|
};
|
|
}
|
|
return {
|
|
...ShellBaseConfig(),
|
|
plugins: [...ShellBaseConfigPlugin],
|
|
};
|
|
});
|