feat: SMB-Zielpfadverarbeitung verbessert und Versionsnummer auf 1.0.47 erhöht
This commit is contained in:
26
app.py
26
app.py
@@ -899,33 +899,37 @@ def _remote_name(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:
|
||||
"""Baut ein rclone-Ziel fuer gespeicherte SMB-Targets.
|
||||
|
||||
Gespeicherte Ziele werden als benannte rclone-Remotes angelegt. Diese
|
||||
Remote-Konfiguration ist die kanonische Quelle fuer Host, Share und Login;
|
||||
der Inline-String bleibt nur als Fallback fuer unvollstaendige Legacy-Eintraege.
|
||||
Bei rclone SMB ist die Freigabe der erste Pfadteil nach dem Remote:
|
||||
remote:share/ordner. Die Remote-Konfiguration enthaelt Host und Login.
|
||||
"""
|
||||
share = t.get('smb_share', '')
|
||||
remote_path = _join_remote_path(share, path)
|
||||
if t.get('id'):
|
||||
return f'{_remote_name(t["id"])}:{path}'
|
||||
return f'{_remote_name(t["id"])}:{remote_path}'
|
||||
|
||||
host = t.get('smb_host', '')
|
||||
share = t.get('smb_share', '')
|
||||
if not host or not share:
|
||||
return f':{path}'
|
||||
conn = f':smb,host={host},share={share}'
|
||||
if not host:
|
||||
return f':{remote_path}'
|
||||
conn = f':smb,host={host}'
|
||||
if t.get('smb_user'):
|
||||
conn += f',user={t["smb_user"]}'
|
||||
if t.get('smb_pass'):
|
||||
conn += f',pass={t["smb_pass"]}'
|
||||
conn += f':{path}'
|
||||
conn += f':{remote_path}'
|
||||
return conn
|
||||
|
||||
|
||||
def configure_smb_remote(tid, host, share, user, pw):
|
||||
rn = _remote_name(tid)
|
||||
_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:
|
||||
args += [f'user={user}']
|
||||
if pw:
|
||||
@@ -2380,7 +2384,7 @@ function renderUTs(){
|
||||
<span class="ut-ico">🖧</span>
|
||||
<div style="flex:1;min-width:0">
|
||||
<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 class="ut-acts">
|
||||
<button class="btn sm ghost" id="ut-test-${t.id}" onclick="utTest('${t.id}')">🔍 Test</button>
|
||||
|
||||
Reference in New Issue
Block a user