Skip to content

Commit

Permalink
release: 0.17.0 Characinae
Browse files Browse the repository at this point in the history
release: 0.17.0 Characinae
  • Loading branch information
ZsgsDesign committed Oct 9, 2021
2 parents 3d37609 + 7f35ae6 commit b0d42ac
Show file tree
Hide file tree
Showing 123 changed files with 11,420 additions and 9,207 deletions.
7 changes: 6 additions & 1 deletion .env.example
Expand Up @@ -21,12 +21,17 @@ ADMIN_RECAPTCHAV2_SECRET=
ADMIN_RECAPTCHAV2_DOMAIN="https://recaptcha.net" # or https://www.google.com (unavailable in china)
ADMIN_RECAPTCHAV2_TIMEOUT=30

WKHTML_PDF_BINARY="/usr/local/bin/wkhtmltopdf"
WKHTML_IMG_BINARY="/usr/local/bin/wkhtmltoimage"

TRUSTED_PROXIES=null # can be null, "*", "192.168.100.1" or if multiple, "192.168.100.1,192.168.100.2,10.0.0.0/8"

FUNC_ENABLE_REGISTER=true
FUNC_STRONG_PASSWORD=true

BABEL_MIRROR=https://acm.njupt.edu.cn/babel #The mirror of babel marketplace
PAGINATION_PROBLEM_PER_PAGE=20

BABEL_MIRROR=https://acm.njupt.edu.cn/babel # The mirror of babel marketplace, you can also use github public mirror at https://njuptaaa.github.io/babel

SESSION_DOMAIN=.ojsystem.com # set null if multi-domain or http 419

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -21,3 +21,5 @@ yarn-error.log
/public/static/language-services
/.vscode/ipch
/.rnd

/_ide_helper.php
141 changes: 141 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,147 @@

All notable changes to this project will be documented in this file.

## v0.17.0 Characinae - 2021-10-09
This is a minor version update. As mentioned in `0.5.0` logs, the new version system would merge the old major and minor version numbers into new minor version numbers, thus as the 17th minor version update since NOJ `0.1.0`, this version would be numbered as major version `0`, minor version `17`, build pack `0` and patch number `0`.

**Important:** Please follow NOJ Document's guide to upgrading your NOJ from `v0.16.x` to `v0.17.0`.

**Summary:** Update Laravel from `6.x` to `8.5`, update Laravel Mix to `6.0`, requires `WKHTMLPDF` installed, uses new logo design, supports multiple log channels, supports group homework, supports strong password, supports `C11`, `C++14` and `C++17`, supports new contest rejudge interface, supports new contest pdf generation interface, supports problem lazy load that increases site rank and group loading time, supports new material preloader, supports new `sortable.js` as a sortable method, supports Carbon as time processer, supports 2 fonts and 5 environment variables. This version update also includes lots of query optimizations, bug fixes, functionality & UI improvements, and security updates.

