diff --git a/configs/nginx-chbase.sh b/configs/nginx-chbase.sh index 0a8afe60..7e96201a 100755 --- a/configs/nginx-chbase.sh +++ b/configs/nginx-chbase.sh @@ -17,13 +17,12 @@ run() { case "${f}" in "${FILE}/"*.html|"${FILE}/"*.js|"${FILE}/"*.css) run "${NEWBASE}" "${f}";; - *) - [ -d "${f}" ] && run "${NEWBASE}" "${f}";; esac done elif [ -f "${FILE}" ] then - sed -ri "s@(href|src)=\"${CURRENT_BASE}@\1=\"${NEWBASE}@g;s@base: \"${CURRENT_BASE%/}\"@base: \"${NEWBASE%/}\"@;s@\\\$http.get\(\"${CURRENT_BASE}@\$http.get\(\"${NEWBASE}@g;s@\\\$http\((.*)\"${CURRENT_BASE}@\$http(\1\"${NEWBASE}@g;s@\"${CURRENT_BASE}_app/immutable/@\"${NEWBASE}_app/immutable/@g;s@^(\s+)paths: \{\"base\":\s*\"[^\"]*\",\"assets\":\s*\"[^\"]*\"\},\$@\1paths: {\"base\":\"${NEWBASE%/}\",\"assets\":\"${NEWBASE%/}\"},@;s@url\(${CURRENT_BASE}_app/immutable/@url(${NEWBASE}_app/immutable/@g;s@\"${CURRENT_BASE#/}_app/@\"${NEWBASE#/}_app/@g" ${FILE} + echo "Updating base path for $FILE..." + sed -ri "s@@@;s@\"${CURRENT_BASE}_app/@\"${NEWBASE}_app/@;s@base: \"${CURRENT_BASE%/}\"@base: \"${NEWBASE%/}\"@" ${FILE} fi } diff --git a/entrypoint-receiver.sh b/entrypoint-receiver.sh index f2f5453c..415f0948 100755 --- a/entrypoint-receiver.sh +++ b/entrypoint-receiver.sh @@ -15,13 +15,12 @@ run() { case "${f}" in "${FILE}/"*.html|"${FILE}/"*.js) run "${NEWBASE}" "${f}";; - *) - [ -d "${f}" ] && run "${NEWBASE}" "${f}";; esac done elif [ -f "${FILE}" ] then - sed -ri "s@(href|src)=\"${CURRENT_BASE}@\1=\"${NEWBASE}@g;s@\\\$http.get\(\"${CURRENT_BASE}@\$http.get\(\"${NEWBASE}@g;s@\\\$http\((.*)\"${CURRENT_BASE}@\$http(\1\"${NEWBASE}@g;s@\"${CURRENT_BASE}_app/immutable/@\"${NEWBASE}_app/immutable/@g;s@\"${CURRENT_BASE}_app/\"@\"${NEWBASE}_app/\"@g" ${FILE} + echo "Updating base path for $FILE..." + sed -ri "s@@@;s@\"${CURRENT_BASE}_app/@\"${NEWBASE}_app/@;s@base: \"${CURRENT_BASE%/}\"@base: \"${NEWBASE%/}\"@" ${FILE} fi } diff --git a/frontend/fic/svelte.config.js b/frontend/fic/svelte.config.js index 2a822529..17a2ea01 100644 --- a/frontend/fic/svelte.config.js +++ b/frontend/fic/svelte.config.js @@ -6,10 +6,6 @@ const config = { adapter: adapt({ fallback: 'index.html' }), - paths: { - // base: '/2022', - relative: false, - }, } }; diff --git a/receiver/chbase.sh b/receiver/chbase.sh deleted file mode 100755 index 161fb145..00000000 --- a/receiver/chbase.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# You can define the current base URL in your environment -[ -n "${CURRENT_BASE}" ] || CURRENT_BASE="/" - -usage() { - echo "$0 NEWBASE STATICDIR" - echo - echo " This script can be used to change the base URL of the frontend." - echo " Gives as PATH, the path to the static directory." - echo " You should use this script only one time (ie. from a fresh git repository)," - echo " as it doesn't erase previously defined base: it assumes the current base is /." - echo - echo " For example:" - echo - echo " $0 /$(date -d 'next year' +%Y)/" static/ - echo -} - -run() { - local NEWBASE=$1 - local FILE=$2 - - if [ -d "${FILE}" ] - then - for f in "${FILE}/"*.html "${FILE}/"*.js - do - run "${NEWBASE}" "${f}" - done - [ -d "${FILE}/js/" ] && run "${NEWBASE}" "${FILE}/js" - [ -d "${FILE}/views/" ] && run "${NEWBASE}" "${FILE}/views" - elif [ -f "${FILE}" ] - then - sed -ri "s@(href|src)=\"${CURRENT_BASE}@\1=\"${NEWBASE}@g;s@\\\$http.get\(\"${CURRENT_BASE}@\$http.get\(\"${NEWBASE}@g;s@\\\$http\((.*)\"${CURRENT_BASE}@\$http(\1\"${NEWBASE}@g" ${FILE} - fi -} - -if [ $# -gt 1 ] -then - run $1 $2 -else - usage - exit 1 -fi