mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
bug fixes & improments
This commit is contained in:
11 files changed
+15
-18
No files matched your search
@@ -6,7 +6,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-react/eslint-plugin": "^1.37.0",
|
"@eslint-react/eslint-plugin": "^1.37.0",
|
||||||
"@eslint/compat": "^1.2.7",
|
"@eslint/compat": "^1.2.7",
|
||||||
"@eslint/eslintrc": "^3.3.0",
|
"@eslint/eslintrc": "^3.3.1",
|
||||||
"@stylistic/eslint-plugin": "^4.2.0",
|
"@stylistic/eslint-plugin": "^4.2.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
||||||
"@typescript-eslint/parser": "^8.27.0",
|
"@typescript-eslint/parser": "^8.27.0",
|
||||||
|
|||||||
+2
-2
@@ -43,7 +43,7 @@
|
|||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cross-spawn": "^7.0.6",
|
"cross-spawn": "^7.0.6",
|
||||||
"esbuild": "0.25.0",
|
"esbuild": "0.25.0",
|
||||||
"eslint": "^9.22.0",
|
"eslint": "^9.23.0",
|
||||||
"eslint-import-resolver-typescript": "^4.2.2",
|
"eslint-import-resolver-typescript": "^4.2.2",
|
||||||
"eslint-import-resolver-webpack": "^0.13.10",
|
"eslint-import-resolver-webpack": "^0.13.10",
|
||||||
"fs-extra": "^11.3.0",
|
"fs-extra": "^11.3.0",
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
"mongodb-memory-server": "10.1.4",
|
"mongodb-memory-server": "10.1.4",
|
||||||
"nyc": "^17.1.0",
|
"nyc": "^17.1.0",
|
||||||
"ora": "^8.2.0",
|
"ora": "^8.2.0",
|
||||||
"oxlint": "^0.16.1",
|
"oxlint": "^0.16.2",
|
||||||
"package-json": "^10.0.1",
|
"package-json": "^10.0.1",
|
||||||
"semver": "^7.7.1",
|
"semver": "^7.7.1",
|
||||||
"simple-git": "^3.27.0",
|
"simple-git": "^3.27.0",
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export default class ElasticSearchService extends Service {
|
|||||||
this.client = new Client({ node: config.url });
|
this.client = new Client({ node: config.url });
|
||||||
}
|
}
|
||||||
|
|
||||||
async problemSearch(domainId: string, q: string, opts): ReturnType<ProblemSearch> {
|
async problemSearch(domainId: string, q: string, opts: Parameters<ProblemSearch>[2] = {}): ReturnType<ProblemSearch> {
|
||||||
const size = opts?.limit || SystemModel.get('pagination.problem');
|
const size = opts?.limit || SystemModel.get('pagination.problem');
|
||||||
const from = Math.min(this.config.indexSize - size, opts?.skip || 0);
|
const from = Math.min(this.config.indexSize - size, opts?.skip || 0);
|
||||||
const res = await this.client.search({
|
const res = await this.client.search({
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class DiscussionMainHandler extends Handler {
|
|||||||
const parentType = { $in: Object.keys(typeMapper).map((i) => typeMapper[i]) };
|
const parentType = { $in: Object.keys(typeMapper).map((i) => typeMapper[i]) };
|
||||||
all &&= this.user.hasPerm(PERM.PERM_MOD_BADGE);
|
all &&= this.user.hasPerm(PERM.PERM_MOD_BADGE);
|
||||||
const [ddocs, dpcount] = await this.paginate(
|
const [ddocs, dpcount] = await this.paginate(
|
||||||
discussion.getMulti(domainId, { parentType, ...all ? {} : { hidden: false } }),
|
discussion.getMulti(domainId, { parentType, ...all ? {} : { hidden: false } }).hint('discussionSort'),
|
||||||
page,
|
page,
|
||||||
'discussion',
|
'discussion',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -507,6 +507,8 @@ class HomeDomainHandler extends Handler {
|
|||||||
|
|
||||||
@param('id', Types.String)
|
@param('id', Types.String)
|
||||||
async postLeave({ }, id: string) {
|
async postLeave({ }, id: string) {
|
||||||
|
const ddoc = await domain.get(id);
|
||||||
|
if (!ddoc) throw new NotFoundError(id);
|
||||||
await domain.setJoin(id, this.user._id, false);
|
await domain.setJoin(id, this.user._id, false);
|
||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ if (process.env.NIX_PROFILES) {
|
|||||||
|
|
||||||
export class Loader extends Service {
|
export class Loader extends Service {
|
||||||
public state: Record<string, EffectScope> = Object.create(null);
|
public state: Record<string, EffectScope> = Object.create(null);
|
||||||
public config: {};
|
|
||||||
public suspend = false;
|
public suspend = false;
|
||||||
public cache: Record<string, string> = Object.create(null);
|
public cache: Record<string, string> = Object.create(null);
|
||||||
// public warnings: Record<string, string> = Object.create(null);
|
// public warnings: Record<string, string> = Object.create(null);
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ export async function deleteSub<T extends keyof DocType, K extends ArrayKeys<Doc
|
|||||||
domainId: string, docType: T, docId: DocType[T]['docId'],
|
domainId: string, docType: T, docId: DocType[T]['docId'],
|
||||||
key: K, subId: MaybeArray<DocType[T][K][0]['_id']>,
|
key: K, subId: MaybeArray<DocType[T][K][0]['_id']>,
|
||||||
): Promise<DocType[T]> {
|
): Promise<DocType[T]> {
|
||||||
subId = (subId instanceof Array) ? subId : [subId];
|
subId = Array.isArray(subId) ? subId : [subId];
|
||||||
return await coll.findOneAndUpdate(
|
return await coll.findOneAndUpdate(
|
||||||
{ domainId, docType, docId },
|
{ domainId, docType, docId },
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -416,6 +416,7 @@ export async function apply(ctx: Context) {
|
|||||||
collStatus.deleteMany({ domainId }),
|
collStatus.deleteMany({ domainId }),
|
||||||
]));
|
]));
|
||||||
await db.clearIndexes(coll, ['tag', 'hidden']);
|
await db.clearIndexes(coll, ['tag', 'hidden']);
|
||||||
|
const onlyFor = (docType: number) => ({ partialFilterExpression: { docType } });
|
||||||
await db.ensureIndexes(
|
await db.ensureIndexes(
|
||||||
coll,
|
coll,
|
||||||
{ key: { domainId: 1, docType: 1, docId: 1 }, name: 'basic', unique: true },
|
{ key: { domainId: 1, docType: 1, docId: 1 }, name: 'basic', unique: true },
|
||||||
@@ -426,8 +427,8 @@ export async function apply(ctx: Context) {
|
|||||||
// For problem solution
|
// For problem solution
|
||||||
{ key: { domainId: 1, docType: 1, parentType: 1, parentId: 1, vote: -1, docId: -1 }, name: 'solution', sparse: true },
|
{ key: { domainId: 1, docType: 1, parentType: 1, parentId: 1, vote: -1, docId: -1 }, name: 'solution', sparse: true },
|
||||||
// For discussion
|
// For discussion
|
||||||
{ key: { domainId: 1, docType: 1, pin: -1, docId: -1 }, name: 'discussionSort', sparse: true },
|
{ key: { docType: 1, domainId: 1, hidden: 1, pin: -1, docId: -1 }, name: 'discussionSort', ...onlyFor(TYPE_DISCUSSION) },
|
||||||
{ key: { domainId: 1, docType: 1, parentType: 1, parentId: 1, pin: -1, docId: -1 }, name: 'discussionNodeSort', sparse: true },
|
{ key: { docType: 1, domainId: 1, hidden: 1, parentType: 1, parentId: 1, pin: -1, docId: -1 }, name: 'discussionNodeSort', sparse: true },
|
||||||
// Hidden doc
|
// Hidden doc
|
||||||
{ key: { domainId: 1, docType: 1, hidden: 1, docId: -1 }, name: 'hiddenDoc', sparse: true },
|
{ key: { domainId: 1, docType: 1, hidden: 1, docId: -1 }, name: 'hiddenDoc', sparse: true },
|
||||||
// For contest
|
// For contest
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ export async function apply(ctx: Context) {
|
|||||||
ctx.on('domain/delete-cache', async (domainId: string) => {
|
ctx.on('domain/delete-cache', async (domainId: string) => {
|
||||||
const ddoc = await DomainModel.get(domainId);
|
const ddoc = await DomainModel.get(domainId);
|
||||||
if (!ddoc) return;
|
if (!ddoc) return;
|
||||||
for (const host of ddoc.hosts || []) {
|
for (const host of ddoc.host || []) {
|
||||||
cache.delete(`host::${host}`);
|
cache.delete(`host::${host}`);
|
||||||
}
|
}
|
||||||
cache.delete(`id::${domainId}`);
|
cache.delete(`id::${domainId}`);
|
||||||
|
|||||||
@@ -7,6 +7,6 @@
|
|||||||
"postinstall": "node -r @hydrooj/register install.ts"
|
"postinstall": "node -r @hydrooj/register install.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@xcpcio/board-app": "^0.53.2"
|
"@xcpcio/board-app": "^0.54.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,9 +7,6 @@
|
|||||||
"types": "api.ts",
|
"types": "api.ts",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"scripts": {
|
|
||||||
"lint": "eslint"
|
|
||||||
},
|
|
||||||
"hydro": {
|
"hydro": {
|
||||||
"cli": false
|
"cli": false
|
||||||
},
|
},
|
||||||
@@ -25,7 +22,7 @@
|
|||||||
"@fontsource/source-code-pro": "^5.2.5",
|
"@fontsource/source-code-pro": "^5.2.5",
|
||||||
"@fontsource/ubuntu-mono": "^5.2.5",
|
"@fontsource/ubuntu-mono": "^5.2.5",
|
||||||
"@hydrooj/utils": "workspace:^",
|
"@hydrooj/utils": "workspace:^",
|
||||||
"@sentry/browser": "^9.7.0",
|
"@sentry/browser": "^9.8.0",
|
||||||
"@sentry/webpack-plugin": "^3.2.2",
|
"@sentry/webpack-plugin": "^3.2.2",
|
||||||
"@simplewebauthn/browser": "13.1.0",
|
"@simplewebauthn/browser": "13.1.0",
|
||||||
"@svgr/webpack": "^8.1.0",
|
"@svgr/webpack": "^8.1.0",
|
||||||
@@ -70,7 +67,7 @@
|
|||||||
"jquery.easing": "^1.4.1",
|
"jquery.easing": "^1.4.1",
|
||||||
"jquery.transit": "^0.9.12",
|
"jquery.transit": "^0.9.12",
|
||||||
"matchmedia-polyfill": "^0.3.2",
|
"matchmedia-polyfill": "^0.3.2",
|
||||||
"md-editor-rt": "^5.4.2",
|
"md-editor-rt": "^5.4.3",
|
||||||
"mini-css-extract-plugin": "^2.9.2",
|
"mini-css-extract-plugin": "^2.9.2",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"monaco-editor": "0.52.2",
|
"monaco-editor": "0.52.2",
|
||||||
|
|||||||
@@ -13,11 +13,9 @@
|
|||||||
"react-dom": "^18.3.1"
|
"react-dom": "^18.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.22.0",
|
|
||||||
"@types/react": "^19.0.12",
|
"@types/react": "^19.0.12",
|
||||||
"@types/react-dom": "^19.0.4",
|
"@types/react-dom": "^19.0.4",
|
||||||
"@vitejs/plugin-react-swc": "^3.8.1",
|
"@vitejs/plugin-react-swc": "^3.8.1",
|
||||||
"typescript": "~5.8.2",
|
|
||||||
"vite": "^6.2.2"
|
"vite": "^6.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user