Skip to content

Commit

Permalink
Merge branch 'master' into typeorm
Browse files Browse the repository at this point in the history
  • Loading branch information
Menci authored May 1, 2019
2 parents 427dc7e + cd183f1 commit 7563694
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 16 deletions.
4 changes: 1 addition & 3 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion config-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 6 additions & 6 deletions libs/code_formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
13 changes: 12 additions & 1 deletion static/self/monaco-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -608,6 +614,9 @@ require(['vs/editor/editor.main'], function () {
hideCursorInOverviewRuler: true,
contextmenu: false
});

autoLayout(editor);
return editor;
};

window.createMarkdownEditor = function (wrapperElement, content, input) {
Expand Down Expand Up @@ -653,6 +662,8 @@ require(['vs/editor/editor.main'], function () {
input.value = editor.getValue();
});

autoLayout(editor);

return editor;
};

Expand Down
2 changes: 1 addition & 1 deletion utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 8 additions & 1 deletion views/user_edit.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="field">
<label for="information">个性签名</label>
</div>

</div>
<div class="editor editor-with-border" id="information" style="width: 100%; height: 100px; margin-bottom: 1em; ">
<%- this.showLoadingEditor(); %>
Expand Down Expand Up @@ -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) %> },
Expand Down

0 comments on commit 7563694

Please sign in to comment.