Skip to content

Commit

Permalink
Merge branch 'master' into man/hof
Browse files Browse the repository at this point in the history
  • Loading branch information
winprn committed Sep 19, 2023
2 parents 793c437 + d43611c commit 61ff301
Show file tree
Hide file tree
Showing 249 changed files with 7,447 additions and 6,128 deletions.
15 changes: 10 additions & 5 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ application-import-names = dmoj,judge,django_ace
import-order-style = pycharm
enable-extensions = G
ignore =
W504, # line break occurred after a binary operator
# line break occurred after a binary operator
W504,
# allow only generator_stop and annotations future imports
FI10,FI11,FI12,FI13,FI14,FI15,FI16,FI17,FI18,FI55,FI58,
C814, # missing trailing comma in Python 2 only
# missing trailing comma in Python 2 only
C814,
per-file-ignores =
# F401: unused imports, ignore in all __init__.py
# F403: import *
Expand All @@ -20,7 +22,10 @@ per-file-ignores =
# PyCharm likes to have double lines between class/def in an if statement.
./judge/widgets/pagedown.py:E303
exclude =
./dmoj/local_settings.py, # belongs to the user
./dmoj/local_urls.py, # belongs to the user
./.ci.settings.py, # is actually a fragment to be included by settings.py
# belongs to the user
./dmoj/local_settings.py,
# belongs to the user
./dmoj/local_urls.py,
# is actually a fragment to be included by settings.py
./.ci.settings.py,
fc_*
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: '3.7'
- name: Install flake8
run: pip install flake8 flake8-import-order flake8-future-import flake8-commas flake8-logging-format flake8-quotes
- name: Lint with flake8
Expand All @@ -18,11 +18,11 @@ jobs:
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: '3.7'
- name: Cache pip
uses: actions/cache@v2
with:
Expand All @@ -43,7 +43,7 @@ jobs:
styles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Node 14
uses: actions/setup-node@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/caniuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
if: github.repository == 'DMOJ/online-judge'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Download Can I use... data
run: |
curl -s https://raw.githubusercontent.com/Fyrd/caniuse/master/data.json | python3 -m json.tool > resources/caniuse.json
- name: Create pull request
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
author: dmoj-build <build@dmoj.ca>
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/compilemessages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
compilemessages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: '3.7'
- name: Checkout submodules
run: |
git submodule init
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/updatemessages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
if: github.repository == 'DMOJ/online-judge'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: '3.7'
- name: Checkout submodules
run: |
git submodule init
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
git reset --hard "$i18n_head"
fi
- name: Create pull request
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
author: dmoj-build <build@dmoj.ca>
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ dmoj-site.pid
dmoj-site.sock
uwsgi.ini
.fuse_hidden*
resources/style.css
resources/content-description.css
resources/ranks.css
resources/table.css
resources/dark
resources/martor-description.css
resources/select2-dmoj.css
resources/style.css
resources/vars.scss
sass_processed
bridge_log.txt
_mytempfile/
Expand Down
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
# VNOJ: VNOI Online Judge [![Build Status](https://github.com/VNOI-Admin/OJ/workflows/build/badge.svg)](https://github.com/VNOI-Admin/OJ/actions/) [![AGPL License](https://img.shields.io/badge/license-AGPLv3.0-blue.svg)](http://www.gnu.org/licenses/agpl-3.0) [![Discord link](https://img.shields.io/discord/660930260405190688?color=%237289DA&label=Discord&logo=Discord)](https://discord.com/invite/TDyYVyd)

