Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#3383 from H0llyW00dzZ/auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa authored Nov 27, 2023
2 parents 4636a75 + dda40e2 commit 2c12be6
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,11 @@ export function Settings() {
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);
return () => {
document.removeEventListener("keydown", keydownEvent);
Expand Down Expand Up @@ -909,21 +914,26 @@ export function Settings() {

{!accessStore.hideUserApiKey && (
<>
<ListItem
title={Locale.Settings.Access.CustomEndpoint.Title}
subTitle={Locale.Settings.Access.CustomEndpoint.SubTitle}
>
<input
type="checkbox"
checked={accessStore.useCustomConfig}
onChange={(e) =>
accessStore.update(
(access) =>
(access.useCustomConfig = e.currentTarget.checked),
)
}
></input>
</ListItem>
{
// Conditionally render the following ListItem based on clientConfig.isApp
!clientConfig?.isApp && ( // only show if isApp is false
<ListItem
title={Locale.Settings.Access.CustomEndpoint.Title}
subTitle={Locale.Settings.Access.CustomEndpoint.SubTitle}
>
<input
type="checkbox"
checked={accessStore.useCustomConfig}
onChange={(e) =>
accessStore.update(
(access) =>
(access.useCustomConfig = e.currentTarget.checked),
)
}
></input>
</ListItem>
)
}
{accessStore.useCustomConfig && (
<>
<ListItem
Expand Down

0 comments on commit 2c12be6

Please sign in to comment.