core&ui: contest: acm: lock scoreboard

This commit is contained in:
undefined committed 2022-02-02 00:53:06 +08:00
1 parent cb02b8dafe
commit e67ff511bb
17 files changed
+224 -196

No files matched your search

+12 -3
View File
@@ -305,7 +305,7 @@ function _digit2(number: number) {
return number < 10 ? `0${number}` : number.toString();
}
export function formatSeconds(_seconds = '0') {
export function formatSeconds(_seconds: string | number = '0') {
const seconds = +_seconds;
return '{0}:{1}:{2}'.format(
_digit2(Math.floor(seconds / 3600)),
@@ -431,11 +431,20 @@ export function sortFiles(files: { _id: string }[] | string[]) {
return isString ? result.map((x) => x.name) : result;
}
export const htmlEncode = (str) => str.replace(/[&<>'"]/g,
(tag) => ({
export const htmlEncode = (str: string) => str.replace(/[&<>'"]/g,
(tag: string) => ({
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
"'": '&#39;',
'"': '&quot;',
}[tag]));
export function Counter<T extends (string | number) = string>() {
return new Proxy({}, {
get: (target, prop) => {
if (target[prop] === undefined) return 0;
return target[prop];
},
}) as Record<T, number>;
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/utils",
"version": "1.1.11",
"version": "1.1.13",
"description": "hydrooj utils",
"main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git",
@@ -12,7 +12,7 @@
"js-yaml": "^4.1.0",
"moment": "^2.29.1",
"mongodb": "^3.7.3",
"systeminformation": "^5.9.17"
"systeminformation": "^5.11.0"
},
"devDependencies": {
"@types/fs-extra": "^9.0.13",