mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-08 06:58:42 +00:00
Handle mktemp suffix compatibility
This commit is contained in:
@@ -27,9 +27,10 @@ With [Homebrew](https://brew.sh) you can install the same dependencies:
|
|||||||
brew install jq qrencode imagemagick poppler node coreutils
|
brew install jq qrencode imagemagick poppler node coreutils
|
||||||
```
|
```
|
||||||
|
|
||||||
These scripts rely on the GNU implementation of `mktemp` (`gmktemp`) found in
|
The obfuscation scripts attempt to use `mktemp --suffix` when creating
|
||||||
`coreutils`. If you prefer not to install `coreutils`, edit the scripts to use
|
temporary files. If that option is unavailable – for example on macOS without
|
||||||
`mktemp` without the `--suffix` option.
|
GNU `coreutils` – the scripts automatically fall back to a portable `mktemp`
|
||||||
|
command that yields the same result.
|
||||||
|
|
||||||
The obfuscation scripts also rely on a pair of Node modules. Install them
|
The obfuscation scripts also rely on a pair of Node modules. Install them
|
||||||
globally:
|
globally:
|
||||||
|
@@ -15,11 +15,20 @@ for cmd in javascript-obfuscator html-minifier-terser node; do
|
|||||||
require_cmd "$cmd"
|
require_cmd "$cmd"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Detect whether mktemp supports the --suffix option. If not, fall back to a
|
||||||
|
# portable template-based approach (e.g., on macOS).
|
||||||
|
if tmp=$(mktemp --suffix=.test 2>/dev/null); then
|
||||||
|
rm -f "$tmp"
|
||||||
|
mktemp_with_suffix() { mktemp --suffix="$1"; }
|
||||||
|
else
|
||||||
|
mktemp_with_suffix() { mktemp "${TMPDIR:-/tmp}/tmp.XXXXXX$1"; }
|
||||||
|
fi
|
||||||
|
|
||||||
# Input and output file names
|
# Input and output file names
|
||||||
input_file="index-master.html"
|
input_file="index-master.html"
|
||||||
output_file="index.html"
|
output_file="index.html"
|
||||||
temp_js_file=$(mktemp --suffix=.js) # Temporary .js file for extracting JavaScript
|
temp_js_file=$(mktemp_with_suffix .js) # Temporary .js file for extracting JavaScript
|
||||||
temp_js_obfuscated_file=$(mktemp --suffix=.js) # Temporary file for obfuscated JavaScript
|
temp_js_obfuscated_file=$(mktemp_with_suffix .js) # Temporary file for obfuscated JavaScript
|
||||||
temp_html_file=$(mktemp) # Temporary file for processing HTML without JS
|
temp_html_file=$(mktemp) # Temporary file for processing HTML without JS
|
||||||
|
|
||||||
# Check if the input file exists
|
# Check if the input file exists
|
||||||
|
@@ -15,11 +15,20 @@ for cmd in javascript-obfuscator html-minifier-terser node; do
|
|||||||
require_cmd "$cmd"
|
require_cmd "$cmd"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Detect whether mktemp supports the --suffix option. If not, fall back to a
|
||||||
|
# portable template-based approach (e.g., on macOS).
|
||||||
|
if tmp=$(mktemp --suffix=.test 2>/dev/null); then
|
||||||
|
rm -f "$tmp"
|
||||||
|
mktemp_with_suffix() { mktemp --suffix="$1"; }
|
||||||
|
else
|
||||||
|
mktemp_with_suffix() { mktemp "${TMPDIR:-/tmp}/tmp.XXXXXX$1"; }
|
||||||
|
fi
|
||||||
|
|
||||||
# Input and output file names
|
# Input and output file names
|
||||||
input_file="nostr-master.html"
|
input_file="nostr-master.html"
|
||||||
output_file="nostr.html"
|
output_file="nostr.html"
|
||||||
temp_js_file=$(mktemp --suffix=.js) # Temporary .js file for extracting JavaScript
|
temp_js_file=$(mktemp_with_suffix .js) # Temporary .js file for extracting JavaScript
|
||||||
temp_js_obfuscated_file=$(mktemp --suffix=.js) # Temporary file for obfuscated JavaScript
|
temp_js_obfuscated_file=$(mktemp_with_suffix .js) # Temporary file for obfuscated JavaScript
|
||||||
temp_html_file=$(mktemp) # Temporary file for processing HTML without JS
|
temp_html_file=$(mktemp) # Temporary file for processing HTML without JS
|
||||||
|
|
||||||
# Check if the input file exists
|
# Check if the input file exists
|
||||||
|
Reference in New Issue
Block a user