78 lines
2.4 KiB
Plaintext
78 lines
2.4 KiB
Plaintext
Portable mini-program QR PoC
|
|
|
|
Requirements:
|
|
- Python 3
|
|
- Node.js
|
|
|
|
CLI usage:
|
|
1) Fetch server data and generate GIF
|
|
python3 miniapp_qr_poc.py --member-id 114477 --json-out member_114477.json --gif-out member_114477.gif
|
|
|
|
2) Offline mode from an existing qr hex string
|
|
python3 miniapp_qr_poc.py --qr A92205FA05FA000E3C9E107C23EE7F1234560031050C0000000000000000000000000000000000000000000000000000000000000000003A0000 --gif-out out.gif
|
|
|
|
Web usage:
|
|
1) Install dependencies
|
|
python3 -m pip install -r requirements.txt
|
|
|
|
2) Start the web page
|
|
python3 web_app.py
|
|
|
|
3) Open:
|
|
http://127.0.0.1:8000
|
|
|
|
Docker usage:
|
|
1) Build
|
|
docker build -t miniapp-qr-web .
|
|
|
|
2) Run
|
|
docker run --rm -p 8000:8000 -e TZ=Asia/Shanghai -e MINIAPP_QR_TIMEZONE=Asia/Shanghai miniapp-qr-web
|
|
|
|
Or use compose:
|
|
docker compose up --build
|
|
|
|
Features:
|
|
- Reads IDs from ./found_ids.txt
|
|
- Lets you select an ID from the page
|
|
- Calls the original API and generates the QR GIF in-browser
|
|
- Keeps the original CLI script available
|
|
|
|
Notes:
|
|
- The script looks for JS dependencies relative to itself under ./js/
|
|
- It reproduces the mini-program's getCommand(qr) wrapping and uses the bundled QR JS renderer
|
|
- Default timezone for QR payload generation is Asia/Shanghai; you can override it with MINIAPP_QR_TIMEZONE
|
|
|
|
Gitea CI/CD template:
|
|
1) Add `.gitea/workflows/docker-cicd.yaml` to your repository.
|
|
|
|
2) Repository Actions must be enabled:
|
|
- Repository Settings -> Enable Repository Actions
|
|
|
|
3) Your runner should have a label like:
|
|
linux_amd64
|
|
|
|
4) The runner host needs these commands installed:
|
|
- git
|
|
- docker
|
|
- curl
|
|
|
|
5) Required repository variables/secrets:
|
|
Variables:
|
|
- PACKAGE_USER -> optional; defaults to current repo owner. If your repo is under an organization, or the token belongs to another user/bot, set this explicitly to the token owner username.
|
|
- DEFAULT_BRANCH -> optional, defaults to main
|
|
- IMAGE_NAME -> optional, defaults to current repo name
|
|
|
|
Secret:
|
|
- DOCKER_TOKEN -> personal access token with at least repository read + package read/write permissions
|
|
|
|
6) What the workflow does:
|
|
- clones the current repo from Gitea
|
|
- builds the Docker image
|
|
- pushes it to the current Gitea instance package registry
|
|
- links the pushed container package back to the current repository
|
|
|
|
7) Registry image naming:
|
|
{gitea-domain}/{owner}/{image}
|
|
Example:
|
|
gitea.example.com/myteam/miniapp_qr_portable_bundle:latest
|