diff --git a/docs/data.json b/docs/data.json index f01d9713..37edcd52 100644 --- a/docs/data.json +++ b/docs/data.json @@ -1,5 +1,15 @@ { "update": [ + { + "version": "2021-09-28", + "level": "Recommend", + "title": "2021-09-28", + "details": [ + "修复 Golang 编译运行的一些问题", + "支持 JavaScript 语言,注意,升级后需要按照 文档来 reset_languages,如果有自定义配置将会被重置,需要先备份。", + "增加了一些语言的编辑器语法高亮配置" + ] + }, { "version": "2021-08-07", "level": "Recommend", diff --git a/judge/languages.py b/judge/languages.py index 6b7ab665..1038231a 100644 --- a/judge/languages.py +++ b/judge/languages.py @@ -189,13 +189,40 @@ _go_lang_config = { "max_real_time": 5000, "max_memory": 1024 * 1024 * 1024, "compile_command": "/usr/bin/go build -o {exe_path} {src_path}", - "env": ["GOCACHE=/tmp", "GOPATH=/tmp"] + "env": ["GOCACHE=/tmp", "GOPATH=/tmp", "GOMAXPROCS=1"] + default_env }, "run": { "command": "{exe_path}", - "seccomp_rule": "", + "seccomp_rule": "golang", # 降低内存占用 - "env": ["GODEBUG=madvdontneed=1"] + default_env, + "env": ["GODEBUG=madvdontneed=1", "GOMAXPROCS=1"] + default_env, + "memory_limit_check_only": 1 + } +} + +_node_lang_config = { + "template": """//PREPEND BEGIN +//PREPEND END + +//TEMPLATE BEGIN +//TEMPLATE END + +//APPEND BEGIN +//APPEND END""", + "compile": { + "src_name": "main.js", + "exe_name": "main.js", + "max_cpu_time": 3000, + "max_real_time": 5000, + "max_memory": 1024 * 1024 * 1024, + "compile_command": "/usr/bin/node --check {src_path}", + "env": default_env + }, + "run": { + "command": "/usr/bin/node {exe_path}", + "seccomp_rule": "node", + # 降低内存占用 + "env": default_env, "memory_limit_check_only": 1 } } @@ -208,5 +235,6 @@ languages = [ {"config": _java_lang_config, "name": "Java", "description": "OpenJDK 11", "content_type": "text/x-java"}, {"config": _py2_lang_config, "name": "Python2", "description": "Python 2.7", "content_type": "text/x-python"}, {"config": _py3_lang_config, "name": "Python3", "description": "Python 3.6", "content_type": "text/x-python"}, - {"config": _go_lang_config, "name": "Golang", "description": "Golang 1.15", "content_type": "text/x-go"}, + {"config": _go_lang_config, "name": "Golang", "description": "Golang 1.17", "content_type": "text/x-go"}, + {"config": _node_lang_config, "name": "JavaScript", "description": "Node 14", "content_type": "text/javascript"}, ]