vjudge: support enableOn option

pull/428/head
undefined 2 years ago
parent 333b96f34c
commit ba187a168a

@ -1,6 +1,6 @@
{
"name": "@hydrooj/vjudge",
"version": "1.5.0-next.12",
"version": "1.5.0-next.13",
"description": "Submit problems to remote oj",
"main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git",

@ -11,6 +11,7 @@ export interface RemoteAccount {
query?: string;
frozen?: string;
problemLists?: string[];
enableOn?: string[];
}
declare module 'hydrooj/src/interface' {
interface Collections {

@ -1,4 +1,5 @@
/* eslint-disable no-await-in-loop */
import os from 'os';
import { sleep } from '@hydrooj/utils/lib/utils';
import * as Judge from 'hydrooj/src/handler/judge';
import { Logger } from 'hydrooj/src/logger';
@ -131,6 +132,7 @@ async function loadAccounts() {
const accounts = await coll.find().toArray();
for (const account of accounts) {
if (!providers[account.type]) continue;
if (account.enableOn && !account.enableOn.includes(os.hostname())) continue;
Pool[`${account.type}/${account.handle}`] = new Service(providers[account.type], account);
}
}

Loading…
Cancel
Save