setup librejs license and cachebust service worker file

This commit is contained in:
realaravinth
2021-12-02 14:25:29 +05:30
parent 0126dc0e3a
commit 410232041b
4 changed files with 80 additions and 31 deletions

View File

@@ -8,29 +8,10 @@ readonly DIST=$PROJECT_ROOT/static/cache/bundle/
readonly SOURCE="// @source https://github.com/mCaptcha/mCaptcha"
readonly LICENSE_END="// @license-end"
cleanup() {
trap - SIGINT SIGTERM ERR EXIT
# script cleanup here
}
setup_colors() {
if [[ -t 2 ]] && [[ -z "${NO_COLOR-}" ]] && [[ "${TERM-}" != "dumb" ]]; then
NOCOLOR='\033[0m' RED='\033[0;31m' GREEN='\033[0;32m' ORANGE='\033[0;33m' BLUE='\033[0;34m' PURPLE='\033[0;35m' CYAN='\033[0;36m' YELLOW='\033[1;33m'
else
NOCOLOR='' RED='' GREEN='' ORANGE='' BLUE='' PURPLE='' CYAN='' YELLOW=''
fi
}
msg() {
echo >&2 -e "${1-}"
}
get_file_name() {
echo $file | rev | cut -d '/' -f 1 | rev
}
source $PROJECT_ROOT/scripts/lib.sh
print_license_msg() {
msg "${GREEN}[*] Applying $1 on $(get_file_name $2)"
msg "${GREEN}- Applying $1 on $(get_file_name $2)"
}
apply_agpl() {
@@ -53,6 +34,8 @@ apply_apache() {
setup_colors
msg "${BLUE}[*] LibreJS processor running"
for file in $(find $DIST -type f -a -name "*.js")
do
contents=$(cat $file)
@@ -63,12 +46,12 @@ do
"bundle.js")
apply_agpl $file
;;
"verificationWidget.js")
"verificationWidget.js" | "bench.js")
apply_x11 $file
apply_apache $file
;;
*)
msg "${RED}[!] License not configured for $name. Applying default license"
msg "${RED}- [!] License not configured for $name. Applying default license"
apply_agpl $file
;;
esac