From f3c955b0f818f96912535bf31d64f46022114b23 Mon Sep 17 00:00:00 2001 From: binwiederhier Date: Thu, 1 Jun 2023 22:13:31 -0400 Subject: [PATCH 1/3] PoC: Load external images --- web/public/config.js | 2 +- web/src/components/Notifications.jsx | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/web/public/config.js b/web/public/config.js index 2f46d65..7bcad73 100644 --- a/web/public/config.js +++ b/web/public/config.js @@ -7,7 +7,7 @@ var config = { base_url: window.location.origin, // Change to test against a different server - app_root: "/app", + app_root: "/", enable_login: true, enable_signup: true, enable_payments: false, diff --git a/web/src/components/Notifications.jsx b/web/src/components/Notifications.jsx index 2faf2fd..385b487 100644 --- a/web/src/components/Notifications.jsx +++ b/web/src/components/Notifications.jsx @@ -287,14 +287,15 @@ const NotificationItem = (props) => { const Attachment = (props) => { const { t } = useTranslation(); + const [ imageError, setImageError ] = useState(false); const { attachment } = props; const expired = attachment.expires && attachment.expires < Date.now() / 1000; const expires = attachment.expires && attachment.expires > Date.now() / 1000; const displayableImage = !expired && attachment.type && attachment.type.startsWith("image/"); // Unexpired image - if (displayableImage) { - return ; + if (!imageError) { + return setImageError(true)} />; } // Anything else: Show box @@ -376,14 +377,19 @@ const Attachment = (props) => { const Image = (props) => { const { t } = useTranslation(); const [open, setOpen] = useState(false); + const [loaded, setLoaded] = useState(false); return ( - <> +
setOpen(true)} + onLoad={() => setLoaded(true)} + onError={props.onError} sx={{ marginTop: 2, borderRadius: "4px", @@ -413,7 +419,7 @@ const Image = (props) => { /> - +
); }; From 77f5dd705c471f12c79527d5f3fdff4687103bf5 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Sat, 3 Jun 2023 15:29:51 -0400 Subject: [PATCH 2/3] *: python pip in debian bookworm/testing needs venv When testing this build using the upcoming debian bookworm/testing, the python pip v3.11 fails to install requirements that may clobber the host install packages. It prints out that venv must be used. This change works fine on the current debian bullseye, and will continue to work once folks switch to the upcoming debian bookworm release. Signed-off-by: Vincent Batts --- Dockerfile-build | 3 ++- Makefile | 14 ++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Dockerfile-build b/Dockerfile-build index f8af256..dec2d96 100644 --- a/Dockerfile-build +++ b/Dockerfile-build @@ -8,7 +8,8 @@ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash RUN apt-get install -y \ build-essential \ nodejs \ - python3-pip + python3-pip \ + python3-venv WORKDIR /app ADD Makefile . diff --git a/Makefile b/Makefile index 8cb7523..440bfa6 100644 --- a/Makefile +++ b/Makefile @@ -110,8 +110,9 @@ build-deps-ubuntu: docs: docs-deps docs-build -docs-build: .PHONY - @if ! /bin/echo -e "import sys\nif sys.version_info < (3,8):\n exit(1)" | python3; then \ +docs-build: venv .PHONY + @. venv/bin/activate && \ + if ! /bin/echo -e "import sys\nif sys.version_info < (3,8):\n exit(1)" | python3; then \ if which python3.8; then \ echo "python3.8 $(shell which mkdocs) build"; \ python3.8 $(shell which mkdocs) build; \ @@ -124,10 +125,15 @@ docs-build: .PHONY mkdocs build; \ fi -docs-deps: .PHONY +venv: + python3 -m venv ./venv + +docs-deps: venv .PHONY + . venv/bin/activate && \ pip3 install -r requirements.txt -docs-deps-update: .PHONY +docs-deps-update: venv .PHONY + . venv/bin/activate && \ pip3 install -r requirements.txt --upgrade From 8eecd3c72a10a46da750d80f36a465694ff54361 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Sat, 3 Jun 2023 15:33:31 -0400 Subject: [PATCH 3/3] Dockerfile*: use my images Signed-off-by: Vincent Batts --- Dockerfile | 2 +- Dockerfile-build | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7c2052e..feb813f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine +FROM r.batts.cloud/debian:testing LABEL org.opencontainers.image.authors="philipp.heckel@gmail.com" LABEL org.opencontainers.image.url="https://ntfy.sh/" diff --git a/Dockerfile-build b/Dockerfile-build index dec2d96..9c6d1bc 100644 --- a/Dockerfile-build +++ b/Dockerfile-build @@ -1,4 +1,4 @@ -FROM golang:1.19-bullseye as builder +FROM r.batts.cloud/golang:1.19 as builder ARG VERSION=dev ARG COMMIT=unknown @@ -37,7 +37,7 @@ ADD ./user ./user ADD ./util ./util RUN make VERSION=$VERSION COMMIT=$COMMIT cli-linux-server -FROM alpine +FROM r.batts.cloud/debian:testing LABEL org.opencontainers.image.authors="philipp.heckel@gmail.com" LABEL org.opencontainers.image.url="https://ntfy.sh/"