├── README.md ├── package.json ├── Dockerfile ├── static ├── script.js └── style.css ├── views ├── register.ejs ├── preview.ejs └── button.ejs ├── .github └── workflows │ ├── docker-dockerhub.yml │ └── docker-github.yml ├── index.js └── yarn.lock /README.md: -------------------------------------------------------------------------------- 1 | # 2022 HGAME WEEK2 Designer 2 | 3 | > Come and design your button 4 | 5 | 本项目使用动态flag,请使用`$FLAG`环境变量传入flag数据(如`CTFd`),题目环境位于`9090`端口 6 | 7 | docker镜像发布于DockerHub:`randark/2023-hgame-week2-web-designer:master` 8 | 9 | 源码储存于Github:https://github.com/CTF-Archives/2023-hgame-week2-web-designer -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "btn-designer", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "ejs": "^3.1.8", 8 | "express": "^4.18.2", 9 | "jsonwebtoken": "^9.0.0", 10 | "nodemon": "^2.0.20", 11 | "puppeteer": "^19.5.2", 12 | "query-string": "^8.1.0" 13 | }, 14 | "scripts": { 15 | "start": "nodemon -x 'node index.js || touch index.js'" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:19 2 | 3 | RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \ 4 | && sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list \ 5 | && apt-get update \ 6 | && apt-get install -y chromium \ 7 | && rm -rf /var/lib/apt/lists/* 8 | 9 | WORKDIR /app 10 | ADD . . 11 | RUN yarn config set registry https://registry.npmmirror.com && yarn 12 | 13 | CMD ["yarn", "start"] -------------------------------------------------------------------------------- /static/script.js: -------------------------------------------------------------------------------- 1 | $('.message a').click(function () { 2 | $('form').animate({ height: "toggle", opacity: "toggle" }, "slow"); 3 | }) 4 | 5 | $('#register').click(e => { 6 | e.preventDefault() 7 | const username = $('#username').val() 8 | axios.post("/user/register", { username }).then(res => { 9 | const { token } = res.data 10 | localStorage.setItem("token", token) 11 | if (token) { 12 | window.location = "/button/edit" 13 | } 14 | }) 15 | }) -------------------------------------------------------------------------------- /views/register.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |