feat: login by command by web

This commit is contained in:
2025-02-25 20:04:24 +08:00
parent 02a1f51d63
commit 26c6248d10
8 changed files with 644 additions and 210 deletions

View File

@@ -0,0 +1,55 @@
import { query } from '@/module/query.ts';
type OperateAction = 'start' | 'stop' | 'restart' | 'reload' | 'delete' | 'update' | 'install' | 'uninstall';
export const queryServiceOperate = async (appKey: string, action: OperateAction) => {
if (['start', 'stop', 'restart'].indexOf(action) === -1) {
throw new Error('Invalid action');
}
return await query.post({
path: 'local-apps',
key: 'operate',
appKey: appKey,
action: action,
});
};
export const queryServiceList = async () => {
return await query.post({
path: 'local-apps',
key: 'list',
});
};
export const queryServiceUpdate = async (appKey: string, data: any) => {
return await query.post({
path: 'local-apps',
key: 'update',
appkey: appKey,
data: data,
});
};
export const queryServiceDownload = async (id: string, token: string, installDeps: boolean = true) => {
return await query.post({
path: 'local-apps',
key: 'download',
id: id,
token: token,
installDeps: installDeps,
});
};
export const queryServiceDetect = async () => {
return await query.get({
path: 'local-apps',
key: 'detect',
});
};
export const queryServiceDelect = async (appKey: string) => {
return await query.get({
path: 'local-apps',
key: 'delete',
appKey: appKey,
});
};