This commit is contained in:
2026-01-17 01:13:55 +08:00
parent 327f115ef2
commit cc043bfd7e
17 changed files with 768 additions and 790 deletions

View File

@@ -1,6 +1,6 @@
import { App } from '@kevisual/router';
import { SimpleRouter } from '@kevisual/router/simple'
// import { App } from '@kevisual/router/src/app.ts';
import { HttpsPem } from '@/module/assistant/https/sign.ts';
// import { AssistantConfig } from '@/module/assistant/index.ts';
import { AssistantInit, parseHomeArg } from '@/services/init/index.ts';
import { configDir as HomeConfigDir } from '@/module/assistant/config/index.ts';
@@ -21,8 +21,6 @@ export const assistantQuery = useContextKey('assistantQuery', () => {
return new AssistantQuery(assistantConfig);
});
const httpsPem = new HttpsPem(assistantConfig);
export const runtime = useContextKey('runtime', () => {
return {
type: 'client',
@@ -32,36 +30,22 @@ export const runtime = useContextKey('runtime', () => {
export const app: App = useContextKey<App>('app', () => {
const init = isInit;
if (init) {
const config = assistantConfig.getConfig();
if (config?.https?.type !== 'https') {
console.log('http模式', 'http');
return new App({
serverOptions: {
path: '/client/router',
httpType: 'http',
cors: {
origin: '*',
},
io: true
return new App({
serverOptions: {
path: '/client/router',
httpType: 'http',
cors: {
origin: '*',
},
});
}
}
return new App({
serverOptions: {
path: '/client/router',
httpType: 'https',
httpsCert: httpsPem.cert,
httpsKey: httpsPem.key,
cors: {
origin: '*',
io: true
},
io: true
},
});
});
}
});
export const simpleRouter = useContextKey('simpleRouter', () => {
return new SimpleRouter();
});
app.route({
path: 'router',