diff --git a/.gitignore b/.gitignore index fb7530896..6db07f7bf 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ dist* node_modules/ assets/icons +assets/favicons bin/ *.hi *.o diff --git a/Makefile b/Makefile index 282944364..37cf6fbba 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ all: .PHONY: clean clean: - rm -rf node_modules .npm .cache assets/icons well-known static/ + rm -rf node_modules .npm .cache assets/icons assets/favicons well-known static/ rm -rf .stack .stack-work .stack-work-build .stack-work-run .stack-work-test .stack-work-doc rm -rf bin/ @@ -105,7 +105,11 @@ node_modules: package.json package-lock.json package-lock.json: package.json npm install --cache .npm --prefer-offline +# FIXME: refraining from targets below assets/ (e.g. assets/icons, assets/favicon) to avoid / in target name for now (and maybe to avoid target name pollution) assets: node_modules +# favicons + ./utils/faviconize.pl assets/favicon.svg long assets/favicons +# site icons ./utils/renamer.pl node_modules/@fortawesome/fontawesome-free/svgs/solid utils/rename-fa.json assets/icons/fradrive ./utils/renamer.pl node_modules/@fortawesome/fontawesome-free/svgs/regular utils/rename-fa.json assets/icons/fradrive assets/.assets: @@ -196,6 +200,7 @@ serve-database: --containerized-database .PHONY: --containerized-database --containerized-database: FRADRIVE_SERVICE=database +# port forwarding is disabled in --network=host mode; nevertheless it is stated here for documentation reasons --containerized-database: CONTAINER_PORTS=-p 5432:5432 --network="host" --containerized-database: --image-build if [ "$(IN_CONTAINER)" == "false" ] ; then \ diff --git a/assets/apple-icon-180x180.png b/assets/apple-icon-180x180.png deleted file mode 100644 index 7616ebd51..000000000 Binary files a/assets/apple-icon-180x180.png and /dev/null differ diff --git a/assets/apple-icon-180x180.png.license b/assets/apple-icon-180x180.png.license deleted file mode 100644 index dfb358d6a..000000000 --- a/assets/apple-icon-180x180.png.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2022 Fraport AG - -SPDX-License-Identifier: LicenseRef-Fraport-Corporate-Design diff --git a/assets/favicon.ico b/assets/favicon.ico deleted file mode 100644 index 8d3db0787..000000000 Binary files a/assets/favicon.ico and /dev/null differ diff --git a/assets/favicon.ico.license b/assets/favicon.ico.license deleted file mode 100644 index dfb358d6a..000000000 --- a/assets/favicon.ico.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2022 Fraport AG - -SPDX-License-Identifier: LicenseRef-Fraport-Corporate-Design diff --git a/assets/favicon.svg.license b/assets/favicon.svg.license deleted file mode 100644 index dfb358d6a..000000000 --- a/assets/favicon.svg.license +++ /dev/null @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2022 Fraport AG - -SPDX-License-Identifier: LicenseRef-Fraport-Corporate-Design diff --git a/utils/faviconize.pl b/utils/faviconize.pl new file mode 100755 index 000000000..8298a4cc5 --- /dev/null +++ b/utils/faviconize.pl @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +my ($file, $sizes, $faviconDir) = @ARGV; + +die "usage: $0 [origfile] [sizes] [faviconDir] (sizes is ,-seperated list of side length or short, medium or long\n" unless defined $file and defined $sizes and defined $faviconDir; + +die "File '$file' not found!\n" unless -e $file; + +$sizes = '16,32' if 'short' eq $sizes; +$sizes = '16,32,48,64,128,256' if 'medium' eq $sizes; +$sizes = '16,32,48,64,128,192,228,230,256,512' if 'long' eq $sizes; + +my @sizes = split m/,/, $sizes; + +my $include = ""; + +mkdir($faviconDir); +system("rm $faviconDir/*"); +for my $s(@sizes) { + resize($s, "favicon-${s}x$s.png"); +} + +resize(180, "apple-touch-icon.png"); + +sub resize { + my ($size, $newfile) = @_; + my $ret = system("convert '$file' -resize '${size}x$size' '$faviconDir/$newfile'"); + die "$0: convert exited with error code $ret on generating '$faviconDir/$newfile'\n" if $ret; + die "$0: output file '$faviconDir/$newfile' could not be generated\n" unless -e "$faviconDir/$newfile"; + my $icon = "icon"; + $icon = "apple-touch-icon" if $newfile=~m#apple#; + $include .= qq## +} + +my $wh = undef; +open($wh, '>', "$faviconDir/include.html") or die "Could not write '$faviconDir/include.html', because: $!"; +print $wh $include; + +