mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-07 06:28:43 +00:00
Fix installers and tests
This commit is contained in:
14
README.md
14
README.md
@@ -17,10 +17,10 @@ See [docs/usage.md](docs/usage.md) for detailed usage instructions.
|
||||
|
||||
Run the installer to set up the core dependencies and install the `voxvera` CLI.
|
||||
The script installs Tor, OnionShare, `jq`, `qrencode`, and ImageMagick before
|
||||
fetching the latest release of the CLI. Other prerequisites like Node.js,
|
||||
`javascript-obfuscator`, `html-minifier-terser`, and the Python packages
|
||||
`InquirerPy` and `rich` are not installed automatically. Run `setup.sh` or
|
||||
install those packages manually if they are missing.
|
||||
fetching the latest release of the CLI. Run `setup.sh` to install additional
|
||||
dependencies such as Node.js, `javascript-obfuscator`, `html-minifier-terser`,
|
||||
and the Python packages `InquirerPy` and `rich` if they are not already
|
||||
available.
|
||||
|
||||
If you already have the prerequisites you can install the package directly from
|
||||
PyPI:
|
||||
@@ -95,14 +95,14 @@ globally:
|
||||
npm install -g javascript-obfuscator html-minifier-terser
|
||||
```
|
||||
|
||||
Install the Python dependencies:
|
||||
`setup.sh` also installs the required Python packages automatically. If you
|
||||
prefer to install them manually, run:
|
||||
|
||||
```bash
|
||||
pip install --user InquirerPy rich
|
||||
```
|
||||
|
||||
A helper script `setup.sh` is provided to check for these dependencies and
|
||||
install anything that is missing.
|
||||
The script checks for these dependencies and installs anything that is missing.
|
||||
|
||||
### Windows
|
||||
|
||||
|
@@ -5,25 +5,33 @@ LOG_DIR="$(pwd)/ci-logs"
|
||||
mkdir -p "$LOG_DIR"
|
||||
exec >"$LOG_DIR/run.log" 2>&1
|
||||
|
||||
# Install VoxVera from the local repository and time it
|
||||
{ time pip install -e .; } 2>&1
|
||||
# Install VoxVera
|
||||
if [ -n "${VOXVERA_BIN:-}" ]; then
|
||||
voxvera_cmd="$VOXVERA_BIN"
|
||||
echo "Using provided VoxVera binary: $voxvera_cmd" >&2
|
||||
else
|
||||
{ time pip install -e .; } 2>&1
|
||||
voxvera_cmd="$(command -v voxvera)"
|
||||
fi
|
||||
|
||||
# Generate demo flyer
|
||||
voxvera init --template voxvera <<EOI
|
||||
"$voxvera_cmd" init --template voxvera <<EOI
|
||||
DemoUser
|
||||
demosite
|
||||
EOI
|
||||
voxvera build
|
||||
"$voxvera_cmd" build
|
||||
ls -R dist >>"$LOG_DIR/tree.txt"
|
||||
|
||||
# Start Tor
|
||||
tor >"$LOG_DIR/tor.log" 2>&1 &
|
||||
TOR_PID=$!
|
||||
sleep 10
|
||||
# Optional network tests
|
||||
if [ "${VOXVERA_E2E_OFFLINE:-}" != "1" ]; then
|
||||
# Start Tor
|
||||
tor >"$LOG_DIR/tor.log" 2>&1 &
|
||||
TOR_PID=$!
|
||||
sleep 10
|
||||
|
||||
# Start OnionShare
|
||||
onionshare-cli --website --public --persistent dist/demosite/.onionshare-session dist/demosite >"$LOG_DIR/onionshare.log" 2>&1 &
|
||||
OS_PID=$!
|
||||
# Start OnionShare
|
||||
onionshare-cli --website --public --persistent dist/demosite/.onionshare-session dist/demosite >"$LOG_DIR/onionshare.log" 2>&1 &
|
||||
OS_PID=$!
|
||||
|
||||
# Wait for URL
|
||||
URL=""
|
||||
@@ -52,7 +60,11 @@ curl --socks5-hostname 127.0.0.1:9050 "$URL" | grep -q '<title>'
|
||||
# Clean up
|
||||
kill $OS_PID
|
||||
kill $TOR_PID
|
||||
wait $OS_PID 2>/dev/null || true
|
||||
wait $TOR_PID 2>/dev/null || true
|
||||
wait $OS_PID 2>/dev/null || true
|
||||
wait $TOR_PID 2>/dev/null || true
|
||||
else
|
||||
echo "Skipping network-dependent tests" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
45
install.ps1
45
install.ps1
@@ -39,13 +39,32 @@ function Install-PipFallback {
|
||||
}
|
||||
}
|
||||
|
||||
function Install-PipRepoFallback {
|
||||
if (Get-Command pip -ErrorAction SilentlyContinue) {
|
||||
try {
|
||||
pip install --user git+https://github.com/PR0M3TH3AN/VoxVera
|
||||
Write-Host 'VoxVera installed successfully from repository.'
|
||||
exit 0
|
||||
} catch {
|
||||
Write-Error 'pip installation from repository failed.'
|
||||
exit 1
|
||||
}
|
||||
} else {
|
||||
Write-Error 'pip not found for fallback installation.'
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
function Download-Binary {
|
||||
param([string]$Url, [string]$Dest)
|
||||
try {
|
||||
Invoke-WebRequest -Uri $Url -OutFile $Dest -ErrorAction Stop
|
||||
return $true
|
||||
$response = Invoke-WebRequest -Uri $Url -OutFile $Dest -ErrorAction Stop
|
||||
return $response.StatusCode
|
||||
} catch {
|
||||
return $false
|
||||
if ($_.Exception.Response) {
|
||||
return $_.Exception.Response.StatusCode.value__
|
||||
}
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,11 +85,15 @@ if (Get-Command pipx -ErrorAction SilentlyContinue) {
|
||||
$dest = Join-Path $home '.local\bin'
|
||||
New-Item -ItemType Directory -Path $dest -Force | Out-Null
|
||||
$url = 'https://github.com/PR0M3TH3AN/VoxVera/releases/latest/download/voxvera.exe'
|
||||
if (-not (Download-Binary $url "$dest/voxvera.exe")) {
|
||||
$status = Download-Binary $url "$dest/voxvera.exe"
|
||||
if ($status -eq 200) {
|
||||
Check-LocalBin
|
||||
} elseif ($status -eq 404) {
|
||||
Write-Host 'Release asset not found, installing from repository'
|
||||
Install-PipRepoFallback
|
||||
} else {
|
||||
Write-Host 'Binary download failed, falling back to pip'
|
||||
Install-PipFallback
|
||||
} else {
|
||||
Check-LocalBin
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -78,11 +101,15 @@ if (Get-Command pipx -ErrorAction SilentlyContinue) {
|
||||
$dest = Join-Path $home '.local\bin'
|
||||
New-Item -ItemType Directory -Path $dest -Force | Out-Null
|
||||
$url = 'https://github.com/PR0M3TH3AN/VoxVera/releases/latest/download/voxvera.exe'
|
||||
if (-not (Download-Binary $url "$dest/voxvera.exe")) {
|
||||
$status = Download-Binary $url "$dest/voxvera.exe"
|
||||
if ($status -eq 200) {
|
||||
Check-LocalBin
|
||||
} elseif ($status -eq 404) {
|
||||
Write-Host 'Release asset not found, installing from repository'
|
||||
Install-PipRepoFallback
|
||||
} else {
|
||||
Write-Host 'Binary download failed, falling back to pip'
|
||||
Install-PipFallback
|
||||
} else {
|
||||
Check-LocalBin
|
||||
}
|
||||
}
|
||||
|
||||
|
60
install.sh
60
install.sh
@@ -65,12 +65,24 @@ download_binary() {
|
||||
local url=$1
|
||||
local dest=$2
|
||||
if command_exists curl; then
|
||||
curl -fsSL "$url" -o "$dest" || return 1
|
||||
local status
|
||||
status=$(curl -w "%{http_code}" -fsSL "$url" -o "$dest" || true)
|
||||
if [ "$status" = "404" ]; then
|
||||
return 2
|
||||
elif [ "$status" != "200" ]; then
|
||||
return 1
|
||||
fi
|
||||
elif command_exists wget; then
|
||||
wget -q "$url" -O "$dest" || return 1
|
||||
local out
|
||||
out=$(wget --server-response -q "$url" -O "$dest" 2>&1 || true)
|
||||
if echo "$out" | grep -q "404 Not Found"; then
|
||||
return 2
|
||||
elif ! echo "$out" | grep -q "200 OK"; then
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo "Install curl or wget to download voxvera" >&2
|
||||
return 2
|
||||
return 1
|
||||
fi
|
||||
chmod +x "$dest"
|
||||
}
|
||||
@@ -95,6 +107,20 @@ pip_fallback() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
pip_repo_fallback() {
|
||||
if command_exists pip; then
|
||||
echo "Attempting pip install from repository as fallback..."
|
||||
if pip install --user git+https://github.com/PR0M3TH3AN/VoxVera; then
|
||||
echo "VoxVera installed successfully from repository."
|
||||
exit 0
|
||||
fi
|
||||
echo "pip installation from repository failed." >&2
|
||||
else
|
||||
echo "pip not found for fallback installation" >&2
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
if command_exists pipx; then
|
||||
if ! pipx install --force voxvera; then
|
||||
echo "pipx install failed, downloading binary"
|
||||
@@ -102,11 +128,17 @@ if command_exists pipx; then
|
||||
mkdir -p "$install_dir"
|
||||
url="https://github.com/PR0M3TH3AN/VoxVera/releases/latest/download/voxvera"
|
||||
dest="$install_dir/voxvera"
|
||||
if ! download_binary "$url" "$dest"; then
|
||||
echo "Binary download failed, falling back to pip." >&2
|
||||
pip_fallback
|
||||
else
|
||||
if download_binary "$url" "$dest"; then
|
||||
check_local_bin
|
||||
else
|
||||
rc=$?
|
||||
echo "Binary download failed." >&2
|
||||
if [ $rc -eq 2 ]; then
|
||||
echo "Release asset not found, installing from repository." >&2
|
||||
pip_repo_fallback
|
||||
else
|
||||
pip_fallback
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
@@ -114,11 +146,17 @@ else
|
||||
mkdir -p "$install_dir"
|
||||
url="https://github.com/PR0M3TH3AN/VoxVera/releases/latest/download/voxvera"
|
||||
dest="$install_dir/voxvera"
|
||||
if ! download_binary "$url" "$dest"; then
|
||||
echo "Binary download failed, falling back to pip." >&2
|
||||
pip_fallback
|
||||
else
|
||||
if download_binary "$url" "$dest"; then
|
||||
check_local_bin
|
||||
else
|
||||
rc=$?
|
||||
echo "Binary download failed." >&2
|
||||
if [ $rc -eq 2 ]; then
|
||||
echo "Release asset not found, installing from repository." >&2
|
||||
pip_repo_fallback
|
||||
else
|
||||
pip_fallback
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
4
setup.sh
4
setup.sh
@@ -41,11 +41,11 @@ done
|
||||
|
||||
# ensure Python packages used by the CLI are available
|
||||
for py in InquirerPy rich; do
|
||||
python3 - <<EOF >/dev/null 2>&1
|
||||
if ! python3 - <<EOF >/dev/null 2>&1
|
||||
import importlib.util, sys
|
||||
sys.exit(0 if importlib.util.find_spec('$py') else 1)
|
||||
EOF
|
||||
if [ $? -ne 0 ]; then
|
||||
then
|
||||
pip install --user "$py"
|
||||
fi
|
||||
done
|
||||
|
Reference in New Issue
Block a user