diff --git a/cgi-bin/search.cgi b/cgi-bin/search.cgi deleted file mode 100755 index 448cbf1..0000000 --- a/cgi-bin/search.cgi +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/bash - -# Configuration options -BASE_DIR="/data/sites" -STORAGE_PREFIX="/storage/md0" -IGNORE_REGEXES=('^/\.sandbox.*' '^/\.lftp.*' '^/dead\.letter' '.*\.rsync-tmp.*') -HEADER_DARK="$BASE_DIR/${SERVER_NAME:-slackware.uk}/html/includes/search-header-dark.html" -FOOTER_DARK="$BASE_DIR/${SERVER_NAME:-slackware.uk}/html/includes/search-footer-dark.html" -HEADER_LIGHT="$BASE_DIR/${SERVER_NAME:-slackware.uk}/html/includes/search-header-light.html" -FOOTER_LIGHT="$BASE_DIR/${SERVER_NAME:-slackware.uk}/html/includes/search-footer-light.html" -LOCATEDB="/tmp/mirrors.db" -LIMIT=1000 -MAX_CONCURRENT=5 - -# Extglob is required. -shopt -s extglob - -# Output an error in processing. -die() { - # $1 = The error message to output. - # $2 = Whether to include the retry link ("false" to disable inclusion, everything else is true). - cat <
-
- - - - -
- Error: $1$([[ "${2,,}" != "false" ]] && printf "
\n Please click here to retry your search." "${REQUEST_SCHEME:-https}://${SERVER_NAME:-slackware.uk}/search?$QUERY_STRING") -
-
- - -EOF - exit 1 -} - -# Initial headers. -printf "%s: %s\\n" "Content-type" "text/html" -printf "%s: %s\\n" "Cache-Control" "no-cache, no-store, must-revalidate" -printf "%s: %s\\n" "Pragma" "no-cache" -printf "%s: %s\\n\\n" "Expires" "1" - -# Extract cookies. -while read -r -d " " RAW; do - KEY="${RAW%%=*}" - VALUE="${RAW#*=}" - declare -A COOKIES+=( ["${KEY,,}"]="${VALUE,,}" ) -done <<<"$HTTP_COOKIE " # The space at the end is required. - -# Include the themed header. -if [[ "${COOKIES['theme']}" == "dark" ]]; then - cat "$HEADER_DARK" -else - cat "$HEADER_LIGHT" -fi - -# Limit the number of concurrent searches to avoid DoS. -if (( $(lsof -t "$LOCATEDB" | wc -l) > (MAX_CONCURRENT - 1) )); then - die "too many concurrent searches!" -else - exec 9<"$LOCATEDB" && flock -s -E 10 -w 2 9 || die "too many concurrent searches!" - - while read -r -d '&' QUERY; do - # If the read returned an empty string, skip. - [[ -z "$QUERY" ]] && continue - - # Extract the key and value to temporary variables. - KEY="${QUERY%%=*}" - VALUE="${QUERY#*=}" - - # Check the key is valid as a variable name. - [[ ! "$KEY" =~ ^[[:digit:]_]*[[:alnum:]_]*$ ]] && die "invalid query - don't try to be clever :)" "false" - - # Remove spaces from beginning and end of value. - : "${VALUE/#+(+)}" - : "${_/%+(+)}" - - # Squash multiple spaces in value. - : "${_//+(+)/+}" - - # Convert values from %-encoded form. - : "${_//%/\\x}" - - # Define the variable from the key name. - declare "X_$KEY"="$(printf "%b" "${_//+/ }")" - done <<<"${QUERY_STRING,,}&" # The & at the end is required. - - # Take a copy of q before it's modified, for the heading. - Q_COPY="${X_q:-(empty)}" - - # Adjust 'X_q' for the locate command by wrapping search elements in *s. - : "*${X_q// /* *}*" - X_q="${_//\/*/*}" - - # HTML boilerplate. - cat < - - - - -
- Search Results

