diff --git a/cgi-bin/searchapi.cgi b/cgi-bin/searchapi.cgi new file mode 100755 index 0000000..3f6fce7 --- /dev/null +++ b/cgi-bin/searchapi.cgi @@ -0,0 +1,119 @@ +#!/bin/bash + +# Configuration. +STORAGE_PREFIX="/storage/md0" +LOCATE_DB="/tmp/mirrors.db" +DEF_RESULTS=500 +MAX_RESULTS=3000 +MAX_CONCURRENT=10 +IGNORE_REGEXES=('^/\.sandbox.*' '^/\.lftp.*' '^/dead\.letter' '.*\.rsync-tmp.*') + +# Extglob is required. +shopt -s extglob + +# Output an error in processing. +die() { + # $1 = The error code to output. + # 0 = Success. + # 1 = Temporary error (eg, max concurrent). + # 2 = Perminant error. + # $2 = The error message to output (if any). + printf "%s: %s%b" "Status" "${1:-2}" "\0" + [[ -n "$2" ]] && printf "%s: %s%b" "Error" "$2" "\0" + exit 1 +} + +# Initial headers. +#printf "%s: %s\\n" "Content-type" "text/plain" +printf "%s: %s\\n" "Content-type" "application/octet-stream" +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" + +# Limit the number of concurrent searches to avoid DoS. +if (( $(lsof -t "$LOCATE_DB" | wc -l) > (MAX_CONCURRENT - 1) )); then + die "1" "Too many concurrent searches!" +else + # Lock the DB for the lsof count above. + # shellcheck disable=SC2015 + exec 9<"$LOCATE_DB" && flock -s -E 10 -w 2 9 || die "1" "Too many concurrent searches!" + + # shellcheck disable=SC2154 + 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 "2" "Invalid query - don't try to be clever :)" + + # Define the variable from the key name. + declare "QS_$KEY"="$VALUE" + done <<<"${QUERY_STRING,,}&" # The & at the end is required. + + # Remove spaces from beginning and end of query. + QS_q="${QS_q/##+(+)}" + QS_q="${QS_q/%%+(+)}" + + # Squash multiple +s in query. + QS_q="${QS_q//+(+)/+}" + + # Convert any +s in the path and query into spaces. + QS_p="${QS_p//+/ }" + QS_q="${QS_q//+/ }" + + # Don't allow /s in the query. + # [[ "$QS_q" == */* ]] || [[ "$QS_q" == *%2F* ]] && die "2" "Searches may not include the '/' character." + + # Convert path and query from %-encoded form. + QS_p="$(printf "%b" "${QS_p//%/\\x}")" + QS_q="$(printf "%b" "${QS_q//%/\\x}")" + + # Adjust 'QS_q' for the locate command by wrapping search elements in *. + QS_q="*${QS_q// /* *}*" + + # Adjust 'QS_l' to not go over maximum limit of results, or use default if not supplied. + [[ -z "$QS_l" ]] && QS_l="$DEF_RESULTS" + (( QS_l > MAX_RESULTS )) && QS_l="$MAX_RESULTS" + + # Give success status as checks have passed. + printf "%s: %s%b" "Status" "0" "\0" + + I=1 + # shellcheck disable=SC2154 + while read -r -d $'\0' ITEM; do + # Only show specified number of items. + (( I == (QS_l + 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[@]}" + + # Don't list the path searched for. + [[ "${ITEM/$STORAGE_PREFIX}" == "$QS_p" ]] && continue + + # List the item. + if [[ -f "$ITEM" ]]; then + # File type. + printf "%s %s%b" "f" "${ITEM/$STORAGE_PREFIX}" "\0" + elif [[ -d "$ITEM" ]]; then + # Directory type. + printf "%s %s%b" "d" "${ITEM/$STORAGE_PREFIX}" "\0" + elif [[ -L "$ITEM" ]]; then + # Symbolic link type. + printf "%s %s%b" "l" "${ITEM/$STORAGE_PREFIX}" "\0" + elif [[ -e "$ITEM" ]]; then + # Other type. + printf "%s %s%b" "o" "${ITEM/$STORAGE_PREFIX}" "\0" + else + # Stale file in database. + printf "%s %s%b" "?" "${ITEM/$STORAGE_PREFIX}" "\0" + fi + + (( I++ )) + done < <(locate -0 -A -d "$LOCATE_DB" -i -l "$(( QS_l * 2 ))" "$STORAGE_PREFIX/${QS_p/#+(\/)}" $QS_q | sort) +fi diff --git a/html/dark.css b/html/dark.css index 3c2db57..03c5b25 100644 --- a/html/dark.css +++ b/html/dark.css @@ -14,110 +14,261 @@ a:hover { } body { - background-image: url("/html/circuit-dark.png"); background-color: #000000; + background-image: url("/html/circuit-dark.png"); color: #aeaeae; - margin-left: 15px; - margin-right: 15px; -} - -form { - margin-left: 0; - margin-right: 0; - margin-top: 0; - margin-bottom: 0; + padding-top: 15px; } hr { - height: 2px; - border-width: 0; - color: #888888; background-color: #888888; + border: 0; + color: #888888; + height: 2px; +} + +img { + border: 0; } pre { + font-size: 15px; +} + +pre img { + vertical-align: bottom; +} + +table { + margin-bottom: 5px; + margin-left: 5px; + margin-right: 5px; + margin-top: 5px; + width: 100%; +} + +table, td { + border: 1px solid; + border-collapse: collapse; + color: #888888; +} + +td { + padding-bottom: 5px; + padding-left: 5px; + padding-right: 5px; + padding-top: 5px; +} + +.bold { + font-weight: bold; +} + +.box { background: #060606; border: 2px solid #aaaaaa; - padding-left: 20; - padding-right: 20; box-shadow: 10px 10px 10px -5px rgba(128,128,128,0.5); } +.boxmargins { + margin-bottom: 10px; +} + +.boxpadding { + padding-left: 20px; + padding-right: 20px; +} + .heading { font-size: 200%; } +.motdcontent { +} + +.motdheader { + font-weight: bold; + text-decoration: underline; +} + +.notice { + display: block; + margin-left: auto; + margin-bottom: 25px; + margin-right: auto; + text-align: center; + width: 70%; +} + +.searchinput { + background-color: #060606; + border: 0; + color: #888888; + font-size: 15px; + height: 15px; + outline: 0; + margin-left: 25px; + margin-right: 5px; +} + +.searchresultsinput { + border: 1px; + border-color: #555555; + border-style: solid; + width: 500px; +} + +.sponsor { + margin-top: 15px; + margin-bottom: 15px; +} + .subheading { font-size: 125%; } -.breadcrumbs { - font-size: 150%; - background: #060606; - border: 2px solid #aaaaaa; - padding-left: 10; - padding-top: 2; - padding-right: 10; - padding-bottom: 2; - box-shadow: 10px 10px 10px -5px rgba(128,128,128,0.5); +.underline { + text-decoration: underline; } -.header { - background: #060606; - border: 2px solid #aaaaaa; - margin: 20; - padding-left: 10; - padding-top: 10; - padding-right: 10; - padding-bottom: 10; - box-shadow: 10px 10px 10px -5px rgba(128,128,128,0.5); + +#breadcrumbs { + align-self: end; + display: flex; + min-height: 25px; + margin-left: auto; + margin-right: auto; } -.navbar { - width: 100%; +#breadcrumbstext { + align-content: center; + font-size: 15px; + text-align: center; + margin-left: 5px; + margin-right: 5px; +} + +#bwbar { + display: block; + margin-left: auto; + margin-right: auto; + margin-top: 30px; text-align: center; } -.search { - background: #060606; - border: 2px solid #aaaaaa; - box-shadow: 10px 10px 10px -5px rgba(128,128,128,0.5); +#copyright { + font-size: 10px; + text-align: center; } -.searchinput { - border: none; - background: #060606; - outline: none; - color: #888888; - font-size: 11px; - box-sizing: border-box; - padding-left: 10; - padding-top: 2; - padding-right: 10; - padding-bottom: 2; +#donatebuttons { + display: grid; + column-gap: 10%; + grid-template-columns: auto auto; + justify-content: center; + margin-bottom: 10px; + margin-top: 20px; +} + +#headingbox { + margin-left: auto; + margin-right: auto; + width: fit-content; +} + +#headingtext { + text-align: center; + margin-bottom: 5px; + margin-left: 5px; + margin-right: 5px; + margin-top: 5px; +} + +#donorslistbox { + margin-left: auto; + margin-right: auto; + width: 70%; + text-align: center; +} + +#donorstable { +} + +#logo { + display: flex; + justify-content: center; + margin-bottom: 30px; +} + +#motd { + column-gap: 40px; + display: grid; + grid-template-columns: auto auto; + margin-left: 30px; + margin-right: 30px; + row-gap: 15px; + text-align: left; +} + +#page { + margin-left: auto; + margin-right: auto; + width: 90%; +} + +#search { + align-content: center; + align-self: end; background-color: #060606; background-image: url('/html/search-white.png'); - background-size: 15px 15px; - background-position: 2px 2px; + background-position: 5px 5px; background-repeat: no-repeat; - padding-left: 20px; + background-size: 15px 15px; + height: 25px; + margin-left: 0; + margin-right: auto; + max-height: 25px; } -.searchresults { - background: #060606; - border: 2px solid #aaaaaa; - padding-left: 20; - padding-right: 20; - box-shadow: 10px 10px 10px -5px rgba(128,128,128,0.5); +#searchbreadcrumbstheme { + display: grid; + column-gap: 50px; + grid-template-columns: auto auto auto; } -.sponsorslist { - background: #060606; - border: 2px solid #777; - margin: 20; - padding-left: 10; - padding-top: 10; - padding-right: 10; - padding-bottom: 10; - box-shadow: 10px 10px 10px -5px rgba(128,128,128,0.5); +#signature { + grid-column-start: 1; + grid-column-end: 3; + margin-bottom: 50px; + text-align: right; +} + +#sponsorship { + font-weight: bold; + margin-bottom: 20px; + text-align: center; +} + +#themetoggle { + align-self: end; + display: flex; + height: 25px; + margin-left: auto; + margin-right: 0; + max-height: 25px; + text-align: right; +} + +#themetoggleimg { + height: 15px; + margin-right: 5px; + vertical-align: middle; +} + +#themetoggletext { + align-content: center; + color: #888888; + font-size: 15px; + margin-left: 5px; + margin-right: 5px; } diff --git a/html/donors.php b/html/donors.php index 8c3c1cb..742106e 100644 --- a/html/donors.php +++ b/html/donors.php @@ -1,660 +1,308 @@ - - - - -
-
- 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: - - |
-
- Project Supporters - The following people have kindly donated to slackware.uk. - Thank you very much for your support! :) - |
-
- 21st July 2022 - | -- David Woodfall - | -
- 18th July 2022 - | -- Luke Dedek - | -
- 14th July 2022 - | -- Jack Leong - | -
- 10th July 2022 - | -- Charles Coffee - | -
- 8th July 2022 - | -- Randall Robinson - | -
- 20th June 2022 - | -- Richard Hoyle - | -
- 7th June 2022 - | -- Richard Hanser - | -
- 7th June 2022 - | -- Abehinichi - | -
- 6th June 2022 - | -- Keith Burnett - | -
- 6th June 2022 - | -- David Ian Allen - | -
- 6th June 2022 - | -- Duncan Wood - | -
- 6th June 2022 - | -- Robert Bresaz - | -
- 4th June 2022 - | -- Barry Grundy - | -
- 4th June 2022 - | -- Antoine Dierstein - | -
- 4th June 2022 - | -- Karl Gunnar Hammarlund - | -
- 4th June 2022 - | -- Matthew Dinslage - | -
- 4th June 2022 - | -- David Hall - | -
- 27th April 2022 - | -- Matthew Dinslage - | -
- 4th April 2022 - | -- Edward Rosenberg - | -
- 2nd April 2022 - | -- Matthew Dinslage - | -
- 21th March 2022 - | -- Theodore Allen - | -
- 18th March 2022 - | -- George Nielsen - | -
- 18th March 2022 - | -- Ioannis Anagnostakis - | -
- 18th March 2022 - | -- Karl Gunnar Hammarlund - | -
- 18th March 2022 - | -- Brian Lawrence - | -
- 18th March 2022 - | -- Dane Jensen - | -
- 18th March 2022 - | -- Matthew Dinslage - | -
- 9th March 2022 - | -- David Trudgian - | -
- 7th March 2022 - | -- Robert Bresaz - | -
- 13th January 2022 - | -- Rod Ziemski - | -
- 21st December 2021 - | -- Eric Trimmer - | -
- 30th September 2021 - | -- Brian Lawrence - | -
- 17th August 2021 - | -- Christoph Willing - | -
- 14th July 2021 - | -- Brian Lawrence - | -
- 11th July 2021 - | -- Don Boots - | -
- 6th June 2021 - | -- Cleverson Casarin Uliana - | -
- 30th May 2021 - | -- Klaus Gretland - | -
- 25th May 2021 - | -- Matthew Dinslage - | -
- 25th May 2021 - | -- Karl Bruns - | -
- 18th May 2021 - | -- Karl Gunnar Hammarlund - | -
- 15th May 2021 - | -- Christoph Koernig - | -
- 20th April 2021 - | -- Anthony McKenzie - | -
- 18th April 2021 - | -- Marcin Wolcendorf - | -
- 10th April 2021 - | -- Christoph Kühne - | -
- 8th April 2021 - | -- Patrick Volkerding - | -
- 29th March 2021 - | -- Anthony McKenzie - | -
- 7th March 2021 - | -- James Scott - | -
- 2nd March 2021 - | -- Alain Detal - | -
- 15th February 2021 - | -- Diniz Fernando Bortolotto Ferreira - | -
- 22nd December 2020 - | -- Peter Christy - | -
- 22nd December 2020 - | -- Karl Gunnar Hammarlund - | -
- 15th December 2020 - | -- Karol Jurica - | -
- 14th December 2020 - | -- Stanley Garvey - | -
- 2nd October 2020 - | -- Corby Roberts - | -
- 24th August 2020 - | -- Weber Kai - | -
- 7th August 2020 - | -- Brian Lawrence - | -
- 6th August 2020 - | -- Marcin Słodkiewicz - | -
- 30th May 2020 - | -- Ahmed Abbas - | -
- 23rd May 2020 - | -- Adam Purkrt - | -
- 5th May 2020 - | -- Clemens Sauerzopf - | -
- 30th April 2020 - | -- Gerard Lally - | -
- 6th April 2020 - | -- Peter Christy - | -
- 3rd April 2020 - | -- Tom Kosir - | -
- 30th March 2020 - | -- jwc1936 - | -
- 13th March 2020 - | -- Gregory Guy Rozan - | -
- 6th March 2020 - | -- Brian Lawrence - | -
- 5th March 2020 - | -- Karl Gunnar Hammarlund - | -
- 5th March 2020 - | -- Pierre-Philipp Braun - | -
- 4th March 2020 - | -- Christoph Kühne - | -
- 22nd February 2020 - | -- Aaditya Bagga - | -
- 20th October 2019 - | -- Shuaidu Yang - | -
- 12th October 2019 - | -- Andrew Macks - | -
- 9th October 2019 - | -- Tapio Pätilä - | -
- 30th August 2019 - | -- Nora's Portal - | -
- 18th July 2019 - | -- Karl Gunnar Hammarlund - | -
- 21st May 2019 - | -- Brian Lawrence - | -
- 16th May 2019 - | -- Daniel Bowling - | -
- 27th April 2019 - | -- Antoniazzi Leonardo - | -
25th July 2024 | M W Magee | +
3rd June 2024 | Karl Gunnar Hammarlund | +
15th May 2024 | Tomasz Szewczyk | +
27th March 2024 | Raul Nevarez Garay | +
3rd March 2024 | Richard Barnes | +
30th November 2023 | Eduardo Alberto Castillo | +
20th September 2023 | Daniel Pompey | +
25th August 2023 | Syed Sajjad Rizvi | +
21st July 2023 | Jude DaShiell | +
4th June 2023 | Gerald Morris | +
3rd May 2023 | Syed Sajjad Rizvi | +
20th March 2023 | Luna Jernberg | +
8th February 2023 | Sergej Tjart | +
21st December 2022 | Karl Gunnar Hammarlund | +
5th November 2022 | David Melik | +
27th September 2022 | Miguel Angel González Moreno | +
23rd September 2022 | Christoph Koernig | +
8th September 2022 | Leeung-Jen | +
21st July 2022 | David Woodfall | +
18th July 2022 | Luke Dedek | +
14th July 2022 | Jack Leong | +
10th July 2022 | Charles Coffee | +
8th July 2022 | Randall Robinson | +
20th June 2022 | Richard Hoyle | +
7th June 2022 | Richard Hanser | +
7th June 2022 | Abehinichi | +
6th June 2022 | Keith Burnett | +
6th June 2022 | David Ian Allen | +
6th June 2022 | Duncan Wood | +
6th June 2022 | Robert Bresaz | +
4th June 2022 | Barry Grundy | +
4th June 2022 | Antoine Dierstein | +
4th June 2022 | Karl Gunnar Hammarlund | +
4th June 2022 | Matthew Dinslage | +
4th June 2022 | David Hall | +
27th April 2022 | Matthew Dinslage | +
4th April 2022 | Edward Rosenberg | +
2nd April 2022 | Matthew Dinslage | +
21th March 2022 | Theodore Allen | +
18th March 2022 | George Nielsen | +
18th March 2022 | Ioannis Anagnostakis | +
18th March 2022 | Karl Gunnar Hammarlund | +
18th March 2022 | Brian Lawrence | +
18th March 2022 | Dane Jensen | +
18th March 2022 | Matthew Dinslage | +
9th March 2022 | David Trudgian | +
7th March 2022 | Robert Bresaz | +
13th January 2022 | Rod Ziemski | +
21st December 2021 | Eric Trimmer | +
30th September 2021 | Brian Lawrence | +
17th August 2021 | Christoph Willing | +
14th July 2021 | Brian Lawrence | +
11th July 2021 | Don Boots | +
6th June 2021 | Cleverson Casarin Uliana | +
30th May 2021 | Klaus Gretland | +
25th May 2021 | Matthew Dinslage | +
25th May 2021 | Karl Bruns | +
18th May 2021 | Karl Gunnar Hammarlund | +
15th May 2021 | Christoph Koernig | +
20th April 2021 | Anthony McKenzie | +
18th April 2021 | Marcin Wolcendorf | +
10th April 2021 | Christoph Kühne | +
8th April 2021 | Patrick Volkerding | +
29th March 2021 | Anthony McKenzie | +
7th March 2021 | James Scott | +
2nd March 2021 | Alain Detal | +
15th February 2021 | Diniz Fernando Bortolotto Ferreira | +
22nd December 2020 | Peter Christy | +
22nd December 2020 | Karl Gunnar Hammarlund | +
15th December 2020 | Karol Jurica | +
14th December 2020 | Stanley Garvey | +
2nd October 2020 | Corby Roberts | +
24th August 2020 | Weber Kai | +
7th August 2020 | Brian Lawrence | +
6th August 2020 | Marcin Słodkiewicz | +
30th May 2020 | Ahmed Abbas | +
23rd May 2020 | Adam Purkrt | +
5th May 2020 | Clemens Sauerzopf | +
30th April 2020 | Gerard Lally | +
6th April 2020 | Peter Christy | +
3rd April 2020 | Tom Kosir | +
30th March 2020 | jwc1936 | +
13th March 2020 | Gregory Guy Rozan | +
6th March 2020 | Brian Lawrence | +
5th March 2020 | Karl Gunnar Hammarlund | +
5th March 2020 | Pierre-Philipp Braun | +
4th March 2020 | Christoph Kühne | +
22nd February 2020 | Aaditya Bagga | +
20th October 2019 | Shuaidu Yang | +
12th October 2019 | Andrew Macks | +
9th October 2019 | Tapio Pätilä | +
30th August 2019 | Nora's Portal | +
18th July 2019 | Karl Gunnar Hammarlund | +
21st May 2019 | Brian Lawrence | +
16th May 2019 | Daniel Bowling | +
27th April 2019 | Antoniazzi Leonardo | +
- 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: - - All donations will be gratefully received - thank you! - |
-
- 400 - Bad Request - The server could not understand the request. - |
-
- 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: - - All donations will be gratefully received - thank you! - |
-
- 401 - Unauthorised - Authentication is required. - |
-
- 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: - - All donations will be gratefully received - thank you! - |
-
- 403 - Forbidden - You do not have permission to access this resource. - |
-
- 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: - - All donations will be gratefully received - thank you! - |
-
- 404 - Not Found - The requested page or file is not found. - |
-
- 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: - - All donations will be gratefully received - thank you! - |
-
- 405 - Method Forbidden - Access method is not authorised. - |
-