feat: SMB-Zielpfadverarbeitung verbessert und Versionsnummer auf 1.0.47 erhöht

This commit is contained in:
2026-05-09 13:56:24 +02:00
parent c4501b381f
commit 5ecea9fc21
2 changed files with 16 additions and 12 deletions

26
app.py
View File

@@ -899,33 +899,37 @@ def _remote_name(tid):
return f'picopy_{tid}' return f'picopy_{tid}'
def _join_remote_path(*parts) -> str:
return '/'.join(str(p).strip('/') for p in parts if str(p).strip('/'))
def _smb_conn(t: dict, path: str = '') -> str: def _smb_conn(t: dict, path: str = '') -> str:
"""Baut ein rclone-Ziel fuer gespeicherte SMB-Targets. """Baut ein rclone-Ziel fuer gespeicherte SMB-Targets.
Gespeicherte Ziele werden als benannte rclone-Remotes angelegt. Diese Bei rclone SMB ist die Freigabe der erste Pfadteil nach dem Remote:
Remote-Konfiguration ist die kanonische Quelle fuer Host, Share und Login; remote:share/ordner. Die Remote-Konfiguration enthaelt Host und Login.
der Inline-String bleibt nur als Fallback fuer unvollstaendige Legacy-Eintraege.
""" """
share = t.get('smb_share', '')
remote_path = _join_remote_path(share, path)
if t.get('id'): if t.get('id'):
return f'{_remote_name(t["id"])}:{path}' return f'{_remote_name(t["id"])}:{remote_path}'
host = t.get('smb_host', '') host = t.get('smb_host', '')
share = t.get('smb_share', '') if not host:
if not host or not share: return f':{remote_path}'
return f':{path}' conn = f':smb,host={host}'
conn = f':smb,host={host},share={share}'
if t.get('smb_user'): if t.get('smb_user'):
conn += f',user={t["smb_user"]}' conn += f',user={t["smb_user"]}'
if t.get('smb_pass'): if t.get('smb_pass'):
conn += f',pass={t["smb_pass"]}' conn += f',pass={t["smb_pass"]}'
conn += f':{path}' conn += f':{remote_path}'
return conn return conn
def configure_smb_remote(tid, host, share, user, pw): def configure_smb_remote(tid, host, share, user, pw):
rn = _remote_name(tid) rn = _remote_name(tid)
_rclone('config', 'delete', rn) _rclone('config', 'delete', rn)
args = ['config', 'create', rn, 'smb', f'host={host}', f'share={share}'] args = ['config', 'create', rn, 'smb', f'host={host}']
if user: if user:
args += [f'user={user}'] args += [f'user={user}']
if pw: if pw:
@@ -2380,7 +2384,7 @@ function renderUTs(){
<span class="ut-ico">🖧</span> <span class="ut-ico">🖧</span>
<div style="flex:1;min-width:0"> <div style="flex:1;min-width:0">
<div class="ut-nm">${t.name}</div> <div class="ut-nm">${t.name}</div>
<div class="ut-meta">SMB/NAS | ${t.dest_path}</div> <div class="ut-meta">SMB/NAS | ${(t.smb_share||'?')}${t.dest_path?'/'+t.dest_path:''}</div>
</div> </div>
<div class="ut-acts"> <div class="ut-acts">
<button class="btn sm ghost" id="ut-test-${t.id}" onclick="utTest('${t.id}')">&#128269; Test</button> <button class="btn sm ghost" id="ut-test-${t.id}" onclick="utTest('${t.id}')">&#128269; Test</button>

View File

@@ -1 +1 @@
1.0.46 1.0.47