Merge pull request #838 from gotify/fix-ci

This commit is contained in:
Jannis Mattheis 2025-09-13 10:44:29 +02:00 committed by GitHub
commit 0239db0a6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 11 deletions

View File

@ -2,11 +2,7 @@ LICENSE_DIR=./licenses/
BUILD_DIR=./build
DOCKER_DIR=./docker/
SHELL := /bin/bash
ifdef GOTOOLCHAIN
GO_VERSION=$(GOTOOLCHAIN)
else
GO_VERSION=$(shell go mod edit -json | jq -r .Toolchain | sed -e 's/go//')
endif
GO_VERSION=$(shell go mod edit -json | jq -r .Toolchain | sed -e 's/go//')
DOCKER_BUILD_IMAGE=docker.io/gotify/build
DOCKER_WORKDIR=/proj
DOCKER_RUN=docker run --rm -e LD_FLAGS="$$LD_FLAGS" -v "$$PWD/.:${DOCKER_WORKDIR}" -v "`go env GOPATH`/pkg/mod/.:/go/pkg/mod:ro" -w ${DOCKER_WORKDIR}

View File

@ -55,6 +55,7 @@ const Layout = observer(() => {
const {
currentUser: {
loggedIn,
authenticating,
user: {name, admin},
logout,
tryReconnect,
@ -79,7 +80,9 @@ const Layout = observer(() => {
};
const authed = (children: React.ReactNode) => (
<RequireAuth loggedIn={loggedIn}>{children}</RequireAuth>
<RequireAuth loggedIn={loggedIn} authenticating={authenticating}>
{children}
</RequireAuth>
);
return (
@ -167,11 +170,16 @@ const Lazy = ({component}: {component: () => Promise<{default: React.ComponentTy
);
};
const RequireAuth: React.FC<React.PropsWithChildren<{loggedIn: boolean}>> = ({
children,
loggedIn,
}) => {
return loggedIn ? <>{children}</> : <Navigate replace={true} to="/login" />;
const RequireAuth: React.FC<
React.PropsWithChildren<{loggedIn: boolean; authenticating: boolean}>
> = ({children, authenticating, loggedIn}) => {
if (authenticating) {
return <LoadingSpinner />;
}
if (!loggedIn) {
return <Navigate replace={true} to="/login" />;
}
return <>{children}</>;
};
export default Layout;