### Update Logs
* **Compatibility:** NOJ now supports Laravel `8.5` per #672 requests, the latest version of Laravel. `8.x` uses Symphony 4, which introduced a lot of changes to the base code.
* **Compatibility:** NOJ now deprecates **DomPDF** and uses **WKHTMLPDF** instead.
* **Compatibility:** NOJ now uses `lax` for the same site verification.
* **Compatibility:** NOJ now uses `Throwable` instead of `Exception` for the error handler.
* **Compatibility:** NOJ now uses Laravel Mix `6.0`.
* **Compatibility:** NOJ now separate log channels, `group_elo_update` and `babel_judge_sync` are now stored in different files apart from `app.log` (which originally named `laravel.log`) and expired after 7 days.
* **New:** Group homework support per #667 requests, this feature can be seen as the privatized lite version of **NOJ Dojo**.
* **New:** Add `createHomework` AJAX API.
* **New:** Use the third edition of the NOJ logo materialized design per #676 requests. While replacing all old logos, the third edition also modifies its dark and light flattened variant.
* **New:** Strong password support via environment variable `FUNC_STRONG_PASSWORD`.
* **New:** Add `C11` language support per #663 requests (require NOJ JudgeServer `v0.2.1` or higher).
* **New:** Add `C++14` language support per #663 requests (require NOJ JudgeServer `v0.2.1` or higher).
* **New:** Add `C++17` language support per #663 requests (require NOJ JudgeServer `v0.2.1` or higher).
* **New:** Add new problem selector component per #664 requests.
* **New:** Remastered contest rejudge feature per #673 requests. This function now opt-in for the beta test.
* **New:** Contest rejudge now supports custom verdict to rejudge.
* **New:** Remastered contest pdf generation feature by using **WKHTMLPDF** per #670 requests. This function now opt-in for the beta test and can only apply to contests in which all problems are self-hosted and you need to install **WKHTMLPDF** first then setup 2 environment variables, `WKHTML_PDF_BINARY` and `WKHTML_IMG_BINARY`.
* **New:** Contest pdf generation now supports math formula rendering.
* **New:** Contest pdf generation now supports removing after generation.
* **New:** Add site-wide `delayProblemLoad` function for image lazy loading.
* **New:** NOJ now uses the new material preloader component.
* **New:** NOJ now uses `sortable.js` for sortable elements.
* **New:** Add group left-to-right layout.
* **New:** Add `users_latest_submission` query builder for problem model.
* **New:** Add `problems_latest_submission` query builder for user model.
* **New:** NOJ now uses `lluminate\Support\Carbon` and its alias `Carbon` for time processing.
* **New:** Add `fonts-asset/simsun` package, see #504.
* **New:** Add `fonts-asset/dejavu` package, see #504.
* **New:** Add `barryvdh/laravel-snappy` package.
* **New:** Add `_declaration` as an scss component.
* **New:** Add `_mathjax` as an scss component.
* **New:** Add `_refreshing` as an scss component.
* **New:** Add `defaultAvatarPNG` as `NOJVariables` in typescript.
* **New:** PDF generation locale support for contest admin panel.
* **New:** Group homework locale support.
* **Deprecated:** Remove `EloquentModel` alias for all eloquent models from now on, eloquent models will be referred to directly.
* **Deprecated:** Remove `barryvdh/laravel-dompdf` package.
* **Deprecated:** Remove `jquery-ui` and `noj-jquery-ui-sortable` package.
* **Fixed:** Duplicate `lodash` package.
* **Fixed:** A bug causing `babel:install` to fail when making directories.
* **Fixed:** A bug causing email verification hidden when social login is disabled.
* **Fixed:** A bug causing congratulation and other dialogs dismissable via ESC key while exit logic not triggered, see #722.
* **Fixed:** A bug causing math formula overflow, see #723.
* **Fixed:** A bug causing sample note blank, see #662.
* **Fixed:** A bug causing admin portal contest registant_type field mapped wrongly.
* **Fixed:** A bug causing SPJ uploading to fail.
* **Fixed:** Typo (we mean it).
* **Improved:** NOJ Dojo is now greatly optimized by using the new dojo status method, see #725.
* **Improved:** Optimized site rank page performance, see #726.
* **Improved:** Optimized group detail page performance, see #728.
* **Improved:** Multidomain config now does not take effect in the console environment.
* **Improved:** Eloquent contest model `getProblemSet` method now optimized.
* **Improved:** PDF generation advice page now uses pure latex formula.
* **Improved:** PDF generation cover page now uses the latest ICPC standard.
* **Improved:** Contest admin panel now separates section-panel to own blade template.
* **Improved:** Problem pagination is now configurable via environment variable `PAGINATION_PROBLEM_PER_PAGE`.
* **Improved:** NOJ now uses blade stack to replace outdated `additionJS` yield.
* **Improved:** NOJ ico file now bundles `16*16`, `48*48` and `256*256` resolution.
* **Improved:** NOJ now uses a new refreshing button design.
* **Improved:** NOJ now uses the new problem selector component for contest editing and arranging per #664 requests.
* **Improved:** Redesign `ajax/problemExists` AJAX API.
* **Improved:** Group function block now has a color scheme.
* **Improved:** Group left-to-right layout now applies to all group detail-related pages.
* **Improved:** NOJ now uses the new left-to-right layout for the analysis page, see #719.
* **Improved:** Eloquent problem model `getProblemStatus` method.
* **Improved:** NOJ now uses the dot-separated router for problems.
* **Improved:** **Google Recaptcha** now defaults to false.
* **Improved:** Admin Portal now displays babel mirror as part of the environment info.
* **Security:** `beyondcode/laravel-dump-server` is now at `1.7.0`.
* **Security:** `dragonmantank/cron-expression` is now at `3.1.0`.
* **Security:** `encore/laravel-admin` is now at `1.8.14`.
* **Security:** `filp/whoops` is now at `2.14.4`.
* **Security:** `graham-campbell/markdown` is now at `13.1.1`.
* **Security:** `intervention/image` is now at `2.7.0`.
* **Security:** `laravel/framework` is now at `8.63.0`.
* **Security:** `laravel/passport` is now at `10.1.3`.
* **Security:** `laravel/socialite` is now at `5.2.5`.
* **Security:** `laravel/tinker` is now at `2.6.2`.
* **Security:** `laravelium/sitemap` is now at `8.0.1`.
* **Security:** `league/mime-type-detection` is now at `1.8.0`.
* **Security:** `mockery/mockery` is now at `1.4.4`.
* **Security:** `monolog/monolog` is now at `2.3.5`.
* **Security:** `nesbot/carbon` is now at `2.53.1`.
* **Security:** `nikic/php-parser` is now at `4.13.0`.
* **Security:** `nunomaduro/collision` is now at `5.10.0`.
* **Security:** `phar-io/manifest` is now at `2.0.3`.
* **Security:** `phar-io/version` is now at `3.1.0`.
* **Security:** `phpdocumentor/type-resolver` is now at `1.5.1`.
* **Security:** `phpoption/phpoption` is now at `1.8.0`.
* **Security:** `phpseclib/phpseclib` is now at `3.0.10`.
* **Security:** `phpspec/prophecy` is now at `1.14.0`.
* **Security:** `phpunit/php-code-coverage` is now at `9.2.7`.
* **Security:** `phpunit/php-file-iterator` is now at `3.0.5`.
* **Security:** `phpunit/php-text-template` is now at `2.0.4`.
* **Security:** `phpunit/php-timer` is now at `5.0.3`.
* **Security:** `phpunit/phpunit` is now at `9.5.10`.
* **Security:** `predis/predis` is now at `1.1.9`.
* **Security:** `psy/psysh` is now at `0.10.8`.
* **Security:** `ramsey/uuid` is now at `4.2.3`.
* **Security:** `sebastian/code-unit-reverse-lookup` is now at `2.0.3`.
* **Security:** `sebastian/comparator` is now at `4.0.6`.
* **Security:** `sebastian/diff` is now at `4.0.4`.
* **Security:** `sebastian/environment` is now at `5.1.3`.
* **Security:** `sebastian/exporter` is now at `4.0.3`.
* **Security:** `sebastian/global-state` is now at `5.0.3`.
* **Security:** `sebastian/object-enumerator` is now at `4.0.4`.
* **Security:** `sebastian/object-reflector` is now at `2.0.4`.
* **Security:** `sebastian/recursion-context` is now at `4.0.4`.
* **Security:** `sebastian/resource-operations` is now at `3.0.3`.
* **Security:** `sebastian/version` is now at `3.0.2`.
* **Security:** `symfony/console` is now at `5.3.7`.
* **Security:** `symfony/dom-crawler` is now at `5.3.7`.
* **Security:** `symfony/error-handler` is now at `5.3.7`.
* **Security:** `symfony/event-dispatcher` is now at `5.3.7`.
* **Security:** `symfony/event-dispatcher-contracts` is now at `2.4.0`.
* **Security:** `symfony/finder` is now at `5.3.7`.
* **Security:** `symfony/http-foundation` is now at `5.3.7`.
* **Security:** `symfony/http-kernel` is now at `5.3.9`.
* **Security:** `symfony/mime` is now at `5.3.8`.
* **Security:** `symfony/process` is now at `5.3.7`.
* **Security:** `symfony/routing` is now at `5.3.7`.
* **Security:** `symfony/translation` is now at `5.3.9`.
* **Security:** `symfony/var-dumper` is now at `5.3.8`.
* **Security:** `vlucas/phpdotenv` is now at `5.3.1`.
* **Security:** `webpack` is now at `5.52.1`.
* **Security:** `typescript` is now at `4.4.3`.
* **Security:** `sass` is now at `1.42.1`.
* **Security:** `pdfobject` is now at `2.2.7`.
* **Security:** `codemirror` is now at `5.63.1`.
* **Security:** `axios` is now at `0.21.4`.
* **Security:** `dompurify` is now at `2.3.2`.
* **Security:** `postcss` is now at `8.3.9`.

