From 1f46e5aa5f03c9f261ab8e08d52aa1e57411ab79 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 18 Jun 2025 21:56:42 -0400 Subject: [PATCH] Resolve paths in OnionShare script --- README.md | 5 +++-- serve_with_onionshare.sh | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3d2df1b..001416a 100644 --- a/README.md +++ b/README.md @@ -102,8 +102,9 @@ same subdomain are removed before new files are written. ## Hosting with OnionShare The folder under `host/` contains everything needed to serve the -flyer. Run the helper script `serve_with_onionshare.sh` from the repository -root to publish it over Tor: +flyer. Run the helper script `serve_with_onionshare.sh` to publish it over Tor. +The script now resolves the configuration and host paths internally, so it can +be invoked from any directory: ```bash ./serve_with_onionshare.sh diff --git a/serve_with_onionshare.sh b/serve_with_onionshare.sh index 8ef242e..163dab8 100755 --- a/serve_with_onionshare.sh +++ b/serve_with_onionshare.sh @@ -8,7 +8,10 @@ fi # get subdomain from config subdomain=$(jq -r '.subdomain' "$CONFIG") -DIR="host/${subdomain}" + +# resolve paths to absolute locations so the script works from anywhere +CONFIG="$(realpath "$CONFIG")" +DIR="$(realpath "host/$subdomain")" if [[ ! -d "$DIR" ]]; then echo "Directory $DIR not found" >&2 exit 1