mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-11-25 23:41:15 +00:00
multi fixes (#1738)
- Fix #1737 - Fix #1736 - Fix #1728 - Fix #1730 - Fix #1732 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved Hardcover metadata searches by distinguishing series names, title prefixes, and genre descriptors. * Login redirects now wait until the logo loads or fails, and respond to changes in the redirect setting. * Increased tolerance for slow responses and improved handling of temporary Hardcover connection failures. * Fixed WireGuard setup when an environment-provided user ID conflicts with the actual root ID. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
1 parent
75b88f55e0
commit
02efb0781b
7 files changed
+179
-8
No files matched your search
@@ -2,7 +2,7 @@ import type { FormEvent, KeyboardEvent } from 'react';
|
||||
import { useRef, useState } from 'react';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
|
||||
import { useMountEffect } from '../hooks/useMountEffect';
|
||||
import { useDependencyEffect, useMountEffect } from '../hooks/useMountEffect';
|
||||
import type { LoginCredentials } from '../types';
|
||||
import { buildOidcLoginUrl } from '../utils/authRedirect';
|
||||
import { withBasePath } from '../utils/basePath';
|
||||
@@ -246,11 +246,13 @@ export const LoginForm = ({
|
||||
}
|
||||
}
|
||||
|
||||
useMountEffect(() => {
|
||||
// Keyed on oidcAutoRedirect rather than run once at mount: LoginPage holds it
|
||||
// false until the logo has loaded, so the redirect fires when it turns on.
|
||||
useDependencyEffect(() => {
|
||||
if (oidcAutoRedirect && isOidc && !error && !oidcError) {
|
||||
window.location.href = oidcLoginUrl;
|
||||
}
|
||||
});
|
||||
}, [oidcAutoRedirect]);
|
||||
|
||||
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
import { LoginForm } from '../components/LoginForm';
|
||||
import type { LoginCredentials } from '../types';
|
||||
import { withBasePath } from '../utils/basePath';
|
||||
@@ -22,6 +24,10 @@ export const LoginPage = ({
|
||||
oidcAutoRedirect,
|
||||
}: LoginPageProps) => {
|
||||
const logoUrl = withBasePath('/logo.png');
|
||||
// Navigating away cancels a logo that is still loading, and Firefox then shows
|
||||
// it as a broken image until the OIDC provider answers. Hold the auto-redirect
|
||||
// until the logo has loaded or failed; a failure must not block sign-in.
|
||||
const [logoSettled, setLogoSettled] = useState(false);
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -38,7 +44,13 @@ export const LoginPage = ({
|
||||
}}
|
||||
>
|
||||
<div className="mb-5 text-center">
|
||||
<img src={logoUrl} alt="Logo" className="mx-auto h-12 w-12" />
|
||||
<img
|
||||
src={logoUrl}
|
||||
alt="Logo"
|
||||
className="mx-auto h-12 w-12"
|
||||
onLoad={() => setLogoSettled(true)}
|
||||
onError={() => setLogoSettled(true)}
|
||||
/>
|
||||
</div>
|
||||
<LoginForm
|
||||
onSubmit={onLogin}
|
||||
@@ -47,7 +59,7 @@ export const LoginPage = ({
|
||||
authMode={authMode}
|
||||
oidcButtonLabel={oidcButtonLabel}
|
||||
hideLocalAuth={hideLocalAuth}
|
||||
oidcAutoRedirect={oidcAutoRedirect}
|
||||
oidcAutoRedirect={oidcAutoRedirect && logoSettled}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user