Compare commits
3 Commits
75ced3fa0e
...
54ed2e08e7
| Author | SHA1 | Date | |
|---|---|---|---|
| 54ed2e08e7 | |||
| aa67b9ee17 | |||
| fed6a35e59 |
|
|
@ -169,7 +169,7 @@ export default function IECPage({ config, setConfig }: IECPageProps) {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<h2 className="text-sm text-neutral-500 pt-4 flex items-center gap-2"><List className="w-4 h-4" /> Directory Settings</h2>
|
<h2 className="text-sm text-neutral-500 pt-4 flex items-center gap-2"><List className="w-4 h-4" /> Directory Enhancements</h2>
|
||||||
|
|
||||||
<div className="bg-white border border-neutral-200 rounded-lg divide-y divide-neutral-200">
|
<div className="bg-white border border-neutral-200 rounded-lg divide-y divide-neutral-200">
|
||||||
{Object.entries(iec.directory || {}).map(([key, value]) => (
|
{Object.entries(iec.directory || {}).map(([key, value]) => (
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,20 @@ const SAVED_INDICATOR_MS = 1500;
|
||||||
|
|
||||||
export type SettingsConfig = Record<string, any>;
|
export type SettingsConfig = Record<string, any>;
|
||||||
|
|
||||||
|
/** Try primary path first, fall back to secondary. Returns null if both fail. */
|
||||||
|
async function getTextWithFallback(primary: string, fallback: string): Promise<string | null> {
|
||||||
|
try { return await getFileContents(primary).then(b => b.text()); } catch { /* try fallback */ }
|
||||||
|
try { return await getFileContents(fallback).then(b => b.text()); } catch { /* both failed */ }
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/** Read both config files from the WebDAV server and merge them. Returns null on failure. */
|
/** Read both config files from the WebDAV server and merge them. Returns null on failure. */
|
||||||
export async function readSettings(): Promise<SettingsConfig | null> {
|
export async function readSettings(): Promise<SettingsConfig | null> {
|
||||||
try {
|
try {
|
||||||
|
// Mirror firmware priority: /sd/.sys/ first, fall back to /.sys/
|
||||||
const [configText, devicesText] = await Promise.all([
|
const [configText, devicesText] = await Promise.all([
|
||||||
getFileContents(SETTINGS_PATH).then(b => b.text()),
|
getTextWithFallback('/sd' + SETTINGS_PATH, SETTINGS_PATH),
|
||||||
getFileContents(DEVICES_PATH).then(b => b.text()).catch(() => null),
|
getTextWithFallback('/sd' + DEVICES_PATH, DEVICES_PATH),
|
||||||
]);
|
]);
|
||||||
if (!configText) return null;
|
if (!configText) return null;
|
||||||
const config = JSON.parse(configText);
|
const config = JSON.parse(configText);
|
||||||
|
|
|
||||||
|
|
@ -91,10 +91,11 @@
|
||||||
},
|
},
|
||||||
"directory": {
|
"directory": {
|
||||||
"force_0801": 1,
|
"force_0801": 1,
|
||||||
"nfo_header": 1,
|
|
||||||
"bam_message": 1,
|
"bam_message": 1,
|
||||||
"hidden_files": 1,
|
"nfo_header": 1,
|
||||||
"hidden_dirs": 1,
|
"hidden_dirs": 1,
|
||||||
|
"hidden_files": 1,
|
||||||
|
"extension_colon": 1,
|
||||||
"date_time": 1,
|
"date_time": 1,
|
||||||
"load_address": 1,
|
"load_address": 1,
|
||||||
"sys_address": 1,
|
"sys_address": 1,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user