Coder Social home page Coder Social logo

judgegirl / judgenode Goto Github PK

View Code? Open in Web Editor NEW
56.0 56.0 16.0 55.76 MB

Small Online Judge frontend, based on Nodejs, Express4, MySQL

Home Page: http://judgegirl.csie.ntu.edu.tw/

License: GNU General Public License v3.0

JavaScript 67.86% CSS 8.84% HTML 23.19% Python 0.07% Makefile 0.01% CoffeeScript 0.02% Shell 0.02%

judgenode's People

Contributors

jaidtw avatar morris821028 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

judgenode's Issues

SSL Certificate - Failed to load resource: net::ERR_INSECURE_RESPONSE

主要原因為 Chrome 只為某個 domain name 進行合法憑證,假設現在對 judgegirl.csie.org 網站進行信任,在尚未對實際主機 IP 140.112.31.208 進行信任,在 judgegirl.csie.org 中使用 ajax 訪問 https://140.112.31.208 則會發生錯誤。

修改方式預計在 express 中介層,加入設定參數 req.hostname,針對不同使用者從不同 domain name 進入網站而做不同渲染工作。
http://expressjs.com/en/api.html#req.hostname

第一班 第二班

Could we use 週一班,週二班? It will be much easier to understand.

批改考卷設計 - 選擇題提交

由鑒於 NTU 系統目前沒提供選擇題考卷,下學期平行程式設計的小考考卷批改!

若在電腦教室上課,目標加入電腦閱卷功能。

預設上傳檔案個數限制

