add LEGACY_AUTH env variable (#1473)

This commit is contained in:
jeffvli
2026-01-01 20:33:27 -08:00
parent aaf840d358
commit 55cead87c8
8 changed files with 20 additions and 7 deletions
@@ -52,6 +52,7 @@ const LoginRoute = () => {
const serverType = window.SERVER_TYPE ? toServerType(window.SERVER_TYPE) : null;
const serverName = window.SERVER_NAME || '';
const serverUrl = window.SERVER_URL || '';
const legacyAuth = isServerLock ? Boolean(window.LEGACY_AUTHENTICATION) || false : false;
const config = [
{
@@ -122,7 +123,7 @@ const LoginRoute = () => {
const data: AuthenticationResponse | undefined = await authFunction(
serverUrl,
{
legacy: false,
legacy: legacyAuth,
password: values.password,
username: values.username,
},
@@ -94,9 +94,12 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => {
const { addServer, setCurrentServer } = useAuthStoreActions();
const { servers: discovered } = useAutodiscovery();
const isServerLock = Boolean(window.SERVER_LOCK) || false;
const legacyAuthDefault = isServerLock ? Boolean(window.LEGACY_AUTHENTICATION) || false : false;
const form = useForm({
initialValues: {
legacyAuth: false,
legacyAuth: legacyAuthDefault,
name:
(localSettings ? localSettings.env.SERVER_NAME : window.SERVER_NAME) || 'My Server',
password: '',
@@ -113,9 +116,6 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => {
},
});
// server lock for web is only true if lock is true *and* all other properties are set
const isServerLock = Boolean(window.SERVER_LOCK) || false;
const isSubmitDisabled = !form.values.name || !form.values.url || !form.values.username;
const fillServerDetails = (server: DiscoveredServerItem) => {
@@ -308,6 +308,7 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => {
)}
{form.values.type === ServerType.SUBSONIC && (
<Checkbox
disabled={isServerLock}
label={t('form.addServer.input', {
context: 'legacyAuthentication',
postProcess: 'titleCase',
+1
View File
@@ -1,6 +1,7 @@
declare global {
interface Window {
ANALYTICS_DISABLED?: boolean | string;
LEGACY_AUTHENTICATION?: boolean;
SERVER_LOCK?: boolean;
SERVER_NAME?: string;
SERVER_TYPE?: string;