kiwix-js/scripts/test_pwa_server.sh
Daksh Bajaj dda6fe9762
Moved configuration code to init.js #1033 (#1057)
Fixes #1033
Signed off by @Daksh119.
2023-08-25 10:18:27 +01:00

15 lines
515 B
Bash

#!/bin/bash
# This bash script tests whether PWAServer has been set correctly in init.js
SERVER=$(grep -E '^[^/]+?params.+?PWAServer.+?http' ./www/js/init.js)
echo "The PWAServer is set to $SERVER"
SERVER_COUNT=$(grep -o 'PWAServer' <<< "$SERVER" | wc -l)
echo "$SERVER_COUNT server(s) are set in init.js"
if [[ $SERVER_COUNT > 1 || ! $SERVER =~ 'kiwix.org' ]]; then
echo "WARNING: The value of params['PWAServer'] is incorrectly set in init.js!"
exit 1
else
echo "PWAServer is correctly set in init.js"
fi