From a25a3ce6fd290415e7086af634e793a1819e467e Mon Sep 17 00:00:00 2001 From: Aetherinox Date: Sun, 27 Oct 2024 07:35:31 -0700 Subject: [PATCH] ci: generate proper id --- .github/scripts/bl-block.sh | 3 ++- .github/scripts/bl-format.sh | 3 ++- .github/scripts/bl-html.sh | 3 ++- .github/scripts/bl-htmlip.sh | 3 ++- .github/scripts/bl-json.sh | 3 ++- .github/scripts/bl-master.sh | 5 +++-- .github/scripts/bl-plain.sh | 3 ++- .github/scripts/bl-spf.sh | 3 ++- 8 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/scripts/bl-block.sh b/.github/scripts/bl-block.sh index 5786343b7..4b522f42e 100644 --- a/.github/scripts/bl-block.sh +++ b/.github/scripts/bl-block.sh @@ -74,7 +74,8 @@ COUNT_TOTAL_IP=0 # number of single IPs ( BLOCKS_COUNT_TOTAL_IP=0 # number of ips for one particular file BLOCKS_COUNT_TOTAL_SUBNET=0 # number of subnets for one particular file TEMPL_NOW=`date -u` # get current date in utc format -TEMPL_ID="${APP_FILE_PERM//[^[:alnum:]]/_}" # ipset id, /description/* and /category/* files must match this value +TEMPL_ID=$(basename -- ${APP_FILE_PERM}) # ipset id, get base filename +TEMPL_ID="${TEMPL_ID//[^[:alnum:]]/_}" # ipset id, only allow alphanum and underscore, /description/* and /category/* files must match this value TEMPL_UUID=$(uuidgen -m -N "${TEMPL_ID}" -n @url) # uuid associated to each release APP_AGENT="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" TEMPL_DESC=$(curl -sSL -A "${APP_AGENT}" "https://raw.githubusercontent.com/${APP_REPO}/${APP_REPO_BRANCH}/.github/descriptions/${TEMPL_ID}.txt") diff --git a/.github/scripts/bl-format.sh b/.github/scripts/bl-format.sh index 5788241ac..e2ce853cb 100644 --- a/.github/scripts/bl-format.sh +++ b/.github/scripts/bl-format.sh @@ -64,7 +64,8 @@ COUNT_TOTAL_IP=0 # number of single IPs ( BLOCKS_COUNT_TOTAL_IP=0 # number of ips for one particular file BLOCKS_COUNT_TOTAL_SUBNET=0 # number of subnets for one particular file TEMPL_NOW=`date -u` # get current date in utc format -TEMPL_ID="${APP_FILE_PERM//[^[:alnum:]]/_}" # ipset id, /description/* and /category/* files must match this value +TEMPL_ID=$(basename -- ${APP_FILE_PERM}) # ipset id, get base filename +TEMPL_ID="${TEMPL_ID//[^[:alnum:]]/_}" # ipset id, only allow alphanum and underscore, /description/* and /category/* files must match this value TEMPL_UUID=$(uuidgen -m -N "${TEMPL_ID}" -n @url) # uuid associated to each release APP_AGENT="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" TEMPL_DESC=$(curl -sSL -A "${APP_AGENT}" "https://raw.githubusercontent.com/${APP_REPO}/${APP_REPO_BRANCH}/.github/descriptions/${TEMPL_ID}.txt") diff --git a/.github/scripts/bl-html.sh b/.github/scripts/bl-html.sh index 116415939..2388b81fa 100644 --- a/.github/scripts/bl-html.sh +++ b/.github/scripts/bl-html.sh @@ -80,7 +80,8 @@ COUNT_LINES=0 # number of lines in doc COUNT_TOTAL_SUBNET=0 # number of IPs in all subnets combined COUNT_TOTAL_IP=0 # number of single IPs (counts each line) TEMPL_NOW=`date -u` # get current date in utc format -TEMPL_ID="${APP_FILE_PERM//[^[:alnum:]]/_}" # ipset id, /description/* and /category/* files must match this value +TEMPL_ID=$(basename -- ${APP_FILE_PERM}) # ipset id, get base filename +TEMPL_ID="${TEMPL_ID//[^[:alnum:]]/_}" # ipset id, only allow alphanum and underscore, /description/* and /category/* files must match this value TEMPL_UUID=$(uuidgen -m -N "${TEMPL_ID}" -n @url) # uuid associated to each release APP_AGENT="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" TEMPL_DESC=$(curl -sSL -A "${APP_AGENT}" "https://raw.githubusercontent.com/${APP_REPO}/${APP_REPO_BRANCH}/.github/descriptions/${TEMPL_ID}.txt") diff --git a/.github/scripts/bl-htmlip.sh b/.github/scripts/bl-htmlip.sh index 55677d007..6db92fa04 100644 --- a/.github/scripts/bl-htmlip.sh +++ b/.github/scripts/bl-htmlip.sh @@ -84,7 +84,8 @@ COUNT_TOTAL_IP=0 # number of single IPs ( BLOCKS_COUNT_TOTAL_IP=0 # number of ips for one particular file BLOCKS_COUNT_TOTAL_SUBNET=0 # number of subnets for one particular file TEMPL_NOW=`date -u` # get current date in utc format -TEMPL_ID="${APP_FILE_PERM//[^[:alnum:]]/_}" # ipset id, /description/* and /category/* files must match this value +TEMPL_ID=$(basename -- ${APP_FILE_PERM}) # ipset id, get base filename +TEMPL_ID="${TEMPL_ID//[^[:alnum:]]/_}" # ipset id, only allow alphanum and underscore, /description/* and /category/* files must match this value TEMPL_UUID=$(uuidgen -m -N "${TEMPL_ID}" -n @url) # uuid associated to each release APP_AGENT="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" TEMPL_DESC=$(curl -sSL -A "${APP_AGENT}" "https://raw.githubusercontent.com/${APP_REPO}/${APP_REPO_BRANCH}/.github/descriptions/${TEMPL_ID}.txt") diff --git a/.github/scripts/bl-json.sh b/.github/scripts/bl-json.sh index 889fa401c..54cdd9c63 100755 --- a/.github/scripts/bl-json.sh +++ b/.github/scripts/bl-json.sh @@ -85,7 +85,8 @@ COUNT_TOTAL_IP=0 # number of single IPs ( BLOCKS_COUNT_TOTAL_IP=0 # number of ips for one particular file BLOCKS_COUNT_TOTAL_SUBNET=0 # number of subnets for one particular file TEMPL_NOW=`date -u` # get current date in utc format -TEMPL_ID="${APP_FILE_PERM//[^[:alnum:]]/_}" # ipset id, /description/* and /category/* files must match this value +TEMPL_ID=$(basename -- ${APP_FILE_PERM}) # ipset id, get base filename +TEMPL_ID="${TEMPL_ID//[^[:alnum:]]/_}" # ipset id, only allow alphanum and underscore, /description/* and /category/* files must match this value TEMPL_UUID=$(uuidgen -m -N "${TEMPL_ID}" -n @url) # uuid associated to each release APP_AGENT="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" TEMPL_DESC=$(curl -sSL -A "${APP_AGENT}" "https://raw.githubusercontent.com/${APP_REPO}/${APP_REPO_BRANCH}/.github/descriptions/${TEMPL_ID}.txt") diff --git a/.github/scripts/bl-master.sh b/.github/scripts/bl-master.sh index 6b7bd3b3d..71df510dd 100755 --- a/.github/scripts/bl-master.sh +++ b/.github/scripts/bl-master.sh @@ -79,7 +79,8 @@ COUNT_TOTAL_IP=0 # number of single IPs ( BLOCKS_COUNT_TOTAL_IP=0 # number of ips for one particular file BLOCKS_COUNT_TOTAL_SUBNET=0 # number of subnets for one particular file TEMPL_NOW=`date -u` # get current date in utc format -TEMPL_ID="${APP_FILE_PERM//[^[:alnum:]]/_}" # ipset id, /description/* and /category/* files must match this value +TEMPL_ID=$(basename -- ${APP_FILE_PERM}) # ipset id, get base filename +TEMPL_ID="${TEMPL_ID//[^[:alnum:]]/_}" # ipset id, only allow alphanum and underscore, /description/* and /category/* files must match this value TEMPL_UUID=$(uuidgen -m -N "${TEMPL_ID}" -n @url) # uuid associated to each release APP_AGENT="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" TEMPL_DESC=$(curl -sSL -A "${APP_AGENT}" "https://raw.githubusercontent.com/${APP_REPO}/${APP_REPO_BRANCH}/.github/descriptions/${TEMPL_ID}.txt") @@ -88,7 +89,7 @@ TEMPL_EXP=$(curl -sSL -A "${APP_AGENT}" "https://raw.githubusercontent.com/${APP TEMP_URL_SRC=$(curl -sSL -A "${APP_AGENT}" "https://raw.githubusercontent.com/${APP_REPO}/${APP_REPO_BRANCH}/.github/url-source/${TEMPL_ID}.txt") REGEX_URL='^(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]\.[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]$' REGEX_ISNUM='^[0-9]+$' - +$(basename -- "$TEMPL_ID") # # # Default Values # # diff --git a/.github/scripts/bl-plain.sh b/.github/scripts/bl-plain.sh index adb1d7978..dde187d18 100644 --- a/.github/scripts/bl-plain.sh +++ b/.github/scripts/bl-plain.sh @@ -71,7 +71,8 @@ COUNT_LINES=0 # number of lines in doc COUNT_TOTAL_SUBNET=0 # number of IPs in all subnets combined COUNT_TOTAL_IP=0 # number of single IPs (counts each line) TEMPL_NOW=`date -u` # get current date in utc format -TEMPL_ID="${APP_FILE_PERM//[^[:alnum:]]/_}" # ipset id, /description/* and /category/* files must match this value +TEMPL_ID=$(basename -- ${APP_FILE_PERM}) # ipset id, get base filename +TEMPL_ID="${TEMPL_ID//[^[:alnum:]]/_}" # ipset id, only allow alphanum and underscore, /description/* and /category/* files must match this value TEMPL_UUID=$(uuidgen -m -N "${TEMPL_ID}" -n @url) # uuid associated to each release APP_AGENT="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" TEMPL_DESC=$(curl -sSL -A "${APP_AGENT}" "https://raw.githubusercontent.com/${APP_REPO}/${APP_REPO_BRANCH}/.github/descriptions/${TEMPL_ID}.txt") diff --git a/.github/scripts/bl-spf.sh b/.github/scripts/bl-spf.sh index 135f9cd43..37660818c 100644 --- a/.github/scripts/bl-spf.sh +++ b/.github/scripts/bl-spf.sh @@ -62,7 +62,8 @@ COUNT_TOTAL_IP=0 # number of single IPs ( BLOCKS_COUNT_TOTAL_IP=0 # number of ips for one particular file BLOCKS_COUNT_TOTAL_SUBNET=0 # number of subnets for one particular file TEMPL_NOW=`date -u` # get current date in utc format -TEMPL_ID="${APP_FILE_PERM//[^[:alnum:]]/_}" # ipset id, /description/* and /category/* files must match this value +TEMPL_ID=$(basename -- ${APP_FILE_PERM}) # ipset id, get base filename +TEMPL_ID="${TEMPL_ID//[^[:alnum:]]/_}" # ipset id, only allow alphanum and underscore, /description/* and /category/* files must match this value TEMPL_UUID=$(uuidgen -m -N "${TEMPL_ID}" -n @url) # uuid associated to each release APP_AGENT="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" TEMPL_DESC=$(curl -sSL -A "${APP_AGENT}" "https://raw.githubusercontent.com/${APP_REPO}/${APP_REPO_BRANCH}/.github/descriptions/${TEMPL_ID}.txt")