Browse Source

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

pull/1/head
Sebastian 1 year ago
parent
commit
4bb1cbeb71
5 changed files with 77 additions and 1 deletions
  1. +1
    -0
      .gitignore
  2. +6
    -0
      5222.de/config.toml
  3. +1
    -1
      5222.de/themes/mainroad/layouts/partials/widgets/addresses.html
  4. BIN
      5222.de/themes/mainroad/static/favicon.ico
  5. +69
    -0
      precompress.sh

+ 1
- 0
.gitignore View File

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

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

@@ -5,6 +5,12 @@ paginate = "10" # Number of posts per page
theme = "mainroad"
copyright = "This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License."

[[menu.main]]
name = "News"
weight = -110
identifier = "news"
url = "/"

[author]
name = "Sebastian"


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

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

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

Before After
Width: 32  |  Height: 32  |  Size: 1.4KB

+ 69
- 0
precompress.sh View File

@@ -0,0 +1,69 @@
#!/bin/bash -e
#
## nginx precompress script
## by nico from https://magicbroccoli.de/
#

## variables
logfile=/var/log/nginx/precompressing.log

# small set of if rules to define the folders
if [ "$1" == "--all" ]; then
Folders=("/var/www/xmpp-community.org")
elif [ -d $1 ]; then
Folders=("$1")
else
echo "Folders is undefined."
exit 22
fi

ext="css|js|html|xml|svg|ico|eot|otf|ttf"

## functions
function compressResource {
gzip -c9 "$1" >"$1.gz"
chown www-data:www-data "$1.gz"
touch -c --reference="$1" "$1.gz"
log_to_file "$(echo "Compressed: $1 > $1.gz")"
}

function log_to_file {
# ghetto logging
echo "[$(date --rfc-3339=seconds)] - $*" >> "$logfile"
}

## script
# precompiled list of folders
for appDir in "${Folders[@]}"
do
# fetch all existing gzipped CSS/JavaScript/webfont files and remove files that do not have a base uncompressed file
find "$appDir" -type f -regextype posix-extended -iregex ".*\\.(${ext})\\.gz$" -print0 | while read -d '' compressFile
do
if [[ ! -f ${compressFile%.gz} ]]; then
# remove orphan gzipped file
rm "$compressFile"
log_to_file "Removed: $compressFile"
fi
done

# fetch all source CSS/JS/webfont files - excluding *.src.* variants (pre-minified CSS/JavaScript)
# gzip each file and give timestamp identical to that of the uncompressed source file
find "$appDir" -type f -regextype posix-extended \( -iregex ".*\\.(${ext})$" \) \( ! -name "*.src.css" -and ! -name "*.src.js" \) -print0 | while read -d '' sourceFile
do
if [[ -f "$sourceFile.gz" ]]; then
# only re-gzip if source file is different in timestamp to the existing gzip file
if [[ ($sourceFile -nt "$sourceFile.gz") || ($sourceFile -ot "$sourceFile.gz") ]]; then
compressResource "$sourceFile"
fi
else
compressResource "$sourceFile"
fi
done
done

# reloading shit
nginx -s reload

# clearing variables
unset Folders ext logfile
exit 0

Loading…
Cancel
Save