ui: step=any

This commit is contained in:
undefined committed 2021-08-13 17:09:10 +08:00
1 parent 0c7745d435
commit cabd3b44f9
10 files changed
+47 -33

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "2.10.6",
"version": "2.10.7",
"main": "package.json",
"author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git",
+1 -1
View File
@@ -48,7 +48,7 @@ parallelism:
desc: Runner parallelism
default: 2
rate:
type: number
type: float
name: rate
desc: (?)
default: 1
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.32.17",
"version": "2.32.18",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+20 -9
View File
@@ -177,14 +177,6 @@ class ProblemImportSYZOJHandler extends Handler {
text: p.limit_and_hint,
});
}
if (p.have_additional_file) {
content.push({
type: 'Text',
subType: 'markdown',
sectionTitle: this.translate('Additional File'),
text: `${url}download/additional_file`,
});
}
const c = buildContent(content, 'markdown');
const docId = await problem.add(
domainId, target, p.title, c, this.user._id, p.tags || [], hidden,
@@ -215,6 +207,25 @@ class ProblemImportSYZOJHandler extends Handler {
} finally {
fs.unlinkSync(file);
}
if (p.have_additional_file) {
const r1 = download(`${url}download/additional_file`);
const file1 = path.resolve(os.tmpdir(), 'hydro', `import_${domainId}_${docId}_a.zip`);
const w1 = fs.createWriteStream(file1);
try {
await new Promise((resolve, reject) => {
w1.on('finish', resolve);
w1.on('error', reject);
r1.pipe(w1);
});
const zip = new AdmZip(file1);
const entries = zip.getEntries();
for (const entry of entries) {
await problem.addAdditionalFile(domainId, docId, entry.entryName.replace('/', '_'), entry.getData());
}
} finally {
fs.unlinkSync(file1);
}
}
return docId;
}
@@ -296,7 +307,7 @@ class ProblemImportSYZOJHandler extends Handler {
let version = 2;
if (!prefix.endsWith('/')) prefix += '/';
if (prefix.endsWith('/p/')) version = 3;
else if (!prefix.endsWith('/problem/')) prefix += 'problem/';
else prefix = `${prefix.split('/problem/')[0]}/problem/`;
const base = `${prefix}${start}/`;
assert(base.match(RE_SYZOJ), new ValidationError('prefix'));
const [, protocol, host] = RE_SYZOJ.exec(base);
+18 -16
View File
@@ -488,7 +488,7 @@ export interface JudgeResultBody {
export interface Task {
_id: ObjectID,
type: string,
executeAfter?: Date,
executeAfter: Date,
priority: number,
[key: string]: any
}
@@ -624,24 +624,26 @@ export interface UI {
UserDropdown: typeof import('./lib/ui').UserDropdown,
}
export interface HydroGlobal {
version: Record<string, string>,
model: Model,
handler: Record<string, Function>,
script: Record<string, Script>,
service: Service,
lib: Lib,
stat: any,
ui: UI,
error: typeof import('./error'),
Logger: typeof import('./logger').Logger,
logger: typeof import('./logger').logger,
locales: Record<string, Record<string, string>>,
isFirstWorker: boolean,
}
declare global {
namespace NodeJS {
interface Global {
Hydro: {
version: Record<string, string>,
model: Model,
handler: Dict<Function>,
script: Dict<Script>,
service: Service,
lib: Lib,
stat: any,
ui: UI,
error: typeof import('./error'),
Logger: typeof import('./logger').Logger,
logger: typeof import('./logger').logger,
locales: Dict<Dict<string>>,
isFirstWorker: boolean,
},
Hydro: HydroGlobal,
addons: string[],
}
}
+1 -1
View File
@@ -43,7 +43,7 @@ export const DOMAIN_SETTINGS_BY_KEY: SettingDict = {};
export const SYSTEM_SETTINGS_BY_KEY: SettingDict = {};
// eslint-disable-next-line max-len
export type SettingType = 'text' | 'yaml' | 'number' | 'markdown' | 'password' | 'boolean' | 'textarea' | [string, string][] | Record<string, string>;
export type SettingType = 'text' | 'yaml' | 'number' | 'float' | 'markdown' | 'password' | 'boolean' | 'textarea' | [string, string][] | Record<string, string>;
export const Setting = (
family: string, key: string, value: any = null,
+1 -1
View File
@@ -141,7 +141,7 @@ bus.once('app/started', async () => {
await TaskModel.add({
type: 'schedule',
subType: 'task.daily',
executeAfter: moment().hour(3).minute(0).second(0).millisecond(0).toDate(),
executeAfter: moment().add(1, 'day').hour(3).minute(0).second(0).millisecond(0).toDate(),
interval: [1, 'day'],
});
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.17.2",
"version": "4.17.3",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",
@@ -152,9 +152,10 @@
{{ container_attr('textbox-container', args) }}
>
<input
type="{{ args.type or 'text' }}"
type="{{ 'number' if args.type === 'float' else args.type|default('text') }}"
name="{{ args.name }}"
value="{{ args.value }}"
{% if args.type === 'float' %} step="any"{% endif %}
placeholder="{{ args.placeholder }}"
{{ form_attr('textbox', args) }}
>
@@ -7,7 +7,7 @@
{%- for setting in family_settings -%}
{% if not setting.flag|bitand(model.setting.FLAG_HIDDEN) %}
{% set secret = setting.flag|bitand(model.setting.FLAG_SECRET) != 0 %}
{% if setting.type == 'text' or setting.type == 'password' or setting.type == 'number' %}
{% if setting.type == 'text' or setting.type == 'password' or setting.type == 'number' or setting.type == 'float' %}
{{ form.form_text({
type:setting.type,
label:setting.name,