mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-08 06:58:42 +00:00
Move data inside package and update references
This commit is contained in:
117
voxvera/templates/blank/extract_form_fields.sh
Normal file
117
voxvera/templates/blank/extract_form_fields.sh
Normal file
@@ -0,0 +1,117 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define the input PDF, output text file, and output JSON
|
||||
pdf_file="./from_client/submission_form.pdf"
|
||||
text_file="submission_form.txt"
|
||||
json_file="config.json"
|
||||
|
||||
# Log the start of the script
|
||||
echo "Starting script..."
|
||||
echo "Looking for PDF at: $pdf_file"
|
||||
echo "Config JSON: $json_file"
|
||||
|
||||
# Convert PDF to text
|
||||
echo "Converting PDF to text..."
|
||||
pdftotext -layout "$pdf_file" "$text_file"
|
||||
|
||||
# Extract individual fields using grep, logging each step
|
||||
echo "Extracting fields from the text file..."
|
||||
|
||||
# Adjusting the extraction of the name field
|
||||
name=$(grep -A 3 'name (max 25 characters):' "$text_file" | tail -n 1 | awk '{$1=$1;print}')
|
||||
echo "Extracted name: '$name'"
|
||||
|
||||
subdomain=$(grep -A 1 'subdomain (max 30 characters):' "$text_file" | tail -n 1 | awk '{$1=$1;print}')
|
||||
echo "Extracted subdomain: '$subdomain'"
|
||||
|
||||
title=$(grep -A 1 'title (max 30 characters):' "$text_file" | tail -n 1 | awk '{$1=$1;print}')
|
||||
echo "Extracted title: '$title'"
|
||||
|
||||
subtitle=$(grep -A 1 'subtitle (max 45 characters):' "$text_file" | tail -n 1 | awk '{$1=$1;print}')
|
||||
echo "Extracted subtitle: '$subtitle'"
|
||||
|
||||
headline=$(grep -A 1 'headline (max 50 characters):' "$text_file" | tail -n 1 | awk '{$1=$1;print}')
|
||||
echo "Extracted headline: '$headline'"
|
||||
|
||||
# Process the content to remove soft wraps while keeping hard returns
|
||||
content=$(grep -A 100 'content (max 1,400 characters):' "$text_file" | sed -n '2,/url_message/p' | sed '$d' | awk '
|
||||
{
|
||||
if (NR == 1) {
|
||||
prev = $0;
|
||||
next;
|
||||
}
|
||||
|
||||
# Handle paragraph breaks explicitly
|
||||
if ($0 ~ /^[[:space:]]*$/) {
|
||||
if (prev) print prev "\n";
|
||||
prev = "";
|
||||
}
|
||||
# Handle sentences that should stay together
|
||||
else if (prev ~ /[.?!]$/ && $0 ~ /^[[:upper:]]/) {
|
||||
prev = prev " " $0;
|
||||
}
|
||||
# Join lines that are part of the same sentence (soft wrap)
|
||||
else if (prev !~ /[.?!]$/) {
|
||||
prev = prev " " $0;
|
||||
}
|
||||
# Otherwise, treat as a new sentence/paragraph
|
||||
else {
|
||||
if (prev) print prev;
|
||||
prev = $0;
|
||||
}
|
||||
}
|
||||
END { if (prev) print prev }' | sed -E 's/\n\n[[:space:]]+/\n\n/g' | sed -E 's/^[[:space:]]+//g')
|
||||
|
||||
echo "Extracted content: '$content'"
|
||||
|
||||
url_message=$(grep -A 1 'url_message (max 60 characters):' "$text_file" | tail -n 1 | awk '{$1=$1;print}')
|
||||
echo "Extracted url_message: '$url_message'"
|
||||
|
||||
url=$(grep -A 1 'url (max 90 characters):' "$text_file" | tail -n 1 | awk '{$1=$1;print}')
|
||||
echo "Extracted url: '$url'"
|
||||
|
||||
# Construct the URLs with the subdomain
|
||||
onion_base="6dshf2gnj7yzxlfcaczlyi57up4mvbtd5orinuj5bjsfycnhz2w456yd.onion"
|
||||
constructed_url="http://$subdomain.$onion_base"
|
||||
|
||||
# Use an existing tear_off_link from the config if provided; otherwise default
|
||||
# to the constructed onion URL.
|
||||
existing_tear_off_link=$(jq -r '.tear_off_link // empty' "$json_file")
|
||||
tear_off_link="${existing_tear_off_link:-http://$subdomain.$onion_base}"
|
||||
|
||||
echo "Constructed URL: '$constructed_url'"
|
||||
echo "Using Tear-off Link: '$tear_off_link'"
|
||||
|
||||
# Check if the extracted fields are not empty
|
||||
if [ -z "$name" ] || [ -z "$subdomain" ] || [ -z "$title" ] || [ -z "$subtitle" ] || [ -z "$headline" ] || [ -z "$content" ] || [ -z "$url_message" ] || [ -z "$url" ]; then
|
||||
echo "Error: One or more extracted fields are empty. Please check the PDF form and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Update the JSON using jq and log the operation
|
||||
echo "Updating config.json..."
|
||||
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" \
|
||||
'.name = $name |
|
||||
.subdomain = $subdomain |
|
||||
.title = $title |
|
||||
.subtitle = $subtitle |
|
||||
.headline = $headline |
|
||||
.content = $content |
|
||||
.url_message = $url_message |
|
||||
.url = $url |
|
||||
.tear_off_link = $tear_off_link' "$json_file" > tmp.json && mv tmp.json "$json_file"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Config file updated successfully."
|
||||
else
|
||||
echo "Error: Failed to update config file."
|
||||
exit 1
|
||||
fi
|
12
voxvera/templates/voxvera/config.json
Normal file
12
voxvera/templates/voxvera/config.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "Vox Vera Printable Flyers",
|
||||
"subdomain": "voxvera",
|
||||
"title": "TOP SECRET",
|
||||
"subtitle": "DO <span class=\\\"redacted\\\">NOT</span> DISTRIBUTE",
|
||||
"headline": "OPERATION VOX VERA",
|
||||
"content": "Break free from censorship with VoxVera. An anonymous guerrilla marketing and message-spreading tool. Whether online or in the physical world, it can empower you to spread your ideas boldly, shielded by complete anonymity (if you host over Tor). Download the code, design a flyer site, host it online and amplify your message.\\n\\nUse memetic power to share your ideas in your school, workplace, online communities, or even globally. VoxVera ensures your message resonates far and wide, with tear-off sections featuring unique URLs and QR codes for easy reprinting.\\n\\nPrivacy can be maintained. Flyers can be shared via the Tor network, protecting hoster and users from censorship.\\n\\nJoin us in a revolution that values truth and transparency. Together, we can build a network of informed citizens who are unafraid to speak out.\n",
|
||||
"url_message": "Follow this link to learn more. Use Tor Browser.",
|
||||
"url": "https://voxvera.org/",
|
||||
"tear_off_link": "https://voxvera.org/",
|
||||
"binary_message": "0110010 0101011 0110010 0111101 0110100"
|
||||
}
|
0
voxvera/templates/voxvera/download/.gitkeep
Normal file
0
voxvera/templates/voxvera/download/.gitkeep
Normal file
BIN
voxvera/templates/voxvera/example.pdf
Normal file
BIN
voxvera/templates/voxvera/example.pdf
Normal file
Binary file not shown.
1
voxvera/templates/voxvera/index.html
Normal file
1
voxvera/templates/voxvera/index.html
Normal file
File diff suppressed because one or more lines are too long
1
voxvera/templates/voxvera/nostr.html
Normal file
1
voxvera/templates/voxvera/nostr.html
Normal file
@@ -0,0 +1 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Connect with Me on KeyChat</title><style>body{font-family:'Courier New',Courier,monospace;display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;margin:0;background-color:#fff}.container{background-color:#fff;padding:20px;border:1px solid #000;text-align:center;max-width:400px;width:90%;box-shadow:0 0 10px rgba(0,0,0,.1)}h1{color:#333}p{font-size:16px;color:#666}.code-box{background-color:#fff;border:1px solid #000;padding:10px;margin:20px 0;font-size:18px;color:#333;word-wrap:break-word;word-break:break-word;overflow-wrap:break-word;cursor:pointer;user-select:none}.copy-btn{background-color:#000;color:#fff;padding:10px 20px;border:1px solid #000;cursor:pointer;font-size:16px;transition:background-color .3s ease}.copy-btn:hover{background-color:#3d3d3d}footer{margin-top:20px;font-size:14px;color:#999}.credit{font-size:12px;margin-top:10px}a{color:#a30000;text-decoration:none}a:hover{text-decoration:underline}</style></head><body><div class="container"><h1>Nostr</h1><p>Use a secure file shareing tool like <a href="https://onionshare.org/" target="_blank">Onion Share</a> or <a href="https://wormhole.app/" target="_blank">WormHole</a> to send your completed <a href="submission_form.pdf" target="_blank">submission form PDF</a> to the following <a href="https://www.0xchat.com/#/" target="_blank">Nostr</a> npub account:</p><p></p><a href="index.html">Back to Home</a><p></p><div class="code-box" id="keyChatCode">npub1ln8efl52vsyh6lg59c9v3kut56wev489lzcma0sv2mf8nm6jhwjqeteygt</div><button class="copy-btn" onclick="copyCode()">Copy Code</button></div><footer><p>Not on Nostr yet? <a href="https://nostr.how/en/what-is-nostr" target="_blank">Learn more here</a>.</p><p class="credit">Flyer generated with <a href="https://github.com/PR0M3TH3AN/VoxVera">Vox Vera</a>.</p></footer><script>function a0_0x55b4(){var _0xeeb36b=['Failed\x20to\x20copy\x20code:\x20','36973gPfEDk','3hjGEPG','keyChatCode','clipboard','2471RXzkOy','2005220SDqWBz','then','8464mvqASw','24965hDeypK','468jCVegU','3143720lhnwYU','innerText','Code\x20copied\x20to\x20clipboard!','2722248cDzJJD','9411952bWAcnc','2gKXLTl'];a0_0x55b4=function(){return _0xeeb36b;};return a0_0x55b4();}function a0_0x2f09(_0x591295,_0x18ad6e){var _0x55b435=a0_0x55b4();return a0_0x2f09=function(_0x2f098f,_0x3b879c){_0x2f098f=_0x2f098f-0x103;var _0x38cd8a=_0x55b435[_0x2f098f];return _0x38cd8a;},a0_0x2f09(_0x591295,_0x18ad6e);}(function(_0x460aa5,_0xdd901b){var _0x26f888=a0_0x2f09,_0x58db54=_0x460aa5();while(!![]){try{var _0x40318b=parseInt(_0x26f888(0x10d))/0x1*(parseInt(_0x26f888(0x10b))/0x2)+-parseInt(_0x26f888(0x10e))/0x3*(-parseInt(_0x26f888(0x112))/0x4)+parseInt(_0x26f888(0x104))/0x5*(parseInt(_0x26f888(0x105))/0x6)+parseInt(_0x26f888(0x111))/0x7*(-parseInt(_0x26f888(0x103))/0x8)+parseInt(_0x26f888(0x109))/0x9+parseInt(_0x26f888(0x106))/0xa+-parseInt(_0x26f888(0x10a))/0xb;if(_0x40318b===_0xdd901b)break;else _0x58db54['push'](_0x58db54['shift']());}catch(_0x5c0367){_0x58db54['push'](_0x58db54['shift']());}}}(a0_0x55b4,0x4d04e));function copyCode(){var _0x263cfe=a0_0x2f09,_0x201a80=document['getElementById'](_0x263cfe(0x10f))[_0x263cfe(0x107)];navigator[_0x263cfe(0x110)]['writeText'](_0x201a80)[_0x263cfe(0x113)](function(){var _0x2c37ce=_0x263cfe;alert(_0x2c37ce(0x108));},function(_0x3011e9){var _0x5238cb=_0x263cfe;alert(_0x5238cb(0x10c),_0x3011e9);});}</script></body></html>
|
BIN
voxvera/templates/voxvera/qrcode-content.png
Normal file
BIN
voxvera/templates/voxvera/qrcode-content.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
voxvera/templates/voxvera/qrcode-tear-offs.png
Normal file
BIN
voxvera/templates/voxvera/qrcode-tear-offs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
voxvera/templates/voxvera/submission_form.pdf
Normal file
BIN
voxvera/templates/voxvera/submission_form.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user