mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: add warning for no host configured
This commit is contained in:
2 files changed
+6
-2
No files matched your search
@@ -14,7 +14,7 @@
|
|||||||
import './utils';
|
import './utils';
|
||||||
|
|
||||||
import PQueue from 'p-queue';
|
import PQueue from 'p-queue';
|
||||||
import { fs } from '@hydrooj/utils';
|
import { fs, Time } from '@hydrooj/utils';
|
||||||
import { getConfig } from './config';
|
import { getConfig } from './config';
|
||||||
import HydroHost from './hosts/hydro';
|
import HydroHost from './hosts/hydro';
|
||||||
import Vj4Host from './hosts/vj4';
|
import Vj4Host from './hosts/vj4';
|
||||||
@@ -53,6 +53,10 @@ async function daemon() {
|
|||||||
const queue = new PQueue({ concurrency: Infinity });
|
const queue = new PQueue({ concurrency: Infinity });
|
||||||
await fs.ensureDir(getConfig('tmp_dir'));
|
await fs.ensureDir(getConfig('tmp_dir'));
|
||||||
queue.on('error', (e) => log.error(e));
|
queue.on('error', (e) => log.error(e));
|
||||||
|
if (!Object.keys(_hosts).length) {
|
||||||
|
log.warn('No host configured');
|
||||||
|
setInterval(() => log.warn('No host configured'), Time.hour);
|
||||||
|
}
|
||||||
for (const i in _hosts) {
|
for (const i in _hosts) {
|
||||||
_hosts[i].host ||= i;
|
_hosts[i].host ||= i;
|
||||||
hosts[i] = _hosts[i].type === 'vj4' ? new Vj4Host(_hosts[i]) : new HydroHost(_hosts[i]);
|
hosts[i] = _hosts[i].type === 'vj4' ? new Vj4Host(_hosts[i]) : new HydroHost(_hosts[i]);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function initTimePicker(input: HTMLInputElement) {
|
|||||||
}).on('mousedown', (e) => {
|
}).on('mousedown', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$input.val(time).trigger('change');
|
$input.val(time).trigger('change');
|
||||||
closeDropdown(); // eslint-disable-line no-use-before-define
|
closeDropdown(); // eslint-disable-line ts/no-use-before-define
|
||||||
}).on('mouseenter', function () {
|
}).on('mouseenter', function () {
|
||||||
$(this).css('background', 'var(--highlight-color, #e8f0fe)');
|
$(this).css('background', 'var(--highlight-color, #e8f0fe)');
|
||||||
}).on('mouseleave', function () {
|
}).on('mouseleave', function () {
|
||||||
|
|||||||
Reference in new issue
Block a user