commit 6c6902262d0f444b56de1ef35f5f060662efa160
parent 91630243f71440ad015793700823ae2595d1eb1f
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Sat, 15 Jun 2024 11:24:59 +0200
fix: make htaccess browsable in fileview
Diffstat:
3 files changed, 26 insertions(+), 32 deletions(-)
diff --git a/.htaccess b/.htaccess
@@ -1,27 +0,0 @@
-# SPDX-License-Identifier: AGPL-3.0-or-later
-# SPDX-FileCopyrightText: 2021-2024 JayVii <jayvii[AT]posteo[DOT]de>
-
-# Set 404 Document
-ErrorDocument 404 /404.html
-ErrorDocument 403 /404.html
-
-# Disallow file browsing
-Options -Indexes
-
-# Disallow browsing of certain sub-directories (redirect to 404)
-RedirectMatch 404 ^/.git/.*$
-RedirectMatch 404 ^/.ssh/.*$
-RedirectMatch 404 ^/.config/.*$
-RedirectMatch 404 ^/.local/.*$
-RedirectMatch 404 ^/.cache/.*$
-RedirectMatch 404 ^/bin/.*$
-RedirectMatch 404 ^/templates/.*$
-RedirectMatch 404 ^/url$
-RedirectMatch 404 ^/.bash_history$
-
-# Style filebrowser
-IndexStyleSheet /assets/index.css
-
-# Workaround: new directory for private repos
-RewriteEngine On
-RewriteRule ^priv(.*)$ /prv$1 [R=301,L]
diff --git a/bin/git_update_index_html.sh b/bin/git_update_index_html.sh
@@ -35,16 +35,14 @@ ln -sf "${1}/assets/style.css" "${1}/${2}/style.css"
ln -sf "${1}/assets/favicon.png" "${1}/${2}/favicon.png"
ln -sf "${1}/assets/favicon.png" "${1}/${2}/logo.png"
+# link htaccess
+ln -sf "${1}/htaccess" "${1}/.htaccess"
+
# Modules ----------------------------------------------------------------------
# Activity module
if [ -f "${1}/bin/activity.sh" ]; then
-
- echo "Executing Activity Module"
-
ACTIVITY_HTML=`${1}/bin/activity.sh $REPOS`
-
sed "/<div id=\"content\">/a${ACTIVITY_HTML}" \
-i "${1}/${2}/index.html"
-
fi
diff --git a/htaccess b/htaccess
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: AGPL-3.0-or-later
+# SPDX-FileCopyrightText: 2021-2024 JayVii <jayvii[AT]posteo[DOT]de>
+
+# Set 404 Document
+ErrorDocument 404 /404.html
+ErrorDocument 403 /404.html
+
+# Disallow file browsing
+Options -Indexes
+
+# Disallow browsing of certain sub-directories (redirect to 404)
+RedirectMatch 404 ^/\..*$
+RedirectMatch 404 ^/bin/.*$
+RedirectMatch 404 ^/templates/.*$
+RedirectMatch 404 ^/url$
+RedirectMatch 404 ^/htaccess$
+
+# Style filebrowser
+IndexStyleSheet /assets/index.css
+
+# Workaround: new directory for private repos
+RewriteEngine On
+RewriteRule ^priv(.*)$ /prv$1 [R=301,L]