mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: skip server load in cli mode
This commit is contained in:
1 parent
c2c85581c4
commit
f93108f160
4 files changed
+4
-2
No files matched your search
@@ -101,7 +101,7 @@ export async function load(ctx: Context) {
|
||||
model(pending, fail, ctx),
|
||||
setting(pending, fail, require('../model/setting')),
|
||||
]);
|
||||
await require('../service/server').apply(ctx);
|
||||
ctx.plugin(require('../service/server'));
|
||||
await addon(pending, fail, ctx);
|
||||
const scriptDir = path.resolve(__dirname, '..', 'script');
|
||||
for (const h of await fs.readdir(scriptDir)) {
|
||||
|
||||
@@ -18,7 +18,7 @@ export type Disposable = () => void;
|
||||
export type VoidReturn = Promise<any> | any;
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export interface EventMap extends Record<string, any> {
|
||||
export interface EventMap {
|
||||
'app/started': () => void
|
||||
'app/load/lib': () => VoidReturn
|
||||
'app/load/locale': () => VoidReturn
|
||||
|
||||
@@ -409,6 +409,7 @@ export async function apply(pluginContext) {
|
||||
Context.service('server', RouteService);
|
||||
pluginContext.server = new RouteService(pluginContext);
|
||||
app.keys = system.get('session.keys') as unknown as string[];
|
||||
if (process.env.HYDRO_CLI) return;
|
||||
const proxyMiddleware = proxy('/fs', {
|
||||
target: builtinConfig.file.endPoint,
|
||||
changeOrigin: true,
|
||||
|
||||
@@ -219,6 +219,7 @@ class RichMediaHandler extends Handler {
|
||||
}
|
||||
|
||||
export function apply(ctx) {
|
||||
if (process.env.HYDRO_CLI) return;
|
||||
ctx.Route('wiki_help', '/wiki/help', WikiHelpHandler);
|
||||
ctx.Route('wiki_about', '/wiki/about', WikiAboutHandler);
|
||||
ctx.Route('set_theme', '/set_theme/:theme', SetThemeHandler);
|
||||
Reference in new issue
Block a user