Merge remote-tracking branch 'origin/145-build-system-rewrite' into 144-ghc-update
This commit is contained in:
commit
c220a712f7
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
dist*
|
||||
node_modules/
|
||||
assets/icons
|
||||
assets/favicons
|
||||
bin/
|
||||
*.hi
|
||||
*.o
|
||||
@ -16,6 +17,7 @@ cabal-dev/
|
||||
.dev-port-http
|
||||
.dev-port-https
|
||||
.bash_history
|
||||
.lesshst
|
||||
yesod-devel/
|
||||
.cabal-sandbox
|
||||
cabal.sandbox.config
|
||||
@ -60,4 +62,4 @@ tunnel.log
|
||||
**/result
|
||||
**/result-*
|
||||
.develop.cmd
|
||||
/.vscode
|
||||
/.vscode
|
||||
|
||||
@ -60,11 +60,18 @@ setup:dynamic:
|
||||
before_script:
|
||||
- apt-get -y update
|
||||
- apt-get -y install git
|
||||
variables:
|
||||
GIT_DEPTH: 99999
|
||||
GIT_STRATEGY: clone
|
||||
GIT_LOG_COMMAND: 'git log --max-count=1 --date=format:%Y-%m-%dT%H-%M --pretty=format:%cd'
|
||||
script:
|
||||
- FRONTEND_IMAGE_VERSION=`git log ${FRONTEND_IMAGE_DEPENDENCIES} | grep '^commit' | wc --lines | tee frontend-image-version`
|
||||
- BACKEND_IMAGE_VERSION=`git log ${BACKEND_IMAGE_DEPENDENCIES} | grep '^commit' | wc --lines | tee backend-image-version`
|
||||
- echo "${FRONTEND_IMAGE_DEPENDENCIES}"
|
||||
- echo "${BACKEND_IMAGE_DEPENDENCIES}"
|
||||
- FRONTEND_IMAGE_VERSION=`${GIT_LOG_COMMAND} ${FRONTEND_IMAGE_DEPENDENCIES} | tee frontend-image-version`
|
||||
- BACKEND_IMAGE_VERSION=`${GIT_LOG_COMMAND} ${BACKEND_IMAGE_DEPENDENCIES} | tee backend-image-version`
|
||||
- 'echo "FRONTEND_IMAGE_VERSION: ${FRONTEND_IMAGE_VERSION}, BACKEND_IMAGE_VERSION: ${BACKEND_IMAGE_VERSION}"'
|
||||
- cat .gitlab-ci/frontend.yml | .gitlab-ci/dynamci.pl FRONTEND_IMAGE_VERSION=${FRONTEND_IMAGE_VERSION} > frontend.yml
|
||||
- cat .gitlab-ci/backend.yml | .gitlab-ci/dynamci.pl BACKEND_IMAGE_VERSION=${BACKEND_IMAGE_VERSION} > backend.yml
|
||||
- cat .gitlab-ci/backend.yml | .gitlab-ci/dynamci.pl BACKEND_IMAGE_VERSION=${BACKEND_IMAGE_VERSION} PARENT_PIPELINE_ID=${CI_PIPELINE_ID} > backend.yml
|
||||
artifacts:
|
||||
paths:
|
||||
- frontend-image-version
|
||||
@ -83,17 +90,18 @@ setup:containers:frontend: &setup-container
|
||||
IMAGE_TYPE: frontend
|
||||
before_script: &container-before
|
||||
- IMAGE_VERSION=`cat ${IMAGE_TYPE}-image-version`
|
||||
- IMAGE_TAG=${IMAGE_TYPE}/${CI_COMMIT_REF_SLUG}:${IMAGE_VERSION}
|
||||
- REGISTRY_DESTINATION=${CI_REGISTRY_IMAGE}/${IMAGE_TYPE}/${CI_COMMIT_REF_SLUG}:${IMAGE_VERSION}
|
||||
- IMAGE_TAG=${CI_COMMIT_REF_SLUG}/${IMAGE_TYPE}:${IMAGE_VERSION}
|
||||
- REGISTRY_DESTINATION=${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_SLUG}/${IMAGE_TYPE}:${IMAGE_VERSION}
|
||||
script:
|
||||
- curl --request GET --header "PRIVATE-TOKEN:${REGISTRY_AUTH_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/registry/repositories?tags=true" > .gitlab-ci/.container-registry-contents.json
|
||||
- IMAGE_EXISTS=`grep \""${REGISTRY_DESTINATION}"\" .gitlab-ci/.container-registry-contents.json`
|
||||
- cat .gitlab-ci/.container-registry-contents.json
|
||||
- IMAGE_EXISTS=`grep \""${REGISTRY_DESTINATION}"\" .gitlab-ci/.container-registry-contents.json || :`
|
||||
- echo "${IMAGE_EXISTS}"
|
||||
- test "${CI_JOB_MANUAL}" = true && echo "Force rebuilding container."
|
||||
- >
|
||||
if [ -z "${IMAGE_EXISTS}" -o "${CI_JOB_MANUAL}" = true ] ; then
|
||||
echo "Building image..."
|
||||
buildah bud -t ${IMAGE_TAG} --build-arg PROJECT_DIR=${CI_PROJECT_DIR} --volume ${CI_PROJECT_DIR}:/tmp/${CI_PROJECT_DIR} --file docker/${IMAGE_TYPE}/Dockerfile
|
||||
echo "Building image ${REGISTRY_DESTINATION}..."
|
||||
buildah bud -t ${IMAGE_TAG} --build-arg PROJECT_DIR=${CI_PROJECT_DIR} --build-arg MOUNT_DIR=/mnt/${CI_PROJECT_DIR} --volume ${CI_PROJECT_DIR}:/mnt/${CI_PROJECT_DIR} --file docker/${IMAGE_TYPE}/Dockerfile
|
||||
buildah push --creds "${CI_REGISTRY_USER}:${CI_JOB_TOKEN}" ${IMAGE_TAG} ${REGISTRY_DESTINATION}
|
||||
else
|
||||
echo "Image ${IMAGE_TAG} already exists in the container registry. Skipping build."
|
||||
@ -107,6 +115,9 @@ setup:containers:frontend:wait: &setup-container-wait
|
||||
needs:
|
||||
- setup:dynamic
|
||||
before_script: *container-before
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
IMAGE_TYPE: frontend
|
||||
script:
|
||||
- apt-get -y update && apt-get -y install curl
|
||||
- >
|
||||
@ -114,10 +125,14 @@ setup:containers:frontend:wait: &setup-container-wait
|
||||
echo "Waiting for container ${IMAGE_TAG} to appear in the container registry..."
|
||||
sleep 5
|
||||
done
|
||||
- echo "Image ${IMAGE_TAG} has been found in the container registry. Proceeding with the pipeline."
|
||||
rules:
|
||||
- if: $CI_MERGE_REQUEST_ID
|
||||
when: always
|
||||
- when: never
|
||||
retry: 0
|
||||
interruptible: true
|
||||
timeout: 3h
|
||||
|
||||
setup:containers:backend:
|
||||
<<: *setup-container
|
||||
@ -126,6 +141,7 @@ setup:containers:backend:
|
||||
setup:containers:backend:wait:
|
||||
<<: *setup-container-wait
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
IMAGE_TYPE: backend
|
||||
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
variables:
|
||||
BACKEND_IMAGE_VERSION: #dyn#
|
||||
PARENT_PIPELINE_ID: #dyn#
|
||||
|
||||
stages:
|
||||
- compile
|
||||
@ -22,10 +23,13 @@ stages:
|
||||
|
||||
default:
|
||||
image:
|
||||
name: ${CI_REGISTRY_IMAGE}/backend/${CI_COMMIT_REF_SLUG}:${BACKEND_IMAGE_VERSION}
|
||||
name: ${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_SLUG}/backend:${BACKEND_IMAGE_VERSION}
|
||||
entrypoint: [""]
|
||||
docker:
|
||||
platform: x86_64
|
||||
before_script:
|
||||
- ./.gitlab-ci/pull-frontend-artifacts.pl "${REGISTRY_AUTH_TOKEN}" "${PARENT_PIPELINE_ID}"
|
||||
- unzip ./.artifacts.tmp/artifacts.zip
|
||||
artifacts:
|
||||
name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}"
|
||||
expire_in: "1 day"
|
||||
@ -36,7 +40,7 @@ default:
|
||||
compile:
|
||||
stage: compile
|
||||
script:
|
||||
- make -- backend-build${PROD_BUILD}
|
||||
- make -- compile${PROD_BUILD}-backend IN_CI=true IN_CONTAINER=true
|
||||
artifacts:
|
||||
paths:
|
||||
- ${CI_PROJECT_DIR}/.stack-work/
|
||||
@ -46,7 +50,7 @@ compile:
|
||||
lint:
|
||||
stage: lint
|
||||
script:
|
||||
- make -- backend-lint${PROD_BUILD}
|
||||
- make -- lint${PROD_BUILD}-backend IN_CI=true IN_CONTAINER=true
|
||||
cache: *backend-cache
|
||||
|
||||
test:
|
||||
@ -54,7 +58,7 @@ test:
|
||||
needs:
|
||||
- compile
|
||||
script:
|
||||
- make -- backend-test${PROD_BUILD}
|
||||
- make -- test${PROD_BUILD}-backend IN_CI=true IN_CONTAINER=true
|
||||
cache: *backend-cache
|
||||
|
||||
container:
|
||||
@ -69,4 +73,5 @@ container:
|
||||
- buildah bud -t ${IMAGE_TAG} --volume ${CI_PROJECT_DIR}/bin/:/tmp/uniworx-bin --file docker/fradrive/Dockerfile
|
||||
- buildah push --creds "${CI_REGISTRY_USER}:${CI_JOB_TOKEN}" ${IMAGE_TAG} ${CI_REGISTRY_IMAGE}/${IMAGE_TAG}
|
||||
rules:
|
||||
- if: ${PROD_BUILD} == -prod
|
||||
- if: '"${PROD_BUILD}" == "-prod"'
|
||||
when: always
|
||||
@ -21,7 +21,7 @@ stages:
|
||||
|
||||
default:
|
||||
image:
|
||||
name: ${CI_REGISTRY_IMAGE}/frontend/${CI_COMMIT_REF_SLUG}:${FRONTEND_IMAGE_VERSION}
|
||||
name: ${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_SLUG}/frontend:${FRONTEND_IMAGE_VERSION}
|
||||
entrypoint: [""]
|
||||
docker:
|
||||
platform: x86_64
|
||||
@ -35,11 +35,12 @@ default:
|
||||
compile:
|
||||
stage: compile
|
||||
script:
|
||||
- make -- frontend-build
|
||||
- make -- compile-frontend IN_CI=true IN_CONTAINER=true
|
||||
artifacts:
|
||||
paths:
|
||||
- ${CI_PROJECT_DIR}/node_modules
|
||||
- ${CI_PROJECT_DIR}/well-known
|
||||
- ${CI_PROJECT_DIR}/config/webpack.yml
|
||||
cache:
|
||||
- &frontend-cache
|
||||
key: default-frontend
|
||||
@ -50,7 +51,7 @@ compile:
|
||||
lint:
|
||||
stage: lint
|
||||
script:
|
||||
- make -- frontend-lint
|
||||
- make -- lint-frontend IN_CI=true IN_CONTAINER=true
|
||||
cache: *frontend-cache
|
||||
|
||||
test:
|
||||
@ -58,5 +59,5 @@ test:
|
||||
needs:
|
||||
- compile
|
||||
script:
|
||||
- make -- frontend-test
|
||||
- make -- test-frontend IN_CI=true IN_CONTAINER=true
|
||||
cache: *frontend-cache
|
||||
|
||||
52
.gitlab-ci/pull-frontend-artifacts.pl
Executable file
52
.gitlab-ci/pull-frontend-artifacts.pl
Executable file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $dir = ".artifacts.tmp";
|
||||
my ($token, $id) = @ARGV;
|
||||
die "usage: $0 [token] [id]" unless defined $token and defined $id;
|
||||
die "id in bad format" unless $id=~m#^[0-9]+$#;
|
||||
|
||||
if(!-d $dir) {
|
||||
mkdir($dir) or die "Cannot create directory '$dir', because: $!\n";
|
||||
}
|
||||
|
||||
system(qq(curl --globoff --header "PRIVATE-TOKEN: $token" "https://gitlab.uniworx.de/api/v4/projects/5/pipelines/$id/bridges" > $dir/bridges));
|
||||
my $pips = pparse("$dir/bridges", {id=>qq#."downstream_pipeline"."id"#}, {name=>""});
|
||||
|
||||
my $fe = $pips->{frontend}{id};
|
||||
|
||||
die "No frontend pipeline found!" unless $fe;
|
||||
|
||||
system(qq(curl --globoff --header "PRIVATE-TOKEN: $token" "https://gitlab.uniworx.de/api/v4/projects/5/pipelines/$fe/jobs" > $dir/fe-jobs));
|
||||
my $arte = pparse("$dir/fe-jobs", {id=>""}, {name=>"", web_url=>"", artifacts=>""});
|
||||
|
||||
system(qq#curl --output $dir/artifacts.zip --location --header "PRIVATE-TOKEN: $token" "https://gitlab.uniworx.de/api/v4/projects/5/jobs/$arte->{compile}{id}/artifacts"#);
|
||||
|
||||
|
||||
sub pparse {
|
||||
my ($file, $numerical, $alpha) = @_;
|
||||
my %all = ();
|
||||
for my $k(keys %$numerical) {
|
||||
$all{$k} = $numerical->{$k} || qq#."$k"#;
|
||||
}
|
||||
for my $k(keys %$alpha) {
|
||||
$all{$k} = $alpha->{$k} || qq#."$k"#;
|
||||
}
|
||||
my $select = join ', ', map {qq#"$_": $all{$_}#} sort keys %all;
|
||||
my $cont = qx(cat $file | jq -c '.[] | {$select}');
|
||||
my @cont = split m/\R/, $cont;
|
||||
my %ret = ();
|
||||
for my $c(@cont) {
|
||||
my %block = ();
|
||||
for(keys %$numerical) {
|
||||
$block{$_} = $1 if $c=~m#"$_":([0-9]+)#;
|
||||
}
|
||||
for(keys %$alpha) {
|
||||
$block{$_} = $1 if $c=~m#"$_":"([^"]*)"#;
|
||||
}
|
||||
$ret{$block{name}} =\%block;
|
||||
}
|
||||
return \%ret
|
||||
}
|
||||
76
Makefile
76
Makefile
@ -1,6 +1,8 @@
|
||||
SHELL=bash
|
||||
|
||||
export CONTAINER_COMMAND ?= podman
|
||||
export CONTAINER_INTERACTIVE
|
||||
export CONTAINER_PORTS
|
||||
export IN_CONTAINER ?= false
|
||||
export IN_CI ?= false
|
||||
export WATCH
|
||||
@ -21,9 +23,14 @@ 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 static well-known
|
||||
rm -rf .stack .stack-work .stack-work-build .stack-work-run .stack-work-test .stack-work-doc
|
||||
rm -rf bin/
|
||||
rm -rf bin/ .Dockerfile .dev-port-http .dev-port-https
|
||||
.PHONY: clean-all
|
||||
clean-all: clean
|
||||
$(CONTAINER_COMMAND) system prune --all --force --volumes
|
||||
$(CONTAINER_COMMAND) image prune --all --force
|
||||
$(CONTAINER_COMMAND) volume prune --force
|
||||
|
||||
.PHONY: release
|
||||
release:
|
||||
@ -34,6 +41,13 @@ release:
|
||||
git commit -m "chore(release): ${VERSION}"
|
||||
git push
|
||||
|
||||
.PHONY: %-shell
|
||||
%-shell:
|
||||
MOUNT_DIR=/mnt/fradrive ; \
|
||||
FRADRIVE_SERVICE=$* ; \
|
||||
$(MAKE) -- --image-build FRADRIVE_SERVICE=$${FRADRIVE_SERVICE} ; \
|
||||
$(CONTAINER_COMMAND) run -it -v $(PWD):$${MOUNT_DIR} $(CONTAINER_PORTS) --env IN_CONTAINER=true --entrypoint /bin/bash --name fradrive.$${FRADRIVE_SERVICE}.interactive.$$(date +'%Y-%m-%dT%H-%M-%S') fradrive/$${FRADRIVE_SERVICE}
|
||||
|
||||
##### GENERAL TARGETS #####
|
||||
###########################
|
||||
|
||||
@ -42,6 +56,7 @@ release:
|
||||
##### UNIFIED FRONTEND/BACKEND TARGETS #####
|
||||
|
||||
.PHONY: serve
|
||||
serve: CONTAINER_INTERACTIVE=-it
|
||||
serve:
|
||||
$(MAKE) serve-database &
|
||||
$(MAKE) serve-frontend &
|
||||
@ -74,9 +89,14 @@ test: test-frontend test-backend i18n-check
|
||||
--compile-frontend: --frontend-dependencies
|
||||
npx -- webpack --progress $(WATCH)
|
||||
|
||||
.PHONY: --serve-frontend
|
||||
--serve-frontend: WATCH=--watch
|
||||
--serve-frontend: --compile-frontend;
|
||||
.PHONY: serve-frontend
|
||||
serve-frontend: CONTAINER_INTERACTIVE=-it
|
||||
serve-frontend:
|
||||
$(MAKE) -- --containerized---compile-frontend WATCH=--watch
|
||||
|
||||
# .PHONY: --serve-frontend
|
||||
# --serve-frontend: WATCH=--watch
|
||||
# --serve-frontend: --compile-frontend;
|
||||
|
||||
.PHONY: --lint-frontend
|
||||
--lint-frontend: eslint.config.js
|
||||
@ -97,17 +117,15 @@ node_modules: package.json package-lock.json
|
||||
package-lock.json: package.json
|
||||
npm install --cache .npm --prefer-offline
|
||||
|
||||
assets: node_modules
|
||||
assets: assets/favicons assets/icons
|
||||
assets/favicons:
|
||||
./utils/faviconize.pl assets/favicon.svg long assets/favicons
|
||||
assets/icons: node_modules
|
||||
./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:
|
||||
# no-op target
|
||||
|
||||
well-known: node_modules assets well-known/.well-known
|
||||
well-known: node_modules assets
|
||||
npx webpack --progress
|
||||
touch well-known/.well-known
|
||||
well-known/.well-known:
|
||||
# no-op target
|
||||
|
||||
##### FRONTEND TARGETS #####
|
||||
############################
|
||||
@ -135,14 +153,15 @@ well-known/.well-known:
|
||||
--%-prod-backend: --image-build --containerized-%-backend;
|
||||
|
||||
.PHONY: serve-backend
|
||||
serve-backend: CONTAINER_INTERACTIVE=-it
|
||||
serve-backend:
|
||||
DEV_PORT_HTTP=`docker/backend/dev_port.pl 3000 | tee .dev-port-http` \
|
||||
DEV_PORT_HTTPS=`docker/backend/dev_port.pl 3443 | tee .dev-port-https` \
|
||||
DEV_PORT_HTTP=`docker/backend/dev_port.pl 3000 | tee .dev-port-http`; \
|
||||
DEV_PORT_HTTPS=`docker/backend/dev_port.pl 3443 | tee .dev-port-https`; \
|
||||
$(MAKE) -- --containerized---serve-dev-backend DEV_PORT_HTTP=$${DEV_PORT_HTTP} DEV_PORT_HTTPS=$${DEV_PORT_HTTPS}
|
||||
.PHONY: --serve-dev-backend
|
||||
--serve-dev-backend: start.sh
|
||||
DEV_PORT_HTTP=`cat .dev-port-http` \
|
||||
DEV_PORT_HTTPS=`cat .dev-port-https` \
|
||||
DEV_PORT_HTTP=`cat .dev-port-http`; \
|
||||
DEV_PORT_HTTPS=`cat .dev-port-https`; \
|
||||
./start.sh
|
||||
|
||||
.PHONY: --compile-backend
|
||||
@ -159,23 +178,31 @@ serve-backend:
|
||||
|
||||
# TODO: maybe deprecated
|
||||
.PHONY: database
|
||||
database: .stack .stack-work.lock compile-backend-prod
|
||||
database: .stack compile-backend-prod
|
||||
export SERVER_SESSION_ACID_FALLBACK=$${SERVER_SESSION_ACID_FALLBACK:-true}
|
||||
export AVSPASS=$${AVSPASS:-nopasswordset}
|
||||
stack exec uniworxdb -- $(db)
|
||||
|
||||
.PHONY: serve-database
|
||||
serve-database: CONTAINER_INTERACTIVE=-it
|
||||
serve-database: --containerized-database
|
||||
|
||||
.PHONY: .stack
|
||||
.PHONY: database-%
|
||||
database-%:
|
||||
@echo "This target, intended to fill, clear, migrate, ... the database using uniworxdb from inside the backend container is yet to be implemented"
|
||||
exit 1
|
||||
|
||||
# .PHONY: .stack
|
||||
.stack: stack.yaml stack.yaml.lock
|
||||
.stack:
|
||||
$(MAKE) -- --image-run---.stack
|
||||
.PHONY: --.stack
|
||||
--.stack: stack.yaml stack.yaml.lock
|
||||
stack build --fast --only-dependencies $(stackopts)
|
||||
|
||||
.stack-work.lock:
|
||||
[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en .stack-work.lock "$0" "$@" || :
|
||||
# TODO: deprecated, remove
|
||||
# .stack-work.lock:
|
||||
# [ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en .stack-work.lock "$0" "$@" || :
|
||||
|
||||
##### BACKEND TARGETS #####
|
||||
###########################
|
||||
@ -186,9 +213,11 @@ 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/tcp
|
||||
--containerized-database: --image-build
|
||||
if [ "$(IN_CONTAINER)" == "false" ] ; then \
|
||||
$(CONTAINER_COMMAND) run fradrive/$(FRADRIVE_SERVICE) ; \
|
||||
$(CONTAINER_COMMAND) run -it $(CONTAINER_PORTS) --name fradrive.$(FRADRIVE_SERVICE).$$(date +'%Y-%m-%dT%H-%M-%S') fradrive/$(FRADRIVE_SERVICE) ; \
|
||||
fi
|
||||
|
||||
.PHONY: --containerized-%-frontend
|
||||
@ -200,8 +229,9 @@ serve-database: --containerized-database
|
||||
.PHONY: --containerized-%-backend
|
||||
--containerized-%-backend: FRADRIVE_SERVICE=backend
|
||||
#--containerized-%-backend: --image-build --image-run-%-backend;
|
||||
--containerized-%-backend: CONTAINER_PORTS=-p 127.0.0.1:$(DEV_PORT_HTTP):3000/tcp -p 127.0.0.1:$(DEV_PORT_HTTPS):3443/tcp
|
||||
--containerized-%-backend: --image-build
|
||||
$(MAKE) -- --image-run-$*-backend
|
||||
$(MAKE) -- --image-run-$*-backend
|
||||
|
||||
.PHONY: image-rebuild
|
||||
image-rebuild-%:
|
||||
@ -225,7 +255,7 @@ image-rebuild-%:
|
||||
if [ "$(IN_CONTAINER)" == "true" ] ; then \
|
||||
$(MAKE) -- $* ; \
|
||||
else \
|
||||
$(CONTAINER_COMMAND) run -v $(PWD):$${MOUNT_DIR} --env IN_CONTAINER=true --env FRADRIVE_MAKE_TARGET=$* fradrive/$(FRADRIVE_SERVICE) ; \
|
||||
$(CONTAINER_COMMAND) run $(CONTAINER_INTERACTIVE) -v $(PWD):$${MOUNT_DIR} $(CONTAINER_PORTS) --env IN_CONTAINER=true --env FRADRIVE_MAKE_TARGET=$* --env WATCH=$(WATCH) --name fradrive.$(FRADRIVE_SERVICE).$$(date +'%Y-%m-%dT%H-%M-%S') fradrive/$(FRADRIVE_SERVICE) ; \
|
||||
fi
|
||||
|
||||
##### CONTAINER TARGETS #####
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB |
@ -1,3 +0,0 @@
|
||||
SPDX-FileCopyrightText: 2022 Fraport AG
|
||||
|
||||
SPDX-License-Identifier: LicenseRef-Fraport-Corporate-Design
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@ -1,3 +0,0 @@
|
||||
SPDX-FileCopyrightText: 2022 Fraport AG
|
||||
|
||||
SPDX-License-Identifier: LicenseRef-Fraport-Corporate-Design
|
||||
@ -1,3 +0,0 @@
|
||||
SPDX-FileCopyrightText: 2022 Fraport AG
|
||||
|
||||
SPDX-License-Identifier: LicenseRef-Fraport-Corporate-Design
|
||||
@ -1,41 +0,0 @@
|
||||
{
|
||||
"name": "App",
|
||||
"icons": [
|
||||
{
|
||||
"src": "\/android-icon-36x36.png",
|
||||
"sizes": "36x36",
|
||||
"type": "image\/png",
|
||||
"density": "0.75"
|
||||
},
|
||||
{
|
||||
"src": "\/android-icon-48x48.png",
|
||||
"sizes": "48x48",
|
||||
"type": "image\/png",
|
||||
"density": "1.0"
|
||||
},
|
||||
{
|
||||
"src": "\/android-icon-72x72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image\/png",
|
||||
"density": "1.5"
|
||||
},
|
||||
{
|
||||
"src": "\/android-icon-96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image\/png",
|
||||
"density": "2.0"
|
||||
},
|
||||
{
|
||||
"src": "\/android-icon-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image\/png",
|
||||
"density": "3.0"
|
||||
},
|
||||
{
|
||||
"src": "\/android-icon-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image\/png",
|
||||
"density": "4.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
SPDX-FileCopyrightText: 2022 Steffen Jost <jost@cip.ifi.lmu.de>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
@ -19,6 +19,7 @@ services:
|
||||
- *fradrive-mnt
|
||||
depends_on:
|
||||
- frontend
|
||||
stdin_open: true
|
||||
database:
|
||||
# image: registry.uniworx.de/fradrive/fradrive/database
|
||||
# pull_policy: if_not_present
|
||||
|
||||
@ -1,76 +0,0 @@
|
||||
{
|
||||
"masterPicture": "assets/favicon.svg",
|
||||
"design": {
|
||||
"desktop_browser": {},
|
||||
"ios": {
|
||||
"picture_aspect": "background_and_margin",
|
||||
"margin": "5%",
|
||||
"background_color": "#ffffff",
|
||||
"startup_image": {
|
||||
"background_color": "#ffffff"
|
||||
},
|
||||
"app_name": "FRADrive",
|
||||
"assets": {
|
||||
"ios6_and_prior_icons": false,
|
||||
"ios7_and_later_icons": true,
|
||||
"precomposed_icons": true,
|
||||
"declare_only_default_icon": true
|
||||
}
|
||||
},
|
||||
"windows": {
|
||||
"picture_aspect": "white_silhouette",
|
||||
"background_color": "#0a9342",
|
||||
"app_name": "FRADrive"
|
||||
},
|
||||
"firefox_app": {
|
||||
"picture_aspect": "circle",
|
||||
"keep_picture_in_circle": false,
|
||||
"circle_inner_margin": "5%",
|
||||
"background_color": "#ffffff",
|
||||
"overlay": false,
|
||||
"manifest": {
|
||||
"app_name": "FRADrive",
|
||||
"app_description": {
|
||||
"_i18n": true,
|
||||
"de-de-formal": "Ein webbasiertes Schulungsverwaltungssystem",
|
||||
"en-eu": "A web based training management system"
|
||||
},
|
||||
"developer_name": "Uni2work-Team",
|
||||
"developer_url": "https://uni2work.ifi.lmu.de/info",
|
||||
"display": "browser",
|
||||
"start_url": "/"
|
||||
}
|
||||
},
|
||||
"android_chrome": {
|
||||
"picture_aspect": "shadow",
|
||||
"manifest": {
|
||||
"name": "FRADrive",
|
||||
"display": "browser",
|
||||
"orientation": "portrait",
|
||||
"start_url": "/"
|
||||
},
|
||||
"assets": {
|
||||
"legacy_icon": true,
|
||||
"low_resolution_icons": false
|
||||
}
|
||||
},
|
||||
"safari_pinned_tab": {
|
||||
"picture_aspect": "silhouette",
|
||||
"theme_color": "#0a9342"
|
||||
},
|
||||
"coast": {
|
||||
"picture_aspect": "background_and_margin",
|
||||
"background_color": "#ffffff",
|
||||
"margin": "10%"
|
||||
},
|
||||
"open_graph": {
|
||||
"picture_aspect": "background_and_margin",
|
||||
"background_color": "#ffffff",
|
||||
"margin": "10%",
|
||||
"ratio": "square"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"html_code_file": true
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
5
config/i18n.json
Normal file
5
config/i18n.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"_i18n": true,
|
||||
"de-de-formal": "Ein webbasiertes Schulungsverwaltungssystem",
|
||||
"en-eu": "A web-based training management system"
|
||||
}
|
||||
@ -123,7 +123,7 @@ auth-pw-hash:
|
||||
database:
|
||||
user: "_env:PGUSER:uniworx"
|
||||
password: "_env:PGPASS:uniworx"
|
||||
host: "_env:PGHOST:127.0.0.1"
|
||||
host: "_env:PGHOST:host.docker.internal"
|
||||
port: "_env:PGPORT:5432"
|
||||
# See config/test-settings.yml for an override during tests
|
||||
database: "_env:PGDATABASE:uniworx"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
FROM registry.uniworx.de/uniworx/containers/debian:12.5
|
||||
FROM debian:12.5
|
||||
|
||||
RUN apt-get -y update && apt-get -y install haskell-stack git
|
||||
RUN apt-get -y update && apt-get -y install alex g++ happy libghc-zlib-dev libpq-dev libsodium-dev locales locales-all pkg-config
|
||||
@ -12,19 +12,20 @@ ENV LANG=en_US.UTF-8
|
||||
# in CI-pipelines these two should be different, so that the container caches the compilation results.
|
||||
ARG MOUNT_DIR=/mnt/fradrive
|
||||
ARG PROJECT_DIR=/fradrive
|
||||
RUN mkdir -p ${PROJECT_DIR}
|
||||
RUN if [ "${PROJECT_DIR}" != "${MOUNT_DIR}" ] ; then cp -r ${MOUNT_DIR}/* ${PROJECT_DIR} ; fi
|
||||
WORKDIR ${PROJECT_DIR}
|
||||
ENV HOME=${PROJECT_DIR}
|
||||
|
||||
RUN mkdir -p /.stack
|
||||
ENV STACK_ROOT=/.stack
|
||||
RUN mkdir -p "${PROJECT_DIR}"
|
||||
RUN if [ "${PROJECT_DIR}" != "${MOUNT_DIR}" ] ; then cp -r "${MOUNT_DIR}"/* "${PROJECT_DIR}" ; fi
|
||||
WORKDIR "${PROJECT_DIR}"
|
||||
ENV HOME="${PROJECT_DIR}"
|
||||
|
||||
RUN mkdir -p "${PROJECT_DIR}/.stack"
|
||||
ENV STACK_ROOT="${PROJECT_DIR}/.stack"
|
||||
|
||||
RUN make .stack STACK_ROOT=${STACK_ROOT} IN_CONTAINER=true
|
||||
RUN stack build yesod-bin
|
||||
|
||||
ENV FRADRIVE_MAKE_TARGET=serve-backend
|
||||
ENTRYPOINT make -- ${FRADRIVE_MAKE_TARGET} STACK_ROOT=${STACK_ROOT} IN_CONTAINER=true
|
||||
ENTRYPOINT make -- ${FRADRIVE_MAKE_TARGET} STACK_ROOT="${STACK_ROOT}" IN_CONTAINER=true
|
||||
|
||||
EXPOSE 3000/tcp
|
||||
EXPOSE 3443/tcp
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
FROM registry.uniworx.de/fradrive/fradrive/postgres:12
|
||||
FROM docker.io/postgres:12
|
||||
|
||||
# Allow for connecting to database without password authentication
|
||||
ENV POSTGRES_HOST_AUTH_METHOD=trust
|
||||
@ -15,5 +15,4 @@ USER postgres
|
||||
# ADD --chmod=755 ./initdb.sh /etc/fradrive-db
|
||||
|
||||
ENTRYPOINT /etc/fradrive-db
|
||||
EXPOSE $DEV_PORT_HTTP/tcp
|
||||
EXPOSE $DEV_PORT_HTTPS/tcp
|
||||
EXPOSE 5432/tcp
|
||||
@ -1,10 +1,11 @@
|
||||
FROM registry.uniworx.de/uniworx/containers/debian:12.5
|
||||
FROM debian:12.5
|
||||
|
||||
# Basic dependencies
|
||||
RUN apt-get -y update && apt-get -y install curl npm
|
||||
|
||||
# Build and watch dependencies
|
||||
RUN apt-get -y update && apt-get -y install exiftool
|
||||
RUN apt-get -y update && apt-get -y install imagemagick
|
||||
|
||||
# Test dependencies
|
||||
RUN apt-get -y update && apt-get -y install chromium
|
||||
@ -19,7 +20,7 @@ RUN n 20.17.0
|
||||
ARG MOUNT_DIR=/mnt/fradrive
|
||||
ARG PROJECT_DIR=/fradrive
|
||||
RUN mkdir -p ${PROJECT_DIR}
|
||||
RUN if [ "${PROJECT_DIR}" != "${MOUNT_DIR}"]; then cp -r ${MOUNT_DIR}/* ${PROJECT_DIR} ; fi
|
||||
RUN if [ "${PROJECT_DIR}" != "${MOUNT_DIR}" ] ; then cp -r ${MOUNT_DIR}/* ${PROJECT_DIR} ; fi
|
||||
WORKDIR ${PROJECT_DIR}
|
||||
ENV HOME=${PROJECT_DIR}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
# Yoinked with love from:
|
||||
# https://www.redhat.com/sysadmin/podman-inside-container
|
||||
|
||||
FROM registry.uniworx.de/uniworx/containers/debian:12.5
|
||||
FROM debian:12.5
|
||||
|
||||
RUN apt-get -y update
|
||||
|
||||
|
||||
1154
package-lock.json
generated
1154
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -50,7 +50,6 @@
|
||||
"null-loader": "^4.0.1",
|
||||
"postcss-loader": "^8.1.1",
|
||||
"postcss-preset-env": "^10.0.2",
|
||||
"real-favicon-webpack-plugin": "^0.2.3",
|
||||
"remove-files-webpack-plugin": "^1.5.0",
|
||||
"resolve-url-loader": "^5.0.0",
|
||||
"sass": "^1.77.8",
|
||||
|
||||
13
records.json
13
records.json
@ -1,17 +1,4 @@
|
||||
{
|
||||
"app-manifest-webpack-plugin for \"../../config/favicon.json\"": [
|
||||
{
|
||||
"chunks": {
|
||||
"byName": {},
|
||||
"bySource": {},
|
||||
"usedIds": []
|
||||
},
|
||||
"modules": {
|
||||
"byIdentifier": {},
|
||||
"usedIds": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"app-manifest-webpack-plugin for \"/home/gkleen/projects/uni2work/static/wp-4.41/iconstats-[hash].json\"": [
|
||||
{
|
||||
"chunks": {
|
||||
|
||||
128
stack.yaml.lock
128
stack.yaml.lock
@ -6,7 +6,7 @@
|
||||
packages:
|
||||
- completed:
|
||||
commit: 22fc3bb14841d8d50997aa47f1be3852e666f787
|
||||
git: https://gitlab.uniworx.de/haskell/encoding.git
|
||||
git: https://gitea.uniworx.systems/haskell/encoding.git
|
||||
name: encoding
|
||||
pantry-tree:
|
||||
sha256: fec12328951021bb4d9326ae0b35f0c459e65f28442366efd4366cd1e18abe19
|
||||
@ -14,10 +14,10 @@ packages:
|
||||
version: 0.8.2
|
||||
original:
|
||||
commit: 22fc3bb14841d8d50997aa47f1be3852e666f787
|
||||
git: https://gitlab.uniworx.de/haskell/encoding.git
|
||||
git: https://gitea.uniworx.systems/haskell/encoding.git
|
||||
- completed:
|
||||
commit: b7071df50bad3a251a544b984e4bf98fa09b8fae
|
||||
git: https://gitlab.uniworx.de/haskell/memcached-binary.git
|
||||
git: https://gitea.uniworx.systems/haskell/memcached-binary.git
|
||||
name: memcached-binary
|
||||
pantry-tree:
|
||||
sha256: 0da0539b7b9a56d03a116dcd666bc1bbbef085659910420849484d1418aa0857
|
||||
@ -25,10 +25,10 @@ packages:
|
||||
version: 0.2.0
|
||||
original:
|
||||
commit: b7071df50bad3a251a544b984e4bf98fa09b8fae
|
||||
git: https://gitlab.uniworx.de/haskell/memcached-binary.git
|
||||
git: https://gitea.uniworx.systems/haskell/memcached-binary.git
|
||||
- completed:
|
||||
commit: cbea6159c2975d42f948525e03e12fc390da53c5
|
||||
git: https://gitlab.uniworx.de/haskell/conduit-resumablesink.git
|
||||
git: https://gitea.uniworx.systems/haskell/conduit-resumablesink.git
|
||||
name: conduit-resumablesink
|
||||
pantry-tree:
|
||||
sha256: 0cccf4684bbd84f81d2d3d53dd81c46cb103b5322f1d8e89e9b222211281e1b7
|
||||
@ -36,7 +36,7 @@ packages:
|
||||
version: '0.3'
|
||||
original:
|
||||
commit: cbea6159c2975d42f948525e03e12fc390da53c5
|
||||
git: https://gitlab.uniworx.de/haskell/conduit-resumablesink.git
|
||||
git: https://gitea.uniworx.systems/haskell/conduit-resumablesink.git
|
||||
- completed:
|
||||
commit: 5aa1f3b009253b02c4822005ac59ee208a10a347
|
||||
git: https://github.com/jtdaugherty/HaskellNet.git
|
||||
@ -50,7 +50,7 @@ packages:
|
||||
git: https://github.com/jtdaugherty/HaskellNet.git
|
||||
- completed:
|
||||
commit: 40393c938111ac78232dc2c7eec5edb4a22d03e8
|
||||
git: https://gitlab.uniworx.de/haskell/HaskellNet-SSL.git
|
||||
git: https://gitea.uniworx.systems/haskell/HaskellNet-SSL.git
|
||||
name: HaskellNet-SSL
|
||||
pantry-tree:
|
||||
sha256: 95dcec22fdb8af986e59f0f60aa76d4a48f34a546dca799bd571e1d183f773e0
|
||||
@ -58,10 +58,10 @@ packages:
|
||||
version: 0.3.4.1
|
||||
original:
|
||||
commit: 40393c938111ac78232dc2c7eec5edb4a22d03e8
|
||||
git: https://gitlab.uniworx.de/haskell/HaskellNet-SSL.git
|
||||
git: https://gitea.uniworx.systems/haskell/HaskellNet-SSL.git
|
||||
- completed:
|
||||
commit: 01afaf599ba6f8a9d804c269e91d3190b249d3f0
|
||||
git: https://gitlab.uniworx.de/haskell/ldap-client.git
|
||||
git: https://gitea.uniworx.systems/haskell/ldap-client.git
|
||||
name: ldap-client
|
||||
pantry-tree:
|
||||
sha256: 3fa8f102427b437b2baaec15cf884e88b47a1621b1c3fd4d8919f0263fde8656
|
||||
@ -69,10 +69,10 @@ packages:
|
||||
version: 0.4.0
|
||||
original:
|
||||
commit: 01afaf599ba6f8a9d804c269e91d3190b249d3f0
|
||||
git: https://gitlab.uniworx.de/haskell/ldap-client.git
|
||||
git: https://gitea.uniworx.systems/haskell/ldap-client.git
|
||||
- completed:
|
||||
commit: fda3a000f9039e35e76e28f8e88c4942fac9fd69
|
||||
git: https://gitlab.uniworx.de/haskell/serversession.git
|
||||
git: https://gitea.uniworx.systems/haskell/serversession.git
|
||||
name: serversession
|
||||
pantry-tree:
|
||||
sha256: 83ac78a987399db3da62f84bbd335fead11aadebd57251d0688127fca984db23
|
||||
@ -81,11 +81,11 @@ packages:
|
||||
version: 1.0.2
|
||||
original:
|
||||
commit: fda3a000f9039e35e76e28f8e88c4942fac9fd69
|
||||
git: https://gitlab.uniworx.de/haskell/serversession.git
|
||||
git: https://gitea.uniworx.systems/haskell/serversession.git
|
||||
subdir: serversession
|
||||
- completed:
|
||||
commit: fda3a000f9039e35e76e28f8e88c4942fac9fd69
|
||||
git: https://gitlab.uniworx.de/haskell/serversession.git
|
||||
git: https://gitea.uniworx.systems/haskell/serversession.git
|
||||
name: serversession-backend-acid-state
|
||||
pantry-tree:
|
||||
sha256: 4804260c6245c12e1728c78dd33bf16e95b7f2b69b38b6900a4e65b1ef3e04b7
|
||||
@ -94,11 +94,11 @@ packages:
|
||||
version: 1.0.4
|
||||
original:
|
||||
commit: fda3a000f9039e35e76e28f8e88c4942fac9fd69
|
||||
git: https://gitlab.uniworx.de/haskell/serversession.git
|
||||
git: https://gitea.uniworx.systems/haskell/serversession.git
|
||||
subdir: serversession-backend-acid-state
|
||||
- completed:
|
||||
commit: dc928c3a456074b8777603bea20e81937321777f
|
||||
git: https://gitlab.uniworx.de/haskell/xss-sanitize.git
|
||||
git: https://gitea.uniworx.systems/haskell/xss-sanitize.git
|
||||
name: xss-sanitize
|
||||
pantry-tree:
|
||||
sha256: f567a1c834448daaa164f2029fad164e6c8df2d4c92b51f811bae19cc0c95975
|
||||
@ -106,10 +106,10 @@ packages:
|
||||
version: 0.3.6
|
||||
original:
|
||||
commit: dc928c3a456074b8777603bea20e81937321777f
|
||||
git: https://gitlab.uniworx.de/haskell/xss-sanitize.git
|
||||
git: https://gitea.uniworx.systems/haskell/xss-sanitize.git
|
||||
- completed:
|
||||
commit: f8170266ab25b533576e96715bedffc5aa4f19fa
|
||||
git: https://gitlab.uniworx.de/haskell/colonnade.git
|
||||
git: https://gitea.uniworx.systems/haskell/colonnade.git
|
||||
name: colonnade
|
||||
pantry-tree:
|
||||
sha256: 392393652cc0f354d351482557b9385c8e6122e706359b030373656565f2e045
|
||||
@ -118,11 +118,11 @@ packages:
|
||||
version: 1.2.0.2
|
||||
original:
|
||||
commit: f8170266ab25b533576e96715bedffc5aa4f19fa
|
||||
git: https://gitlab.uniworx.de/haskell/colonnade.git
|
||||
git: https://gitea.uniworx.systems/haskell/colonnade.git
|
||||
subdir: colonnade
|
||||
- completed:
|
||||
commit: 42103ab247057c04c8ce7a83d9d4c160713a3df1
|
||||
git: https://gitlab.uniworx.de/haskell/minio-hs.git
|
||||
git: https://gitea.uniworx.systems/haskell/minio-hs.git
|
||||
name: minio-hs
|
||||
pantry-tree:
|
||||
sha256: c5faff15fa22a7a63f45cd903c9bd11ae03f422c26f24750f5c44cb4d0db70fc
|
||||
@ -130,10 +130,10 @@ packages:
|
||||
version: 1.5.2
|
||||
original:
|
||||
commit: 42103ab247057c04c8ce7a83d9d4c160713a3df1
|
||||
git: https://gitlab.uniworx.de/haskell/minio-hs.git
|
||||
git: https://gitea.uniworx.systems/haskell/minio-hs.git
|
||||
- completed:
|
||||
commit: 130b0dcbf2b09ccdf387b50262f1efbbbf1819e3
|
||||
git: https://gitlab.uniworx.de/haskell/cryptoids.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptoids.git
|
||||
name: cryptoids-class
|
||||
pantry-tree:
|
||||
sha256: 30466648d273ffb1d580b7961188d67a0bedb3703d6d5f8cca3c15a45295f203
|
||||
@ -142,11 +142,11 @@ packages:
|
||||
version: 0.0.0
|
||||
original:
|
||||
commit: 130b0dcbf2b09ccdf387b50262f1efbbbf1819e3
|
||||
git: https://gitlab.uniworx.de/haskell/cryptoids.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptoids.git
|
||||
subdir: cryptoids-class
|
||||
- completed:
|
||||
commit: 130b0dcbf2b09ccdf387b50262f1efbbbf1819e3
|
||||
git: https://gitlab.uniworx.de/haskell/cryptoids.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptoids.git
|
||||
name: cryptoids-types
|
||||
pantry-tree:
|
||||
sha256: 824ac5c55c2ad553bd401bb5a99731bbdccc828ecc5d71f174e9375c4e03c46e
|
||||
@ -155,11 +155,11 @@ packages:
|
||||
version: 1.0.0
|
||||
original:
|
||||
commit: 130b0dcbf2b09ccdf387b50262f1efbbbf1819e3
|
||||
git: https://gitlab.uniworx.de/haskell/cryptoids.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptoids.git
|
||||
subdir: cryptoids-types
|
||||
- completed:
|
||||
commit: 130b0dcbf2b09ccdf387b50262f1efbbbf1819e3
|
||||
git: https://gitlab.uniworx.de/haskell/cryptoids.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptoids.git
|
||||
name: cryptoids
|
||||
pantry-tree:
|
||||
sha256: b1f49dde76ff7e78b76e7f2f3b3f76c55e5e61555d1df5415ad3b6eb80dda2cb
|
||||
@ -168,11 +168,11 @@ packages:
|
||||
version: 0.5.1.0
|
||||
original:
|
||||
commit: 130b0dcbf2b09ccdf387b50262f1efbbbf1819e3
|
||||
git: https://gitlab.uniworx.de/haskell/cryptoids.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptoids.git
|
||||
subdir: cryptoids
|
||||
- completed:
|
||||
commit: 130b0dcbf2b09ccdf387b50262f1efbbbf1819e3
|
||||
git: https://gitlab.uniworx.de/haskell/cryptoids.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptoids.git
|
||||
name: filepath-crypto
|
||||
pantry-tree:
|
||||
sha256: 9c31a2ffb2b1c86f9ba34eb83529c7a5a7dc68a49f89813c9b553427474654d9
|
||||
@ -181,11 +181,11 @@ packages:
|
||||
version: 0.1.0.0
|
||||
original:
|
||||
commit: 130b0dcbf2b09ccdf387b50262f1efbbbf1819e3
|
||||
git: https://gitlab.uniworx.de/haskell/cryptoids.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptoids.git
|
||||
subdir: filepath-crypto
|
||||
- completed:
|
||||
commit: 130b0dcbf2b09ccdf387b50262f1efbbbf1819e3
|
||||
git: https://gitlab.uniworx.de/haskell/cryptoids.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptoids.git
|
||||
name: uuid-crypto
|
||||
pantry-tree:
|
||||
sha256: 852e59807df1f2cf4b5a3748c46fa149d15a78651c93addfe5fc31d2d94c47f4
|
||||
@ -194,7 +194,7 @@ packages:
|
||||
version: 1.4.0.0
|
||||
original:
|
||||
commit: 130b0dcbf2b09ccdf387b50262f1efbbbf1819e3
|
||||
git: https://gitlab.uniworx.de/haskell/cryptoids.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptoids.git
|
||||
subdir: uuid-crypto
|
||||
- completed:
|
||||
commit: f216e3c0a1efa11a62fd4c9c2db38f7e2b7ac72d
|
||||
@ -224,7 +224,7 @@ packages:
|
||||
subdir: fastcdc
|
||||
- completed:
|
||||
commit: 843683d024f767de236f74d24a3348f69181a720
|
||||
git: https://gitlab.uniworx.de/haskell/zip-stream.git
|
||||
git: https://gitea.uniworx.systems/haskell/zip-stream.git
|
||||
name: zip-stream
|
||||
pantry-tree:
|
||||
sha256: 0da8bc38d73034962d2e2d1a7586b6dee848a629319fce9cbbf578348c61118c
|
||||
@ -232,10 +232,10 @@ packages:
|
||||
version: 0.2.0.1
|
||||
original:
|
||||
commit: 843683d024f767de236f74d24a3348f69181a720
|
||||
git: https://gitlab.uniworx.de/haskell/zip-stream.git
|
||||
git: https://gitea.uniworx.systems/haskell/zip-stream.git
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-core
|
||||
pantry-tree:
|
||||
sha256: 08c8da10b32c8d9f784238fd87232bf90b752e82f81ef2c52c62210f9aadda9a
|
||||
@ -244,11 +244,11 @@ packages:
|
||||
version: 1.6.20.2
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-core
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-static
|
||||
pantry-tree:
|
||||
sha256: 32c1608243a5309005ce11e2aa379ac1d6f8c380c529785eb510770118f3da06
|
||||
@ -257,11 +257,11 @@ packages:
|
||||
version: 1.6.1.0
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-static
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-persistent
|
||||
pantry-tree:
|
||||
sha256: 3778ef2964e1a3890afc22cc9124eacb40e64b62bed4983a85d3b99897f54c5c
|
||||
@ -270,11 +270,11 @@ packages:
|
||||
version: 1.6.0.7
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-persistent
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-newsfeed
|
||||
pantry-tree:
|
||||
sha256: 53ebad62655863a657dcf749ffd3de46f6af90dd71f55bc4d50805ac48ddb099
|
||||
@ -283,11 +283,11 @@ packages:
|
||||
version: 1.7.0.0
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-newsfeed
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-form
|
||||
pantry-tree:
|
||||
sha256: 260b7f16a8e1d58da137eb91aeed3a11ccbe59ba3e614457a635b9dc3e71426f
|
||||
@ -296,11 +296,11 @@ packages:
|
||||
version: 1.7.0
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-form
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-form-multi
|
||||
pantry-tree:
|
||||
sha256: b21fc50db43733dfe6e285345856610ba4feb83329e9cf953bf8047ba18ecbd6
|
||||
@ -309,11 +309,11 @@ packages:
|
||||
version: 1.7.0.2
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-form-multi
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-auth
|
||||
pantry-tree:
|
||||
sha256: d335b940a207f8155f421b7146746a72d20db6ad54412154f2c829a59bf21e08
|
||||
@ -322,11 +322,11 @@ packages:
|
||||
version: 1.6.10.3
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-auth
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-auth-oauth
|
||||
pantry-tree:
|
||||
sha256: 39d2f7d5d1abb3a2953858c5f23880e60ecfcdad0549ddc2570204f9c47649f4
|
||||
@ -335,11 +335,11 @@ packages:
|
||||
version: 1.6.0.3
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-auth-oauth
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-sitemap
|
||||
pantry-tree:
|
||||
sha256: 971f48af7011ff7816872d067e5de9cadafdd371bdf209170b77df36001abd27
|
||||
@ -348,11 +348,11 @@ packages:
|
||||
version: 1.6.0
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-sitemap
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-test
|
||||
pantry-tree:
|
||||
sha256: 3d5022e8e3f8e77abcf075c42cf49efaa26f4951159bbb5ab50b69fdfeacb7c1
|
||||
@ -361,11 +361,11 @@ packages:
|
||||
version: 1.6.12
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-test
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-bin
|
||||
pantry-tree:
|
||||
sha256: 422d7816965b79826c6c24582d76dadbacd1bfb3e9a8f31208867cd788f2a5b8
|
||||
@ -374,11 +374,11 @@ packages:
|
||||
version: 1.6.1
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-bin
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod
|
||||
pantry-tree:
|
||||
sha256: cb53ef3f2036185d2b4752d6fbc5d78470b4504e646e7eb4dd2397f2599daf42
|
||||
@ -387,11 +387,11 @@ packages:
|
||||
version: 1.6.1.1
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-eventsource
|
||||
pantry-tree:
|
||||
sha256: 6d393201852cd024e377159ba836398e24d191563e08165430113d3c1384aff2
|
||||
@ -400,11 +400,11 @@ packages:
|
||||
version: 1.6.0.1
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-eventsource
|
||||
- completed:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
name: yesod-websockets
|
||||
pantry-tree:
|
||||
sha256: 02df6117e9b74a77879ea750130ba2d8ad8d3c99e14ca678320cb578984301e5
|
||||
@ -413,11 +413,11 @@ packages:
|
||||
version: 0.3.0.3
|
||||
original:
|
||||
commit: aa671eb41fdad360f2f7cb844f8de03479efe3f7
|
||||
git: https://gitlab.uniworx.de/haskell/yesod.git
|
||||
git: https://gitea.uniworx.systems/haskell/yesod.git
|
||||
subdir: yesod-websockets
|
||||
- completed:
|
||||
commit: 71a630edaf5f22c464e24fac8d9d310f4055ea1f
|
||||
git: https://gitlab.uniworx.de/haskell/cryptonite.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptonite.git
|
||||
name: cryptonite
|
||||
pantry-tree:
|
||||
sha256: 19e49259fa5e3c257495d72b3c7c3c49537aeafd508c780c2430ddca2ef71a91
|
||||
@ -425,10 +425,10 @@ packages:
|
||||
version: '0.29'
|
||||
original:
|
||||
commit: 71a630edaf5f22c464e24fac8d9d310f4055ea1f
|
||||
git: https://gitlab.uniworx.de/haskell/cryptonite.git
|
||||
git: https://gitea.uniworx.systems/haskell/cryptonite.git
|
||||
- completed:
|
||||
commit: e18dd125c5ea26fa4e88bed079b61d8c1365ee37
|
||||
git: https://gitlab.uniworx.de/haskell/esqueleto.git
|
||||
git: https://gitea.uniworx.systems/haskell/esqueleto.git
|
||||
name: esqueleto
|
||||
pantry-tree:
|
||||
sha256: 8a93dc98eb4529ff64aa5bcdaa3c00dcdf0378033ad675864e2b0fc3d869d947
|
||||
@ -436,7 +436,7 @@ packages:
|
||||
version: 3.5.4.0
|
||||
original:
|
||||
commit: e18dd125c5ea26fa4e88bed079b61d8c1365ee37
|
||||
git: https://gitlab.uniworx.de/haskell/esqueleto.git
|
||||
git: https://gitea.uniworx.systems/haskell/esqueleto.git
|
||||
- completed:
|
||||
hackage: classy-prelude-yesod-1.5.0@sha256:8f7e183bdfd6d2ea9674284c4f285294ab086aff60d9be4e5d7d2f3c1a2b05b7,1330
|
||||
pantry-tree:
|
||||
|
||||
@ -15,7 +15,8 @@ spec = withApp $ do
|
||||
it "has correct User-agent" $ do
|
||||
get $ WellKnownR RobotsTxt
|
||||
bodyContains "User-agent: *"
|
||||
describe "favicon.ico" $ do
|
||||
it "gives a 200" $ do
|
||||
get $ WellKnownR FaviconIco
|
||||
statusIs 200
|
||||
-- FIXME: deprecated, check for assets/favicons instead!
|
||||
--describe "favicon.ico" $ do
|
||||
-- it "gives a 200" $ do
|
||||
-- get $ WellKnownR FaviconIco
|
||||
-- statusIs 200
|
||||
|
||||
46
utils/faviconize.pl
Executable file
46
utils/faviconize.pl
Executable file
@ -0,0 +1,46 @@
|
||||
#!/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);
|
||||
my $dir = undef;
|
||||
opendir($dir, $faviconDir) or die "Could not read directory '$faviconDir', because: $!\n";
|
||||
while(my $fn = readdir($dir)) {
|
||||
unlink("$faviconDir/$fn") if -d "$faviconDir/$fn"
|
||||
}
|
||||
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#<link rel="$icon" sizes="${size}x$size" href="/$newfile">#
|
||||
}
|
||||
|
||||
my $wh = undef;
|
||||
open($wh, '>', "$faviconDir/include.html") or die "Could not write '$faviconDir/include.html', because: $!";
|
||||
print $wh $include;
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@ import TerserPlugin from 'terser-webpack-plugin';
|
||||
import yaml from 'js-yaml';
|
||||
import postcssPresetEnv from 'postcss-preset-env';
|
||||
import RemovePlugin from 'remove-files-webpack-plugin';
|
||||
import RealFaviconPlugin from 'real-favicon-webpack-plugin';
|
||||
import crypto from 'crypto';
|
||||
|
||||
// import { version as webpackVersion } from 'webpack/package.json' assert { type: 'json' }; // version.split('.').slice(0, 2).join('.');
|
||||
@ -30,22 +29,14 @@ import webpackJson from 'webpack/package.json' assert { type: "json" };
|
||||
const webpackVersion = webpackJson.version.split('.').slice(0, 2).join('.');
|
||||
import packageJson from './package.json' assert { type: "json" };
|
||||
const packageVersion = packageJson.version;
|
||||
|
||||
import faviconJson from './config/favicon.json' assert { type: 'json' };
|
||||
import i18nJson from './config/i18n.json' assert { type: 'json' };
|
||||
|
||||
async function webpackConfig() {
|
||||
const wellKnownCacheDir = resolve('.cache/well-known');
|
||||
const assetsDirectory = resolve('assets');
|
||||
let faviconApiVersion = undefined;
|
||||
|
||||
if (!fs.existsSync(wellKnownCacheDir)) {
|
||||
try {
|
||||
const faviconApiChangelog = await axios.get('https://realfavicongenerator.net/api/versions');
|
||||
faviconApiVersion = faviconApiChangelog.data.filter(vObj => vObj.relevance.automated_update).slice(-1)[0].version;
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
const wellKnownDir = 'well-known';
|
||||
const wellKnownCacheDir = '.cache/well-known';
|
||||
const staticDir = 'static';
|
||||
const assetsDir = 'assets';
|
||||
const faviconsDir = `${assetsDir}/favicons`;
|
||||
|
||||
return {
|
||||
module: {
|
||||
@ -131,8 +122,8 @@ async function webpackConfig() {
|
||||
serialize: yaml.dump
|
||||
}),
|
||||
new CleanWebpackPlugin({
|
||||
cleanOnceBeforeBuildPatterns: [ resolve('static'),
|
||||
resolve('well-known'),
|
||||
cleanOnceBeforeBuildPatterns: [ resolve(staticDir),
|
||||
resolve(wellKnownDir),
|
||||
]
|
||||
}),
|
||||
new webpack.IgnorePlugin({
|
||||
@ -144,44 +135,26 @@ async function webpackConfig() {
|
||||
}),
|
||||
...(() => {
|
||||
const langs = new Set();
|
||||
function findLangs(json) {
|
||||
function findLangs(json, langs = new Set()) {
|
||||
if (json && json._i18n) {
|
||||
Object.keys(json).forEach(key => {
|
||||
if (key !== '_i18n') {
|
||||
langs.add(key);
|
||||
}
|
||||
})
|
||||
} else if (Array.isArray(json)) {
|
||||
json.forEach(elem => findLangs(elem));
|
||||
} else if (typeof json === 'object') {
|
||||
Object.keys(json).forEach(key => findLangs(json[key]));
|
||||
}
|
||||
}
|
||||
findLangs(faviconJson);
|
||||
|
||||
function selectLang(lang, json) {
|
||||
if (json && json._i18n) {
|
||||
return json[lang];
|
||||
} else if (Array.isArray(json)) {
|
||||
return json.map(elem => selectLang(lang, elem));
|
||||
} else if (typeof json === 'object') {
|
||||
return Object.fromEntries(Object.entries(json).map(([k, v]) => [k, selectLang(lang, v)]));
|
||||
} else {
|
||||
return json;
|
||||
console.error('Invalid i18nJson format!');
|
||||
}
|
||||
return langs;
|
||||
}
|
||||
|
||||
const langJsons = {};
|
||||
Array.from(langs).forEach(lang => {
|
||||
langJsons[lang] = selectLang(lang, faviconJson);
|
||||
});
|
||||
findLangs(i18nJson, langs);
|
||||
|
||||
const cacheHash = crypto.createHash('sha256');
|
||||
cacheHash.update(JSON.stringify(langJsons));
|
||||
cacheHash.update(JSON.stringify(langs));
|
||||
|
||||
const cacheFiles = new Set([
|
||||
...(Array.from(langs).map(lang => resolve(langJsons[lang].masterPicture))),
|
||||
resolve('config/robots.txt'),
|
||||
resolve('assets/favicon.svg'),
|
||||
]);
|
||||
|
||||
for (const cacheFile of cacheFiles) {
|
||||
@ -192,7 +165,7 @@ async function webpackConfig() {
|
||||
|
||||
let cachedVersion = undefined;
|
||||
|
||||
const versionFile = resolve('.well-known-cache', `${cacheDigest}.version`);
|
||||
const versionFile = resolve(wellKnownCacheDir, `${cacheDigest}.version`);
|
||||
try {
|
||||
if (fs.existsSync(versionFile)) {
|
||||
cachedVersion = fs.readFileSync(versionFile, 'utf8');
|
||||
@ -201,66 +174,18 @@ async function webpackConfig() {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
if (faviconApiVersion) {
|
||||
cacheHash.update(faviconApiVersion);
|
||||
}
|
||||
const versionDigest = cacheHash.digest('hex');
|
||||
|
||||
return Array.from(langs).map(lang => {
|
||||
const faviconConfig = { versioning: { param_name: 'v', param_value: versionDigest.substr(0,10) }, ...langJsons[lang] };
|
||||
|
||||
const cacheDirectory = resolve('.well-known-cache', `${cacheDigest}-${lang}`);
|
||||
|
||||
if (fs.existsSync(wellKnownCacheDir)) {
|
||||
console.log("Using favicons generated by nix");
|
||||
return [
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{ from: resolve(wellKnownCacheDir, lang), to: resolve('well-known', lang) }
|
||||
]
|
||||
})
|
||||
];
|
||||
} else if (fs.existsSync(cacheDirectory) && (!faviconApiVersion || faviconApiVersion === cachedVersion)) {
|
||||
console.log(`Using cached well-known from ${cacheDirectory} for ${lang}`);
|
||||
return [
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{ from: cacheDirectory, to: resolve('well-known', lang) }
|
||||
]
|
||||
})
|
||||
];
|
||||
} else {
|
||||
const tmpobj = tmp.fileSync({ postfix: ".json" });
|
||||
fs.writeSync(tmpobj.fd, JSON.stringify(faviconConfig));
|
||||
fs.close(tmpobj.fd);
|
||||
|
||||
return [
|
||||
new RealFaviconPlugin({
|
||||
faviconJson: relative(".", tmpobj.name),
|
||||
outputPath: resolve('well-known', lang),
|
||||
inject: false
|
||||
}),
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{ from: 'config/robots.txt', to: resolve('well-known', lang, 'robots.txt') },
|
||||
]
|
||||
}),
|
||||
{ apply: compiler => compiler.hooks.afterEmit.tap('AfterEmitPlugin', compilation => {
|
||||
const imgFiles = globSync(resolve('well-known', lang) + '/*.@(png)');
|
||||
const imgFilesArgs = Array.from(imgFiles).join(" ");
|
||||
execSync(`exiftool -overwrite_original -all= ${imgFilesArgs}`, { stdio: 'inherit' });
|
||||
})
|
||||
},
|
||||
{ apply: compiler => compiler.hooks.afterEmit.tap('AfterEmitPlugin', compilation => {
|
||||
fs.ensureDirSync('.well-known-cache');
|
||||
fs.copySync(resolve('well-known', lang), cacheDirectory);
|
||||
if (!fs.existsSync(versionFile)) {
|
||||
fs.writeFileSync(versionFile, faviconApiVersion, { encoding: 'utf8' });
|
||||
}
|
||||
})
|
||||
}
|
||||
];
|
||||
}
|
||||
return [
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{ from: 'config/robots.txt', to: resolve(wellKnownDir, lang, 'robots.txt') },
|
||||
{ from: `${faviconsDir}/include.html`, to: resolve(wellKnownDir, lang, 'html_code.html') },
|
||||
{ from: `${faviconsDir}/*.png`, to: resolve(wellKnownDir, lang, '[name][ext]') },
|
||||
]
|
||||
}),
|
||||
];
|
||||
}).flat(1);
|
||||
})()
|
||||
],
|
||||
@ -268,8 +193,8 @@ async function webpackConfig() {
|
||||
output: {
|
||||
chunkFilename: '[chunkhash].js',
|
||||
filename: '[chunkhash].js',
|
||||
path: resolve('static', `wp-${webpackVersion}`),
|
||||
publicPath: `/static/res/wp-${webpackVersion}/`,
|
||||
path: resolve(staticDir, `wp-${webpackVersion}`),
|
||||
publicPath: `/${staticDir}/res/wp-${webpackVersion}/`,
|
||||
hashFunction: 'shake256',
|
||||
hashDigestLength: 36
|
||||
},
|
||||
@ -303,4 +228,4 @@ async function webpackConfig() {
|
||||
};
|
||||
}
|
||||
|
||||
export default webpackConfig;
|
||||
export default webpackConfig;
|
||||
Reference in New Issue
Block a user