mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
Hello yarn berry
This commit is contained in:
1 parent
04a4306895
commit
782f334a27
62 files changed
+448
-239
No files matched your search
@@ -5,8 +5,16 @@
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
"js-yaml": "^4.1.0",
|
||||
"superagent": "^6.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-yaml": "^4.0.1",
|
||||
"@types/node": "^15.6.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"hydrooj": "*"
|
||||
}
|
||||
}
|
||||
+1
-1
Submodule packages/customize updated: 14ef44fd1a...2c77ba2f47.
@@ -7,5 +7,6 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"js-yaml": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"preferUnplugged": true
|
||||
}
|
||||
@@ -6,17 +6,18 @@
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
"adm-zip": "^0.5.5",
|
||||
"decode-html": "^2.0.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"mongodb": "^3.6.8",
|
||||
"xml2js": "^0.4.23"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/xml2js": "^0.4.8",
|
||||
"bson": "^4.3.0"
|
||||
"@types/xml2js": "^0.4.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"hydrooj": "^2.20.0"
|
||||
"hydrooj": "*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
const { spawnSync } = require('child_process');
|
||||
const os = require('os');
|
||||
if (os.platform() === 'linux') {
|
||||
spawnSync('bash download.sh');
|
||||
}
|
||||
@@ -6,10 +6,11 @@
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"dependencies": {
|
||||
"maxmind": "^4.3.1"
|
||||
"maxmind": "^4.3.2"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"scripts": {
|
||||
"postinstall": "./download.sh"
|
||||
"postinstall": "node download.js"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"hydrooj": "^2.15.0"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { argv } = require('yargs');
|
||||
const argv = require('cac')().parse();
|
||||
|
||||
if ((argv._ || [])[0] == 'cache') require('../dist/cache')()
|
||||
if (argv.options.debug) process.env.DEV = 'on';
|
||||
if (argv.args[0] === 'cache') require('../dist/cache')();
|
||||
else require('../dist/daemon')();
|
||||
@@ -1,27 +1,32 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "2.6.6",
|
||||
"version": "2.7.0",
|
||||
"main": "package.json",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"dependencies": {
|
||||
"@hydrooj/utils": "^1.0.14",
|
||||
"axios": "^0.21.1",
|
||||
"bson": "^4.3.0",
|
||||
"cac": "^6.7.3",
|
||||
"fs-extra": "^10.0.0",
|
||||
"js-yaml": "^4.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lodash": "^4.17.21",
|
||||
"p-queue": "^6.6.1",
|
||||
"mongodb": "^3.6.8",
|
||||
"p-queue": "^6.6.2",
|
||||
"shell-quote": "^1.7.2",
|
||||
"ws": "^7.4.5",
|
||||
"yargs": "^17.0.1"
|
||||
"ws": "^7.4.6"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"devDependencies": {
|
||||
"@types/bson": "^4.0.2",
|
||||
"@types/fs-extra": "^9.0.10",
|
||||
"@types/js-yaml": "^4.0.0",
|
||||
"@types/shell-quote": "^1.7.0"
|
||||
"@types/fs-extra": "^9.0.11",
|
||||
"@types/js-yaml": "^4.0.1",
|
||||
"@types/lodash": "^4.14.170",
|
||||
"@types/shell-quote": "^1.7.0",
|
||||
"@types/ws": "^7.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"hydrooj": "*"
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,20 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
import { Logger } from './log';
|
||||
import { getConfig } from './config';
|
||||
|
||||
const argv = cac().parse();
|
||||
|
||||
const logger = new Logger('cache');
|
||||
|
||||
export = function main() {
|
||||
const CACHE_DIR = getConfig('cache_dir');
|
||||
if (argv._[1] === 'clean') {
|
||||
if (argv.args[1] === 'clean') {
|
||||
fs.emptyDirSync(CACHE_DIR);
|
||||
logger.info('Cleaned cache.');
|
||||
} else if (argv._[1] === 'prune') {
|
||||
const duration = +argv.duration || 30;
|
||||
} else if (argv.args[1] === 'prune') {
|
||||
const duration = +argv.options.duration || 30;
|
||||
const now = new Date().getTime();
|
||||
const hosts = fs.readdirSync(CACHE_DIR);
|
||||
let cnt = 0;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/* eslint-disable prefer-const */
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import yaml from 'js-yaml';
|
||||
import log from './log';
|
||||
|
||||
const argv = cac().parse();
|
||||
let CONFIG_FILE = path.resolve(os.homedir(), '.config', 'hydro', 'judge.yaml');
|
||||
let LANGS_FILE = path.resolve(os.homedir(), '.config', 'hydro', 'langs.yaml');
|
||||
|
||||
@@ -43,20 +44,20 @@ if (fs.existsSync(path.resolve(process.cwd(), '.env'))) {
|
||||
|
||||
if (!global.Hydro) {
|
||||
// standalone
|
||||
if (process.env.CONFIG_FILE || argv.config) {
|
||||
CONFIG_FILE = path.resolve(process.env.CONFIG_FILE || argv.config as string);
|
||||
if (process.env.CONFIG_FILE || argv.options.config) {
|
||||
CONFIG_FILE = path.resolve(process.env.CONFIG_FILE || argv.options.config);
|
||||
}
|
||||
if (process.env.LANGS_FILE || argv.langs) {
|
||||
LANGS_FILE = path.resolve(process.env.LANGS_FILE || argv.langs as string);
|
||||
if (process.env.LANGS_FILE || argv.options.langs) {
|
||||
LANGS_FILE = path.resolve(process.env.LANGS_FILE || argv.options.langs);
|
||||
}
|
||||
if (process.env.TEMP_DIR || argv.tmp) {
|
||||
config.tmp_dir = path.resolve(process.env.TEMP_DIR || argv.tmp as string);
|
||||
if (process.env.TEMP_DIR || argv.options.tmp) {
|
||||
config.tmp_dir = path.resolve(process.env.TEMP_DIR || argv.options.tmp);
|
||||
}
|
||||
if (process.env.CACHE_DIR || argv.cache) {
|
||||
config.cache_dir = path.resolve(process.env.CACHE_DIR || argv.cache as string);
|
||||
if (process.env.CACHE_DIR || argv.options.cache) {
|
||||
config.cache_dir = path.resolve(process.env.CACHE_DIR || argv.options.cache);
|
||||
}
|
||||
if (process.env.EXECUTION_HOST || argv.sandbox) {
|
||||
config.sandbox_host = path.resolve(process.env.EXECUTION_HOST || argv.execute as string);
|
||||
if (process.env.EXECUTION_HOST || argv.options.sandbox) {
|
||||
config.sandbox_host = path.resolve(process.env.EXECUTION_HOST || argv.options.sandbox);
|
||||
}
|
||||
const configFile = fs.readFileSync(CONFIG_FILE).toString();
|
||||
config = { ...config, ...yaml.load(configFile) as any };
|
||||
|
||||
@@ -3,9 +3,9 @@ import path from 'path';
|
||||
import axios from 'axios';
|
||||
import fs from 'fs-extra';
|
||||
import WebSocket from 'ws';
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
import { noop } from 'lodash';
|
||||
import { ObjectID } from 'bson';
|
||||
import { ObjectID } from 'mongodb';
|
||||
import { LangConfig } from '@hydrooj/utils/lib/lang';
|
||||
import * as tmpfs from '../tmpfs';
|
||||
import log from '../log';
|
||||
@@ -17,6 +17,8 @@ import readCases from '../cases';
|
||||
import judge from '../judge';
|
||||
import * as sysinfo from '../sysinfo';
|
||||
|
||||
const argv = cac().parse();
|
||||
|
||||
class JudgeTask {
|
||||
stat: Record<string, Date>;
|
||||
session: any;
|
||||
@@ -86,7 +88,7 @@ class JudgeTask {
|
||||
});
|
||||
} else {
|
||||
log.error(e);
|
||||
this.next({ message: { message: e.message, params: e.params || [], ...argv.debug ? { stack: e.stack } : {} } });
|
||||
this.next({ message: { message: e.message, params: e.params || [], ...argv.options.debug ? { stack: e.stack } : {} } });
|
||||
this.end({
|
||||
status: STATUS_SYSTEM_ERROR, score: 0, time_ms: 0, memory_kb: 0,
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import Queue from 'p-queue';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import { argv } from 'yargs';
|
||||
import * as STATUS from '../status';
|
||||
import { SystemError } from '../error';
|
||||
import { parseFilename } from '../utils';
|
||||
@@ -173,7 +172,7 @@ export const judge = async (ctx) => {
|
||||
if (effective) ctx.total_score += scores[sid];
|
||||
}
|
||||
ctx.stat.done = new Date();
|
||||
if (argv.debug) ctx.next({ message: JSON.stringify(ctx.stat) });
|
||||
if (process.env.DEV) ctx.next({ message: JSON.stringify(ctx.stat) });
|
||||
ctx.end({
|
||||
status: ctx.total_status,
|
||||
score: ctx.total_score,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import Queue from 'p-queue';
|
||||
import fs from 'fs-extra';
|
||||
import { argv } from 'yargs';
|
||||
import * as STATUS from '../status';
|
||||
import { parse } from '../testlib';
|
||||
import { findFileSync, parseFilename } from '../utils';
|
||||
@@ -123,7 +122,7 @@ export const judge = async (ctx) => {
|
||||
}
|
||||
await Promise.all(tasks);
|
||||
ctx.stat.done = new Date();
|
||||
if (argv.debug) ctx.next({ message: JSON.stringify(ctx.stat) });
|
||||
if (process.env.DEV) ctx.next({ message: JSON.stringify(ctx.stat) });
|
||||
console.log({
|
||||
status: ctx.total_status,
|
||||
score: ctx.total_score,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { argv } from 'yargs';
|
||||
import * as STATUS from '../status';
|
||||
import { run } from '../sandbox';
|
||||
import compile from '../compile';
|
||||
@@ -100,7 +99,7 @@ export const judge = async (ctx) => {
|
||||
},
|
||||
});
|
||||
ctx.stat.done = new Date();
|
||||
if (argv.debug) ctx.next({ message: JSON.stringify(ctx.stat) });
|
||||
if (process.env.DEV) ctx.next({ message: JSON.stringify(ctx.stat) });
|
||||
ctx.end({
|
||||
status,
|
||||
score: status === STATUS.STATUS_ACCEPTED ? 100 : 0,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { inspect, InspectOptions, format } from 'util';
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
|
||||
const argv = cac().parse();
|
||||
|
||||
namespace Time {
|
||||
export const second = 1000;
|
||||
@@ -41,7 +43,7 @@ export class Logger {
|
||||
static readonly INFO = 2;
|
||||
static readonly WARN = 2;
|
||||
static readonly DEBUG = 3;
|
||||
static baseLevel = argv.debug ? 3 : 2;
|
||||
static baseLevel = argv.options.debug ? 3 : 2;
|
||||
static showDiff = false;
|
||||
static levels: Record<string, number> = {};
|
||||
static lastTime = 0;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Axios from 'axios';
|
||||
import fs from 'fs-extra';
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
import * as STATUS from './status';
|
||||
import { FormatError, SystemError } from './error';
|
||||
import { cmd, parseMemoryMB } from './utils';
|
||||
import { getConfig } from './config';
|
||||
import { Logger } from './log';
|
||||
|
||||
const argv = cac().parse();
|
||||
const logger = new Logger('sandbox');
|
||||
let callId = 0;
|
||||
|
||||
@@ -90,9 +91,9 @@ export async function runMultiple(execute) {
|
||||
body.cmd[1].files[0] = null;
|
||||
body.cmd[1].files[1] = null;
|
||||
const id = callId++;
|
||||
if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(body));
|
||||
if (argv.options['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(body));
|
||||
res = await Axios.create({ baseURL: getConfig('sandbox_host') }).post('/run', body);
|
||||
if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(res.data));
|
||||
if (argv.options['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(res.data));
|
||||
} catch (e) {
|
||||
if (e instanceof FormatError) throw e;
|
||||
throw new SystemError('Sandbox Error');
|
||||
@@ -113,9 +114,9 @@ export async function run(execute, params?) {
|
||||
try {
|
||||
const body = { cmd: [proc({ execute, ...params })] };
|
||||
const id = callId++;
|
||||
if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(body));
|
||||
if (argv.options['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(body));
|
||||
const res = await Axios.create({ baseURL: getConfig('sandbox_host') }).post('/run', body);
|
||||
if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(res.data));
|
||||
if (argv.options['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(res.data));
|
||||
[result] = res.data;
|
||||
} catch (e) {
|
||||
if (e instanceof FormatError) throw e;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import 'hydrooj';
|
||||
import path from 'path';
|
||||
import { argv } from 'yargs';
|
||||
import { ObjectID } from 'bson';
|
||||
import cac from 'cac';
|
||||
import { ObjectID } from 'mongodb';
|
||||
import fs from 'fs-extra';
|
||||
import { noop } from 'lodash';
|
||||
import { Logger } from 'hydrooj/dist/logger';
|
||||
@@ -217,7 +217,7 @@ async function postInit() {
|
||||
});
|
||||
} else {
|
||||
logger.error(e);
|
||||
this.next({ message: { message: e.message, params: e.params, ...argv.debug ? { stack: e.stack } : {} } });
|
||||
this.next({ message: { message: e.message, params: e.params, ...process.env.DEV ? { stack: e.stack } : {} } });
|
||||
this.end({
|
||||
status: STATUS_SYSTEM_ERROR, score: 0, time_ms: 0, memory_kb: 0,
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ const os = require('os');
|
||||
const path = require('path');
|
||||
const cluster = require('cluster');
|
||||
const fs = require('fs-extra');
|
||||
const { argv } = require('yargs');
|
||||
const argv = require('cac')().parse();
|
||||
const child = require('child_process');
|
||||
|
||||
function buildUrl(opts) {
|
||||
@@ -29,24 +29,24 @@ if (!cluster.isMaster) {
|
||||
if (!fs.existsSync(addonPath)) fs.writeFileSync(addonPath, '[]');
|
||||
let addons = JSON.parse(fs.readFileSync(addonPath).toString());
|
||||
|
||||
if (argv._[0] === 'db') {
|
||||
if (argv.args[0] === 'db') {
|
||||
const dbConfig = fs.readFileSync(path.resolve(hydroPath, 'config.json'), 'utf-8');
|
||||
const url = buildUrl(JSON.parse(dbConfig));
|
||||
return child.spawn('mongo', [url], { stdio: 'inherit' });
|
||||
}
|
||||
|
||||
try {
|
||||
const ui = argv.ui || '@hydrooj/ui-default';
|
||||
const ui = argv.options.ui || '@hydrooj/ui-default';
|
||||
require.resolve(ui);
|
||||
addons.push(ui);
|
||||
} catch (e) {
|
||||
console.error('Please also install @hydrooj/ui-default');
|
||||
}
|
||||
|
||||
if (argv._[0] && argv._[0] !== 'cli') {
|
||||
const operation = argv._[0];
|
||||
const arg1 = argv._[1];
|
||||
const arg2 = argv._[2];
|
||||
if (argv.args[0] && argv.args[0] !== 'cli') {
|
||||
const operation = argv.args[0];
|
||||
const arg1 = argv.args[1];
|
||||
const arg2 = argv.args[2];
|
||||
if (operation === 'addon') {
|
||||
if (arg1 === 'add') addons.push(arg2);
|
||||
else if (arg1 === 'remove') {
|
||||
@@ -65,7 +65,7 @@ if (!cluster.isMaster) {
|
||||
const hydro = require('../dist/loader');
|
||||
addons = Array.from(new Set(addons));
|
||||
for (const addon of addons) hydro.addon(addon);
|
||||
(argv._[0] === 'cli' ? hydro.loadCli : hydro.load)().catch((e) => {
|
||||
(argv.args[0] === 'cli' ? hydro.loadCli : hydro.load)().catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.27.3",
|
||||
"version": "2.27.4",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
@@ -10,50 +10,51 @@
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
"@hydrooj/utils": "^1.0.17",
|
||||
"adm-zip": "^0.5.5",
|
||||
"ansi_up": "^5.0.1",
|
||||
"cac": "^6.7.3",
|
||||
"cookies": "^0.8.0",
|
||||
"detect-browser": "^5.1.1",
|
||||
"detect-browser": "^5.2.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"js-yaml": "^4.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"koa": "^2.13.1",
|
||||
"koa-body": "^4.2.0",
|
||||
"koa-compress": "^5.0.1",
|
||||
"koa-proxies": "^0.12.1",
|
||||
"koa-router": "^10.0.0",
|
||||
"koa-static-cache": "^5.1.3",
|
||||
"koa-static-cache": "^5.1.4",
|
||||
"lodash": "^4.17.21",
|
||||
"lru-cache": "^6.0.0",
|
||||
"minio": "7.0.17",
|
||||
"moment-timezone": "^0.5.32",
|
||||
"mongodb": "^3.6.6",
|
||||
"nodemailer": "^6.6.0",
|
||||
"moment-timezone": "^0.5.33",
|
||||
"mongodb": "^3.6.8",
|
||||
"nodemailer": "^6.6.1",
|
||||
"p-queue": "^6.6.2",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"serialize-javascript": "^5.0.1",
|
||||
"sockjs": "^0.3.20",
|
||||
"superagent": "^6.1.0",
|
||||
"yargs": "^17.0.1"
|
||||
"sockjs": "^0.3.21",
|
||||
"superagent": "^6.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/adm-zip": "^0.4.34",
|
||||
"@types/fs-extra": "^9.0.10",
|
||||
"@types/js-yaml": "^4.0.0",
|
||||
"@types/fs-extra": "^9.0.11",
|
||||
"@types/js-yaml": "^4.0.1",
|
||||
"@types/koa": "^2.13.1",
|
||||
"@types/koa-compress": "^4.0.1",
|
||||
"@types/koa-router": "^7.4.1",
|
||||
"@types/koa-router": "^7.4.2",
|
||||
"@types/koa-static-cache": "^5.1.0",
|
||||
"@types/lodash": "^4.14.168",
|
||||
"@types/lodash": "^4.14.170",
|
||||
"@types/lru-cache": "^5.1.0",
|
||||
"@types/minio": "^7.0.7",
|
||||
"@types/mongodb": "^3.6.12",
|
||||
"@types/nodemailer": "^6.4.1",
|
||||
"@types/mongodb": "^3.6.16",
|
||||
"@types/nodemailer": "^6.4.2",
|
||||
"@types/serialize-javascript": "^5.0.0",
|
||||
"@types/sockjs": "^0.3.32",
|
||||
"@types/superagent": "^4.1.11",
|
||||
"@types/yargs": "^16.0.1",
|
||||
"formidable": "^1.2.2"
|
||||
"formidable": "^1.2.2",
|
||||
"moment": "^2.29.1"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
import { argv } from 'yargs';
|
||||
import { ObjectID } from 'mongodb';
|
||||
import cac from 'cac';
|
||||
import {
|
||||
lib, service, model, script,
|
||||
builtinLib, builtinModel, builtinScript,
|
||||
@@ -11,6 +11,7 @@ import { validate } from '../lib/validator';
|
||||
import * as bus from '../service/bus';
|
||||
import db from '../service/db';
|
||||
|
||||
const argv = cac().parse();
|
||||
const COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
|
||||
const ARR = /=>.*$/mg;
|
||||
function parseParameters(fn: Function) {
|
||||
@@ -29,7 +30,7 @@ async function runScript(name: string, arg: any) {
|
||||
}
|
||||
|
||||
async function cli() {
|
||||
const [, modelName, func, ...args] = argv._ as [string, string, string, ...any[]];
|
||||
const [, modelName, func, ...args] = argv.args as [string, string, string, ...any[]];
|
||||
if (modelName === 'script') {
|
||||
let arg: any;
|
||||
try {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
import { builtinModel } from './common';
|
||||
import { Entry } from '../loader';
|
||||
import { Logger } from '../logger';
|
||||
@@ -11,13 +11,14 @@ import options from '../options';
|
||||
import * as bus from '../service/bus';
|
||||
import db from '../service/db';
|
||||
|
||||
const argv = cac().parse();
|
||||
const logger = new Logger('entry/master');
|
||||
const tmpdir = path.resolve(os.tmpdir(), 'hydro');
|
||||
const lockfile = path.resolve(tmpdir, 'lock.json');
|
||||
|
||||
export async function load(call: Entry) {
|
||||
fs.ensureDirSync(tmpdir);
|
||||
if (fs.existsSync(lockfile) && !argv.ignorelock) {
|
||||
if (fs.existsSync(lockfile) && !argv.options.ignorelock) {
|
||||
try {
|
||||
const file = require(lockfile);
|
||||
process.kill(file.pid, 0);
|
||||
|
||||
@@ -6,11 +6,11 @@ import Koa, { Context } from 'koa';
|
||||
import Body from 'koa-body';
|
||||
import cache from 'koa-static-cache';
|
||||
import mongodb from 'mongodb';
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
const logger = new Logger('setup');
|
||||
const listenPort = argv.port || 8888;
|
||||
const listenPort = cac().parse().options.port || 8888;
|
||||
|
||||
async function get(ctx: Context) {
|
||||
ctx.body = `<!DOCTYPE html>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
import {
|
||||
locale, template, lib, service, model, handler, script, setting, uistatic,
|
||||
builtinLib, builtinScript, builtinHandler, builtinModel,
|
||||
@@ -11,32 +11,33 @@ import db from '../service/db';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
const logger = new Logger('loader/worker');
|
||||
const detail = cac().parse().options.loaderDetail;
|
||||
|
||||
export async function load() {
|
||||
const pending = global.addons;
|
||||
const fail = [];
|
||||
const active = [];
|
||||
if (argv.loaderDetail) logger.info('start');
|
||||
if (detail) logger.info('start');
|
||||
require('../lib/i18n');
|
||||
require('../utils');
|
||||
require('../error');
|
||||
require('../options');
|
||||
if (argv.loaderDetail) logger.info('finish: options');
|
||||
if (detail) logger.info('finish: options');
|
||||
await Promise.all([
|
||||
locale(pending, fail),
|
||||
template(pending, fail),
|
||||
uistatic(pending, fail),
|
||||
]);
|
||||
if (argv.loaderDetail) logger.info('finish: locale/template/static');
|
||||
if (detail) logger.info('finish: locale/template/static');
|
||||
const opts = options();
|
||||
await db.start(opts);
|
||||
if (argv.loaderDetail) logger.info('finish: db.connect');
|
||||
if (detail) logger.info('finish: db.connect');
|
||||
const modelSystem = require('../model/system');
|
||||
await modelSystem.runConfig();
|
||||
if (argv.loaderDetail) logger.info('finish: config');
|
||||
if (detail) logger.info('finish: config');
|
||||
const storage = require('../service/storage');
|
||||
await storage.start();
|
||||
if (argv.loaderDetail) logger.info('finish: storage.connect');
|
||||
if (detail) logger.info('finish: storage.connect');
|
||||
for (const i of builtinLib) {
|
||||
let t;
|
||||
try {
|
||||
@@ -46,40 +47,40 @@ export async function load() {
|
||||
}
|
||||
require(t);
|
||||
}
|
||||
if (argv.loaderDetail) logger.info('finish: lib.builtin');
|
||||
if (detail) logger.info('finish: lib.builtin');
|
||||
await lib(pending, fail);
|
||||
if (argv.loaderDetail) logger.info('finish: lib.extra');
|
||||
if (detail) logger.info('finish: lib.extra');
|
||||
require('../service/gridfs');
|
||||
require('../service/monitor');
|
||||
if (argv.loaderDetail) logger.info('finish: gridfs/monitor');
|
||||
if (detail) logger.info('finish: gridfs/monitor');
|
||||
const server = require('../service/server');
|
||||
await server.prepare();
|
||||
if (argv.loaderDetail) logger.info('finish: server');
|
||||
if (detail) logger.info('finish: server');
|
||||
await service(pending, fail);
|
||||
if (argv.loaderDetail) logger.info('finish: service.extra');
|
||||
if (detail) logger.info('finish: service.extra');
|
||||
for (const i of builtinModel) require(`../model/${i}`);
|
||||
if (argv.loaderDetail) logger.info('finish: model.builtin');
|
||||
if (detail) logger.info('finish: model.builtin');
|
||||
for (const i of builtinHandler) require(`../handler/${i}`);
|
||||
if (argv.loaderDetail) logger.info('finish: handler.builtin');
|
||||
if (detail) logger.info('finish: handler.builtin');
|
||||
await model(pending, fail);
|
||||
if (argv.loaderDetail) logger.info('finish: model.extra');
|
||||
if (detail) logger.info('finish: model.extra');
|
||||
const modelSetting = require('../model/setting');
|
||||
await setting(pending, fail, modelSetting);
|
||||
if (argv.loaderDetail) logger.info('finish: setting');
|
||||
if (detail) logger.info('finish: setting');
|
||||
await handler(pending, fail);
|
||||
if (argv.loaderDetail) logger.info('finish: handler.extra');
|
||||
if (detail) logger.info('finish: handler.extra');
|
||||
for (const i in global.Hydro.handler) await global.Hydro.handler[i]();
|
||||
if (argv.loaderDetail) logger.info('finish: handler.apply');
|
||||
if (detail) logger.info('finish: handler.apply');
|
||||
const notfound = require('../handler/notfound');
|
||||
await notfound.apply();
|
||||
for (const i of builtinScript) require(`../script/${i}`);
|
||||
if (argv.loaderDetail) logger.info('finish: script.builtin');
|
||||
if (detail) logger.info('finish: script.builtin');
|
||||
await script(pending, fail, active);
|
||||
if (argv.loaderDetail) logger.info('finish: script.extra');
|
||||
if (detail) logger.info('finish: script.extra');
|
||||
await bus.serial('app/started');
|
||||
if (argv.loaderDetail) logger.info('finish: bus.serial(start)');
|
||||
if (detail) logger.info('finish: bus.serial(start)');
|
||||
await server.start();
|
||||
if (argv.loaderDetail) logger.info('finish: server.start');
|
||||
if (detail) logger.info('finish: server.start');
|
||||
setInterval(() => {
|
||||
process.send({ event: 'stat', count: global.Hydro.stat.reqCount });
|
||||
global.Hydro.stat.reqCount = 0;
|
||||
|
||||
@@ -8,6 +8,15 @@ import 'reflect-metadata';
|
||||
const versionNum = +process.version.replace(/v/gim, '').split('.')[0];
|
||||
if (versionNum < 14) throw new Error('NodeJS >=v14 required');
|
||||
|
||||
import cac from 'cac';
|
||||
|
||||
const argv = cac().parse();
|
||||
|
||||
if (argv.options.debug) {
|
||||
process.env.NODE_ENV = 'development';
|
||||
process.env.DEV = 'on';
|
||||
} else process.env.NODE_ENV = process.env.NODE_ENV || 'production';
|
||||
|
||||
if (!global.Hydro) {
|
||||
global.Hydro = {
|
||||
version: {
|
||||
@@ -44,7 +53,6 @@ import os from 'os';
|
||||
import path from 'path';
|
||||
import cluster from 'cluster';
|
||||
import fs from 'fs-extra';
|
||||
import { argv } from 'yargs';
|
||||
import './utils';
|
||||
import { Logger } from './logger';
|
||||
import './ui';
|
||||
@@ -95,7 +103,7 @@ async function stopWorker() {
|
||||
}
|
||||
|
||||
async function startWorker(cnt: number, createFirst = true) {
|
||||
if (argv.single) {
|
||||
if (argv.options.single) {
|
||||
await entry({ entry: 'worker' });
|
||||
} else {
|
||||
await fork(createFirst ? ['--firstWorker'] : undefined);
|
||||
@@ -154,7 +162,7 @@ export function addon(addonPath: string, prepend = false) {
|
||||
export async function load() {
|
||||
addon(path.resolve(__dirname, '..'), true);
|
||||
Error.stackTraceLimit = 50;
|
||||
if (cluster.isMaster || argv.startAsMaster) {
|
||||
if (cluster.isMaster || argv.options.startAsMaster) {
|
||||
logger.info(`Master ${process.pid} Starting`);
|
||||
const cnt = await entry({ entry: 'master' });
|
||||
logger.info('Master started');
|
||||
@@ -173,14 +181,14 @@ export async function load() {
|
||||
});
|
||||
await startWorker(cnt);
|
||||
} else {
|
||||
global.addons = JSON.parse(Buffer.from(argv.addons as string, 'base64').toString());
|
||||
global.addons = JSON.parse(Buffer.from(argv.options.addons as string, 'base64').toString());
|
||||
logger.info('%o', global.addons);
|
||||
if (argv.entry) {
|
||||
logger.info(`Worker ${process.pid} Starting as ${argv.entry}`);
|
||||
await entry({ entry: argv.entry as string });
|
||||
logger.success(`Worker ${process.pid} Started as ${argv.entry}`);
|
||||
if (argv.options.entry) {
|
||||
logger.info(`Worker ${process.pid} Starting as ${argv.options.entry}`);
|
||||
await entry({ entry: argv.options.entry });
|
||||
logger.success(`Worker ${process.pid} Started as ${argv.options.entry}`);
|
||||
} else {
|
||||
if (argv.firstWorker) global.Hydro.isFirstWorker = true;
|
||||
if (argv.options.firstWorker) global.Hydro.isFirstWorker = true;
|
||||
else global.Hydro.isFirstWorker = false;
|
||||
logger.info(`Worker ${process.pid} Starting`);
|
||||
await entry({ entry: 'worker' });
|
||||
@@ -195,8 +203,8 @@ export async function loadCli() {
|
||||
process.kill(process.pid, 'SIGINT');
|
||||
}
|
||||
|
||||
if (argv.pandora || require.main === module) {
|
||||
const func = argv._[0] === 'cli' ? load : loadCli;
|
||||
if (argv.options.pandora || require.main === module) {
|
||||
const func = argv.args[0] === 'cli' ? load : loadCli;
|
||||
func().catch((e) => {
|
||||
logger.error(e);
|
||||
process.exit(1);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { inspect, format, InspectOptions } from 'util';
|
||||
import { argv } from 'yargs';
|
||||
import { Time } from './utils';
|
||||
|
||||
const colors = [
|
||||
@@ -20,7 +19,7 @@ export class Logger {
|
||||
static readonly INFO = 2;
|
||||
static readonly WARN = 2;
|
||||
static readonly DEBUG = 3;
|
||||
static baseLevel = argv.debug ? 3 : 2;
|
||||
static baseLevel = process.env.DEV ? 3 : 2;
|
||||
static showDiff = false;
|
||||
static levels: Record<string, number> = {};
|
||||
static lastTime = 0;
|
||||
|
||||
@@ -16,7 +16,7 @@ class BlackListModel {
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ _id: id },
|
||||
{ $set: { expireAt } },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ export async function set<K extends keyof DocType>(
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ domainId, docType, docId },
|
||||
update,
|
||||
{ returnOriginal: false, upsert: true },
|
||||
{ returnDocument: 'after', upsert: true },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ export async function inc<K extends keyof DocType>(
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ domainId, docType, docId },
|
||||
{ $inc: { [key]: value } },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ export async function incAndSet<K extends keyof DocType>(
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ domainId, docType, docId },
|
||||
{ $inc: { [key]: value }, $set: args },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ export async function push(
|
||||
const doc = await coll.findOneAndUpdate(
|
||||
{ domainId, docType, docId },
|
||||
{ $push: { [key]: v } },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
return [doc.value, _id];
|
||||
}
|
||||
@@ -195,7 +195,7 @@ export async function pull<K extends keyof DocType, T extends ArrayKeys<DocType[
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ domainId, docType, docId },
|
||||
{ $pull: { [setKey]: { $in: contents } } },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ export async function deleteSub<T extends keyof DocType, K extends ArrayKeys<Doc
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ domainId, docType, docId },
|
||||
{ $pull: { [key]: { _id: { $in: subId } } } },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ export async function setSub<T extends keyof DocType, K extends ArrayKeys<DocTyp
|
||||
[key]: { $elemMatch: { _id: subId } },
|
||||
},
|
||||
{ $set },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ export async function addToSet<T extends keyof DocType, K extends ArrayKeys<DocT
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ domainId, docType, docId },
|
||||
{ $addToSet: { [setKey]: content } },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -285,7 +285,7 @@ export async function setStatus<K extends keyof DocStatusType>(
|
||||
const res = await collStatus.findOneAndUpdate(
|
||||
{ domainId, docType, docId, uid },
|
||||
{ $set: args },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -308,7 +308,7 @@ export async function setIfNotStatus<T extends keyof DocStatusType, K extends ke
|
||||
const res = await collStatus.findOneAndUpdate(
|
||||
{ domainId, docType, docId, uid },
|
||||
{ $set: { [key]: value, ...args } },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ export async function setStatusIfNotCondition<T extends keyof DocStatusType>(
|
||||
const res = await collStatus.findOneAndUpdate(
|
||||
{ domainId, docType, docId, uid },
|
||||
{ $set: args },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ export async function cappedIncStatus<T extends keyof DocStatusType>(
|
||||
const res = await collStatus.findOneAndUpdate(
|
||||
{ domainId, docType, docId, uid, [key]: { $not } },
|
||||
{ $inc: { [key]: value } },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -348,7 +348,7 @@ export async function incStatus<T extends keyof DocStatusType>(
|
||||
const res = await collStatus.findOneAndUpdate(
|
||||
{ domainId, docType, docId, uid },
|
||||
{ $inc: { [key]: value } },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -360,13 +360,13 @@ export async function revPushStatus<T extends keyof DocStatusType>(
|
||||
let res = await collStatus.findOneAndUpdate(
|
||||
{ domainId, docType, docId, uid, [`${key}.${id}`]: value[id] },
|
||||
{ $set: { [`${key}.$`]: value }, $inc: { rev: 1 } },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
if (!res.value) {
|
||||
res = await collStatus.findOneAndUpdate(
|
||||
{ domainId, docType, docId, uid },
|
||||
{ $push: { [key]: value }, $inc: { rev: 1 } },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
}
|
||||
return res.value;
|
||||
@@ -378,7 +378,7 @@ export async function revInitStatus<T extends keyof DocStatusType>(
|
||||
const res = await collStatus.findOneAndUpdate(
|
||||
{ domainId, docType, docId, uid },
|
||||
{ $inc: { rev: 1 } },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
@@ -389,7 +389,7 @@ export async function revSetStatus<T extends keyof DocStatusType>(
|
||||
): Promise<any> {
|
||||
const filter = { domainId, docType, docId, uid, rev };
|
||||
const update = { $set: args, $inc: { rev: 1 } };
|
||||
const res = await collStatus.findOneAndUpdate(filter, update, { returnOriginal: false });
|
||||
const res = await collStatus.findOneAndUpdate(filter, update, { returnDocument: 'after' });
|
||||
return res.value;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class DomainModel {
|
||||
|
||||
static async edit(domainId: string, $set: Partial<DomainDoc>) {
|
||||
await bus.serial('domain/before-update', domainId, $set);
|
||||
const result = await coll.findOneAndUpdate({ _id: domainId }, { $set }, { returnOriginal: false });
|
||||
const result = await coll.findOneAndUpdate({ _id: domainId }, { $set }, { returnDocument: 'after' });
|
||||
await bus.serial('domain/update', domainId, $set, result.value);
|
||||
return result.value;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ class DomainModel {
|
||||
// FIXME
|
||||
// @ts-expect-error
|
||||
{ $inc: { [field]: n } },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
return res.value[field];
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class DomainModel {
|
||||
@ArgMethod
|
||||
static async setUserRole(domainId: string, uid: MaybeArray<number>, role: string) {
|
||||
if (!(uid instanceof Array)) {
|
||||
const res = await collUser.findOneAndUpdate({ domainId, uid }, { $set: { role } }, { upsert: true, returnOriginal: false });
|
||||
const res = await collUser.findOneAndUpdate({ domainId, uid }, { $set: { role } }, { upsert: true, returnDocument: 'after' });
|
||||
const udoc = await UserModel.getById(domainId, uid);
|
||||
deleteUserCache(udoc);
|
||||
return res;
|
||||
|
||||
@@ -46,7 +46,7 @@ class MessageModel {
|
||||
const result = await coll.findOneAndUpdate(
|
||||
{ _id: messageId },
|
||||
{ $bit: { flag: { xor: flag } } },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
return result.value;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class OauthModel {
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ _id },
|
||||
{ $set: { value } },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
return res.value.uid;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class RecordModel {
|
||||
const res = await RecordModel.coll.findOneAndUpdate(
|
||||
{ _id, domainId },
|
||||
$update,
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export class StorageModel {
|
||||
}
|
||||
|
||||
static async get(path: string, savePath?: string) {
|
||||
const { value } = await StorageModel.coll.findOneAndUpdate({ path }, { $set: { lastUsage: new Date() } }, { returnOriginal: false });
|
||||
const { value } = await StorageModel.coll.findOneAndUpdate({ path }, { $set: { lastUsage: new Date() } }, { returnDocument: 'after' });
|
||||
if (value) return await storage.get(value._id, savePath);
|
||||
return await storage.get(path, savePath);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export class StorageModel {
|
||||
}
|
||||
|
||||
static async getMeta(path: string) {
|
||||
const { value } = await StorageModel.coll.findOneAndUpdate({ path }, { $set: { lastUsage: new Date() } }, { returnOriginal: false });
|
||||
const { value } = await StorageModel.coll.findOneAndUpdate({ path }, { $set: { lastUsage: new Date() } }, { returnDocument: 'after' });
|
||||
if (!value) return null;
|
||||
return {
|
||||
...value.meta,
|
||||
|
||||
@@ -15,22 +15,22 @@ export function get(key: string): any {
|
||||
|
||||
export function getMany<
|
||||
A extends keyof SystemKeys, B extends keyof SystemKeys,
|
||||
>(keys: [A, B]): [SystemKeys[A], SystemKeys[B]];
|
||||
>(keys: [A, B]): [SystemKeys[A], SystemKeys[B]];
|
||||
export function getMany<
|
||||
A extends keyof SystemKeys, B extends keyof SystemKeys, C extends keyof SystemKeys,
|
||||
>(keys: [A, B, C]): [SystemKeys[A], SystemKeys[B], SystemKeys[C]];
|
||||
>(keys: [A, B, C]): [SystemKeys[A], SystemKeys[B], SystemKeys[C]];
|
||||
export function getMany<
|
||||
A extends keyof SystemKeys, B extends keyof SystemKeys, C extends keyof SystemKeys,
|
||||
D extends keyof SystemKeys,
|
||||
>(keys: [A, B, C, D]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D]];
|
||||
>(keys: [A, B, C, D]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D]];
|
||||
export function getMany<
|
||||
A extends keyof SystemKeys, B extends keyof SystemKeys, C extends keyof SystemKeys,
|
||||
D extends keyof SystemKeys, E extends keyof SystemKeys,
|
||||
>(keys: [A, B, C, D, E]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D], SystemKeys[E]];
|
||||
>(keys: [A, B, C, D, E]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D], SystemKeys[E]];
|
||||
export function getMany<
|
||||
A extends keyof SystemKeys, B extends keyof SystemKeys, C extends keyof SystemKeys,
|
||||
D extends keyof SystemKeys, E extends keyof SystemKeys, F extends keyof SystemKeys,
|
||||
>(keys: [A, B, C, D, E, F]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D], SystemKeys[E], SystemKeys[F]];
|
||||
>(keys: [A, B, C, D, E, F]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D], SystemKeys[E], SystemKeys[F]];
|
||||
export function getMany(keys: (keyof SystemKeys)[]): any[];
|
||||
export function getMany(keys: string[]): any[] {
|
||||
return keys.map((key) => cache[key]);
|
||||
@@ -43,7 +43,7 @@ export async function set(_id: string, value: any, boardcast = true) {
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ _id },
|
||||
{ $set: { value } },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
cache[_id] = res.value.value;
|
||||
return res.value.value;
|
||||
@@ -55,7 +55,7 @@ export async function inc<K extends NumberKeys<SystemKeys>>(_id: K) {
|
||||
// FIXME NumberKeys<>
|
||||
// @ts-ignore
|
||||
{ $inc: { value: 1 } },
|
||||
{ upsert: true, returnOriginal: false },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
cache[_id] = res.value.value;
|
||||
return res.value.value;
|
||||
|
||||
@@ -53,7 +53,7 @@ class TokenModel {
|
||||
tokenType,
|
||||
},
|
||||
},
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
return res.value;
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ class UserModel {
|
||||
const op: any = {};
|
||||
if ($set && Object.keys($set).length) op.$set = $set;
|
||||
if ($unset && Object.keys($unset).length) op.$unset = $unset;
|
||||
const res = await coll.findOneAndUpdate({ _id: uid }, op, { returnOriginal: false });
|
||||
const res = await coll.findOneAndUpdate({ _id: uid }, op, { returnDocument: 'after' });
|
||||
deleteUserCache(res.value);
|
||||
return res;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ class UserModel {
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ _id: uid },
|
||||
{ $set: { salt, hash: pwhash(password, salt), hashType: 'hydro' } },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
deleteUserCache(res.value);
|
||||
return res.value;
|
||||
@@ -290,7 +290,7 @@ class UserModel {
|
||||
const res = await coll.findOneAndUpdate(
|
||||
{ _id: uid },
|
||||
{ $set: { priv } },
|
||||
{ returnOriginal: false },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
deleteUserCache(res.value);
|
||||
return res.value;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import cluster from 'cluster';
|
||||
import serialize from 'serialize-javascript';
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
import type { Db, FilterQuery, OnlyFieldsOfType } from 'mongodb';
|
||||
import type { Handler } from './server';
|
||||
import { Logger } from '../logger';
|
||||
@@ -16,6 +16,7 @@ import type { UserRegisterHandler } from '../handler/user';
|
||||
|
||||
const _hooks: Record<keyof any, Array<(...args: any[]) => any>> = {};
|
||||
const logger = new Logger('bus', true);
|
||||
const argv = cac().parse();
|
||||
|
||||
function isBailed(value: any) {
|
||||
return value !== null && value !== false && value !== undefined;
|
||||
@@ -146,9 +147,9 @@ export function off<K extends keyof EventMap>(name: K, listener: EventMap[K]) {
|
||||
|
||||
export async function parallel<K extends keyof EventMap>(name: K, ...args: Parameters<EventMap[K]>): Promise<void> {
|
||||
const tasks: Promise<any>[] = [];
|
||||
if (argv.showBus) logger.debug('parallel: %s %o', name, args);
|
||||
if (argv.options.showBus) logger.debug('parallel: %s %o', name, args);
|
||||
for (const callback of _hooks[name] || []) {
|
||||
if (argv.busDetail) logger.debug(callback.toString());
|
||||
if (argv.options.busDetail) logger.debug(callback.toString());
|
||||
tasks.push(callback.apply(this, args));
|
||||
}
|
||||
await Promise.all(tasks);
|
||||
@@ -159,16 +160,16 @@ export function emit<K extends keyof EventMap>(name: K, ...args: Parameters<Even
|
||||
}
|
||||
|
||||
export async function serial<K extends keyof EventMap>(name: K, ...args: Parameters<EventMap[K]>): Promise<void> {
|
||||
if (argv.showBus) logger.debug('serial: %s %o', name, args);
|
||||
if (argv.options.showBus) logger.debug('serial: %s %o', name, args);
|
||||
const hooks = Array.from(_hooks[name] || []);
|
||||
for (const callback of hooks) {
|
||||
if (argv.busDetail) logger.debug(callback.toString());
|
||||
if (argv.options.busDetail) logger.debug(callback.toString());
|
||||
await callback.apply(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
export function bail<K extends keyof EventMap>(name: K, ...args: Parameters<EventMap[K]>): ReturnType<EventMap[K]> {
|
||||
if (argv.showBus) logger.debug('bail: %s %o', name, args);
|
||||
if (argv.options.showBus) logger.debug('bail: %s %o', name, args);
|
||||
const hooks = Array.from(_hooks[name] || []);
|
||||
for (const callback of hooks) {
|
||||
const result = callback.apply(this, args);
|
||||
|
||||
@@ -15,7 +15,7 @@ import Router from 'koa-router';
|
||||
import proxy from 'koa-proxies';
|
||||
import cache from 'koa-static-cache';
|
||||
import sockjs from 'sockjs';
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
import { createHash } from 'crypto';
|
||||
import type { SetOption } from 'cookies';
|
||||
import * as bus from './bus';
|
||||
@@ -38,6 +38,7 @@ import token from '../model/token';
|
||||
import * as opcount from '../model/opcount';
|
||||
import { PERM, PRIV } from '../model/builtin';
|
||||
|
||||
const argv = cac().parse();
|
||||
const logger = new Logger('server');
|
||||
export const app = new Koa();
|
||||
export const server = http.createServer(app.callback());
|
||||
@@ -248,8 +249,8 @@ export async function prepare() {
|
||||
rewrite: (p) => p.replace('/fs', ''),
|
||||
}));
|
||||
app.use(Compress());
|
||||
if (argv.public) {
|
||||
app.use(cache(argv.public, {
|
||||
if (argv.options.public) {
|
||||
app.use(cache(argv.options.public, {
|
||||
maxAge: 0,
|
||||
}));
|
||||
} else {
|
||||
@@ -257,7 +258,7 @@ export async function prepare() {
|
||||
maxAge: 30 * 24 * 60 * 60,
|
||||
}));
|
||||
}
|
||||
if (argv.debug) {
|
||||
if (process.env.DEV) {
|
||||
app.use(async (ctx: Context, next: Function) => {
|
||||
const startTime = new Date().getTime();
|
||||
await next();
|
||||
@@ -482,7 +483,7 @@ export class Handler extends HandlerCommon {
|
||||
}
|
||||
|
||||
async init({ domainId }) {
|
||||
if (!argv.benchmark) await this.limitRate('global', 10, 88);
|
||||
if (!argv.options.benchmark) await this.limitRate('global', 10, 88);
|
||||
const [absoluteDomain, inferDomain, bdoc] = await Promise.all([
|
||||
domain.get(domainId),
|
||||
domain.getByHost(this.request.host),
|
||||
@@ -844,8 +845,8 @@ export function start() {
|
||||
if (started) return;
|
||||
const port = system.get('server.port');
|
||||
app.use(router.routes()).use(router.allowedMethods());
|
||||
server.listen(argv.port || port);
|
||||
logger.success('Server listening at: %d', argv.port || port);
|
||||
server.listen(argv.options.port || port);
|
||||
logger.success('Server listening at: %d', argv.options.port || port);
|
||||
started = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
import cluster from 'cluster';
|
||||
import { argv } from 'yargs';
|
||||
import * as bus from './service/bus';
|
||||
|
||||
const disabledTerminal = argv.legacy || argv._.length || process.env.NODE_ENV === 'test';
|
||||
|
||||
export namespace Progress {
|
||||
export class Progress {
|
||||
constructor(public args) {
|
||||
@@ -40,7 +37,6 @@ async function terminate() {
|
||||
}
|
||||
process.on('SIGINT', terminate);
|
||||
if (cluster.isMaster) {
|
||||
if (!disabledTerminal) console.log('Not running in a terminal environment. Interactive mode disabled.');
|
||||
bus.on('message/log', (message) => {
|
||||
process.stdout.write(`${message}\n`);
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
"adm-zip": "^0.5.5",
|
||||
"decode-html": "^2.0.0",
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"preferUnplugged": true,
|
||||
"scripts": {
|
||||
"lint": "eslint lib.ts --fix",
|
||||
"build": "tsc"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"preferUnplugged": true,
|
||||
"scripts": {
|
||||
"lint": "eslint lib.ts --fix",
|
||||
"build": "tsc"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"preferUnplugged": true,
|
||||
"scripts": {
|
||||
"lint": "eslint lib.ts --fix",
|
||||
"build": "tsc"
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
"ws": "^7.4.5"
|
||||
"ws": "^7.4.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ws": "^7.4.2"
|
||||
"@types/ws": "^7.4.4"
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"preferUnplugged": true,
|
||||
"scripts": {
|
||||
"lint": "eslint lib.ts script.ts --fix",
|
||||
"build": "tsc"
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
"main": "package.json",
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"preferUnplugged": true,
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"devDependencies": {
|
||||
"@types/mongodb": "^3.6.12"
|
||||
"@types/mongodb": "^3.6.16"
|
||||
},
|
||||
"dependencies": {
|
||||
"mongodb": "^3.6.6"
|
||||
"mongodb": "^3.6.8"
|
||||
}
|
||||
}
|
||||
@@ -4,5 +4,6 @@
|
||||
"main": "package.json",
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"preferUnplugged": true,
|
||||
"license": "SEE LICENSE IN LICENSE"
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
"superagent": "^6.1.0"
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"description": "Sonic search service",
|
||||
"main": "service.js",
|
||||
"typings": "service.d.ts",
|
||||
"preferUnplugged": true,
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
|
||||
@@ -4,20 +4,21 @@ const yaml = require('js-yaml');
|
||||
const serialize = require('serialize-javascript');
|
||||
const nunjucks = require('nunjucks');
|
||||
const { filter } = require('lodash');
|
||||
const { argv } = require('yargs');
|
||||
const argv = require('cac')().parse();
|
||||
const { findFileSync } = require('@hydrooj/utils/lib/utils');
|
||||
const status = require('@hydrooj/utils/lib/status');
|
||||
const markdown = require('./markdown');
|
||||
|
||||
const { misc, buildContent, avatar } = global.Hydro.lib;
|
||||
|
||||
if (argv.template && argv.template !== 'string') argv.template = findFileSync('@hydrooj/ui-default/templates');
|
||||
else if (argv.template) argv.template = findFileSync(argv.template);
|
||||
let template = argv.options.template;
|
||||
if (template && typeof template !== 'string') template = findFileSync('@hydrooj/ui-default/templates');
|
||||
else if (template) template = findFileSync(template);
|
||||
|
||||
class Loader extends nunjucks.Loader {
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
getSource(name) {
|
||||
if (!argv.template) {
|
||||
if (!template) {
|
||||
if (!global.Hydro.ui.template[name]) throw new Error(`Cannot get template ${name}`);
|
||||
return {
|
||||
src: global.Hydro.ui.template[name],
|
||||
@@ -26,7 +27,7 @@ class Loader extends nunjucks.Loader {
|
||||
};
|
||||
}
|
||||
let fullpath = null;
|
||||
const p = path.resolve(argv.template, name);
|
||||
const p = path.resolve(template, name);
|
||||
if (fs.existsSync(p)) fullpath = p;
|
||||
if (!fullpath) {
|
||||
if (global.Hydro.ui.template[name]) {
|
||||
@@ -147,7 +148,7 @@ async function render(name, state) {
|
||||
...state,
|
||||
formatJudgeTexts: (texts) => texts.map((text) => {
|
||||
if (typeof text === 'string') return text;
|
||||
return state._(text.message).format(...text.params || []) + ((argv.debug && text.stack) ? `\n${text.stack}` : '');
|
||||
return state._(text.message).format(...text.params || []) + ((process.env.DEV && text.stack) ? `\n${text.stack}` : '');
|
||||
}).join('\n'),
|
||||
perm: global.Hydro.model.builtin.PERM,
|
||||
PRIV: global.Hydro.model.builtin.PRIV,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
import webpack from 'webpack';
|
||||
import WebpackDevServer from 'webpack-dev-server';
|
||||
import gulp from 'gulp';
|
||||
@@ -9,6 +9,8 @@ import root from './utils/root';
|
||||
import gulpConfig from './config/gulp';
|
||||
import webpackConfig from './config/webpack';
|
||||
|
||||
const argv = cac().parse();
|
||||
|
||||
function runWebpack({
|
||||
watch, production, measure, dev,
|
||||
}) {
|
||||
@@ -35,7 +37,7 @@ function runWebpack({
|
||||
if (err.details) console.error(err.details);
|
||||
reject(err);
|
||||
}
|
||||
if (argv.detail) console.log(stats.toString());
|
||||
if (argv.options.detail) console.log(stats.toString());
|
||||
if (!watch && (!stats || stats.hasErrors())) process.exitCode = 1;
|
||||
resolve();
|
||||
}
|
||||
@@ -70,7 +72,7 @@ async function main() {
|
||||
const dir = process.cwd();
|
||||
process.chdir(root());
|
||||
await runGulp();
|
||||
await runWebpack(argv);
|
||||
await runWebpack(argv.options);
|
||||
process.chdir(dir);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const { writeFileSync } = require('fs');
|
||||
const { argv } = require('yargs');
|
||||
const argv = require('cac')().parse();
|
||||
const pkg = require('../package.json');
|
||||
|
||||
if (argv.dev) pkg.version = `${pkg.version}-dev`;
|
||||
if (argv.options.dev) pkg.version = `${pkg.version}-dev`;
|
||||
else pkg.version = pkg.version.replace('-dev', '');
|
||||
|
||||
writeFileSync(`${process.cwd()}/package.json`, JSON.stringify(pkg, null, 2));
|
||||
@@ -1,30 +1,31 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.10.3",
|
||||
"version": "4.10.4",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"preferUnplugged": true,
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.13.14",
|
||||
"@babel/core": "^7.14.0",
|
||||
"@babel/eslint-parser": "7.14.2",
|
||||
"@babel/cli": "^7.14.3",
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/eslint-parser": "7.14.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.12.13",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.14.2",
|
||||
"@babel/plugin-proposal-function-sent": "^7.12.13",
|
||||
"@babel/plugin-proposal-json-strings": "^7.13.8",
|
||||
"@babel/plugin-proposal-numeric-separator": "^7.12.13",
|
||||
"@babel/plugin-proposal-json-strings": "^7.14.2",
|
||||
"@babel/plugin-proposal-numeric-separator": "^7.14.2",
|
||||
"@babel/plugin-proposal-throw-expressions": "^7.12.13",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
||||
"@babel/plugin-transform-runtime": "^7.13.10",
|
||||
"@babel/preset-env": "^7.14.1",
|
||||
"@babel/plugin-transform-runtime": "^7.14.3",
|
||||
"@babel/preset-env": "^7.14.2",
|
||||
"@babel/preset-react": "^7.13.13",
|
||||
"@babel/register": "^7.13.14",
|
||||
"@babel/register": "^7.13.16",
|
||||
"@babel/runtime-corejs3": "^7.14.0",
|
||||
"@blueprintjs/core": "^3.44.2",
|
||||
"@blueprintjs/icons": "^3.26.0",
|
||||
"@blueprintjs/select": "^3.16.2",
|
||||
"@blueprintjs/core": "^3.44.3",
|
||||
"@blueprintjs/icons": "^3.26.1",
|
||||
"@blueprintjs/select": "^3.16.3",
|
||||
"@hydrooj/utils": "^1.0.15",
|
||||
"@undefined-moe/monaco-yaml": "^2.5.0",
|
||||
"ansi_up": "^5.0.1",
|
||||
@@ -35,18 +36,18 @@
|
||||
"chalk": "^4.1.1",
|
||||
"classnames": "^2.3.1",
|
||||
"clipboard": "^2.0.8",
|
||||
"copy-webpack-plugin": "^6.1.1",
|
||||
"css-loader": "^4.2.2",
|
||||
"copy-webpack-plugin": "^6.4.1",
|
||||
"css-loader": "^4.3.0",
|
||||
"diff-dom": "^4.2.2",
|
||||
"echarts": "^5.1.1",
|
||||
"emojify.js": "^1.1.0",
|
||||
"eslint": "^7.26.0",
|
||||
"eslint": "^7.27.0",
|
||||
"eslint-config-airbnb": "^18.2.1",
|
||||
"eslint-import-resolver-webpack": "^0.13.0",
|
||||
"eslint-import-resolver-webpack": "^0.13.1",
|
||||
"eslint-plugin-babel": "^5.3.1",
|
||||
"eslint-plugin-import": "^2.23.2",
|
||||
"eslint-plugin-import": "^2.23.3",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-react": "^7.23.1",
|
||||
"eslint-plugin-react": "^7.23.2",
|
||||
"fancy-log": "^1.3.3",
|
||||
"file-loader": "^6.2.0",
|
||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||
@@ -65,11 +66,11 @@
|
||||
"mini-css-extract-plugin": "^1.6.0",
|
||||
"moment": "^2.29.1",
|
||||
"monaco-editor": "^0.24.0",
|
||||
"monaco-editor-webpack-plugin": "^3.0.1",
|
||||
"monaco-editor-webpack-plugin": "^3.1.0",
|
||||
"nanoid": "^3.1.23",
|
||||
"normalize.css": "^8.0.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.4",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.6",
|
||||
"pickadate": "^3.6.4",
|
||||
"plugin-error": "^1.0.1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
@@ -80,10 +81,10 @@
|
||||
"react-dom": "^17.0.2",
|
||||
"react-redux": "^7.2.4",
|
||||
"react-split-pane": "^0.1.92",
|
||||
"redux": "^4.0.5",
|
||||
"redux": "^4.1.0",
|
||||
"redux-logger": "^3.0.6",
|
||||
"redux-promise-middleware": "^6.1.2",
|
||||
"redux-thunk": "^2.2.0",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"rupture": "^0.7.1",
|
||||
"slideout": "^1.0.1",
|
||||
"sockjs-client": "^1.5.1",
|
||||
@@ -92,34 +93,33 @@
|
||||
"style-loader": "^2.0.0",
|
||||
"stylus": "^0.54.8",
|
||||
"stylus-loader": "^3.0.2",
|
||||
"tether": "^1.4.6",
|
||||
"tether": "^1.4.7",
|
||||
"tether-drop": "^1.4.2",
|
||||
"through2": "^4.0.2",
|
||||
"timeago-react": "^3.0.2",
|
||||
"timeago.js": "^4.0.2",
|
||||
"vditor": "^3.8.4",
|
||||
"vditor": "^3.8.5",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"wastyle": "^0.0.5",
|
||||
"web-streams-polyfill": "^3.0.2",
|
||||
"webpack": "^4.44.2",
|
||||
"web-streams-polyfill": "^3.0.3",
|
||||
"webpack": "^4.46.0",
|
||||
"webpack-bundle-analyzer": "^4.4.2",
|
||||
"webpack-dev-server": "^3.11.2",
|
||||
"webpackbar": "^5.0.0-3"
|
||||
},
|
||||
"dependencies": {
|
||||
"js-yaml": "^4.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"katex": "^0.13.11",
|
||||
"lodash": "^4.17.21",
|
||||
"markdown-it": "^12.0.6",
|
||||
"markdown-it-anchor": "^7.1.0",
|
||||
"markdown-it-footnote": "^3.0.2",
|
||||
"markdown-it-footnote": "^3.0.3",
|
||||
"markdown-it-imsize": "^2.0.1",
|
||||
"markdown-it-mark": "^3.0.1",
|
||||
"markdown-it-merge-cells": "^1.0.1",
|
||||
"markdown-it-table-of-contents": "^0.5.2",
|
||||
"nunjucks": "^3.2.3",
|
||||
"streamsaver": "^2.0.5",
|
||||
"xss": "^1.0.9",
|
||||
"yargs": "^17.0.1"
|
||||
"xss": "^1.0.9"
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import os from 'os';
|
||||
import { Duplex } from 'stream';
|
||||
import { ObjectID } from 'bson';
|
||||
import { ObjectID } from 'mongodb';
|
||||
import { isMoment } from 'moment';
|
||||
import type { Moment } from 'moment-timezone';
|
||||
|
||||
|
||||
@@ -6,12 +6,17 @@
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0-only",
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
"bson": "^4.3.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"moment": "^2.29.1",
|
||||
"systeminformation": "^5.6.20"
|
||||
"mongodb": "^3.6.8",
|
||||
"systeminformation": "^5.7.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "^9.0.11",
|
||||
"@types/node": "^15.6.1",
|
||||
"moment-timezone": "^0.5.33"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user