mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
update cli
This commit is contained in:
1 parent
c4a13f2e27
commit
8b5107fefa
7 files changed
+34
-33
No files matched your search
@@ -1,5 +0,0 @@
|
|||||||
FROM mhart/alpine-node:slim-10
|
|
||||||
WORKDIR /app
|
|
||||||
COPY .build /app
|
|
||||||
EXPOSE 8888
|
|
||||||
CMD ["node", ".build/app.js"]
|
|
||||||
@@ -5,13 +5,11 @@ Hydro是一个高效的信息学在线测评系统。
|
|||||||
|
|
||||||
[中文文档](docs/deploy.md)
|
[中文文档](docs/deploy.md)
|
||||||
|
|
||||||
Hydro 的界面基于 Vijos 二次开发。
|
|
||||||
|
|
||||||
如果您认为本项目有价值,欢迎 star 。
|
如果您认为本项目有价值,欢迎 star 。
|
||||||
|
|
||||||
## 联系我们
|
## 联系我们
|
||||||
|
|
||||||
QQ [3402182471](tencent://AddContact/?uin=3402182471&subcmd=all)
|
QQ [3402182471](https://wpa.qq.com/msgrd?v=3&uin=3402182471&site=qq&menu=yes)
|
||||||
Telegram [@webpack_exports_undefined](https://t.me/webpack_exports_undefined)
|
Telegram [@webpack_exports_undefined](https://t.me/webpack_exports_undefined)
|
||||||
|
|
||||||
## 鸣谢
|
## 鸣谢
|
||||||
|
|||||||
@@ -10,4 +10,3 @@ model.setting.ui.name
|
|||||||
pdoc.secretConfig?
|
pdoc.secretConfig?
|
||||||
在线IDE 更换颜色主题, fix resize
|
在线IDE 更换颜色主题, fix resize
|
||||||
move to @hydrooj/core?
|
move to @hydrooj/core?
|
||||||
remove koa-router
|
|
||||||
+31
-6
@@ -1,20 +1,45 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const os = require('os');
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs-extra');
|
||||||
const { argv } = require('yargs');
|
const { argv } = require('yargs');
|
||||||
const hydro = require('../dist/loader');
|
const hydro = require('../dist/loader');
|
||||||
|
|
||||||
const ui = argv.ui || '@hydrooj/ui-default';
|
fs.ensureDirSync(path.resolve(os.homedir(), '.hydro'));
|
||||||
|
const addonPath = path.resolve(os.homedir(), '.hydro', 'addon.json');
|
||||||
|
if (!fs.existsSync(addonPath)) fs.writeFileSync(addonPath, '[]');
|
||||||
|
const addons = JSON.parse(fs.readFileSync(addonPath).toString());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const ui = argv.ui || '@hydrooj/ui-default';
|
||||||
require.resolve(ui);
|
require.resolve(ui);
|
||||||
|
addons.push(ui);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Please also install @hydrooj/ui-default');
|
console.error('Please also install @hydrooj/ui-default');
|
||||||
process.exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hydro.addon(ui);
|
if (argv._[0]) {
|
||||||
|
const operation = argv._[0];
|
||||||
hydro.load().catch((e) => {
|
const arg1 = argv._[1];
|
||||||
|
const arg2 = argv._[2];
|
||||||
|
if (operation === 'addon') {
|
||||||
|
if (arg1 === 'add') addons.push(arg2);
|
||||||
|
else if (arg1 === 'remove') {
|
||||||
|
for (let i = 0; i < addons.length; i++) {
|
||||||
|
if (addons[i] === arg2) {
|
||||||
|
addons.splice(i, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('Current Addons: ', addons);
|
||||||
|
fs.writeFileSync(addonPath, JSON.stringify(addons, null, 2));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (const addon of addons) hydro.addon(addon);
|
||||||
|
hydro.load().catch((e) => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
services:
|
|
||||||
hydro:
|
|
||||||
image: hydrooj/hydro:latest
|
|
||||||
restart: always
|
|
||||||
links:
|
|
||||||
- mongo
|
|
||||||
volumes:
|
|
||||||
- ./data/config:/config
|
|
||||||
ports:
|
|
||||||
- 8888:8888
|
|
||||||
mongo:
|
|
||||||
image: mongo:latest
|
|
||||||
restart: always
|
|
||||||
volumes:
|
|
||||||
- ./data/db:/data/db
|
|
||||||
@@ -137,7 +137,7 @@ export function getStatus(domainId: string, did: ObjectID, uid: number) {
|
|||||||
return document.getStatus(domainId, document.TYPE_DISCUSSION, did, uid);
|
return document.getStatus(domainId, document.TYPE_DISCUSSION, did, uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addNode(domainId: string, _id: string, category: string, args: any) {
|
export function addNode(domainId: string, _id: string, category: string, args: any = {}) {
|
||||||
return document.add(
|
return document.add(
|
||||||
domainId, category, 1, document.TYPE_DISCUSSION_NODE,
|
domainId, category, 1, document.TYPE_DISCUSSION_NODE,
|
||||||
_id, null, null, args,
|
_id, null, null, args,
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.9.3",
|
"version": "2.9.4",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
Reference in new issue
Block a user