Browse Source

added news button to menu, changed typo in addresses widget, added favicon, added precompress.sh

Sebastian 10 months ago
parent
commit
4bb1cbeb71

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
1
+5222.de/public/

+ 6
- 0
5222.de/config.toml View File

@@ -5,6 +5,12 @@ paginate = "10" # Number of posts per page
5 5
 theme = "mainroad"
6 6
 copyright = "This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License."
7 7
 
8
+[[menu.main]]
9
+    name = "News"
10
+    weight = -110
11
+    identifier = "news"
12
+    url = "/"
13
+
8 14
 [author]
9 15
     name = "Sebastian"
10 16
 

+ 1
- 1
5222.de/themes/mainroad/layouts/partials/widgets/addresses.html View File

@@ -1,5 +1,5 @@
1 1
 <div class="widget-recent widget">
2
-	<h4 class="widget__title">RSS</h4>
2
+	<h4 class="widget__title">Adressen</h4>
3 3
 	<div class="widget__content">
4 4
 		<ul class="widget__list">
5 5
             <strong>STARTTLS/TLS:</strong>

BIN
5222.de/themes/mainroad/static/favicon.ico View File


+ 69
- 0
precompress.sh View File

@@ -0,0 +1,69 @@
1
+#!/bin/bash -e
2
+#
3
+## nginx precompress script
4
+## by nico from https://magicbroccoli.de/
5
+#
6
+
7
+## variables
8
+logfile=/var/log/nginx/precompressing.log
9
+
10
+# small set of if rules to define the folders
11
+if [ "$1" ==  "--all" ]; then
12
+    Folders=("/var/www/xmpp-community.org")
13
+elif [ -d $1 ]; then
14
+    Folders=("$1")
15
+else
16
+    echo "Folders is undefined."
17
+    exit 22
18
+fi
19
+
20
+ext="css|js|html|xml|svg|ico|eot|otf|ttf"
21
+
22
+## functions
23
+function compressResource {
24
+    gzip -c9 "$1" >"$1.gz"
25
+    chown www-data:www-data "$1.gz"
26
+    touch -c --reference="$1" "$1.gz"
27
+    log_to_file "$(echo "Compressed: $1 > $1.gz")"
28
+}
29
+
30
+function log_to_file {
31
+    # ghetto logging
32
+    echo "[$(date --rfc-3339=seconds)] - $*" >> "$logfile"
33
+}
34
+
35
+## script
36
+# precompiled list of folders
37
+for appDir in "${Folders[@]}"
38
+do
39
+    # fetch all existing gzipped CSS/JavaScript/webfont files and remove files that do not have a base uncompressed file
40
+    find "$appDir" -type f -regextype posix-extended -iregex ".*\\.(${ext})\\.gz$" -print0 | while read -d '' compressFile
41
+    do
42
+        if [[ ! -f ${compressFile%.gz} ]]; then
43
+            # remove orphan gzipped file
44
+            rm "$compressFile"
45
+            log_to_file "Removed: $compressFile"
46
+        fi
47
+    done
48
+
49
+    # fetch all source CSS/JS/webfont files - excluding *.src.* variants (pre-minified CSS/JavaScript)
50
+    # gzip each file and give timestamp identical to that of the uncompressed source file
51
+    find "$appDir" -type f -regextype posix-extended \( -iregex ".*\\.(${ext})$" \) \( ! -name "*.src.css" -and ! -name "*.src.js" \) -print0 | while read -d '' sourceFile
52
+    do
53
+        if [[ -f "$sourceFile.gz" ]]; then
54
+            # only re-gzip if source file is different in timestamp to the existing gzip file
55
+            if [[ ($sourceFile -nt "$sourceFile.gz") || ($sourceFile -ot "$sourceFile.gz") ]]; then
56
+                compressResource "$sourceFile"
57
+            fi
58
+        else
59
+            compressResource "$sourceFile"
60
+        fi
61
+    done
62
+done
63
+
64
+# reloading shit
65
+nginx -s reload
66
+
67
+# clearing variables
68
+unset Folders ext logfile
69
+exit 0

Loading…
Cancel
Save