feat(MediaManager): add base URL handling for drive and meatloaf devices
This commit is contained in:
parent
0b7dc77e78
commit
df121bd9c3
|
|
@ -1261,9 +1261,9 @@ export default function MediaManager({ initialPath = '/', rootPath, title, confi
|
||||||
{(() => {
|
{(() => {
|
||||||
const drives = Object.entries(config?.iec?.devices?.drive ?? {})
|
const drives = Object.entries(config?.iec?.devices?.drive ?? {})
|
||||||
.filter(([k]) => k !== 'vdrive' && k !== 'rom')
|
.filter(([k]) => k !== 'vdrive' && k !== 'rom')
|
||||||
.map(([k, v]: [string, any]) => ({ type: 'drive' as const, key: k, url: v?.url as string | undefined, enabled: !!v?.enabled }));
|
.map(([k, v]: [string, any]) => ({ type: 'drive' as const, key: k, base_url: v?.base_url as string | undefined, url: v?.url as string | undefined, enabled: !!v?.enabled }));
|
||||||
const meatloafs = Object.entries(config?.iec?.devices?.meatloaf ?? {})
|
const meatloafs = Object.entries(config?.iec?.devices?.meatloaf ?? {})
|
||||||
.map(([k, v]: [string, any]) => ({ type: 'meatloaf' as const, key: k, url: v?.url as string | undefined, enabled: !!v?.enabled }));
|
.map(([k, v]: [string, any]) => ({ type: 'meatloaf' as const, key: k, base_url: v?.base_url as string | undefined, url: v?.url as string | undefined, enabled: !!v?.enabled }));
|
||||||
const devices = [...drives, ...meatloafs];
|
const devices = [...drives, ...meatloafs];
|
||||||
if (!devices.length)
|
if (!devices.length)
|
||||||
return <p className="text-sm text-neutral-500 text-center py-4">No drive devices found in config.</p>;
|
return <p className="text-sm text-neutral-500 text-center py-4">No drive devices found in config.</p>;
|
||||||
|
|
@ -1278,7 +1278,11 @@ export default function MediaManager({ initialPath = '/', rootPath, title, confi
|
||||||
<HardDrive className={`w-5 h-5 flex-shrink-0 ${dev.enabled ? 'text-blue-500' : 'text-neutral-400'}`} />
|
<HardDrive className={`w-5 h-5 flex-shrink-0 ${dev.enabled ? 'text-blue-500' : 'text-neutral-400'}`} />
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<div className="font-medium text-sm">Device #{dev.key}</div>
|
<div className="font-medium text-sm">Device #{dev.key}</div>
|
||||||
{dev.url && <div className="text-xs text-neutral-500 truncate">{dev.url}</div>}
|
{(dev.base_url || dev.url) && (
|
||||||
|
<div className="text-xs text-neutral-500 truncate">
|
||||||
|
{[dev.base_url, dev.url].filter(Boolean).join('')}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{!dev.enabled && <span className="text-xs text-neutral-400 flex-shrink-0">disabled</span>}
|
{!dev.enabled && <span className="text-xs text-neutral-400 flex-shrink-0">disabled</span>}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user