mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
fix ci
This commit is contained in:
4 files changed
+13
-16
No files matched your search
@@ -712,14 +712,13 @@ ${c.response.status} ${endTime - startTime}ms ${c.response.length}`);
|
||||
this.ctx.on(`handler/register/${name}`, callback as any);
|
||||
}
|
||||
|
||||
// FIXME: should be typeof Handler<Context> instead of any
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
public Route(name: string, path: string, RouteHandler: any, ...permPrivChecker) {
|
||||
public Route(name: string, path: string, RouteHandler: typeof Handler<C>, ...permPrivChecker) {
|
||||
return this.register('route', name, path, RouteHandler, ...permPrivChecker);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
public Connection(name: string, path: string, RouteHandler: any, ...permPrivChecker) {
|
||||
public Connection(name: string, path: string, RouteHandler: typeof ConnectionHandler<C>, ...permPrivChecker) {
|
||||
return this.register('conn', name, path, RouteHandler, ...permPrivChecker);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,12 +40,12 @@ export class ConfigService extends Service {
|
||||
|
||||
applyDelta(source: any, key: string, value: any) {
|
||||
const path = key.split('.');
|
||||
if (path.filter((i) => ['__proto__', 'prototype'].includes(i)).length) return false;
|
||||
if (path.filter((i) => ['__proto__', 'prototype', 'constructor'].includes(i)).length) return false;
|
||||
const t = path.pop();
|
||||
const root = JSON.parse(JSON.stringify(source));
|
||||
let cursor = root;
|
||||
for (const p of path) {
|
||||
cursor[p] ||= {};
|
||||
cursor[p] ??= {};
|
||||
cursor = cursor[p];
|
||||
}
|
||||
cursor[t] = value;
|
||||
|
||||
@@ -25,13 +25,14 @@ const page = new NamedPage('manage_config', async () => {
|
||||
const { monaco, registerAction, renderMarkdown } = await load(['yaml']);
|
||||
const KForm = applyVueInReact(form.Form) as any;
|
||||
|
||||
function MarkdownContainer(props) {
|
||||
function MarkdownContainer({ source }) {
|
||||
const rendered = React.useMemo(() => {
|
||||
const res = renderMarkdown({ value: props.source });
|
||||
const res = renderMarkdown({ value: source });
|
||||
const value = res.element.innerHTML;
|
||||
res.dispose();
|
||||
return value;
|
||||
}, [props.source]);
|
||||
}, [source]);
|
||||
// Markdown snippet come from trusted backend code, no need to sanitize here
|
||||
return <div dangerouslySetInnerHTML={{ __html: rendered }} />;
|
||||
}
|
||||
const [, ReactMissVue] = createReactMissVue({
|
||||
@@ -62,8 +63,8 @@ const page = new NamedPage('manage_config', async () => {
|
||||
if (!editor) return;
|
||||
editor.layout();
|
||||
};
|
||||
document.addEventListener('resize', listener);
|
||||
return () => document.removeEventListener('resize', listener);
|
||||
window.addEventListener('resize', listener);
|
||||
return () => window.removeEventListener('resize', listener);
|
||||
}, [editor]);
|
||||
React.useEffect(() => {
|
||||
if (!editorRef.current || loading) return;
|
||||
|
||||
@@ -3,12 +3,10 @@ import importMetaUrlPlugin from '@codingame/esbuild-import-meta-url-plugin';
|
||||
import react from '@vitejs/plugin-react-swc';
|
||||
import c2k from 'koa2-connect';
|
||||
import _ from 'lodash';
|
||||
import fs from 'fs';
|
||||
import { createServer } from 'vite';
|
||||
import { } from '@hydrooj/framework';
|
||||
import {
|
||||
BadRequestError, Context, db, DocumentModel, Handler, ObjectId, param, ProblemModel, RecordModel, SettingModel,
|
||||
StorageModel,
|
||||
} from 'hydrooj';
|
||||
import { Context } from 'hydrooj';
|
||||
|
||||
export async function apply(ctx: Context) {
|
||||
if (process.env.HYDRO_CLI) return;
|
||||
@@ -45,8 +43,7 @@ export async function apply(ctx: Context) {
|
||||
for (const route of capture) {
|
||||
ctx.server.addCaptureRoute(route, middleware);
|
||||
}
|
||||
const html = require('fs').readFileSync(path.join(__dirname, 'index.html'), 'utf-8');
|
||||
console.log(html);
|
||||
const html = fs.readFileSync(path.join(__dirname, 'index.html'), 'utf-8');
|
||||
ctx.server.registerRenderer('next', {
|
||||
name: 'next',
|
||||
accept: ['main.html'],
|
||||
|
||||
Reference in new issue
Block a user