diff --git a/app.py b/app.py
index 59c3933..8f74e31 100644
--- a/app.py
+++ b/app.py
@@ -908,8 +908,28 @@ def delete_remote(tid):
def test_remote(tid):
- r = _rclone('lsd', f'{_remote_name(tid)}:', timeout=20)
- return r.returncode == 0, r.stderr.strip()
+ remote = _remote_name(tid)
+ # 1. Verbindung prüfen (Verzeichnis auflisten)
+ r = _rclone('lsd', f'{remote}:', timeout=20)
+ if r.returncode != 0:
+ err = r.stderr.strip().splitlines()[-1] if r.stderr.strip() else 'Verbindung fehlgeschlagen'
+ return False, f'Verbindung: {err}'
+ # 2. Schreibzugriff prüfen (Test-Datei schreiben und löschen)
+ test_file = f'{remote}:picopy_writetest_{int(time.time())}.tmp'
+ import tempfile, os as _os
+ with tempfile.NamedTemporaryFile(mode='w', suffix='.tmp', delete=False) as tf:
+ tf.write('PiCopy write test')
+ tmp_path = tf.name
+ try:
+ rw = _rclone('copyto', tmp_path, test_file, timeout=20)
+ if rw.returncode != 0:
+ err = rw.stderr.strip().splitlines()[-1] if rw.stderr.strip() else 'Schreiben fehlgeschlagen'
+ return False, f'Kein Schreibzugriff: {err}'
+ _rclone('deletefile', test_file, timeout=10)
+ finally:
+ try: _os.unlink(tmp_path)
+ except Exception: pass
+ return True, ''
def run_uploads(local_dir: Path, cfg: dict):
@@ -2234,10 +2254,11 @@ function renderUTs(){
SMB/NAS | ${t.dest_path}
-
+
+
`).join('');
}
function utToggleForm(){
@@ -2274,13 +2295,25 @@ async function utSave(){
flash('ut-form-flash','ok','Speichere...');
const r=await api('/upload/targets','POST',body);
if(r.error){flash('ut-form-flash','err',r.error);return;}
+ flash('ut-form-flash','ok','Teste Verbindung...');
const t=await api('/upload/targets/'+r.id+'/test','POST');
- if(t.ok){flash('ut-form-flash','ok','✓ Verbindung OK!');utToggleForm();await loadUTs();}
- else flash('ut-form-flash','err','Test fehlgeschlagen: '+t.error);
+ if(t.ok){flash('ut-form-flash','ok','✓ Verbindung OK - Lesen & Schreiben erfolgreich');utToggleForm();await loadUTs();}
+ else flash('ut-form-flash','err','✗ ' + (t.error||'Test fehlgeschlagen'));
}
-async function utTest(id,name){
+async function utTest(id){
+ const btn=$('ut-test-'+id), res=$('ut-test-result-'+id);
+ btn.disabled=true; btn.textContent='Teste...';
+ res.style.display='none';
const r=await api('/upload/targets/'+id+'/test','POST');
- alert(r.ok?'✓ Verbindung zu "'+name+'" erfolgreich!':'✗ Fehler: '+r.error);
+ btn.disabled=false; btn.innerHTML='🔍 Test';
+ res.style.display='block';
+ if(r.ok){
+ res.style.background='rgba(52,211,153,.12)'; res.style.color='var(--grn)';
+ res.textContent='✓ Verbindung OK - Lesen & Schreiben erfolgreich';
+ } else {
+ res.style.background='rgba(248,113,113,.1)'; res.style.color='var(--red)';
+ res.textContent='✗ ' + (r.error||'Test fehlgeschlagen');
+ }
}
async function utToggle(id){await api('/upload/targets/'+id+'/toggle','POST');await loadUTs();}
async function utDel(id,name){
diff --git a/version.txt b/version.txt
index 08a69b5..c1cf2f9 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-1.0.32
\ No newline at end of file
+1.0.33
\ No newline at end of file