router.post('/submit', 
    upload.fields([{name: 'code0', maxCount: 1}, {name: 'code1', maxCount: 1},
                   {name: 'code2', maxCount: 1}, {name: 'code3', maxCount: 1},
                   {name: 'code4', maxCount: 1}, {name: 'code5', maxCount: 1},
                   {name: 'code6', maxCount: 1}, {name: 'code7', maxCount: 1}]), 

回報訊息:不知道是不是上傳的source檔案數量有限制,剛剛有個題目 10 個 source 一上傳就 JudgeNode 就 crash

目標在下一次工作日研究一下 multer 給的 API,並完成檔案傳輸個數與大小上傳限制的測試。

yaml setting & .gitignore

建造 _config.yml 檔案,使用 YAML format 方便處理預設內容,而不直接去更動 source code。

# JUDGE_PATH/submission /testdata /source
# JUDGE_PATH: c:/Users/morris821028/Desktop/github/
JUDGE_PATH: /home/c2014/judgesister/

# MODE: limits user open previous source code & submit problem which not in contest.
CONTEST:
    MODE: true
    SUBMIT_LIMIT: 15

# DATABASE Setting, MySQL
DATABASE:
    host: '140.112.xxx.xxxx'
    user: 'c2015'
    password: 'xxxxxxxxxx'
    port: '3306'
    dbname: 'c2015'

加入 .gitignore 把 log 檔案移除。

考試規則客製化

對於每一場考試說明,提供預設內容和可以更改的 markdown 類型,有如 problem description 得更動頁面。

Submission number

List the number of times the student has submitted a solution to a task.

User 介面的最近上傳連結錯誤

http://xxx.xxx.xxx.xxx/user/1,點選上傳紀錄會跳轉到 http://xxx.xxx.xxx.xxx/user/1/detail/xxxxx,正確顯示應為 http://xxx.xxx.xxx.xxx/detail/xxxxx

AC code made public to other ACer.

One can see other's AC code when he gets AC. I think a better implementation is to give the student the following option. If he allows other ACer to see his AC code, the he can see others' AC code when he gets AC.

Submission widget

由於加入重測按鈕,總共有三個地方會顯示 submission,problem/status, problem/mystatus, user/status,為了往後更改,需要加入統一的模組參數。

建議修改

$ chmod +x deploy_mySQL.sh
$ ./deploy_mysql.sh
大小寫

$ python distribute_setup.py
未更新

root $ cd Judge-receiver/scripts
沒s

$ bower install
$ gulp build
以上皆須先NPM INSTALL BOWER,GULP

$ ./start
先安裝colorama by pip3
pip3 install colorama

$ node adduser.js nodejs judgegirl notpassword 0 [email protected]
參數有錯 nodejs adduser.js $1 $2 $3 $4
motto nname ename 沒有default值
須自行加入adduser.js

root $ cd Judge-receiver/scripts
root $ ./mount
./mount,每一次主機重新開啟 (例如斷電重開職主機後),要重新執行這條指令

Distributed Judge configuration

需要更好的 Judge 排程,區分成 rejudge 和 livejudge,

  • livejudge 最新上傳應該按照時間優先測試。
  • rejudge 針對題目重新測試,應在 idle 下進行重測,並不影響 livejudge。

為何在題目下方的留言會自動加上="">?

為何在題目下方的留言會自動加上="">?我在題目留言之後發現留言後方被自動加上了="">這串符號
如圖
送出前
image
送出後
image
想請問會這樣設計的原因是什麼?是不是為了要防止SQL injection ?

URL 網址前綴設計

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://judgegirl.github.io/
root: /

用來與其他網站伺服器架構結合,提供轉跳用途。

Nginx: build JudgeNode (virtual host)

/etc/nginx/sites-available 下建立 judgegirl 的資訊,目前將 Nodejs 開在 port 4000。host domain name 為 apponline.tw,預期使用 judgegirl.apponline.tw 連入。

root@tts:/etc/nginx/sites-available# cat judgegirl
upstream nodejs {
        server 127.0.0.1:4000 max_fails=0;
}

server {
        listen 80;
        server_name judgegirl.apponline.tw;


      location / {
        proxy_pass  http://127.0.0.1:4000;
      }
   }

複製一份連結到 /etc/nginx/sites-available 目錄下

$ cd /etc/nginx/sites-enabled
$ ln -s /etc/nginx/sites-available/judgegirl .

測試 nginx 設定檔案是否可行

$ sudo nginx -t

如果測試成功,直接重開 nginx 服務

$ service nginx restart

之後再測試 https port 443 的情況。

Ubuntu 16.04 Update Problems: MySQL, Redis Server

Redis Server

You may got the error message when you start with redis server. Please check the port 6379 usage first, and then check redis setting in host OS.

https://bugs.launchpad.net/ubuntu/+source/redis/+bug/1663911

    $ sudo su
    $ mkdir /etc/systemd/system/redis-server.service.d/
    $ cd /etc/systemd/system/redis-server.service.d/
    $ echo '[Service]' > redis.override.conf
    $ echo 'PrivateDevices=no' >> redis.override.conf

MySQL grouping

Please degrade your MySQL version into 5.6. There are some SQL query sentences written by me as web beginner. If you don't want to change MySQL server, remove group feature from MySQL configuration.

https://stackoverflow.com/questions/23921117/disable-only-full-group-by

https://blog.csdn.net/helloxiaozhe/article/details/78570016

https://blog.csdn.net/u283056051/article/details/52463948

Use https and mulitdomain with letsencrypt

https://github.com/letsencrypt/letsencrypt

./letsencrypt-auto certonly --standalone --email [email protected] -d judgegirl.csie.org
./letsencrypt-auto certonly --standalone --email [email protected] -d judgegirl.csie.ntu.edu.tw

change ./bin/www

/*
  https
*/
var crypto = require('crypto');
var https = require('https'),
    fs = require("fs");

function getSecureContext(domain) {
    return crypto.createCredentials({
        key:  fs.readFileSync('/etc/letsencrypt/live/'+ domain + '/privkey.pem'),
        cert:  fs.readFileSync('/etc/letsencrypt/live/' + domain + '/cert.pem')
      }).context;
}

var secureContext = {
    'judgegirl.csie.org': getSecureContext('judgegirl.csie.org'),
    'judgegirl.csie.ntu.edu.tw': getSecureContext('judgegirl.csie.ntu.edu.tw')
};

var options = {
    SNICallback: function(domain) {
        return secureContext[domain];
    },
    port: 443,
    path: '/140.112.31.208',
    method: 'GET',
    key: fs.readFileSync('/etc/letsencrypt/live/judgegirl.csie.org/privkey.pem'),
    cert: fs.readFileSync('/etc/letsencrypt/live/judgegirl.csie.org/cert.pem')
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.