renbaoshuo / s2oj Goto Github PK
View Code? Open in Web Editor NEWOnline Judge System for Shijiazhuang No.2 Middle School, based on Universal Online Judge.
Home Page: https://sjzezoj.com
License: GNU Affero General Public License v3.0
Online Judge System for Shijiazhuang No.2 Middle School, based on Universal Online Judge.
Home Page: https://sjzezoj.com
License: GNU Affero General Public License v3.0
在 OJ 的使用过程中经常会遇到需要上传图片的情况,目前的解决方案是上传至外部图床,但存在失效风险,因此需要一个内建的图床来保证图片在 OJ 的存续期间一直有效。
为 S2OJ 增加图床功能。
在顶栏增加「应用」下拉菜单,在下拉菜单中显示图床入口。
/image_hosting/:name.png
获取图片
/image_hosting
图片浏览 & 上传
UOJConfig::$data['profile']['short-name']
的水印/super-manage/image_hosting
图床管理
新表:users_images
列名 | 值类型 | 描述 |
---|---|---|
id |
int(11) | ID |
filename |
varchar(100) |
图片存储文件名 |
uploader |
varchar(20) |
上传者的用户名 |
width |
int(11) |
宽度(单位:像素) |
height |
int(11) |
高度(单位:像素) |
upload_time |
datetime |
上传时间 |
size |
int(11) |
大小(单位:Byte) |
hash |
varchar(70) |
文件哈希值 |
已存在表:user_info
新列 | 值类型 | 描述 |
---|---|---|
images_size_limit |
int(11) |
图片上传总大小限制(单位:Byte) |
在 S2OJ 的使用过程中,有一些敏感操作是不会记录操作者信息的。随着题目管理员数量的日渐增加,增加审计日志的必要性在日渐提升。
为 S2OJ 增加审计日志功能。
audit_logs
表列名 | 数据类型 | 说明 |
---|---|---|
username |
varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL |
用户名 |
type |
varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL |
记录类型 |
target_id |
int NOT NULL |
对应项目的 ID |
time |
datetime DEFAULT CURRENT_TIMESTAMP |
时间 |
remote_addr |
varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL |
remote_addr |
http_x_forwarded_for |
varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL |
http_x_forwarded_for |
detail |
json NOT NULL |
详情 |
TODO
在 S2OJ 的使用过程中,题目标签一直是由题目上传者和管理员手动配置的,这样一来就会出现不同名称的标签表达同一意思的情况。一个最典型的例子就是「动态规划」和「DP」这两个标签。
将题目标签系统修改为类似 LibreOJ 的标签系统。附图:
▲ 标签管理入口
▲ 标签管理界面
注:无需实现多语言功能。
tags
表键名 | 类型 |
---|---|
id |
int NOT NULL AUTO_INCREMENT |
name |
varchar(30) NOT NULL |
problems_tags
表键名 | 类型 |
---|---|
id |
int NOT NULL AUTO_INCREMENT |
problem_id |
int NOT NULL |
tag_id |
int NOT NULL |
引导用户前往 洛谷 上手动提交代码,然后提交以下信息:
_uid
和 __clientid
;然后通过 https://www.luogu.com.cn/record/{id}?_contentOnly=1
获取信息,所需内容结构如下:
{
"code": 200,
"currentTemplate": "RecordShow",
"currentData": {
"record": {
"detail": {
"compileResult": {
"success": true,
"message": null
},
"judgeResult": {
"subtasks": [
{
"id": 0,
"score": 100,
"status": 12,
"testCases": [
{
"id": 0,
"status": 12,
"time": 28,
"memory": 5976,
"score": 20,
"signal": 0,
"exitCode": 0,
"description": "ok accepted",
"subtaskID": 0
},
{
"id": 1,
"status": 12,
"time": 57,
"memory": 7116,
"score": 20,
"signal": 0,
"exitCode": 0,
"description": "ok accepted",
"subtaskID": 0
},
{
"id": 2,
"status": 12,
"time": 92,
"memory": 7772,
"score": 20,
"signal": 0,
"exitCode": 0,
"description": "ok accepted",
"subtaskID": 0
},
{
"id": 3,
"status": 12,
"time": 127,
"memory": 9292,
"score": 20,
"signal": 0,
"exitCode": 0,
"description": "ok accepted",
"subtaskID": 0
},
{
"id": 4,
"status": 12,
"time": 129,
"memory": 9680,
"score": 20,
"signal": 0,
"exitCode": 0,
"description": "ok accepted",
"subtaskID": 0
}
],
"time": 433,
"memory": 9680
}
],
"finishedCaseCount": 5,
"status": 0,
"time": 0,
"memory": 0,
"score": 0
}
},
"sourceCode": "",
"time": 0,
"memory": 0,
"problem": {
"pid": "",
"fullScore": 100
},
"sourceCodeLength": 3892,
"submitTime": 1675255767,
"language": 11,
"user": {
"uid": 168214
},
"id": 101128189,
"status": 12,
"enableO2": true,
"score": 100
},
"testCaseGroup": [[0, 1, 2, 3, 4]],
"showStatus": true
},
"currentTime": 1675333702,
"currentUser": {
"uid": 168214
}
}
解析,并转换为 UOJ 格式。
在教学过程中,经常会遇到同一题单中的题目在不同 Online Judge 上的情况。此类情况一般使用 Vjudge 解决,但 Vjudge 无法添加校内 OJ 上的题目,因此只能在不同的网站上来回切换完成教学、学习任务,存在一定不便。
为 S2OJ 实现 Remote Judge 功能,并将其集成进以下模块中:
需要支持以下 Online Judge:
编写一个 Node 脚本,支持以下操作:
Judgement Failed
。// S2OJ_SUBMISSION_ID: xxxxxx
作为识别。Judgement Failed
。此外,还需要对各个题库做针对性地适配,对接其网站上的相关接口。
在 Web 端,需要进行以下修改:
以及一些其他杂项的修改。
在日常训练中,经常会出现自己忘了报名比赛或者老师批量报名时遗漏的情况,这在老师不在场或者不便联系老师时会带来一些麻烦。
允许选手在比赛的中途报名参赛。
本 Issue 作为此需求的备忘录。
见 1227acf。
今天打比赛发现网有点慢,结果就是Mathjax的加载速度很慢,有的时候刷新好几次等上几分钟也渲染不出来,上午刚给自己的博客从 Mathjax 换到 KaTeX 无斜体版本,发现契合度和 Mathjax 根本不是一个量级,在同样差的网络下, Mathjax 会在打开几秒后才渲染成功, KaTeX 能做到在网页加载成功的同时渲染完成。
效果预览
(因为 hexo 渲染器的问题一些公式没有被渲染,但是使用 KaTeX script 在本地能够全部渲染成功)
用 KaTeX 替代 S2OJ 中的 Mathjax,作为 markdown LaTeX 公式的渲染器
不太会前端,还在研究怎么改
目前的想法是把 requirelib 含有 mathjax 的全部改成katex,然后添加 katex.min.css katex.min.js auto-render.min.js 与渲染规则(可以直接从网上照搬)
markdown editor 先不动(我看不懂),先继续使用 mathjax,修改为 katex 可以参考 markdown all-in-one 的实现
我已经做了改动,但是部署镜像之后网页端跑不起来 (archlinux),所以没法测试,您可以看我 fork 的仓库的修改
当前 S2OJ 的权限管理虽能满足基本需求,但当部分情况下需要灵活管理权限时则会遇到诸多问题。一个典型的案例是在正常情况下,外校学生不应当能查看非自己参加过的比赛的题目,并且参赛需要老师为其手动报名,不能自行点击「报名」按钮报名。当前对这个功能的实现过于丑陋,同时也不具备良好的可扩展性。
为 S2OJ 实现一个灵活的、可扩展的权限管理模型。
本 Issue 将作为此构想的备忘录。
user_info
表
该表中现有的 usertype
字段将只存在以下几个值:
student
学生账号teacher
老师账号banned
封禁账号system
系统账号(root,std)其余权限将存放在 PR #14 中引入的 extra
字段中,使用 $.permissions
读取。
problems
problems.view
problems.create
problems.download_testdata
problems.manage
contests
contests.view
(若无权限则只显示已参加过的比赛列表)contests.register
contests.create
contests.start_final_test
contests.manage
lists
lists.view
(关闭后无法查看题单列表及详情)lists.create
lists.manage
groups
groups.view
(若无此权限则只能查看所在的小组)groups.create
groups.manage
blogs
blogs.view
(若无此权限只能查看自己创建的博客)blogs.create
blogs.manage
users
users.view
users.upload_image
仅限超级用户。
执行 docker-compose -f docker-compose.development.yml up -d --build
报错:
Failed to load remote-judger.development.env: open remote-judger.development.env: no such file or directory
.
如题。
在评测机拉取到新的提交记录后将之前由该评测机评测的所有处于 Judging 状态的提交记录记为 Judgment Failed 状态。
UOJSubmission::rejudgeById()
进行重测。A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.