As a fork of [DMOJ](https://github.com/DMOJ/online-judge), VNOJ serves as the official online judge and programming contests of [VNOI](https://vnoi.info/).

As a fork of [DMOJ](https://github.com/DMOJ/online-judge), VNOJ serves as the official online judge and programming contests of [VNOI](https://vnoi.info/).

See it live at [oj.vnoi.info](http://oj.vnoi.info/)!

## Features

Checkout the features listed [here](https://github.com/DMOJ/online-judge#features).

Addition features:
- Beside Python checkers [here](https://docs.dmoj.ca/#/problem_format/custom_checkers), we can write custom C++ checker using `testlib.h`.

- Beside Python checkers [here](https://docs.dmoj.ca/#/problem_format/custom_checkers), we can write custom C++ checker using `testlib.h`.

## Installation

Check out the install documentation at [docs.dmoj.ca](https://docs.dmoj.ca/#/site/installation). Almost all installation steps is the same as the docs, there is one minor change: clone this repo instead of dmoj repo.

### Additional step in installation:

- You **have to** define `DMOJ_PROBLEM_DATA_ROOT` in `local_settings.py`, this is path to your problems tests folder.

- Considering to disable Full text search, please check [this issuse](https://github.com/VNOI-Admin/OJ/issues/4) for more information.

- To sync the caching of judge server and site, change cache framework (`CACHES`) to `memcached` or `redis` instead of the default (local-memory caching).
- The "home button" the admin dashboard (/admin) will redirect to `localhost:8081` if you use `python3 manage.py loaddata demo`, there is 2 ways to fix it:
1. You can change that in [demo.json](judge/fixtures/demo.json)
2. You can go to the admin page, scoll down to find the `Sites` settings and change `localhost:8081` to your domain.

- The "home button" the admin dashboard (/admin) will redirect to `localhost:8081` if you use `python3 manage.py loaddata demo`, there is 2 ways to fix it:

1. You can change that in [demo.json](judge/fixtures/demo.json)
2. You can go to the admin page, scoll down to find the `Sites` settings and change `localhost:8081` to your domain.

- To support `testlib.h`, you need to copy the [testlib.h](https://github.com/MikeMirzayanov/testlib/blob/master/testlib.h) to g++ include path in judge server. To speed up compiler time, you may create the precompiled header to `testlib.h`.

## Contributing ![PR's Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)

Take a look at [our contribution guideline](contributing.md).

If you found any bug, please feel free to contact us via Discord [![Discord Chat](https://img.shields.io/discord/660930260405190688?color=%237289DA&label=Discord&logo=Discord)](https://discord.gg/TDyYVyd) or open an issue.
If you found any bug, please feel free to contact us via Discord [![Discord Chat](https://img.shields.io/discord/660930260405190688?color=%237289DA&label=Discord&logo=Discord)](https://discord.gg/TDyYVyd) or open an issue.

Pull requests are welcome as well. Before you submitting your PR, please check your code with [flake8](https://flake8.pycqa.org/en/latest/) and format it if needed.
Pull requests are welcome as well. Before you submitting your PR, please check your code with [flake8](https://flake8.pycqa.org/en/latest/) and format it if needed.

Translation contributions are also welcome.
17 changes: 0 additions & 17 deletions django_2_2_pymysql_patch.py

This file was deleted.

17 changes: 17 additions & 0 deletions django_ace/static/django_ace/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
editor = ace.edit(div),
mode = widget.getAttribute('data-mode'),
theme = widget.getAttribute('data-theme'),
default_light_theme = widget.getAttribute('data-default-light-theme'),
default_dark_theme = widget.getAttribute('data-default-dark-theme'),
wordwrap = widget.getAttribute('data-wordwrap'),
toolbar = prev(widget),
main_block = toolbar.parentNode;
Expand All @@ -98,6 +100,21 @@
}
if (theme) {
editor.setTheme("ace/theme/" + theme);
} else {
if (window.matchMedia) {
const setEditorTheme = function (is_dark) {
if (is_dark) {
editor.setTheme("ace/theme/" + default_dark_theme);
} else {
editor.setTheme("ace/theme/" + default_light_theme);
}
}

setEditorTheme(window.matchMedia('(prefers-color-scheme: dark)').matches);
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function(ev) {
setEditorTheme(ev.matches);
})
}
}
if (wordwrap == "true") {
editor.getSession().setUseWrapMode(true);
Expand Down
2 changes: 2 additions & 0 deletions django_ace/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def render(self, name, value, attrs=None, renderer=None):
ace_attrs['data-mode'] = self.mode
if self.theme:
ace_attrs['data-theme'] = self.theme
ace_attrs['data-default-light-theme'] = settings.ACE_DEFAULT_LIGHT_THEME
ace_attrs['data-default-dark-theme'] = settings.ACE_DEFAULT_DARK_THEME
if self.wordwrap:
ace_attrs['data-wordwrap'] = 'true'

Expand Down
2 changes: 1 addition & 1 deletion dmoj/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Load task modules from all registered Django app configs.
app.autodiscover_tasks()

# Logger to enable errors be reported.
# Logger to enable reporting of errors.
logger = logging.getLogger('judge.celery')


Expand Down
Loading

0 comments on commit 61ff301

Please sign in to comment.