Browse Source

Merge branch 'master' into typeorm

master
Menci 6 years ago committed by GitHub
parent
commit
7563694a68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      README.en.md
  2. 4
      README.md
  3. 3
      config-example.json
  4. 12
      libs/code_formatter.js
  5. 13
      static/self/monaco-editor.js
  6. 2
      utility.js
  7. 7
      views/user_edit.ejs

4
README.en.md

@ -4,9 +4,7 @@
An online judge system for algorithm competition.
This project is the **official** successor and rewritten version of the original Python/Flask version of SYZOJ, which is authorized by the original author [@Chenyao2333](https://github.com/Chenyao2333).
Currently maintained by [LibreOJ](https://loj.ac).
This project is based on [@Chenyao2333](https://github.com/Chenyao2333)'s [SYZOJ](https://github.com/Zhengzhou-11-Highschool/syzoj). Currently maintained by [LibreOJ](https://loj.ac).
# Deploying
Currently, the tutorial for deploying is only available in Chinese. It's [部署指南](https://github.com/syzoj/syzoj/wiki/%E9%83%A8%E7%BD%B2%E6%8C%87%E5%8D%97) in this project's wiki.

4
README.md

@ -4,9 +4,7 @@
一个用于算法竞赛的在线评测系统。
此项目为重写过的、原 Python/Flask 版 SYZOJ 的**官方**后继版本,由原作者 [@Chenyao2333](https://github.com/Chenyao2333) 授权。
目前由 [LibreOJ](https://loj.ac) 维护。
本项目继承自 [@Chenyao2333](https://github.com/Chenyao2333) 的 [SYZOJ](https://github.com/Zhengzhou-11-Highschool/syzoj),目前由 [LibreOJ](https://loj.ac) 维护。
# 部署
见本项目 Wiki 中的 [部署指南](https://github.com/syzoj/syzoj/wiki/%E9%83%A8%E7%BD%B2%E6%8C%87%E5%8D%97)。

3
config-example.json

@ -124,5 +124,6 @@
"url": "https://fonts.loli.net"
},
"no_cdn": false,
"submissions_page_fast_pagination": false
"submissions_page_fast_pagination": false,
"username_regex": "^[a-zA-Z0-9\\-\\_]+$"
}

12
libs/code_formatter.js

@ -35,16 +35,16 @@ module.exports = async (code, lang) => {
}
await new Promise((resolve, reject) => {
let exit = code => {
if (code === 0) resolve();
else reject(code);
let exit = () => {
if (process.exitCode === 0) resolve();
else reject(process.exitCode);
}
if (process.exitCode !== null) exit(process.exitCode);
else process.on('close', exit);
if (process.exitCode !== null) exit();
else process.on('close', () => exit());
});
} catch (e) {
console.log(e.stack);
console.log(e);
result = null;
}

13
static/self/monaco-editor.js

@ -584,10 +584,16 @@ require(['vs/editor/editor.main'], function () {
});
}
function autoLayout(editor) {
window.addEventListener('resize', function () {
editor.layout();
});
}
$.getScript(window.pathSelfLib + "monaco-editor-tomorrow.js", function () {
window.createCodeEditor = function (editorElement, langauge, content) {
editorElement.innerHTML = '';
return monaco.editor.create(editorElement, {
var editor = monaco.editor.create(editorElement, {
value: content,
language: langauge,
multicursorModifier: 'ctrlCmd',
@ -608,6 +614,9 @@ require(['vs/editor/editor.main'], function () {
hideCursorInOverviewRuler: true,
contextmenu: false
});
autoLayout(editor);
return editor;
};
window.createMarkdownEditor = function (wrapperElement, content, input) {
@ -653,6 +662,8 @@ require(['vs/editor/editor.main'], function () {
input.value = editor.getValue();
});
autoLayout(editor);
return editor;
};

2
utility.js

@ -268,7 +268,7 @@ module.exports = {
return md5.digest('hex');
},
isValidUsername(s) {
return /^[a-zA-Z0-9\-\_]+$/.test(s);
return RegExp(syzoj.config.username_regex).test(s);
},
locks: [],
lock(key, cb) {

7
views/user_edit.ejs

@ -94,7 +94,14 @@
</form>
</div>
</div>
<script>
var bakDefine = define;
define = undefined;
</script>
<script src="<%- lib('blueimp-md5/2.10.0/js/md5.min.js') %>"></script>
<script>
define = bakDefine;
</script>
<script type="text/javascript">
var editors = {
information: { defaultValue: <%- serializejs(edited_user.information) %> },

Loading…
Cancel
Save