Enable long filename configuration and provide read-only DOS compatibility export

This commit is contained in:
2026-11-28 10:25:40 +00:00
parent ae647ce99a
commit 0dbd5c34bf
16 changed files with 182 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
'use strict';
const $=id=>document.getElementById(id), groups=['1','2','3','4','5','12','13','17','21','45','200'];
const $=id=>document.getElementById(id), groups=['1','2','3','4','5','6','12','13','17','21','45','200'];
let scriptDoc=null, scriptOriginal='', scriptScope='system', scriptName='';
let state=null, mode='guided', checked=null, dirty=false, busy=false, page=0, rawBase='', backupName=null;
function notice(text,kind='ok'){const el=$('notice');el.replaceChildren();if(text){const p=document.createElement('div');p.className='message '+kind;p.textContent=text;el.append(p);}if($('viewDialog').open)$('sheetNotice').textContent=text;}
@@ -11,7 +11,7 @@ async function api(path,body){const options={cache:'no-store',credentials:'same-
async function task(fn){if(busy)return;busy=true;updateControls();try{await fn();}catch(e){notice(e.message,'error');}finally{busy=false;updateControls();}}
function row(parent,values){const tr=document.createElement('tr');values.forEach(v=>{const td=document.createElement('td');td.textContent=v;tr.append(td);});parent.append(tr);}
function option(parent,value,label){const o=document.createElement('option');o.value=value;o.textContent=label;parent.append(o);}
function apply(s){state=s;$('defaultWarning').hidden=!s.defaultPassword;mode='guided';rawBase='';backupName=null;for(const k of groups)$('g'+k).value=s.groups[k].join('\n');$('raw').value='';$('rawArea').hidden=true;$('superPassword').value='';$('unixUser').value='';$('configPath').textContent=s.path;$('configStatus').textContent=s.validation.errors.length?'Einrichtung nötig':'Grundprüfung OK';$('deviceCount').textContent=s.devices.length;$('devices').replaceChildren();$('newDevice').replaceChildren();for(const d of s.devices){row($('devices'),[d.name,d.mac,d.state]);option($('newDevice'),d.name,d.name+' · '+d.state);}if(!s.devices.length)row($('devices'),['Kein geeignetes Interface','–','–']);$('backups').replaceChildren();for(const b of s.backups)option($('backups'),b,b);$('restore').disabled=!s.backups.length;$('serviceHint').textContent=s.services?'Aktionen werden erst nach einer Bestätigung ausgeführt.':'Dienststeuerung deaktiviert (Standardkennwort oder --no-services).';mark(false);}
function apply(s){state=s;$('defaultWarning').hidden=!s.defaultPassword;mode='guided';rawBase='';backupName=null;for(const k of groups)$('g'+k).value=(s.groups[k]||[]).join('\n');$('raw').value='';$('rawArea').hidden=true;$('superPassword').value='';$('unixUser').value='';$('configPath').textContent=s.path;$('configStatus').textContent=s.validation.errors.length?'Einrichtung nötig':'Grundprüfung OK';$('deviceCount').textContent=s.devices.length;$('devices').replaceChildren();$('newDevice').replaceChildren();for(const d of s.devices){row($('devices'),[d.name,d.mac,d.state]);option($('newDevice'),d.name,d.name+' · '+d.state);}if(!s.devices.length)row($('devices'),['Kein geeignetes Interface','–','–']);$('backups').replaceChildren();for(const b of s.backups)option($('backups'),b,b);$('restore').disabled=!s.backups.length;$('serviceHint').textContent=s.services?'Aktionen werden erst nach einer Bestätigung ausgeführt.':'Dienststeuerung deaktiviert (Standardkennwort oder --no-services).';mark(false);}
async function status(){const s=await api('/api/status');const a=s['mars-nwe-pcap.service']||'Nicht verfügbar';const b=s['mars-pcapd.service']||'Nicht verfügbar';$('statusText').textContent='MARS NWE\n'+a+'\n\nPCAP\n'+b;$('serverStatus').textContent=a.match(/^ActiveState=(.*)$/m)?.[1]||'Nicht verfügbar';$('brokerStatus').textContent='PCAP: '+(b.match(/^ActiveState=(.*)$/m)?.[1]||'unbekannt');}
function rawPayload(){const value=$('raw').value;const normalized=rawBase.replace(/\r\n|\r/g,'\n');if(value===normalized){if(backupName)return {revision:state.revision,mode:'backup',name:backupName};return {revision:state.revision,mode:'raw',text:rawBase};}const text=rawBase.includes('\r\n')&&!rawBase.replace(/\r\n/g,'').includes('\n')?value.replace(/\n/g,'\r\n'):value;return {revision:state.revision,mode:'raw',text};}
function payload(){if(mode==='raw')return rawPayload();return {revision:state.revision,mode,groups:Object.fromEntries(groups.map(k=>[k,$('g'+k).value.split('\n').filter(x=>x.trim())]))};}
@@ -155,3 +155,17 @@ async function driverState(){const d=await api('/api/drivers');document.querySel
$('gwWinClients').onclick=()=>{ $('winClientDialog').showModal();driverState().catch(e=>$('driverStatus').textContent=e.message);};
$('activateDrivers').onclick=async()=>{const b=$('activateDrivers');b.disabled=true;try{const platforms=Array.from(document.querySelectorAll('[name=driverOS]:checked'),el=>el.value);if(!platforms.length)throw Error('Mindestens ein Betriebssystem wählen.');await api('/api/drivers/activate',{confirm:true,platforms});await driverState();}catch(e){$('driverStatus').textContent=e.message;}finally{b.disabled=false;}};
$('winClientClose').onclick=()=> $('winClientDialog').close();
$('enableLFN').onclick=()=>guided(()=>{
const lines=$('g1').value.split('\n').filter(x=>x.trim()).map(line=>{
const hash=line.indexOf('#'),comment=hash>=0?line.slice(hash):'';
const fields=(hash>=0?line.slice(0,hash):line).trim().split(/\s+/);
if(fields.length<2)throw Error('Volume-Eintrag unvollständig.');
let flags=(fields[2]||'').replace(/[-k]/g,'');
if(!flags.includes('i'))flags+='i';if(!flags.includes('O'))flags+='O';fields[2]=flags;
return fields.join(' ')+(comment?' '+comment:'');
});
$('g1').value=lines.join('\n');
const version=$('g6').value.trim().split(/\s+/);if(!['1','2'].includes(version[0]))version[0]='2';
$('g6').value=version.join(' ');mark();notice('LFN-Entwurf vorbereitet. Vorschau prüfen, speichern und Dateiserver neu starten. DOS-Programme benötigen weiterhin 8.3-Namen.');
});