Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
undefined-moe committed Oct 23, 2024
1 parent f7b1ca5 commit 3c642de
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 204 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Hydro 用户群:1085853538
<details>
<summary><h2>更新日志(点击展开)</h2></summary>

## Hydro 4.17.0 / UI 4.55.0
## Hydro 4.17.1 / UI 4.55.1

- core: 限制显示名长度
- core: 支持调整代码长度限制
Expand Down
2 changes: 1 addition & 1 deletion framework/framework/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/framework",
"version": "0.1.0",
"version": "0.1.1",
"main": "index.ts",
"license": "MIT",
"peerDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion packages/elastic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const processDocument = (doc: Partial<ProblemDoc>) => {
doc.content &&= doc.content.replace(/[[\]【】()()]/g, ' ');
doc.title &&= doc.title.replace(/[[\]【】()()]/g, ' ')
.replace(/([a-zA-Z]{2,})(\d+)/, '$1$2 $1 $2');
doc.pid &&= doc.pid.replace(/([a-zA-Z]{2,})(\d+)/, '$1$2 $1 $2');
if (doc.pid?.includes('-')) {
const ns = doc.pid.split('-')[0];
doc.tag.push(ns);
}
doc.pid &&= doc.pid.replace(/([a-zA-Z]{2,})(\d+)/, '$1$2 $1 $2').replace(/-/g, ' ');
return _.omit(doc, indexOmit);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/elastic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/elastic-search",
"version": "1.1.7",
"version": "1.1.8",
"main": "index.ts",
"repository": "https://github.com/hydro-dev/Hydro",
"author": "undefined <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrooj/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "4.17.0",
"version": "4.17.1",
"bin": "bin/hydrooj.js",
"main": "src/plugin-api",
"module": "src/plugin-api",
Expand Down
8 changes: 7 additions & 1 deletion packages/hydrooj/src/handler/problem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class ProblemMainHandler extends Handler {
const psdict = {};
const search = global.Hydro.lib.problemSearch || defaultSearch;
const parsed = parser.parse(q, {
keywords: ['category', 'difficulty'],
keywords: ['category', 'difficulty', 'namespace'],
offsets: false,
alwaysArray: true,
tokenize: true,
Expand All @@ -120,6 +120,12 @@ export class ProblemMainHandler extends Handler {
query.difficulty = { $in: parsed.difficulty.map(Number) };
}
if (category.length) query.$and = category.map((tag) => ({ tag }));
if (parsed.namespace?.length) {
const mappedPrefix = this.domain.namespaces?.[parsed.namespace[0]];
query.$and ||= [];
if (mappedPrefix) query.$and.push({ sort: new RegExp(`^${mappedPrefix}-`) });
else query.$and.push({ tag: parsed.namespace[0] });
}
if (text) category.push(text);
if (category.length) this.UiContext.extraTitleContent = category.join(',');
let total = 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-default/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.55.0",
"version": "4.55.1",
"author": "undefined <[email protected]>",
"license": "AGPL-3.0",
"main": "index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-default/templates/partials/problem_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<td class="col--status record-status--border edit-mode-hide"></td>
{% endif %}
{% endif %}
<td class="col--name col--problem-name" data-action="{{ url('problem_detail', docId=pdoc.docId) }}" {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} data-star="{{ psdoc.star }}"{% endif %}>
<td class="col--name col--problem-name" data-action="{{ url('problem_detail', pid=pdoc.docId) }}" {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} data-star="{{ psdoc.star }}"{% endif %}>
{{ problem.render_problem_title(pdoc) }}
</td>
<td class="col--ac-tried">{{ pdoc.nAccept }} / {{ pdoc.nSubmit }}</td>
Expand Down
2 changes: 1 addition & 1 deletion packages/vjudge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/vjudge",
"version": "1.9.12",
"version": "1.9.13",
"description": "Submit problems to remote oj",
"main": "./src/index.ts",
"repository": "https://github.com/hydro-dev/Hydro.git",
Expand Down
189 changes: 0 additions & 189 deletions packages/vjudge/src/providers/hustoj.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,195 +233,6 @@ export class HUSTOJ extends BasicFetcher implements IBasicProvider {
}
}

export class YBT extends HUSTOJ {
updateConfig() {
// this.LANGUAGES = {
// cc: 1,
// c: 2,
// java: 3,
// pas: 4,
// py: 5,
// py3: 5,
// };
this.config.login.extra = { login: '登录' };
this.config.submit = {
endpoint: '/action.php',
idField: 'problem_id',
langField: 'language',
codeField: 'source',
extra: { submit: '提交', user_id: this.account.handle },
tooFrequent: '提交频繁啦!',
};
this.config.ceInfo = {
endpoint: '/show_ce_info.php?runid={rid}',
matcher: /<td class="ceinfo">(.*?)<\/td>/gmi,
};
this.config.server = 'http://ybt.ssoier.cn:8088/';
}

async waitForSubmission(rid, next, end) {
const url = `/statusx1.php?runidx=${rid}`;
let res = await this.get(url);
let staText = res.text.split(':');
while (isProcessing(staText[4])) {
next({ status: STATUS.STATUS_JUDGING, progress: 0 });
await sleep(1000);
res = await this.get(url);
staText = res.text.split(':');
}
if (VERDICT[staText[4]] === STATUS.STATUS_COMPILE_ERROR) {
const ceInfoUrl = this.config.ceInfo.endpoint.replace('{rid}', rid);
let compilerText = 'Cannot get compiler text';
if (this.config.ceInfo.matcher) {
const resp = await this.get(ceInfoUrl);
const match = this.config.ceInfo.matcher.exec(resp.text);
if (match) compilerText = decodeURIComponent(match[1]).replace(/\n/g, '').replace(/<br\/>/g, '\n').replace(/\n\n/g, '\n');
} else if (this.config.ceInfo.selector) {
const { document } = await this.html(ceInfoUrl);
const match = document.querySelector(this.config.ceInfo.selector)?.innerHTML;
if (match) compilerText = decodeURIComponent(match).replace(/\n/g, '').replace(/<br\/>/g, '\n').replace(/\n\n/g, '\n');
}
end({
status: STATUS.STATUS_COMPILE_ERROR,
score: 0,
time: 0,
memory: 0,
compilerText,
});
return;
}
const staText4 = staText[4].split('|');
const staText5 = staText[5].split(',');
let totalTime = 0;
let totalMem = 0;
let totalScore = 0;
let totalStatus = STATUS.STATUS_WRONG_ANSWER;
for (const i in staText5) {
if (staText5[i]) {
let score;
const staText5i = staText5[i].split('|');
if (VERDICT[staText5i[0]] === STATUS.STATUS_ACCEPTED) {
score = 100;
totalScore += score;
} else score = 0;
const staText5i1 = staText5i[1].split('_');
totalMem += +staText5i1[0];
totalTime += +staText5i1[1];
next({
status: STATUS.STATUS_JUDGING,
case: {
status: VERDICT[staText5i[0]],
score,
time: +staText5i1[1],
memory: +staText5i1[0],
},
progress: 99,
});
}
}
if (VERDICT[staText4[0]] === STATUS.STATUS_ACCEPTED) {
totalScore = 100;
totalStatus = STATUS.STATUS_ACCEPTED;
} else if (totalScore >= 100) {
totalScore = 0;
}
end({
status: totalStatus,
score: totalScore,
time: totalTime,
memory: totalMem,
});
}
}

// 已弃用。请直接从 https://hydro.ac/ybtbas.zip 下载题库文件并按照压缩包内说明导入系统。
export class YBTBAS extends YBT {
static langs = {
ybtbas: {
display: 'YBTBAS',
hidden: true,
remote: 'ybtbas',
},
'ybtbas.7': {
display: 'G++14',
monaco: 'cpp',
highlight: 'cpp',
},
'ybtbas.1': {
display: 'G++',
monaco: 'cpp',
highlight: 'cpp',
},
'ybtbas.2': {
display: 'GCC',
monaco: 'cpp',
highlight: 'cpp',
},
'ybtbas.3': {
display: 'Java',
monaco: 'java',
highlight: 'java',
},
'ybtbas.4': {
display: 'Pascal',
monaco: 'pas',
highlight: 'pascal',
},
'ybtbas.5': {
display: 'Python',
monaco: 'python',
highlight: 'python',
},
};

updateConfig() {
this.config.login.check = '退出登录';
this.config.login.extra = async () => {
const captcha = await this.get('/login_xx.php').responseType('arraybuffer');
if (captcha.headers['set-cookie']) this.setCookie(captcha.headers['set-cookie']);
if (!global.parseCaptcha) await sleep(30000);
if (!global.parseCaptcha) return { login: '登录' };
return {
login: '登录',
auth: await global.parseCaptcha(captcha.body).toLowerCase(),
};
};
this.config.submit = {
endpoint: '/action.php',
idField: 'problem_id',
langField: 'language',
codeField: 'source',
extra: { submit: '提交', user_id: this.account.handle },
tooFrequent: '提交频繁啦!',
rid: /runidx=([0-9]+)/mi,
noRefetch: true,
};
this.config.ceInfo = {
endpoint: '/show_ce_info.php?runid={rid}',
selector: 'table[width="900px"]>tbody>tr>td>div>center>table>tbody>tr>td',
};
this.config.server = 'http://bas.ssoier.cn:8086/';
sleep(30000).then(() => {
// Prevent cookie expiration
if (!global.parseCaptcha) setInterval(() => this.get('/'), 60000);
});
}
}

export class BZOJ extends HUSTOJ {
updateConfig() {
this.config.login = {
endpoint: '/login.php',
usernameField: 'user_id',
passwordField: 'password',
extra: { submit: 'Submit' },
};
this.config.submit.tooFrequent = 'You should not submit more than twice in 10 seconds.....';
this.config.submit.rid = /Submit_Time<\/td><\/tr>\n<tr align="center" class="evenrow"><td>([0-9]+)/igm;
this.config.ceInfo.matcher = /<pre>([\s\S]*?)<\/pre>/im;
}
}

export class XJOI extends HUSTOJ {
updateConfig() {
// this.LANGUAGES = { cc: 'g++', c: 'gcc', pas: 'fpc' };
Expand Down
6 changes: 0 additions & 6 deletions packages/vjudge/src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import codeforces from './codeforces';
import csgoj from './csgoj';
import hduoj from './hduoj';
import {
BZOJ as bzoj,
HUSTOJ as hustoj,
XJOI as xjoi,
YBT as ybt,
YBTBAS as ybtbas,
} from './hustoj';
import poj from './poj';
import spoj from './spoj';
Expand All @@ -20,10 +17,7 @@ const vjudge: Record<string, any> = {
spoj,
uoj,
hustoj,
bzoj,
xjoi,
ybt,
ybtbas,
hduoj,
yacs,
};
Expand Down

0 comments on commit 3c642de

Please sign in to comment.