Merge pull request #3383 from H0llyW00dzZ/auth

This commit is contained in:
Yifei Zhang 2023-11-27 15:51:27 +08:00 committed by GitHub
commit 2c12be62c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -635,6 +635,11 @@ export function Settings() {
navigate(Path.Home); navigate(Path.Home);
} }
}; };
if (clientConfig?.isApp) { // Force to set custom endpoint to true if it's app
accessStore.update((state) => {
state.useCustomConfig = true;
});
}
document.addEventListener("keydown", keydownEvent); document.addEventListener("keydown", keydownEvent);
return () => { return () => {
document.removeEventListener("keydown", keydownEvent); document.removeEventListener("keydown", keydownEvent);
@ -909,21 +914,26 @@ export function Settings() {
{!accessStore.hideUserApiKey && ( {!accessStore.hideUserApiKey && (
<> <>
<ListItem {
title={Locale.Settings.Access.CustomEndpoint.Title} // Conditionally render the following ListItem based on clientConfig.isApp
subTitle={Locale.Settings.Access.CustomEndpoint.SubTitle} !clientConfig?.isApp && ( // only show if isApp is false
> <ListItem
<input title={Locale.Settings.Access.CustomEndpoint.Title}
type="checkbox" subTitle={Locale.Settings.Access.CustomEndpoint.SubTitle}
checked={accessStore.useCustomConfig} >
onChange={(e) => <input
accessStore.update( type="checkbox"
(access) => checked={accessStore.useCustomConfig}
(access.useCustomConfig = e.currentTarget.checked), onChange={(e) =>
) accessStore.update(
} (access) =>
></input> (access.useCustomConfig = e.currentTarget.checked),
</ListItem> )
}
></input>
</ListItem>
)
}
{accessStore.useCustomConfig && ( {accessStore.useCustomConfig && (
<> <>
<ListItem <ListItem