- Search query: $Q_COPY
- Searches may contain multiple terms, include (basic) globs,
- and descend down from the current directory. -
- - - - - - - - - - -
- -
-
- -EOF - - I=1 - COUNT=0 - while read -r ITEM; do - # Only show 1000 items to prevent long load times. - (( I == LIMIT + 1 )) && break - - # Remove paths we don't want the user to see. - while read -r -d " " REGEX; do - [[ "${ITEM/$STORAGE_PREFIX}" =~ $REGEX ]] && continue 2 - done <<<"${IGNORE_REGEXES[@]}" - - # List the item. - printf " • %s
\\n" "${ITEM/$STORAGE_PREFIX}" "${ITEM/$STORAGE_PREFIX}" "${ITEM/$STORAGE_PREFIX}" - - (( I++ )) - (( COUNT++ )) - done < <(locate -A -d "$LOCATEDB" -i -l "$(( LIMIT * 2 ))" "$STORAGE_PREFIX/${X_p##/}" $X_q | sort) - - # Tell the user about the results. - if (( COUNT == 0 )); then - printf " %s" "No results - try to widen your search." - elif (( COUNT == LIMIT )); then - printf " %s" "Maximum $LIMIT items shown - try to refine your search." - else - printf " %s" "$COUNT items found." - fi - -# HTML boilerplate. - cat < -
-
-EOF - - # Include footer. - if [[ "${COOKIES['theme']}" == "dark" ]]; then - cat "$FOOTER_DARK" - else - cat "$FOOTER_LIGHT" - fi -fi diff --git a/html/errordocs/400.shtml b/html/errordocs/400.shtml deleted file mode 100644 index 924e3da..0000000 --- a/html/errordocs/400.shtml +++ /dev/null @@ -1,54 +0,0 @@ - - - - Slackware UK: 400 - - - - - - - - - -

** Slackware UK **

-
- - - - -
- Patronage & donations
- If you use the Slackware UK services on a regular basis, and would like to contribute to running costs, make a continuing patronage (and receive special benefits), or make a one off PayPal payment, please use one of the following buttons: - - - - - - -
- GoFundMe Campaign - - Patreon Page - - PayPal Donation -
- All donations will be gratefully received - thank you! -
-
-
- - - - -
-

400 - Bad Request

- The server could not understand the request. -
-
-
-
-
- Mirror server bandwidth utilisation
- <!--#include virtual='/html/bwbar.txt' --> -
diff --git a/html/errordocs/401.shtml b/html/errordocs/401.shtml deleted file mode 100644 index b37b472..0000000 --- a/html/errordocs/401.shtml +++ /dev/null @@ -1,54 +0,0 @@ - - - - Slackware UK: 401 - - - - - - - - - -

** Slackware UK **

-
- - - - -
- Patronage & donations
- If you use the Slackware UK services on a regular basis, and would like to contribute to running costs, make a continuing patronage (and receive special benefits), or make a one off PayPal payment, please use one of the following buttons: - - - - - - -
- GoFundMe Campaign - - Patreon Page - - PayPal Donation -
- All donations will be gratefully received - thank you! -
-
-
- - - - -
-

401 - Unauthorised

- Authentication is required. -
-
-
-
-
- Mirror server bandwidth utilisation
- <!--#include virtual='/html/bwbar.txt' --> -
diff --git a/html/errordocs/403.shtml b/html/errordocs/403.shtml deleted file mode 100644 index d3e1c0b..0000000 --- a/html/errordocs/403.shtml +++ /dev/null @@ -1,54 +0,0 @@ - - - - Slackware UK: 403 - - - - - - - - - -

** Slackware UK **

-
- - - - -
- Patronage & donations
- If you use the Slackware UK services on a regular basis, and would like to contribute to running costs, make a continuing patronage (and receive special benefits), or make a one off PayPal payment, please use one of the following buttons: - - - - - - -
- GoFundMe Campaign - - Patreon Page - - PayPal Donation -
- All donations will be gratefully received - thank you! -
-
-
- - - - -
-

403 - Forbidden

- You do not have permission to access this resource. -
-
-
-
-
- Mirror server bandwidth utilisation
- <!--#include virtual='/html/bwbar.txt' --> -
diff --git a/html/errordocs/404.shtml b/html/errordocs/404.shtml deleted file mode 100644 index 808a15b..0000000 --- a/html/errordocs/404.shtml +++ /dev/null @@ -1,54 +0,0 @@ - - - - Slackware UK: 404 - - - - - - - - - -

** Slackware UK **

-
- - - - -
- Patronage & donations
- If you use the Slackware UK services on a regular basis, and would like to contribute to running costs, make a continuing patronage (and receive special benefits), or make a one off PayPal payment, please use one of the following buttons: - - - - - - -
- GoFundMe Campaign - - Patreon Page - - PayPal Donation -
- All donations will be gratefully received - thank you! -
-
-
- - - - -
-

404 - Not Found

- The requested page or file is not found. -
-
-
-
-
- Mirror server bandwidth utilisation
- <!--#include virtual='/html/bwbar.txt' --> -
diff --git a/html/errordocs/405.shtml b/html/errordocs/405.shtml deleted file mode 100644 index b021d4d..0000000 --- a/html/errordocs/405.shtml +++ /dev/null @@ -1,54 +0,0 @@ - - - - Slackware UK: 405 - - - - - - - - - -

** Slackware UK **

-
- - - - -
- Patronage & donations
- If you use the Slackware UK services on a regular basis, and would like to contribute to running costs, make a continuing patronage (and receive special benefits), or make a one off PayPal payment, please use one of the following buttons: - - - - - - -
- GoFundMe Campaign - - Patreon Page - - PayPal Donation -
- All donations will be gratefully received - thank you! -
-
-
- - - - -
-

405 - Method Forbidden

- Access method is not authorised. -
-
-
-
-
- Mirror server bandwidth utilisation
- <!--#include virtual='/html/bwbar.txt' --> -
diff --git a/html/includes/breadcrumbs-search-theme.php b/html/includes/breadcrumbs-search-theme.php deleted file mode 100644 index 21b2eac..0000000 --- a/html/includes/breadcrumbs-search-theme.php +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - -
- -
diff --git a/html/includes/search-footer-dark.html b/html/includes/search-footer-dark.html deleted file mode 100644 index f583b33..0000000 --- a/html/includes/search-footer-dark.html +++ /dev/null @@ -1,7 +0,0 @@ -
- Mirror server bandwidth utilisation
- - Bandwidth usage bar -
- - diff --git a/html/includes/search-footer-light.html b/html/includes/search-footer-light.html deleted file mode 100644 index 3bea115..0000000 --- a/html/includes/search-footer-light.html +++ /dev/null @@ -1,7 +0,0 @@ -
- Mirror server bandwidth utilisation
- - Bandwidth usage bar -
- - diff --git a/html/includes/search-header-dark.html b/html/includes/search-header-dark.html deleted file mode 100644 index 7669380..0000000 --- a/html/includes/search-header-dark.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - Slackware UK: Search Results - - -
-

Slackware UK Logo

-
-
- - - - -
- Patronage & Donations -
- If you use the Slackware UK services on a regular basis, and would like to contribute to running costs, make a continuing patronage (and receive special benefits), or make a one off PayPal payment, please use one of the following buttons: - - - - - - -
- Patreon Logo - - PayPal Logo -
- All donations will be gratefully received - thank you! -
-
diff --git a/html/includes/search-header-light.html b/html/includes/search-header-light.html deleted file mode 100644 index ef237fe..0000000 --- a/html/includes/search-header-light.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - Slackware UK: Search Results - - -
-

Slackware UK Logo

-
-
- - - - -
- Patronage & Donations -
- If you use the Slackware UK services on a regular basis, and would like to contribute to running costs, make a continuing patronage (and receive special benefits), or make a one off PayPal payment, please use one of the following buttons: - - - - - - -
- Patreon Logo - - PayPal Logo -
- All donations will be gratefully received - thank you! -
-
diff --git a/html/uk2-black.png b/html/uk2-black.png deleted file mode 100644 index 6b4fe53..0000000 Binary files a/html/uk2-black.png and /dev/null differ diff --git a/html/uk2-white.png b/html/uk2-white.png deleted file mode 100644 index d81be41..0000000 Binary files a/html/uk2-white.png and /dev/null differ