mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: force numeric id
This commit is contained in:
1 parent
336cff75f2
commit
526eaa2603
5 files changed
+15
-6
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.29.44",
|
||||
"version": "2.29.45",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -226,6 +226,7 @@ export class ContestEditHandler extends Handler {
|
||||
i = i.trim();
|
||||
if ((+i).toString() === i) return +i;
|
||||
if (i.split(':')[0] === domainId) return +i.split(':')[1];
|
||||
if (!i.includes(':')) throw new ValidationError('pids');
|
||||
return i;
|
||||
}).filter((i) => i);
|
||||
const beginAtMoment = moment.tz(`${beginAtDate} ${beginAtTime}`, this.user.timeZone);
|
||||
|
||||
@@ -313,6 +313,7 @@ class HomeworkEditHandler extends Handler {
|
||||
i = i.trim();
|
||||
if ((+i).toString() === i) return +i;
|
||||
if (i.split(':')[0] === domainId) return +i.split(':')[1];
|
||||
if (!i.includes(':')) throw new ValidationError('pids');
|
||||
return i;
|
||||
}).filter((i) => i);
|
||||
const tdoc = tid
|
||||
|
||||
@@ -30,6 +30,7 @@ function buildSequence(pages, type) {
|
||||
async function load() {
|
||||
if (UiContext.extraPages) {
|
||||
const tasks = [];
|
||||
const ts = new Date().getTime();
|
||||
for (const page of UiContext.extraPages) {
|
||||
const head = document.getElementsByTagName('head')[0];
|
||||
const script = document.createElement('script');
|
||||
@@ -41,6 +42,10 @@ async function load() {
|
||||
}));
|
||||
}
|
||||
await Promise.all(tasks);
|
||||
const time = new Date().getTime() - ts;
|
||||
if ((process.env.NODE_ENV !== 'production' && time > 16) || time > 256) {
|
||||
console.warn(`Extra pages loading took ${time}ms`);
|
||||
}
|
||||
}
|
||||
|
||||
const pageLoader = new PageLoader();
|
||||
@@ -56,9 +61,7 @@ async function load() {
|
||||
];
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const { page, func, type } of loadSequence) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
console.time(`${page.name}: ${type}Loading`);
|
||||
}
|
||||
const ts = new Date().getTime();
|
||||
try {
|
||||
await func(currentPageName);
|
||||
} catch (e) {
|
||||
@@ -66,7 +69,11 @@ async function load() {
|
||||
console.error(`Failed to call '${type}Loading' of ${page.name}\n${e.stack}`);
|
||||
}
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
console.timeEnd(`${page.name}: ${type}Loading`);
|
||||
console.time(`${page.name}: ${type}Loading`);
|
||||
}
|
||||
const time = new Date().getTime() - ts;
|
||||
if ((process.env.NODE_ENV !== 'production' && time > 16) || time > 256) {
|
||||
console.log(`${page.name}: ${type}Loading took ${time}ms`);
|
||||
}
|
||||
}
|
||||
const sections = _.map($('.section').get(), (section, idx) => ({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.13.10",
|
||||
"version": "4.13.11",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
Reference in new issue
Block a user