mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-08 06:58:42 +00:00
Merge pull request #2 from PR0M3TH3AN/codex/create-qr-generation-script-and-update-workflow
Add QR code generation script
This commit is contained in:
@@ -6,6 +6,7 @@ This repository contains a simple Bash script to obfuscate and minify a single H
|
||||
|
||||
- **Debian/Ubuntu**: This script is designed to work on Debian-based systems.
|
||||
- **Node.js**: Terser and html-minifier-terser require Node.js to be installed.
|
||||
- **qrencode**: Generates the QR codes used in the flyers.
|
||||
|
||||
### Install Node.js and npm on Debian
|
||||
|
||||
@@ -128,3 +129,5 @@ The `create_flyer.sh` script automates filling `config.json`, building the HTML
|
||||
```
|
||||
|
||||
By default the script updates `src/config.json`. After answering the prompts (or extracting from the PDF), `index.html` and `nostr.html` are generated and copied along with the QR code images and PDFs. The files end up in `host/<subdomain>` which can be served statically.
|
||||
|
||||
QR codes are built automatically during this process. After the configuration is updated, `create_flyer.sh` calls `generate_qr.sh` to read the URLs from `config.json` and produce `qrcode-content.png` and `qrcode-tear-offs.png`.
|
||||
|
@@ -84,6 +84,9 @@ else
|
||||
update_config_interactive
|
||||
fi
|
||||
|
||||
# Regenerate QR codes based on the updated configuration
|
||||
( cd src && ./generate_qr.sh )
|
||||
|
||||
# Run obfuscation scripts
|
||||
( cd src && ./obfuscate_index.sh && ./obfuscate_nostr.sh )
|
||||
|
||||
|
29
src/generate_qr.sh
Executable file
29
src/generate_qr.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
CONFIG="src/config.json"
|
||||
|
||||
# Ensure dependencies
|
||||
command -v jq >/dev/null 2>&1 || { echo "jq is required" >&2; exit 1; }
|
||||
command -v qrencode >/dev/null 2>&1 || { echo "qrencode is required" >&2; exit 1; }
|
||||
command -v convert >/dev/null 2>&1 || { echo "ImageMagick convert is required" >&2; exit 1; }
|
||||
|
||||
url=$(jq -r '.url' "$CONFIG")
|
||||
tear=$(jq -r '.tear_off_link' "$CONFIG")
|
||||
|
||||
[ -n "$url" ] || { echo "URL missing in $CONFIG" >&2; exit 1; }
|
||||
[ -n "$tear" ] || { echo "tear_off_link missing in $CONFIG" >&2; exit 1; }
|
||||
|
||||
tmp_content=$(mktemp)
|
||||
tmp_tear=$(mktemp)
|
||||
|
||||
qrencode -o "$tmp_content" -s 10 -m 0 "$url"
|
||||
qrencode -o "$tmp_tear" -s 10 -m 0 "$tear"
|
||||
|
||||
convert "$tmp_content" -resize 128x128 "src/qrcode-content.png"
|
||||
convert "$tmp_tear" -resize 128x128 "src/qrcode-tear-offs.png"
|
||||
|
||||
rm -f "$tmp_content" "$tmp_tear"
|
||||
|
||||
echo "QR codes generated in src/"
|
Reference in New Issue
Block a user