fix: properly handle server lock and related properties

This commit is contained in:
Kendall Garner
2026-01-08 07:42:59 -08:00
parent 2fdc214c21
commit 7e67d0dac6
12 changed files with 40 additions and 28 deletions
@@ -5,6 +5,10 @@ import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { api } from '/@/renderer/api';
import {
isLegacyAuth,
isServerLock,
} from '/@/renderer/features/action-required/utils/window-properties';
import JellyfinIcon from '/@/renderer/features/servers/assets/jellyfin.png';
import NavidromeIcon from '/@/renderer/features/servers/assets/navidrome.png';
import SubsonicIcon from '/@/renderer/features/servers/assets/opensubsonic.png';
@@ -94,8 +98,8 @@ 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 serverLock = isServerLock();
const legacyAuthDefault = serverLock && isLegacyAuth();
const form = useForm({
initialValues: {
@@ -231,7 +235,7 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => {
<Stack m={5} ref={focusTrapRef}>
<SegmentedControl
data={ALL_SERVERS}
disabled={isServerLock}
disabled={serverLock}
p="md"
withItemsBorders={false}
{...form.getInputProps('type')}
@@ -239,7 +243,7 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => {
<Group grow>
<TextInput
data-autofocus
disabled={isServerLock}
disabled={serverLock}
label={t('form.addServer.input', {
context: 'name',
postProcess: 'titleCase',
@@ -248,7 +252,7 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => {
{...form.getInputProps('name')}
/>
<TextInput
disabled={isServerLock}
disabled={serverLock}
label={t('form.addServer.input', {
context: 'url',
postProcess: 'titleCase',
@@ -258,7 +262,7 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => {
/>
</Group>
<TextInput
disabled={isServerLock}
disabled={serverLock}
label={t('form.addServer.input', {
context: 'remoteUrl',
postProcess: 'titleCase',
@@ -308,7 +312,7 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => {
)}
{form.values.type === ServerType.SUBSONIC && (
<Checkbox
disabled={isServerLock}
disabled={serverLock}
label={t('form.addServer.input', {
context: 'legacyAuthentication',
postProcess: 'titleCase',