Giter Site home page Giter Site logo

domprinter's Introduction

DOMPrinter

Test codecov Go Report Card GitHub go.mod Go version Github release platform License

Usage

Server

首先需要在 Database 里面创建一张表:建表语句 SQL,DB 你可以复用 DOMjudge 的那个 Database,也可以自己再建一个新的 Database

然后通过 Docker 启动 DOMPrinter 服务,可以参考以下脚本启动容器:

IMAGE="dup4/domprinter:0.0.26"

docker run \
    -d \
    --restart=always \
    --name="${your container name}" \
    -e TZ=Asia/Shanghai \
    -e MYSQL_HOSTNAME="${your db host name}" \
    -e MYSQL_PORT="${your db port}" \
    -e MYSQL_USERNAME="${your db username}" \
    -e MYSQL_PASSWORD="${your db password}" \
    -e MYSQL_SCHEMA="${your db database name}" \
    -e AUTH_USERNAME="${auth username, used for printer client}" \
    -e AUTH_PASSWORD="${auth password}" \
    -p 80:8888 \ # You can change the mapped ports as needed
    "${IMAGE}"

然后 DOMPrinter 的服务端就搞定了

Client

然后需要在能够控制打印机的机器上,安装并启动 printer_client

Handle Script

然后需要将 DOMjudge 和 DOMPrinter 串起来

alt text

你需要在上图所示的这个位置,填入一行命令

/on_print.sh [file] [original] [language] [username] [teamname] [teamid] [location] 2>&1

可以参考这一行命令,on_print.sh 的内容在这里,你需要把这个脚本复制到指定位置,比如按上面的命令,那就需要复制到 /on_print.sh 这个位置

友情提醒:不要在这一行命令中填入任何敏感信息,因为这个配置可以被一个公共的 API (/domjudge/api/v4/config)拿到,如果有选手(比如 2024 浙江省赛位于 2-B26 的某位选手)对 DOMjudge 特别熟悉,那么这场比赛可能就危险了

错误示范:

AUTH_USERNAME=domprinter AUTH_PASSWORD=domprinter DOMPRINTER_HOSTNAME=domprinter /on_print.sh [file] [original] [language] [username] [teamname] [teamid] [location] 2>&1

不要将 DOMPrinter Server 相关信息通过这种方式传入脚本,不然选手能够通过 DOMjudge API 拿到这些信息,并且可能能够直接连入 DOMPrinter Server 拿到别的队伍的打印代码

Sponsors

Logos from Sponsors

License

MIT License © 2020 - PRESENT XCPCIO

domprinter's People

Contributors

dup4 avatar y0omu avatar

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.