summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--files/filters/auth-deny-all.lua46
-rw-r--r--files/filters/highlight.sh9
2 files changed, 55 insertions, 0 deletions
diff --git a/files/filters/auth-deny-all.lua b/files/filters/auth-deny-all.lua
new file mode 100644
index 0000000..1bf34ce
--- /dev/null
+++ b/files/filters/auth-deny-all.lua
@@ -0,0 +1,46 @@
+-- Filter which denies access to all repos
+--
+-- File managed by Puppet
+
+function authenticate_post()
+ return 0
+end
+
+function authenticate_cookie()
+ return 0
+end
+
+function body()
+ html("<h2>Access denied for everyone and everything</h2>")
+ return 0
+end
+
+actions["authenticate-post"] = authenticate_post
+actions["authenticate-cookie"] = authenticate_cookie
+actions["body"] = body
+
+function filter_open(...)
+ action = actions[select(1, ...)]
+ http = {}
+ http["cookie"] = select(2, ...)
+ http["method"] = select(3, ...)
+ http["query"] = select(4, ...)
+ http["referer"] = select(5, ...)
+ http["path"] = select(6, ...)
+ http["host"] = select(7, ...)
+ http["https"] = select(8, ...)
+
+ cgit = {}
+ cgit["repo"] = select(9, ...)
+ cgit["page"] = select(10, ...)
+ cgit["url"] = select(11, ...)
+ cgit["login"] = select(12, ...)
+end
+
+-- function filter_close()
+-- return action()
+-- end
+--
+-- function filter_write(str)
+-- post = parse_qs(str)
+-- end
diff --git a/files/filters/highlight.sh b/files/filters/highlight.sh
new file mode 100644
index 0000000..75a8ccd
--- /dev/null
+++ b/files/filters/highlight.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+filename="$1"
+extension="${filename##*.}"
+
+exec highlight --inline-css --force --fragment \
+ --enclose-pre --out-format=xhtml \
+ --syntax="$extension" \
+ "$filename"