## v0.16.0 Bryconinae - 2021-08-27
This is a minor version update. As mentioned in `0.5.0` logs, the new version system would merge the old major and minor version numbers into new minor version numbers, thus as the 16th minor version update since NOJ `0.1.0`, this version would be numbered as major version `0`, minor version `16`, build pack `0` and patch number `0`.

Expand Down
9 changes: 6 additions & 3 deletions README.md
@@ -1,6 +1,6 @@
# NOJ - Automatic Algorithm Test Platform

![NOJ](/noj2.png)
![NOJ](/noj_banner.png)

NOJ's another online judge platform, stands for NJUPT Online Judge. It's written in PHP, GO, Python and other function-supporting languages and supports both online judges and virtual judges, we called it **mixed judge**.

Expand All @@ -14,9 +14,9 @@ NOJ's another online judge platform, stands for NJUPT Online Judge. It's written
![Stars](https://img.shields.io/github/stars/zsgsdesign/noj.svg?style=flat-square)
![Forks](https://img.shields.io/github/forks/zsgsdesign/noj.svg?style=flat-square)

## v0.16.0 Bryconinae
## v0.17.0 Characinae

For more information, please visit [v0.16.0 Bryconinae Release Log](https://github.com/ZsgsDesign/NOJ/releases/tag/0.16.0) page.
For more information, please visit [v0.17.0 Characinae Release Log](https://github.com/ZsgsDesign/NOJ/releases/tag/0.17.0) page.

### Installation

Expand Down Expand Up @@ -54,7 +54,10 @@ NOJ now supports 15 popular programming languages, you can start issues about ne
|Language|Compile/Run Command|
|--------|-------------------|
|C|/usr/bin/gcc -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c99 {src_path} -lm -o {exe_path}|
|C11|/usr/bin/gcc -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c11 {src_path} -lm -o {exe_path}|
|C++|/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c++11 {src_path} -lm -o {exe_path}|
|C++14|/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c++14 {src_path} -lm -o {exe_path}|
|C++17|/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c++17 {src_path} -lm -o {exe_path}|
|Java|/usr/bin/javac {src_path} -d {exe_dir} -encoding UTF8<br>/usr/bin/java -cp {exe_dir} -XX:MaxRAM={max_memory}k -Djava.security.manager -Dfile.encoding=UTF-8 -Djava.security.policy==/etc/java_policy -Djava.awt.headless=true Main|
|Python2|/usr/bin/python -m py_compile {src_path}<br>/usr/bin/python {exe_path}|
|Python3|/usr/bin/python3.7 -m py_compile {src_path}<br>/usr/bin/python3.7 {exe_path}|
Expand Down
50 changes: 50 additions & 0 deletions app/Babel/Extension/noj/Languages.php
Expand Up @@ -37,6 +37,22 @@ public static function get()
'seccomp_rule' => 'c_cpp',
'env' => $default_env
],
'c11_lang_config' => [
'compile' => [
'src_name' => 'main.c',
'exe_name' => 'main',
'max_cpu_time' => 3000,
'max_real_time' => 10000,
'max_memory' => 1024 * 1024 * 1024,
'compile_command' => '/usr/bin/gcc -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c11 {src_path} -lm -o {exe_path}',
],
'run' => [
'command' => '{exe_path}',
'seccomp_rule' => 'c_cpp',
'env' => $default_env,
'memory_limit_check_only' => 1
]
],
'cpp_lang_config' => [
'name' => 'cpp',
'compile' => [
Expand All @@ -54,6 +70,40 @@ public static function get()
'memory_limit_check_only' => 1
]
],
'cpp14_lang_config' => [
'name' => 'cpp14',
'compile' => [
'src_name' => 'main.cpp',
'exe_name' => 'main',
'max_cpu_time' => 3000,
'max_real_time' => 10000,
'max_memory' => 1024 * 1024 * 1024,
'compile_command' => '/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c++14 {src_path} -lm -o {exe_path}',
],
'run' => [
'command' => '{exe_path}',
'seccomp_rule' => 'c_cpp',
'env' => $default_env,
'memory_limit_check_only' => 1
]
],
'cpp17_lang_config' => [
'name' => 'cpp17',
'compile' => [
'src_name' => 'main.cpp',
'exe_name' => 'main',
'max_cpu_time' => 3000,
'max_real_time' => 10000,
'max_memory' => 1024 * 1024 * 1024,
'compile_command' => '/usr/bin/g++ -DONLINE_JUDGE -O2 -w -fmax-errors=3 -std=c++17 {src_path} -lm -o {exe_path}',
],
'run' => [
'command' => '{exe_path}',
'seccomp_rule' => 'c_cpp',
'env' => $default_env,
'memory_limit_check_only' => 1
]
],
'java_lang_config' => [
'name' => 'java',
'compile' => [
Expand Down
24 changes: 24 additions & 0 deletions app/Babel/Extension/noj/compiler/1630248211.json
@@ -0,0 +1,24 @@
{
"modifications":[{
"code":"c11",
"compability":"c",
"language":"c",
"icon":"devicon-c-plain",
"display":"C11",
"method":"add"
},{
"code":"cpp14",
"compability":"c",
"language":"cpp",
"icon":"devicon-cplusplus-plain",
"display":"C++14",
"method":"add"
},{
"code":"cpp17",
"compability":"c",
"language":"cpp",
"icon":"devicon-cplusplus-plain",
"display":"C++17",
"method":"add"
}]
}
Binary file modified app/Babel/Extension/noj/resources/noj@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions app/Babel/Install/InstallerWorker.php
Expand Up @@ -42,7 +42,7 @@ protected function applyCustom($ocode, $cssPath)
{
$storePath=base_path("public/static/css/oj/");
if (!is_dir($storePath)) {
mkdir($storePath);
mkdir($storePath, 0777, true);
}
if (is_null($cssPath)) {
file_put_contents($storePath."$ocode.css", "\/*Silence is Golden*\/");
Expand All @@ -67,10 +67,8 @@ public function importICON()
protected function applyIcon($ocode, $imgPath)
{
$storePath=base_path("public/static/img/oj/$ocode/");
if (is_dir($storePath)) {
delFile($storePath);
} else {
mkdir($storePath);
if (!is_dir($storePath)) {
mkdir($storePath, 0777, true);
}
file_put_contents($storePath.basename($imgPath), file_get_contents($imgPath));
return "/static/img/oj/$ocode/".basename($imgPath);
Expand Down
8 changes: 5 additions & 3 deletions app/Babel/Judge/Judger.php
Expand Up @@ -29,7 +29,9 @@ public function __construct()

$result=$submissionModel->getWaitingSubmission();

Log::info(json_encode($result));
$submissionCount = count($result);

Log::channel('babel_judge_sync')->info("Currently $submissionCount submission(s) awaiting", [$result]);

foreach ($result as $row) {
$ocode=$row["ocode"];
Expand All @@ -39,9 +41,9 @@ public function __construct()
}
$this->judger[$ocode]->judge($row);
} catch (Throwable $e) {
Log::alert("Exception Occurs While Processing $ocode's Submission {$row['sid']}\n".$e->getMessage()."\nAt ".$e->getFile().":".$e->getLine());
Log::channel('babel_judge_sync')->alert("Exception Occurs While Processing $ocode's Submission {$row['sid']}\n".$e->getMessage()."\nAt ".$e->getFile().":".$e->getLine());
} catch (Exception $e) {
Log::alert("Exception Occurs While Processing $ocode's Submission {$row['sid']}\n".$e->getMessage()."\nAt ".$e->getFile().":".$e->getLine());
Log::channel('babel_judge_sync')->alert("Exception Occurs While Processing $ocode's Submission {$row['sid']}\n".$e->getMessage()."\nAt ".$e->getFile().":".$e->getLine());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Babel/BabelRequire.php
Expand Up @@ -72,7 +72,7 @@ public function handle()
file_put_contents(babel_path("Tmp/$filename"), file_get_contents($targetPackage["downloadURL"][0]["url"]));
// unzip
if (!is_dir(babel_path("Tmp/$extension/"))) {
mkdir(babel_path("Tmp/$extension/"));
mkdir(babel_path("Tmp/$extension/"), 0777, true);
}
try {
$zipFile=new ZipFile();
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Babel/Update.php
Expand Up @@ -76,7 +76,7 @@ public function handle()
private function backup($extension)
{
if (!is_dir(babel_path("Tmp/backup/"))) {
mkdir(babel_path("Tmp/backup/"));
mkdir(babel_path("Tmp/backup/"), 0777, true);
}
if (is_dir(babel_path("Tmp/backup/$extension/"))) {
$this->delDir(babel_path("Tmp/backup/$extension/"));
Expand Down

0 comments on commit b0d42ac

Please sign in to comment.