diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-26 20:17:51 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-26 20:17:51 -0400 |
| commit | 888d48300fd2d098a676503a69ac96db94e61a04 (patch) | |
| tree | 12aa1be24bcc501fa18f9ebeb4961cdb89f76dc6 /build-db | |
| parent | ee64cdc2712a8e7f77c6af02385afd43a2a1e61b (diff) | |
feat: OS Index Pages
Diffstat (limited to 'build-db')
| -rwxr-xr-x | build-db | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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" |
