fix: pass jellyfin/jellyseerr secrets via get_machine_config and add placeholder for set fields

This commit is contained in:
2026-05-07 23:39:59 +02:00
parent 7e80733837
commit befddf93ce
2 changed files with 67 additions and 19 deletions
+46 -16
View File
@@ -78,6 +78,7 @@ function MachineEditor({
hint,
machine,
sshKeys,
editingMachine,
onChange,
onValidateSSH,
isValidatingSSH,
@@ -89,6 +90,7 @@ function MachineEditor({
hint?: string;
machine: MonitoringMachineInput;
sshKeys: SSHKey[];
editingMachine?: MonitoringMachine | null;
onChange: (
draft:
| MonitoringMachineInput
@@ -107,6 +109,8 @@ function MachineEditor({
const enabledServices = draft.services.length;
const hasJellyfin = draft.services.includes("jellyfin");
const hasJellyseerr = draft.services.includes("jellyseerr");
const placeholderIfSet = (isSet: boolean | undefined) =>
isSet ? "Set, not shown" : undefined;
return (
<Card variant="outlined">
<CardContent sx={{ p: 1.5 }}>
@@ -322,6 +326,7 @@ function MachineEditor({
size="small"
label="Password"
type="password"
placeholder={placeholderIfSet(editingMachine?.password_set)}
value={draft.password}
onChange={(e) =>
setDraft((current) => ({
@@ -419,6 +424,7 @@ function MachineEditor({
size="small"
label="Jellyfin API key"
type="password"
placeholder={placeholderIfSet(editingMachine?.jellyfin_api_key_set)}
value={draft.jellyfin_api_key}
onChange={(e) =>
setDraft((current) => ({
@@ -470,6 +476,7 @@ function MachineEditor({
size="small"
label="Jellyseerr API key"
type="password"
placeholder={placeholderIfSet(editingMachine?.jellyseerr_api_key_set)}
value={draft.jellyseerr_api_key}
onChange={(e) =>
setDraft((current) => ({
@@ -832,18 +839,34 @@ function SSHKeyManager({ sshKeys }: { sshKeys: SSHKey[] }) {
</Typography>
</Box>
<Stack direction="row" spacing={1}>
<Button
size="small"
onClick={() =>
setDraft({
id: key.id,
name: key.name,
private_key: "",
passphrase: "",
public_key: key.public_key,
fingerprint: key.fingerprint,
notes: key.notes,
})
<Button
variant="outlined"
onClick={() =>
openEditMachine({
id: selectedMachine.id,
name: selectedMachine.name,
mode: selectedMachine.mode,
enabled: selectedMachine.enabled,
services: selectedMachine.services,
host: selectedMachine.host,
port: selectedMachine.port,
username: selectedMachine.username,
key_directory: "",
key_name: "",
path_prefix: "",
ssh_key_id: selectedMachine.ssh_key_id,
ssh_private_key: "",
ssh_private_key_passphrase: "",
password: "",
media_root: selectedMachine.media_root,
jellyfin_url: selectedMachine.jellyfin_url,
jellyfin_user_id:
selectedMachine.jellyfin_user_id,
jellyfin_api_key: "",
jellyseerr_url: selectedMachine.jellyseerr_url,
jellyseerr_api_key: "",
notes: selectedMachine.notes,
}, selectedMachine)
}
>
Edit
@@ -1005,6 +1028,7 @@ export function Settings() {
const [machineDraft, setMachineDraft] = useState<MonitoringMachineInput>(
emptyMachine(),
);
const [editingMachine, setEditingMachine] = useState<MonitoringMachine | null>(null);
const [selectedMachineId, setSelectedMachineId] = useState("");
const orderedMachines = useMemo(() => machines ?? [], [machines]);
const selectedMachine = useMemo(
@@ -1028,21 +1052,25 @@ export function Settings() {
const beginLocal = () => {
clearSSHValidation();
setMachineDraft(emptyMachine("local"));
setEditingMachine(null);
setMachineDialogOpen(true);
};
const beginRemote = () => {
clearSSHValidation();
setMachineDraft(emptyMachine("ssh"));
setEditingMachine(null);
setMachineDialogOpen(true);
};
const openEditMachine = (machine: MonitoringMachineInput) => {
const openEditMachine = (input: MonitoringMachineInput, original?: MonitoringMachine | null) => {
clearSSHValidation();
setMachineDraft(machine);
setMachineDraft(input);
setEditingMachine(original ?? null);
setMachineDialogOpen(true);
};
const closeMachineDialog = () => {
clearSSHValidation();
setMachineDialogOpen(false);
setEditingMachine(null);
};
const updateMachineDraft = (
draft:
@@ -1056,6 +1084,7 @@ export function Settings() {
clearSSHValidation();
await saveMachine.mutateAsync(draft);
setMachineDialogOpen(false);
setEditingMachine(null);
setMachineDraft(emptyMachine(draft.mode));
};
const validateMachineSSH = async () => {
@@ -1250,7 +1279,7 @@ export function Settings() {
jellyseerr_url: machine.jellyseerr_url,
jellyseerr_api_key: "",
notes: machine.notes,
});
}, machine);
}}
/>
</Box>
@@ -1376,7 +1405,7 @@ export function Settings() {
jellyseerr_url: selectedMachine.jellyseerr_url,
jellyseerr_api_key: "",
notes: selectedMachine.notes,
})
}, selectedMachine)
}
>
Edit
@@ -1425,6 +1454,7 @@ export function Settings() {
}
machine={machineDraft}
sshKeys={sshKeys}
editingMachine={editingMachine}
onChange={updateMachineDraft}
onValidateSSH={validateMachineSSH}
isValidatingSSH={testMachineSSH.isPending}