mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-08 23:18:42 +00:00
update
This commit is contained in:
12
host/blank/config.json
Normal file
12
host/blank/config.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "",
|
||||
"subdomain": "",
|
||||
"title": "",
|
||||
"subtitle": "",
|
||||
"headline": "",
|
||||
"content": "",
|
||||
"url_message": "",
|
||||
"url": "",
|
||||
"tear_off_link": "",
|
||||
"binary_message": "0110010 0101011 0110010 0111101 0110100"
|
||||
}
|
BIN
host/blank/example.pdf
Normal file
BIN
host/blank/example.pdf
Normal file
Binary file not shown.
112
host/blank/extract_form_fields.sh
Executable file
112
host/blank/extract_form_fields.sh
Executable file
@@ -0,0 +1,112 @@
|
||||
#!/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"
|
||||
tear_off_link="http://$subdomain.$onion_base"
|
||||
echo "Constructed URL: '$constructed_url'"
|
||||
echo "Constructed 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 "$constructed_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
|
BIN
host/blank/from_client/submission_form.pdf
Normal file
BIN
host/blank/from_client/submission_form.pdf
Normal file
Binary file not shown.
1
host/blank/index.html
Normal file
1
host/blank/index.html
Normal file
File diff suppressed because one or more lines are too long
1
host/blank/nostr.html
Normal file
1
host/blank/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}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></footer><script>(function(_0x3f0d39,_0x5cad8e){var _0x17b6f3=a0_0x3b8a,_0x3ba263=_0x3f0d39();while(!![]){try{var _0xfbc8a8=parseInt(_0x17b6f3(0x14c))/0x1*(-parseInt(_0x17b6f3(0x150))/0x2)+-parseInt(_0x17b6f3(0x148))/0x3*(parseInt(_0x17b6f3(0x145))/0x4)+parseInt(_0x17b6f3(0x149))/0x5*(-parseInt(_0x17b6f3(0x144))/0x6)+-parseInt(_0x17b6f3(0x14a))/0x7*(parseInt(_0x17b6f3(0x14f))/0x8)+-parseInt(_0x17b6f3(0x142))/0x9+parseInt(_0x17b6f3(0x13f))/0xa*(parseInt(_0x17b6f3(0x14e))/0xb)+-parseInt(_0x17b6f3(0x13e))/0xc*(-parseInt(_0x17b6f3(0x147))/0xd);if(_0xfbc8a8===_0x5cad8e)break;else _0x3ba263['push'](_0x3ba263['shift']());}catch(_0x37e771){_0x3ba263['push'](_0x3ba263['shift']());}}}(a0_0x5414,0xd4e21));function a0_0x3b8a(_0x1324a6,_0x3d024a){var _0x54140d=a0_0x5414();return a0_0x3b8a=function(_0x3b8a2d,_0x350160){_0x3b8a2d=_0x3b8a2d-0x13e;var _0x753cb1=_0x54140d[_0x3b8a2d];return _0x753cb1;},a0_0x3b8a(_0x1324a6,_0x3d024a);}function a0_0x5414(){var _0xf6a092=['Failed\x20to\x20copy\x20code:\x20','13FzsFUs','1976421lICgxk','880430taZArI','28FqvGbv','keyChatCode','1502997STiVAp','innerText','176SvMeKC','48536fRJZWT','2kIOEno','50323680nGsOaP','270350ybseKd','clipboard','getElementById','12528657YfIOtE','Code\x20copied\x20to\x20clipboard!','6NOIDPk','4qiIZtI'];a0_0x5414=function(){return _0xf6a092;};return a0_0x5414();}function copyCode(){var _0x3dca34=a0_0x3b8a,_0x385a15=document[_0x3dca34(0x141)](_0x3dca34(0x14b))[_0x3dca34(0x14d)];navigator[_0x3dca34(0x140)]['writeText'](_0x385a15)['then'](function(){var _0x28ac25=_0x3dca34;alert(_0x28ac25(0x143));},function(_0x249ea4){var _0x716083=_0x3dca34;alert(_0x716083(0x146),_0x249ea4);});}</script></body></html>
|
BIN
host/blank/qrcode-content.png
Normal file
BIN
host/blank/qrcode-content.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
BIN
host/blank/qrcode-tear-offs.png
Normal file
BIN
host/blank/qrcode-tear-offs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
BIN
host/blank/submission_form.pdf
Normal file
BIN
host/blank/submission_form.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user