mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-07 14:38:42 +00:00
docs: note legacy shell wrapper
This commit is contained in:
13
README.md
13
README.md
@@ -17,6 +17,19 @@ See [docs/usage.md](docs/usage.md) for detailed usage instructions.
|
||||
|
||||
Run the installer to set up all dependencies and the `voxvera` CLI in one step.
|
||||
|
||||
If you already have the prerequisites you can install the package directly from
|
||||
PyPI:
|
||||
|
||||
```bash
|
||||
pipx install voxvera # recommended
|
||||
# or
|
||||
pip install --user voxvera
|
||||
```
|
||||
|
||||
The legacy `src/create_flyer.sh` script remains for backward compatibility. It
|
||||
simply forwards its arguments to the Python CLI so existing workflows continue
|
||||
to work.
|
||||
|
||||
### GUI
|
||||
An Electron wrapper is provided under `gui/electron` for users that prefer a graphical interface.
|
||||
Run it with:
|
||||
|
@@ -1,133 +1,10 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Legacy wrapper for voxvera Python CLI
|
||||
|
||||
set -euo pipefail
|
||||
set -e
|
||||
|
||||
require_cmd() {
|
||||
command -v "$1" >/dev/null 2>&1 || {
|
||||
echo "Error: required command '$1' not found" >&2
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
for cmd in jq node javascript-obfuscator html-minifier-terser; do
|
||||
require_cmd "$cmd"
|
||||
done
|
||||
|
||||
CONFIG_PATH="src/config.json"
|
||||
FROM_PDF=""
|
||||
NON_INTERACTIVE=0
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [-c config_path] [--from-pdf PDF] [--no-interaction]"
|
||||
echo "Create and deploy a flyer based on config.json."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-c|--config)
|
||||
CONFIG_PATH="$2"
|
||||
shift 2
|
||||
;;
|
||||
--from-pdf)
|
||||
FROM_PDF="$2"
|
||||
shift 2
|
||||
;;
|
||||
-n|--no-interaction)
|
||||
NON_INTERACTIVE=1
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1" >&2
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# convert CONFIG_PATH to absolute path for nested scripts
|
||||
CONFIG_PATH="$(realpath "$CONFIG_PATH")"
|
||||
|
||||
# Helper function to update config
|
||||
update_config_interactive() {
|
||||
read -rp "Name: " name
|
||||
read -rp "Subdomain: " subdomain
|
||||
read -rp "Title: " title
|
||||
read -rp "Subtitle: " subtitle
|
||||
read -rp "Headline: " headline
|
||||
echo "Enter content (end with EOF on its own line):"
|
||||
content=""
|
||||
while IFS= read -r line; do
|
||||
[[ "$line" == "EOF" ]] && break
|
||||
content+="$line"$'\n'
|
||||
done
|
||||
read -rp "URL message: " url_message
|
||||
|
||||
read -rp "Binary message: " binary_message
|
||||
|
||||
onion_base="6dshf2gnj7yzxlfcaczlyi57up4mvbtd5orinuj5bjsfycnhz2w456yd.onion"
|
||||
constructed_url="http://${subdomain}.${onion_base}"
|
||||
read -rp "URL [${constructed_url}]: " url
|
||||
url=${url:-$constructed_url}
|
||||
read -rp "Tear-off link [${constructed_url}]: " tear_off_link
|
||||
tear_off_link=${tear_off_link:-$constructed_url}
|
||||
|
||||
jq --arg name "$name" \
|
||||
--arg subdomain "$subdomain" \
|
||||
--arg title "$title" \
|
||||
--arg subtitle "$subtitle" \
|
||||
--arg headline "$headline" \
|
||||
--arg content "$content" \
|
||||
--arg url_message "$url_message" \
|
||||
--arg url "$url" \
|
||||
--arg tear_off_link "$tear_off_link" \
|
||||
--arg binary_message "$binary_message" \
|
||||
'.name=$name | .subdomain=$subdomain | .title=$title | .subtitle=$subtitle | .headline=$headline | .content=$content | .url_message=$url_message | .url=$url | .tear_off_link=$tear_off_link | .binary_message=$binary_message' "$CONFIG_PATH" > "$CONFIG_PATH.tmp"
|
||||
mv "$CONFIG_PATH.tmp" "$CONFIG_PATH"
|
||||
}
|
||||
|
||||
update_config_from_pdf() {
|
||||
tmpdir=$(mktemp -d)
|
||||
mkdir -p "$tmpdir/from_client"
|
||||
cp "$FROM_PDF" "$tmpdir/from_client/submission_form.pdf"
|
||||
cp host/blank/extract_form_fields.sh "$tmpdir/"
|
||||
cp "$CONFIG_PATH" "$tmpdir/config.json"
|
||||
(cd "$tmpdir" && bash extract_form_fields.sh >/dev/null)
|
||||
cp "$tmpdir/config.json" "$CONFIG_PATH"
|
||||
rm -rf "$tmpdir"
|
||||
}
|
||||
|
||||
if [[ $NON_INTERACTIVE -eq 0 ]]; then
|
||||
if [[ -n "$FROM_PDF" ]]; then
|
||||
update_config_from_pdf
|
||||
else
|
||||
update_config_interactive
|
||||
fi
|
||||
if command -v voxvera >/dev/null 2>&1; then
|
||||
voxvera "$@"
|
||||
else
|
||||
python3 -m voxvera "$@"
|
||||
fi
|
||||
|
||||
|
||||
# Regenerate QR codes based on the updated configuration
|
||||
( cd src && ./generate_qr.sh "$CONFIG_PATH" )
|
||||
|
||||
# Run obfuscation scripts
|
||||
( cd src && ./obfuscate_index.sh "$CONFIG_PATH" && ./obfuscate_nostr.sh "$CONFIG_PATH" )
|
||||
|
||||
# Insert the binary message directly into the generated HTML
|
||||
binary_message=$(jq -r '.binary_message' "$CONFIG_PATH")
|
||||
perl -0pi -e "s#<p class=\"binary\" id=\"binary-message\">.*?</p>#<p class=\"binary\" id=\"binary-message\">$binary_message</p>#s" src/index.html
|
||||
|
||||
subdomain=$(jq -r '.subdomain' "$CONFIG_PATH")
|
||||
DEST="host/${subdomain}"
|
||||
mkdir -p "$DEST/from_client"
|
||||
|
||||
cp "$CONFIG_PATH" "$DEST/config.json"
|
||||
cp src/index.html src/nostr.html src/qrcode-content.png src/qrcode-tear-offs.png src/example.pdf src/submission_form.pdf "$DEST/"
|
||||
|
||||
if [[ -n "$FROM_PDF" ]]; then
|
||||
cp "$FROM_PDF" "$DEST/from_client/submission_form.pdf"
|
||||
fi
|
||||
|
||||
echo "Flyer files created under $DEST"
|
||||
|
@@ -8,7 +8,6 @@ import sys
|
||||
import datetime
|
||||
from InquirerPy import prompt, inquirer
|
||||
from rich.console import Console
|
||||
tmpimport = None
|
||||
|
||||
|
||||
def require_cmd(cmd: str):
|
||||
|
Reference in New Issue
Block a user