From 888d48300fd2d098a676503a69ac96db94e61a04 Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Sun, 26 Apr 2026 20:17:51 -0400 Subject: feat: OS Index Pages --- build-db | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'build-db') diff --git a/build-db b/build-db index 53418213..5f1aa9bc 100755 --- a/build-db +++ b/build-db @@ -7,6 +7,7 @@ usage() { create_entry() { FILE="$1" SUBDIR="$2" + SQL_FILE="$3" SECTION=$(basename "$FILE" | sed -E 's|.*\.([0-9])\..*|\1|') NAME=$(basename "$FILE" | sed -E 's|(.*)\.[0-9]\.html|\1|') @@ -18,7 +19,7 @@ create_entry() { fi STATEMENT="INSERT INTO manpages (os, name, section, path) VALUES ('"$OS"', '"$NAME"', '"$SECTION"', '"$FILE"');" - printf "%s\n" "$STATEMENT" + printf "%s\n" "$STATEMENT" >> "$SQL_FILE" } if [[ $# -lt 3 ]]; @@ -44,16 +45,23 @@ CREATE TABLE manpages ( ); EOF +printf '{ "AllowedFiles" : [\n' > Allowed.json + for SUBDIR in ${SUBDIRS[*]}; do - FILES=$(find "$SUBDIR" -type f -name "*.html") + FILES=$(find "$SUBDIR" -type f -regex "$SUBDIR/man[0-9]/.*\.[0-9]\.html") for FILE in ${FILES[*]}; do - create_entry "$FILE" "$SUBDIR" >> "$SQL_FILE" + create_entry "$FILE" "$SUBDIR" "$SQL_FILE" + printf '"%s",\n' "$FILE" >> Allowed.json done done +printf '"static/htmx.min.js", "static/css/main.css", "static/index.html",' >> Allowed.json +printf '"static/logos/favicon.png", "static/logos/favicon.svg", "static/logos/favicon16.png",' >> Allowed.json +printf '"static/logos/favicon32.png", "static/logos/FirstInitialLogo.svg", "static/logos/FullNameLogo.svg"]}' >> Allowed.json + sqlite3 "$DB_FILE" < "$SQL_FILE" chmod 400 "$DB_FILE" rm "$SQL_FILE" -- cgit v1.2.3