LocalCDN-Firefox-Chrome-Brave/audit/audit.sh

828 lines
38 KiB
Bash
Raw Normal View History

2021-03-09 06:04:22 +01:00
#!/bin/bash
2021-03-11 06:34:29 +01:00
# =============================================================================
# AUDIT SCRIPT TO VERIFY THE INTEGRITY OF THE BUNDLED RESOURCES
#
# Author nobody
2021-03-11 07:24:11 +01:00
# Versions 1.2
2021-03-11 06:34:29 +01:00
#
# License MPL 2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
2021-03-09 06:04:22 +01:00
# =============================================================================
# PREREQUISITES:
#
# - Bash >= 4.4
# - LocalCDN >= v2.6.3
# - Local Tor SOCKS5 Proxy (optional, but recommended)
#
# =============================================================================
# INSTALL TOR PROXY:
2021-03-09 06:04:22 +01:00
# - sudo apt install tor
# e.g. https://linuxconfig.org/install-tor-proxy-on-ubuntu-20-04-linux
#
# CHECK TOR:
# - systemctl status tor@default.service
# - systemctl status tor.service
2021-03-09 06:04:22 +01:00
#
# =============================================================================
# HOW TO START:
#
# A) Check all files:
# bash audit.sh
2021-03-09 06:04:22 +01:00
#
2021-03-14 11:02:11 +01:00
# B) Check all files and use local Tor proxy (torsocks):
# bash audit.sh -t
#
# C) Check only one library:
# Choose the folder name from /resources/, e.g. jquery
2021-03-14 11:02:11 +01:00
# bash audit.sh -d jquery
#
2021-03-14 11:02:11 +01:00
# D) Check all files and replace in case of hash mismatch:
# bash audit.sh -r
#
2021-03-14 11:02:11 +01:00
# E) Check only one library files and replace in case of hash mismatch:
# Choose the folder name from /resources/, e.g. jquery
2021-03-14 11:02:11 +01:00
# bash audit.sh -rd jquery
2021-03-09 06:04:22 +01:00
#
2021-03-11 06:34:29 +01:00
# =============================================================================
# WHICH FILES WILL BE CHECKED?
#
# All files in the directory /resources/
#
# Exceptions:
2022-11-04 06:25:06 +01:00
# 1) /resources/google-material-design-icons/google-material-design-icons.css
# 2) /resources/google-fonts-placeholder.css
# 3) /resources/*/note
# 4) /resources/blocked/*
# 5) /resources/mathjax/2.7.5/latest.jsm
2021-03-14 11:02:11 +01:00
#
2021-03-12 06:16:39 +01:00
# =============================================================================
2021-03-14 11:02:11 +01:00
# WHY ARE THESE FILES EXCLUDED?
2022-11-04 06:25:06 +01:00
# 1) /resources/google-material-design-icons/google-material-design-icons.css
# This is a separate file so that the WOFF2 file in this extension is
# used and not an external one.
#
# 2) /resources/google-fonts-placeholder.css
# This is a placeholder which is used for Google Fonts redirects. Only
# used when "Block Google Fonts" is enabled.
2021-03-14 11:02:11 +01:00
#
2022-11-04 06:25:06 +01:00
# 3) /resources/*/note
# These files contain notes if a file has been renamed.
2021-11-13 07:38:14 +01:00
#
2022-11-04 06:25:06 +01:00
# 4) /resources/blocked/*
# This folder contains files which will be displayed if the direct CDN
# call is blocked. (https://codeberg.org/nobody/LocalCDN/issues/1050)
2022-09-20 06:51:11 +02:00
#
2022-11-04 06:25:06 +01:00
# 5) /resources/mathjax/2.7.5/latest.jsm
# This file would request the latest version number of Mathjax from a
# CDN API (e.g. https://api.cdnjs.com/libraries/mathjax?fields=version)
# Based on this version number, all further resources will be reloaded
# from this CDN. The reloading of resources would be intercepted or
# prevented by LocalCDN anyway. To prevent requests to the CDN API when
# this file will be requested by a website, it has been modified. This
# audit script would overwrite my changes or declare them as errors,
# so this file is excluded.
# (https://codeberg.org/nobody/LocalCDN/issues/1194)
2021-03-12 06:16:39 +01:00
# =============================================================================
2021-03-11 06:34:29 +01:00
# =============================================================================
# CDNs
# =============================================================================
2021-03-14 11:02:11 +01:00
readonly CLOUDFLARE="https://cdnjs.cloudflare.com/ajax/libs"
readonly CLOUDFLARE_AJAX="https://ajax.cloudflare.com/cdn-cgi/scripts"
readonly JSDELIVR="https://cdn.jsdelivr.net"
readonly NETDNA_BOOTSTRAPCDN="https://netdna.bootstrapcdn.com"
2021-03-14 11:02:11 +01:00
readonly GITHUB="https://raw.githubusercontent.com"
2021-05-01 06:23:14 +02:00
readonly EMBEDLY="https://cdn.embed.ly"
readonly DATATABLES="https://cdn.datatables.net"
2021-06-15 05:58:21 +02:00
readonly FONTAWESOME="https://use.fontawesome.com"
readonly UNPKG="https://unpkg.com"
readonly FONTSGSTATIC="https://fonts.gstatic.com"
2021-09-26 10:48:41 +02:00
readonly GOOGLEAPIS="https://ajax.googleapis.com/ajax/libs"
2022-04-18 06:32:17 +02:00
readonly CREATEJS="https://code.createjs.com"
2021-03-12 06:16:39 +01:00
2021-03-11 06:34:29 +01:00
# =============================================================================
# GLOBALS
# =============================================================================
2021-03-14 11:02:11 +01:00
readonly REGEX_JS=".*\.jsm$"
2021-03-09 06:04:22 +01:00
COUNTER_ALL=0
COUNTER_HASH_FAILED=0
COUNTER_CONNECT_FAILED=0
COUNTER_HASH_OK=0
COUNTER_SKIPPED=0
LOCAL_HASH=""
REMOTE_HASH=""
FILES_FAILED=""
FILES_SKIPPED=""
FILES_NO_CONNECTION=""
2021-03-14 11:02:11 +01:00
USE_TOR=false
CHECK="ALL"
REPLACE=false
CREATE_THIRD_PARTY_FILE=false
2021-04-18 07:26:12 +02:00
ONLY_THIRD_PARTY=false
2021-03-14 11:02:11 +01:00
2021-03-12 06:16:39 +01:00
2021-03-11 06:34:29 +01:00
# =============================================================================
# FORMATTING
# =============================================================================
2021-03-14 11:02:11 +01:00
readonly RED='\033[0;31m'
readonly GREEN='\033[0;32m'
readonly YELLOW='\033[1;33m'
readonly NOCOLOR='\033[0m'
readonly BOLD=$(tput bold)
readonly NORMAL=$(tput sgr0)
readonly DIVIDER=$(printf '%*s\n' 141 '' | tr ' ' "=")
2021-03-09 06:04:22 +01:00
2021-03-12 06:16:39 +01:00
2021-03-11 06:34:29 +01:00
# =============================================================================
2021-03-14 11:02:11 +01:00
# HELP
# =============================================================================
2021-03-14 11:02:11 +01:00
function help() {
echo -e "Audit script to verify the integrity of the bundled resources.\n"
echo -e "Usage:"
echo -e " bash audit.sh [options]"
echo -e " bash audit.sh [options] -d [resource]\n"
echo -e "Example:"
echo -e " bash audit.sh"
echo -e " bash audit.sh -tfr"
echo -e " bash audit.sh -tfrd jquery\n"
echo -e "Options:"
echo -e " -t Use local Tor proxy (torsocks)"
echo -e " -f Create THIRD_PARTY.txt file with all contacted URLs"
echo -e " -r Replace in case of hash mismatch"
echo -e " -l List all resources"
echo -e " -d Check only ONE resource, e.g. jquery"
echo -e " 'bash audit.sh -d jquery'"
2021-04-18 07:26:12 +02:00
echo -e " -u Generate URLs only and create THIRD_PARTY.txt"
2021-03-14 11:02:11 +01:00
exit 0
}
# =============================================================================
# LIST RESOURCES
# =============================================================================
function list_resources() {
echo -e "Usage:"
echo -e " bash audit.sh -d [resource]\n"
echo -e "Example:"
echo -e " bash audit.sh -d jquery"
echo -e " bash audit.sh -d angular-bootstrap-colorpicker\n"
echo -e "Resources:"
resources=()
while IFS= read -r -d $'\0'; do
resources+=( $(echo "$REPLY" | cut -d"/" -f3) )
done < <(find ../resources/ -maxdepth 1 -print0)
printf " %s\n" "${resources[@]}"
exit 0
}
# =============================================================================
# PreCheck
# =============================================================================
function pre_check() {
if [ "$USE_TOR" = true ] && ! command -v torsocks &> /dev/null; then
echo "Command not found: torsocks"
read -r -p "Press enter to close..."; exit 1
fi
if ! command -v wget &> /dev/null; then
echo "Command not found: wget"
read -r -p "Press enter to close..."; exit 1
fi
if ! command -v sha512sum &> /dev/null; then
echo "Command not found: sha512sum"
read -r -p "Press enter to close..."; exit 1
fi
if ! command -v sed &> /dev/null; then
echo "Command not found: sed"
read -r -p "Press enter to close..."; exit 1
fi
if ! command -v cut &> /dev/null; then
echo "Command not found: cut"
read -r -p "Press enter to close..."; exit 1
fi
if ! command -v awk &> /dev/null; then
echo "Command not found: awk"
read -r -p "Press enter to close..."; exit 1
fi
}
2021-03-09 06:04:22 +01:00
2021-03-18 07:00:01 +01:00
# =============================================================================
# SPECIAL CASES (E.G. BUNDLES)
# =============================================================================
declare -A arr_gsap
arr_gsap[AttrPlugin.min.js]="plugins/AttrPlugin.min.js"
arr_gsap[BezierPlugin.min.js]="plugins/BezierPlugin.min.js"
arr_gsap[CSSPlugin.min.js]="plugins/CSSPlugin.min.js"
arr_gsap[CSSRulePlugin.min.js]="plugins/CSSRulePlugin.min.js"
arr_gsap[ColorPropsPlugin.min.js]="plugins/ColorPropsPlugin.min.js"
arr_gsap[DirectionalRotationPlugin.min.js]="plugins/DirectionalRotationPlugin.min.js"
arr_gsap[EaselPlugin.min.js]="plugins/EaselPlugin.min.js"
arr_gsap[EndArrayPlugin.min.js]="plugins/EndArrayPlugin.min.js"
arr_gsap[ModelifiersPlugin.min.js]="plugins/ModelifiersPlugin.min.js"
arr_gsap[PixiPlugin.min.js]="plugins/PixiPlugin.min.js"
arr_gsap[RaphaelPlugin.min.js]="plugins/RaphaelPlugin.min.js"
arr_gsap[RoundPropsPlugin.min.js]="plugins/RoundPropsPlugin.min.js"
arr_gsap[ScrollToPlugin.min.js]="plugins/ScrollToPlugin.min.js"
arr_gsap[TextPlugin.min.js]="plugins/TextPlugin.min.js"
arr_gsap[EasePack.min.js]="easing/EasePack.min.js"
arr_gsap[Draggable.min.js]="utils/Draggable.min.js"
arr_gsap[ModifiersPlugin.min.js]="plugins/ModifiersPlugin.min.js"
declare -A arr_cycle
arr_cycle[jquery.cycle2.min.js]="jquery.cycle2.min.js"
arr_cycle[jquery.cycle2.autoheight.min.js]="jquery.cycle2.autoheight.min.js"
arr_cycle[jquery.cycle2.caption.min.js]="jquery.cycle2.caption.min.js"
arr_cycle[jquery.cycle2.caption2.min.js]="jquery.cycle2.caption2.min.js"
arr_cycle[jquery.cycle2.carousel.min.js]="jquery.cycle2.carousel.min.js"
arr_cycle[jquery.cycle2.center.min.js]="jquery.cycle2.center.min.js"
arr_cycle[jquery.cycle2.command.min.js]="jquery.cycle2.command.min.js"
arr_cycle[jquery.cycle2.core.min.js]="jquery.cycle2.core.min.js"
arr_cycle[jquery.cycle2.flip.min.js]="jquery.cycle2.flip.min.js"
arr_cycle[jquery.cycle2.hash.min.js]="jquery.cycle2.hash.min.js"
arr_cycle[jquery.cycle2.ie-fade.min.js]="jquery.cycle2.ie-fade.min.js"
arr_cycle[jquery.cycle2.loader.min.js]="jquery.cycle2.loader.min.js"
arr_cycle[jquery.cycle2.lookahead.min.js]="jquery.cycle2.lookahead.min.js"
arr_cycle[jquery.cycle2.pager.min.js]="jquery.cycle2.pager.min.js"
arr_cycle[jquery.cycle2.prevnext.min.js]="jquery.cycle2.prevnext.min.js"
arr_cycle[jquery.cycle2.progressive.min.js]="jquery.cycle2.progressive.min.js"
arr_cycle[jquery.cycle2.scrollVert.min.js]="jquery.cycle2.scrollVert.min.js"
arr_cycle[jquery.cycle2.shuffle.min.js]="jquery.cycle2.shuffle.min.js"
arr_cycle[jquery.cycle2.swipe.min.js]="jquery.cycle2.swipe.min.js"
arr_cycle[jquery.cycle2.tile.min.js]="jquery.cycle2.tile.min.js"
arr_cycle[jquery.cycle2.tmpl.min.js]="jquery.cycle2.tmpl.min.js"
arr_cycle[jquery.cycle2.video.min.js]="jquery.cycle2.video.min.js"
arr_cycle[jquery.cycle2.autoheight.min.js]="core/jquery.cycle2.autoheight.min.js"
arr_cycle[jquery.cycle2.caption.min.js]="core/jquery.cycle2.caption.min.js"
arr_cycle[jquery.cycle2.command.min.js]="core/jquery.cycle2.command.min.js"
arr_cycle[jquery.cycle2.core.min.js]="core/jquery.cycle2.core.min.js"
arr_cycle[jquery.cycle2.hash.min.js]="core/jquery.cycle2.hash.min.js"
arr_cycle[jquery.cycle2.loader.min.js]="core/jquery.cycle2.loader.min.js"
arr_cycle[jquery.cycle2.pager.min.js]="core/jquery.cycle2.pager.min.js"
arr_cycle[jquery.cycle2.prevnext.min.js]="core/jquery.cycle2.prevnext.min.js"
arr_cycle[jquery.cycle2.progressive.min.js]="core/jquery.cycle2.progressive.min.js"
arr_cycle[jquery.cycle2.tmpl.min.js]="core/jquery.cycle2.tmpl.min.js"
arr_cycle[jquery.cycle2.caption2.min.js]="plugin/jquery.cycle2.caption2.min.js"
arr_cycle[jquery.cycle2.carousel.min.js]="plugin/jquery.cycle2.carousel.min.js"
arr_cycle[jquery.cycle2.center.min.js]="plugin/jquery.cycle2.center.min.js"
arr_cycle[jquery.cycle2.flip.min.js]="plugin/jquery.cycle2.flip.min.js"
arr_cycle[jquery.cycle2.ie-fade.min.js]="plugin/jquery.cycle2.ie-fade.min.js"
arr_cycle[jquery.cycle2.scrollVert.min.js]="plugin/jquery.cycle2.scrollVert.min.js"
arr_cycle[jquery.cycle2.shuffle.min.js]="plugin/jquery.cycle2.shuffle.min.js"
arr_cycle[jquery.cycle2.swipe.min.js]="plugin/jquery.cycle2.swipe.min.js"
arr_cycle[jquery.cycle2.tile.min.js]="plugin/jquery.cycle2.tile.min.js"
arr_cycle[jquery.cycle2.video.min.js]="plugin/jquery.cycle2.video.min.js"
# https://codeberg.org/nobody/LocalCDN/issues/432
declare -A arr_datatables
2021-08-29 08:17:15 +02:00
arr_datatables[jquery.dataTables.min.css]="1.11.0/css/jquery.dataTables.min.css"
arr_datatables[jquery.dataTables.min.js]="1.11.0/js/jquery.dataTables.min.js"
arr_datatables[dataTables.foundation.min.css]="1.11.0/css/dataTables.foundation.min.css"
arr_datatables[dataTables.foundation.min.js]="1.11.0/js/dataTables.foundation.min.js"
arr_datatables[dataTables.bootstrap.min.css]="1.11.0/css/dataTables.bootstrap.min.css"
arr_datatables[dataTables.bootstrap.min.js]="1.11.0/js/dataTables.bootstrap.min.js"
arr_datatables[dataTables.bootstrap4.min.css]="1.11.0/css/dataTables.bootstrap4.min.css"
arr_datatables[dataTables.bootstrap4.min.js]="1.11.0/js/dataTables.bootstrap4.min.js"
arr_datatables[dataTables.semanticui.min.css]="1.11.0/css/dataTables.semanticui.min.css"
arr_datatables[dataTables.semanticui.min.js]="1.11.0/js/dataTables.semanticui.min.js"
arr_datatables[dataTables.jqueryui.min.css]="1.11.0/css/dataTables.jqueryui.min.css"
arr_datatables[dataTables.jqueryui.min.js]="1.11.0/js/dataTables.jqueryui.min.js"
2021-06-06 06:11:11 +02:00
arr_datatables[autoFill.dataTables.min.css]="autofill/2.3.7/css/autoFill.dataTables.min.css"
arr_datatables[dataTables.autoFill.min.js]="autofill/2.3.7/js/dataTables.autoFill.min.js"
2021-08-29 08:17:15 +02:00
arr_datatables[buttons.dataTables.min.css]="buttons/2.0.0/css/buttons.dataTables.min.css"
arr_datatables[dataTables.buttons.min.js]="buttons/2.0.0/js/dataTables.buttons.min.js"
arr_datatables[buttons.colVis.min.js]="buttons/2.0.0/js/buttons.colVis.min.js"
arr_datatables[buttons.flash.min.js]="buttons/2.0.0/js/buttons.flash.min.js"
arr_datatables[buttons.html5.min.js]="buttons/2.0.0/js/buttons.html5.min.js"
arr_datatables[buttons.print.min.js]="buttons/2.0.0/js/buttons.print.min.js"
2021-06-06 06:11:11 +02:00
arr_datatables[colReorder.dataTables.min.css]="colreorder/1.5.4/css/colReorder.dataTables.min.css"
arr_datatables[dataTables.colReorder.min.js]="colreorder/1.5.4/js/dataTables.colReorder.min.js"
2021-08-29 08:17:15 +02:00
arr_datatables[dataTables.dateTime.min.css]="datetime/1.1.1/css/dataTables.dateTime.min.css"
arr_datatables[dataTables.dateTime.min.js]="datetime/1.1.1/js/dataTables.dateTime.min.js"
2021-06-06 06:11:11 +02:00
arr_datatables[fixedColumns.dataTables.min.css]="fixedcolumns/3.3.3/css/fixedColumns.dataTables.min.css"
arr_datatables[dataTables.fixedColumns.min.js]="fixedcolumns/3.3.3/js/dataTables.fixedColumns.min.js"
arr_datatables[fixedHeader.dataTables.min.css]="fixedheader/3.1.9/css/fixedHeader.dataTables.min.css"
arr_datatables[dataTables.fixedHeader.min.js]="fixedheader/3.1.9/js/dataTables.fixedHeader.min.js"
2021-08-29 08:17:15 +02:00
arr_datatables[keyTable.dataTables.min.css]="keytable/2.6.4/css/keyTable.dataTables.min.css"
arr_datatables[dataTables.keyTable.min.js]="keytable/2.6.4/js/dataTables.keyTable.min.js"
arr_datatables[responsive.dataTables.min.css]="responsive/2.2.9/css/responsive.dataTables.min.css"
arr_datatables[dataTables.responsive.min.js]="responsive/2.2.9/js/dataTables.responsive.min.js"
2021-06-06 06:11:11 +02:00
arr_datatables[rowGroup.dataTables.min.css]="rowgroup/1.1.3/css/rowGroup.dataTables.min.css"
arr_datatables[dataTables.rowGroup.min.js]="rowgroup/1.1.3/js/dataTables.rowGroup.min.js"
arr_datatables[rowReorder.dataTables.min.css]="rowreorder/1.2.8/css/rowReorder.dataTables.min.css"
arr_datatables[dataTables.rowReorder.min.js]="rowreorder/1.2.8/js/dataTables.rowReorder.min.js"
2021-08-29 08:17:15 +02:00
arr_datatables[scroller.dataTables.min.css]="scroller/2.0.5/css/scroller.dataTables.min.css"
arr_datatables[dataTables.scroller.min.js]="scroller/2.0.5/js/dataTables.scroller.min.js"
arr_datatables[searchBuilder.dataTables.min.css]="searchbuilder/1.2.0/css/searchBuilder.dataTables.min.css"
arr_datatables[dataTables.searchBuilder.min.js]="searchbuilder/1.2.0/js/dataTables.searchBuilder.min.js"
arr_datatables[searchPanes.dataTables.min.css]="searchpanes/1.4.0/css/searchPanes.dataTables.min.css"
arr_datatables[dataTables.searchPanes.min.js]="searchpanes/1.4.0/js/dataTables.searchPanes.min.js"
arr_datatables[select.dataTables.min.css]="select/1.3.3/css/select.dataTables.min.css"
arr_datatables[dataTables.select.min.js]="select/1.3.3/js/dataTables.select.min.js"
2021-03-18 07:00:01 +01:00
# =============================================================================
2021-03-11 06:34:29 +01:00
# CHECK RESOURCE
# =============================================================================
2021-03-14 11:02:11 +01:00
function check_resource() {
2021-03-09 06:04:22 +01:00
path=$1
folder=$(echo -e "$path" | cut -d"/" -f3)
if [ "$CHECK" != "ALL" ] && [ "$CHECK" != "$folder" ]; then
return 0
fi
((COUNTER_ALL++))
echo -e "$DIVIDER"
echo -e "SCANNED: ${COUNTER_ALL}/${#array[@]}"
echo -e "PATH: $i"
2021-03-09 06:04:22 +01:00
version=$(echo -e "$path" | cut -d"/" -f4)
file=$(echo -e "$path" | cut -d"/" -f5)
subfile=$(echo -e "$path" | awk -F"/" '{print $NF}')
jfile=$file
url=""
is_javascript=false
error=false
if [[ $path =~ $REGEX_JS ]]; then
path=$(echo "$path" | sed 's/.$//')
jfile=$(echo "$file" | sed 's/.$//')
subfile=$(echo "$subfile" | sed 's/.$//')
is_javascript=true
fi
2021-03-11 06:34:29 +01:00
# Get URL of CDN
create_url
2021-04-18 07:26:12 +02:00
if [ "$ONLY_THIRD_PARTY" = true ]; then
third_party+=("${url}")
return 0
fi
2021-03-12 06:16:39 +01:00
# Random sleep if the CDN rejects connections (DoS)
# sleeps 0.1s - 0.9s per request
#sleep 0.$(( (RANDOM % 10) + 1 ))s
2021-03-12 06:16:39 +01:00
2021-03-11 06:34:29 +01:00
# Use Tor Proxy if set
if [ "$USE_TOR" = true ]; then
if ! torsocks wget --retry-connrefused --waitretry=30 --read-timeout=30 --timeout=30 -t 10 -qO ./tmp "$url"; then
2021-03-11 06:34:29 +01:00
error=true
fi
else
if ! wget --retry-connrefused --waitretry=30 --read-timeout=30 --timeout=30 -t 10 -qO ./tmp "$url"; then
2021-03-11 06:34:29 +01:00
error=true
fi
fi
if [ "$error" = true ]; then
echo -e "${YELLOW}LOCAL HASH: -${NOCOLOR}"
echo -e "${YELLOW}REMOTE HASH: -${NOCOLOR}"
echo -e "${YELLOW}STATUS: NO CONNECTION $url${NOCOLOR}"
FILES_NO_CONNECTION="${YELLOW}No connection: $path --> $url${NOCOLOR}\n$FILES_NO_CONNECTION"
((COUNTER_CONNECT_FAILED++))
2021-03-18 07:00:01 +01:00
return 0
2021-03-11 06:34:29 +01:00
fi
# Calculate hash value
2021-03-11 07:24:11 +01:00
LOCAL_HASH=$(sha512sum "$1" | cut -d " " -f 1)
2021-03-11 06:34:29 +01:00
REMOTE_HASH=$(sha512sum ./tmp | cut -d " " -f 1)
if [ "$LOCAL_HASH" != "$REMOTE_HASH" ]; then
echo -e "${RED}LOCAL HASH: $LOCAL_HASH${NOCOLOR}"
echo -e "${RED}REMOTE HASH: $REMOTE_HASH${NOCOLOR}"
echo -e "${RED}STATUS: FAILED${NOCOLOR}"
if [ "$REPLACE" = true ]; then
if [ "$is_javascript" = true ]; then
mv ./tmp "${path}m"
else
mv ./tmp "${path}"
fi
echo -e "${RED} FILE ALREADY REPLACED${NOCOLOR}"
FILES_FAILED="${RED}Hash mismatch: $path (File already replaced)${NOCOLOR}\n$FILES_FAILED"
else
# No replace
FILES_FAILED="${RED}Hash mismatch: $path${NOCOLOR}\n$FILES_FAILED"
fi
((COUNTER_HASH_FAILED++))
else
echo -e "${GREEN}LOCAL HASH: $LOCAL_HASH${NOCOLOR}"
echo -e "${GREEN}REMOTE HASH: $REMOTE_HASH${NOCOLOR}"
echo -e "${GREEN}STATUS: PASSED${NOCOLOR}"
((COUNTER_HASH_OK++))
fi
2021-03-12 06:16:39 +01:00
# Append URL to THIRD_PARTY.txt
2021-03-11 06:34:29 +01:00
third_party+=("${url}")
}
2021-03-12 06:16:39 +01:00
2021-03-11 06:34:29 +01:00
# =============================================================================
# CREATE URLs
# =============================================================================
2021-03-14 11:02:11 +01:00
function create_url() {
2021-03-09 06:04:22 +01:00
if [ "$folder" = "angular-stripe-checkout" ]; then
url="$JSDELIVR/npm/angular-stripe-checkout@$version/angular-stripe-checkout.min.js"
elif [ "$folder" = "ethjs" ]; then
url="$JSDELIVR/npm/ethjs@$version/dist/ethjs.min.js"
elif [ "$folder" = "react-lifecycles-compat" ]; then
url="$JSDELIVR/npm/react-lifecycles-compat@$version/react-lifecycles-compat.min.js"
elif [ "$folder" = "react-side-effect" ]; then
2021-06-15 05:58:21 +02:00
url="$UNPKG/react-side-effect@$version/lib/index.umd.min.js"
2021-03-09 06:04:22 +01:00
elif [ "$folder" = "p2p-media-loader-core" ]; then
url="$JSDELIVR/npm/p2p-media-loader-core@$version/build/p2p-media-loader-core.min.js"
elif [ "$folder" = "p2p-media-loader-hlsjs" ]; then
url="$JSDELIVR/npm/p2p-media-loader-hlsjs@$version/build/p2p-media-loader-hlsjs.min.js"
elif [ "$folder" = "urlize" ]; then
url="$JSDELIVR/npm/urlize.js/urlize.js"
elif [ "$folder" = "videojs-seek-buttons" ]; then
if [ "$subfile" = "videojs-seek-buttons.min.css" ]; then
url="$JSDELIVR/npm/videojs-seek-buttons@$version/dist/videojs-seek-buttons.css"
else
url="$JSDELIVR/npm/videojs-seek-buttons@$version/dist/videojs-seek-buttons.min.js"
fi
elif [ "$folder" = "rocket-loader" ]; then
url="$CLOUDFLARE_AJAX/7089c43e/cloudflare-static/rocket-loader.min.js"
elif [ "$folder" = "google-material-design-icons" ]; then
2022-05-28 05:48:53 +02:00
iconVersion=$(echo -e "$path" | cut -d"/" -f5)
iconType=$(echo -e "$path" | cut -d"/" -f4)
if [[ $iconType = "materialicons" ]]; then
url="$FONTSGSTATIC/s/materialicons/$iconVersion/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2"
elif [[ $iconType = "materialiconsoutlined" ]]; then
url="$FONTSGSTATIC/s/materialiconsoutlined/$iconVersion/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUce.woff2"
elif [[ $iconType = "materialiconsround" ]]; then
url="$FONTSGSTATIC/s/materialiconsround/$iconVersion/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmP.woff2"
elif [[ $iconType = "materialiconssharp" ]]; then
url="$FONTSGSTATIC/s/materialiconssharp/$iconVersion/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvR.woff2"
elif [[ $iconType = "materialiconstwotone" ]]; then
url="$FONTSGSTATIC/s/materialiconstwotone/$iconVersion/hESh6WRmNCxEqUmNyh3JDeGxjVVyMg4tHGctNCu0.woff2"
fi
2021-03-09 06:04:22 +01:00
elif [ "$folder" = "object-assign" ]; then
url="$JSDELIVR/npm/object-assign@4.1.1/index.js"
elif [ "$folder" = "mirage2" ]; then
url="$CLOUDFLARE_AJAX/04b3eb47/cloudflare-static/mirage2.min.js"
elif [ "$folder" = "highlight.js" ]; then
if [[ $path =~ .*\.(css|png)$ ]]; then
url="$CLOUDFLARE/$folder/$version/styles/$subfile"
elif [[ $subfile = "highlight.min.js" ]]; then
url="$CLOUDFLARE/$folder/$version/$subfile"
else
url="$CLOUDFLARE/$folder/$version/languages/$subfile"
fi
elif [ "$folder" = "bootstrap-datepicker" ]; then
if [[ $file =~ .*\.css$ ]]; then
url="$CLOUDFLARE/$folder/$version/css/$file"
elif [[ $jfile =~ .*bootstrap-datepicker.min.js$ ]]; then
url="$CLOUDFLARE/$folder/$version/js/$jfile"
else
url="$CLOUDFLARE/$folder/$version/locales/$jfile"
fi
elif [ "$folder" = "bowser" ]; then
2021-04-29 06:29:12 +02:00
if [ "${version::1}" = "2" ]; then
url="$CLOUDFLARE/bowser/$version/bundled.min.js"
else
url="$CLOUDFLARE/bowser/$version/bowser.min.js"
2021-04-28 05:27:35 +02:00
fi
2021-06-08 07:42:54 +02:00
elif [ "$folder" = "select2" ] && [ "$version" != "3.5.4" ]; then
2021-03-09 06:04:22 +01:00
if [[ $subfile =~ (select2\.min\.js|select2\.full\.min\.js)$ ]]; then
url="$CLOUDFLARE/$folder/$version/js/$subfile"
elif [ "$subfile" = "select2.min.css" ]; then
url="$CLOUDFLARE/$folder/$version/css/$subfile"
else
url="$CLOUDFLARE/$folder/$version/js/i18n/$subfile"
fi
elif [ "$folder" = "gsap" ]; then
if [ "$version" = "1.20.5" ] || [ "$version" = "2.1.3" ]; then
2021-03-18 07:00:01 +01:00
if [ "${arr_gsap[$jfile]}" != "" ]; then
url="$CLOUDFLARE/$folder/$version/${arr_gsap[$subfile]}"
2021-03-09 06:04:22 +01:00
else
2021-03-18 07:00:01 +01:00
url="$CLOUDFLARE/$folder/$version/$subfile"
2021-03-09 06:04:22 +01:00
fi
else
url="$CLOUDFLARE/$folder/$version/$jfile"
fi
elif [ "$folder" = "element-ui" ]; then
if [ "$jfile" = "index.min.css" ]; then
url="$CLOUDFLARE/$folder/$version/theme-chalk/index.min.css"
elif [ "$jfile" = "index.min.js" ]; then
url="$CLOUDFLARE/$folder/$version/$jfile"
elif [ "$subfile" = "element-icons.woff" ]; then
url="$CLOUDFLARE/$folder/$version/theme-chalk/fonts/element-icons.woff"
else
url="$CLOUDFLARE/$folder/$version/locale/$jfile"
fi
elif [ "$folder" = "bootstrap-multiselect" ]; then
url="$CLOUDFLARE/$folder/$version/js/$jfile"
elif [ "$folder" = "bootstrap-slider" ] && [ "$jfile" = "bootstrap-slider.min.css" ]; then
url="$CLOUDFLARE/$folder/$version/css/$jfile"
elif [ "$folder" = "drawer" ]; then
if [[ $jfile =~ .*\.css$ ]]; then
url="$CLOUDFLARE/$folder/$version/css/$jfile"
elif [[ $jfile =~ .*\.js$ ]]; then
url="$CLOUDFLARE/$folder/$version/js/$jfile"
fi
elif [ "$folder" = "jScrollPane" ]; then
if [ "$jfile" = "jquery.jscrollpane.min.js" ]; then
url="$CLOUDFLARE/$folder/$version/script/$jfile"
fi
elif [ "$folder" = "mdb-ui-kit" ]; then
if [ "$jfile" = "mdb-ui-kit.min.css" ]; then
url="$CLOUDFLARE/$folder/$version/mdb.min.css"
elif [ "$jfile" = "mdb-ui-kit.min.js" ]; then
2023-12-10 07:55:27 +01:00
if [ "$version" = "3.11.0" ] || [ "$version" = "4.4.0" ] || [ "$version" = "5.0.0" ] || [ "$version" = "6.4.2" ]; then
url="$CLOUDFLARE/$folder/$version/mdb.min.js"
else
url="$CLOUDFLARE/$folder/$version/mdb.es.min.js"
fi
2021-03-09 06:04:22 +01:00
fi
elif [ "$folder" = "Modaal" ]; then
if [ "$jfile" = "modaal.min.css" ]; then
url="$CLOUDFLARE/$folder/$version/css/$jfile"
elif [ "$jfile" = "modaal.min.js" ]; then
url="$CLOUDFLARE/$folder/$version/js/$jfile"
fi
elif [ "$folder" = "owl-carousel" ]; then
if [ "$version" = "1.3.3" ]; then
url="$CLOUDFLARE/owl-carousel/$version/$jfile"
else
url="$CLOUDFLARE/OwlCarousel2/$version/$jfile"
fi
elif [ "$folder" = "p5.js" ]; then
if [ "$jfile" = "p5.sound.min.js" ]; then
url="$CLOUDFLARE/$folder/$version/addons/$jfile"
else
url="$CLOUDFLARE/$folder/$version/$jfile"
fi
elif [ "$folder" = "paginationjs" ]; then
if [ "$jfile" = "pagination.min.css" ]; then
url="$CLOUDFLARE/$folder/$version/pagination.css"
else
url="$CLOUDFLARE/$folder/$version/$jfile"
fi
elif [ "$folder" = "OwlCarousel2" ]; then
if [ "$subfile" = "owl.carousel.min.js" ]; then
url="$CLOUDFLARE/$folder/$version/$subfile"
else
url="$CLOUDFLARE/$folder/$version/assets/$subfile"
fi
elif [ "$folder" = "slider-pro" ]; then
url="$CLOUDFLARE/$folder/$version/js/$jfile"
elif [ "$folder" = "Swiper" ] && [ "$version" != "3.4.2" ] && [ "$version" != "4.5.1" ] && [ "$version" != "5.4.5" ]; then
2021-03-09 06:04:22 +01:00
if [[ "$path" =~ .*swiper\.min\.css$ ]]; then
2021-04-18 07:17:51 +02:00
url="$JSDELIVR/npm/swiper@$version/swiper-bundle.min.css"
2021-03-09 06:04:22 +01:00
elif [[ "$path" =~ .*swiper\.min\.js$ ]]; then
2021-04-18 07:17:51 +02:00
url="$JSDELIVR/npm/swiper@$version/swiper-bundle.min.js"
2021-03-09 06:04:22 +01:00
fi
elif [ "$folder" = "tooltipster" ] && [ "$version" = "4.2.8" ]; then
url="$CLOUDFLARE/$folder/$version/js/tooltipster.bundle.min.js"
2021-06-13 06:36:06 +02:00
elif [ "$folder" = "vue" ]; then
if [[ "$version" != 3* ]]; then
url="$JSDELIVR/npm/$folder@$version/dist/vue.min.js"
else
url="$CLOUDFLARE/$folder/$version/vue.global.prod.js"
fi
2021-03-09 06:04:22 +01:00
elif [ "$folder" = "waypoints" ]; then
if [ "$jfile" = "infinite.min.js" ] || [ "$jfile" = "inview.min.js" ] || [ "$jfile" = "sticky.min.js" ]; then
url="$CLOUDFLARE/$folder/$version/shortcuts/$jfile"
else
url="$CLOUDFLARE/$folder/$version/$jfile"
fi
elif [ "$folder" = "twitter-bootstrap" ] && [ "$version" != "2.3.2" ]; then
2021-03-09 06:04:22 +01:00
if [[ "$subfile" =~ \.css$ ]]; then
url="$CLOUDFLARE/$folder/$version/css/$subfile"
elif [[ "$subfile" =~ \.js$ ]]; then
2021-05-24 07:18:39 +02:00
if [[ "$version" = 3* ]]; then
url="$CLOUDFLARE/$folder/$version/js/bootstrap.min.js"
else
url="$CLOUDFLARE/$folder/$version/js/bootstrap.bundle.min.js"
fi
2021-03-09 06:04:22 +01:00
elif [ "$subfile" = "glyphicons-halflings-regular.woff2" ]; then
url="$CLOUDFLARE/twitter-bootstrap/3.4.1/fonts/glyphicons-halflings-regular.woff2"
fi
elif [ "$folder" = "twitter-bootstrap" ] && [ "$version" = "2.3.2" ]; then
if [[ "$subfile" =~ \.css$ ]]; then
url="$NETDNA_BOOTSTRAPCDN/$folder/$version/css/bootstrap-combined.no-icons.min.css"
2021-06-29 06:33:34 +02:00
else
url="$NETDNA_BOOTSTRAPCDN/$folder/$version/js/bootstrap.min.js"
fi
elif [ "$folder" = "vue-i18n" ] && [[ "$version" != 8* ]]; then
2021-03-09 06:04:22 +01:00
url="$CLOUDFLARE/$folder/$version/vue-i18n.cjs.min.js"
2021-03-11 06:34:29 +01:00
elif [ "$path" = "../resources/twitter-bootstrap/fonts/glyphicons-halflings-regular.woff2" ]; then
2021-03-09 06:04:22 +01:00
url="$CLOUDFLARE/twitter-bootstrap/3.4.1/fonts/glyphicons-halflings-regular.woff2"
elif [ "$subfile" = "jquery-ui.min.css" ]; then
url="$CLOUDFLARE/jqueryui/1.8.24/themes/base/minified/jquery-ui.min.css"
elif [ "$folder" = "raven.js" ]; then
url="$JSDELIVR/npm/raven-js@3.27.2/dist/raven.min.js"
elif [ "$folder" = "jquery-validate" ]; then
url="$GITHUB/jquery-validation/jquery-validation/$version/dist/jquery.validate.min.js"
elif [ "$folder" = "jquery-validate" ]; then
url="$GITHUB/jquery-validation/jquery-validation/$version/dist/jquery.validate.min.js"
2021-08-14 06:56:48 +02:00
elif [ "$folder" = "history" ] && [ "$version" != "4.10.1" ]; then
url="$CLOUDFLARE/history/$version/history.production.min.js"
2021-03-09 06:04:22 +01:00
elif [ "$folder" = "material-design-icons" ]; then
url="$GITHUB/Templarian/MaterialDesign-Webfont/v$version/$jfile/$subfile"
elif [ "$folder" = "algoliasearch" ]; then
if [ "$version" = "3.35.1" ]; then
url="$CLOUDFLARE/algoliasearch/$version/algoliasearch.min.js"
else
url="$CLOUDFLARE/algoliasearch/$version/algoliasearch.umd.min.js"
fi
elif [ "$folder" = "angular-translate" ]; then
if [ "$subfile" = "angular-translate.min.js" ]; then
url="$CLOUDFLARE/angular-translate/$version/$subfile"
else
subfolder=$(echo -e "$subfile" | sed 's/\.min\.js//')
url="$CLOUDFLARE/$folder/$version/$subfolder/$subfile"
fi
elif [ "$folder" = "ajax-bootstrap-select" ]; then
url="$CLOUDFLARE/$folder/$version/js/$subfile"
elif [ "$folder" = "algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm" ]; then
url="$JSDELIVR/g/algoliasearch@3(algoliasearchLite.min.js),algoliasearch.helper@2"
elif [ "$subfile" = "jsdelivr-combine-jquery-hogan-algoliasearch-autocomplete.js" ]; then
2021-03-11 07:24:11 +01:00
url="$JSDELIVR/combine/npm/jquery@2.2.4/dist/jquery.min.js,npm/hogan.js@3.0.2/dist/hogan-3.0.2.min.js,npm/algoliasearch@3.30.0/dist/algoliasearch.min.js,npm/autocomplete.js@0.31.0/dist/autocomplete.min.js"
2021-03-09 06:04:22 +01:00
elif [ "$folder" = "vue-resource" ]; then
url="$GITHUB/pagekit/vue-resource/$version/dist/vue-resource.min.js"
2021-03-11 06:34:29 +01:00
elif [ "$path" = "../resources/webfont/fa-loader.js" ]; then
2021-06-15 05:58:21 +02:00
url="$FONTAWESOME/a1f20be65b.js"
2021-03-18 07:00:01 +01:00
elif [ "$folder" = "jquery.cycle2" ]; then
if [ "${arr_cycle[$subfile]}" != "" ]; then
url="$CLOUDFLARE/$folder/$version/${arr_cycle[$subfile]}"
fi
2021-03-31 07:15:54 +02:00
elif [ "$folder" = "semantic-ui" ]; then
relativpath=$(echo -e "$path" | awk -F"../$folder/$version" '{print $NF}')
url="$CLOUDFLARE/$folder/$version/$relativpath"
2022-11-18 06:33:26 +01:00
elif [ "$folder" = "Chart.js" ] && [ "$version" = "2.9.4" ] && [ "$jfile" = "chart.min.js" ]; then
url="$CLOUDFLARE/$folder/$version/Chart.bundle.min.js"
elif [ "$folder" = "angular-ui-select" ] && [ "$version" = "0.19.8" ]; then
url="$JSDELIVR/npm/ui-select@$version/dist/select.min.js"
2021-04-18 06:45:40 +02:00
elif [ "$folder" = "plyr" ]; then
if [ "$jfile" = "plyr.min.js" ]; then
url="$JSDELIVR/npm/plyr@$version/dist/plyr.min.js"
elif [ "$jfile" = "plyr.min.css" ]; then
url="$JSDELIVR/npm/plyr@$version/dist/plyr.css"
fi
elif [ "$folder" = "anchor-js" ]; then
url="$JSDELIVR/npm/anchor-js@$version/$subfile"
elif [ "$folder" = "fancybox" ] && [ "$version" = "2.1.7" ]; then
if [[ $file =~ .*\.css$ ]]; then
url="$CLOUDFLARE/$folder/$version/css/$file"
else
url="$CLOUDFLARE/$folder/$version/js/$jfile"
fi
elif [ "$folder" = "appboy-web-sdk" ]; then
url="$JSDELIVR/npm/appboy-web-sdk@$version/$subfile"
elif [ "$folder" = "ngx-bootstrap" ]; then
url="$JSDELIVR/npm/ngx-bootstrap@$version/$file/$subfile"
2021-05-01 06:23:14 +02:00
elif [ "$folder" = "embedly-player" ]; then
url="$EMBEDLY/player-$version.min.js"
elif [ "$folder" = "datatables" ]; then
if [ "${arr_datatables[$subfile]}" != "" ]; then
url="$DATATABLES/${arr_datatables[$subfile]}"
fi
elif [ "$folder" = "leaflet.featuregroup.subgroup" ]; then
url="$JSDELIVR/npm/$folder@$version/dist/leaflet.featuregroup.subgroup.js"
2021-05-18 06:18:28 +02:00
elif [ "$folder" = "bodymovin" ] && [[ "$version" = 5* ]]; then
url="$CLOUDFLARE/$folder/$version/lottie.min.js"
2022-05-22 06:55:53 +02:00
elif [ "$folder" = "mathjax" ] || [ "$folder" = "tinymce" ]; then
2021-05-26 06:56:35 +02:00
url=$(echo "$path" | cut -d"/" -f3-)
url="$CLOUDFLARE/$url"
elif [ "$folder" = "vanilla-lazyload" ]; then
url="$JSDELIVR/npm/$folder@$version/dist/lazyload.min.js"
2021-06-13 06:36:06 +02:00
elif [ "$folder" = "lightgallery" ] && [ "$version" != "1.10.0" ] && [ "$subfile" = "lightgallery.min.js" ];then
url="$CLOUDFLARE/$folder/$version/lightgallery.min.js"
elif [ "$folder" = "alpinejs" ] && [ "$version" != "2.8.2" ];then
url="$CLOUDFLARE/$folder/$version/cdn.min.js"
2021-06-25 06:33:02 +02:00
elif [ "$folder" = "vuex" ] && [ "$version" != "3.6.2" ];then
url="$CLOUDFLARE/$folder/$version/vuex.cjs.min.js"
2021-07-03 06:42:24 +02:00
elif [ "$folder" = "instantsearch.css" ]; then
url="$JSDELIVR/npm/$folder@$version/themes/algolia-min.css"
2021-07-20 06:32:55 +02:00
elif [ "$folder" = "bootstrap-icons" ] && [ "$subfile" = "bootstrap-icons.woff" ]; then
url="$CLOUDFLARE/$folder/$version/font/fonts/$subfile"
2021-09-18 08:38:20 +02:00
elif [ "$folder" = "vex-js" ]; then
if [[ "$subfile" =~ \.css$ ]]; then
url="$CLOUDFLARE/$folder/$version/css/$subfile"
elif [[ "$subfile" =~ \.js$ ]]; then
url="$CLOUDFLARE/$folder/$version/js/$subfile"
fi
elif [ "$folder" = "angular.js" ]; then
url="$GOOGLEAPIS/angularjs/$version/$subfile"
2022-05-19 19:20:55 +02:00
elif [ "$folder" = "react-router" ] && [[ "$version" != 5* ]];then
2021-11-06 08:21:11 +01:00
url="$CLOUDFLARE/$folder/$version/react-router.production.min.js"
2022-01-15 07:12:32 +01:00
elif [ "$folder" = "search-insights" ];then
url="$JSDELIVR/npm/$folder@$version/dist/$jfile"
2022-02-19 06:42:06 +01:00
elif [ "$folder" = "dygraph" ] && [ "$version" = "1.1.1" ];then
url="$CLOUDFLARE/$folder/$version/dygraph-combined.js"
2022-02-24 05:57:54 +01:00
elif [ "$folder" = "mootools" ] && [ "$version" = "1.4.5" ];then
url="$CLOUDFLARE/$folder/$version/mootools-core-full-compat-yc.min.js"
2022-03-04 06:32:00 +01:00
elif [ "$folder" = "docsify-themeable" ];then
url="$JSDELIVR/npm/$folder@$version/dist/css/$jfile"
elif [ "$folder" = "autocomplete.js" ] && [ "$version" != "0.38.1" ];then
url="$JSDELIVR/npm/@algolia/autocomplete-js@$version/dist/umd/index.production.min.js"
2022-04-09 06:32:13 +02:00
elif [ "$folder" = "vue-match-media" ];then
url="$JSDELIVR/npm/vue-match-media@$version/dist/index.min.js"
2022-04-18 06:32:17 +02:00
elif [ "$folder" = "createjs" ];then
url="$CREATEJS/$version/createjs.min.js"
2022-06-28 08:28:00 +02:00
elif [ "$folder" = "moment.js" ] && [ "$version" = "2.5.1" ];then
url="$CLOUDFLARE/$folder/$version/moment-with-langs.min.js"
2022-07-26 06:13:03 +02:00
elif [ "$folder" = "react-intl" ]; then
url="$JSDELIVR/npm/react-intl@$version/react-intl.iife.min.js"
2022-09-06 05:50:01 +02:00
elif [ "$folder" = "in-view" ]; then
url="$JSDELIVR/npm/in-view@$version/dist/in-view.min.js"
2022-11-23 06:13:31 +01:00
elif [ "$folder" = "knockout" ] && [ "$version" = "3.5.1" ];then
url="$CLOUDFLARE/$folder/$version/knockout-latest.min.js"
2023-01-02 18:23:01 +01:00
elif [ "$folder" = "vue-router" ] && [ "$version" = "3.6.5" ];then
url="$CLOUDFLARE/$folder/$version/vue-router.min.js"
2023-01-02 18:20:02 +01:00
elif [ "$folder" = "ScrollMagic" ] && [ "$jfile" != "ScrollMagic.min.js" ];then
url="$CLOUDFLARE/$folder/$version/plugins/$jfile"
2023-12-10 08:33:51 +01:00
elif [ "$folder" = "redux" ] && [ "$version" != "4.2.1" ];then
url="$CLOUDFLARE/$folder/$version/redux.legacy-esm.min.js"
# --------------------------------------------------------------------------
2021-03-09 06:04:22 +01:00
else
if [ "$subfile" = "$jfile" ]; then
url="$CLOUDFLARE/$folder/$version/$subfile"
else
url="$CLOUDFLARE/$folder/$version/$file/$subfile"
fi
fi
}
2021-03-12 06:16:39 +01:00
2021-03-09 06:04:22 +01:00
# =============================================================================
# MAIN
# =============================================================================
2021-03-14 11:02:11 +01:00
# Check if all used commands exist
pre_check
# Handle arguments
2021-04-18 07:26:12 +02:00
while getopts d:fhlrtu opt; do
2021-03-14 11:02:11 +01:00
case $opt in
d) CHECK="$OPTARG";;
f) CREATE_THIRD_PARTY_FILE=true;;
h) help;;
l) list_resources;;
r) REPLACE=true;;
t) USE_TOR=true;;
2021-04-18 07:26:12 +02:00
u) ONLY_THIRD_PARTY=true && CREATE_THIRD_PARTY_FILE=true;;
2021-03-14 11:02:11 +01:00
?) help;;
esac
done
2021-03-09 06:04:22 +01:00
array=()
2021-03-14 11:02:11 +01:00
third_party=()
2021-03-11 06:34:29 +01:00
# Find files in /resource/
2021-03-09 06:04:22 +01:00
while IFS= read -r -d $'\0'; do
array+=("$REPLY")
2021-11-13 07:21:30 +01:00
done < <(find ../resources/ \
-type f \
\( -iname "*.jsm" -or -iname "*.css" -or -iname "*.woff" -or -iname "*.woff2" \) \
! -iname "fa-loader.css" \
! -iname "google-material-design-icons.css" \
! -iname "google-fonts-placeholder.css" \
2022-09-20 06:51:11 +02:00
-not -path "../resources/blocked/*" \
2022-11-04 06:25:06 +01:00
-not -path "../resources/mathjax/*/latest.jsm" \
2021-11-13 07:21:30 +01:00
-print0)
2021-03-09 06:04:22 +01:00
2021-03-11 06:34:29 +01:00
for i in "${array[@]}"; do
check_resource "$i"
2021-03-09 06:04:22 +01:00
done
2021-03-14 11:02:11 +01:00
# remove temporary file
2021-03-11 06:34:29 +01:00
rm ./tmp 2> /dev/null
2021-03-09 06:04:22 +01:00
IFS=$'\n' sorted=($(sort <<<"${third_party[*]}"))
unset IFS
2021-03-14 11:02:11 +01:00
# create THIRD_PARTY.txt
if [ "$CREATE_THIRD_PARTY_FILE" = true ]; then
printf "%s\n" "${sorted[@]}" > ../THIRD_PARTY.txt
fi
2021-03-09 06:04:22 +01:00
echo -e "\n\n\n"
echo -e "$DIVIDER"
2021-03-09 06:04:22 +01:00
echo -e "${GREEN}${BOLD}D O N E${NORMAL}${NOCOLOR}"
echo -e "$DIVIDER"
echo -e "${BOLD}Total:${NORMAL} $COUNTER_ALL"
2021-03-09 06:04:22 +01:00
echo -e ""
echo -e "${BOLD}Hash passed: ${NORMAL} $COUNTER_HASH_OK"
echo -e "${BOLD}Hash mismatch:${NORMAL} $COUNTER_HASH_FAILED"
echo -e "${BOLD}Skipped: ${NORMAL} $COUNTER_SKIPPED"
echo -e "${BOLD}No connection:${NORMAL} $COUNTER_CONNECT_FAILED"
echo -e ""
echo -e "$FILES_FAILED$FILES_SKIPPED$FILES_NO_CONNECTION"
echo -e ""