9141817867
gates / gates (push) Successful in 24s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
16 lines
967 B
Python
16 lines
967 B
Python
"""ncfile.py put|ls <name> — a file through Nextcloud's OWN WebDAV as the seeded user (front door)."""
|
|
import json, sys, subprocess, re
|
|
import walk as w
|
|
t = json.load(open(w.SC + "/seed-tokens.json"))["nextcloud"]
|
|
mode, name = sys.argv[1], sys.argv[2]
|
|
base = f"https://192.168.0.114/remote.php/dav/files/{t['uid']}/"
|
|
a = ["curl", "-sk", "-u", f"{t['uid']}:{t['pw']}", "-H", "Host: c-nc.enkisfelhom.hu", "-w", "\n%{http_code}"]
|
|
if mode == "put":
|
|
r = subprocess.run(a + ["-X", "PUT", "--data-binary", f"E1 {name}", base + name], capture_output=True, text=True)
|
|
w.say(f"PUT {name} -> {r.stdout.strip().splitlines()[-1]}")
|
|
else:
|
|
r = subprocess.run(a + ["-X", "PROPFIND", "-H", "Depth: 1", base], capture_output=True, text=True)
|
|
code = r.stdout.strip().splitlines()[-1]
|
|
names = sorted(set(re.findall(r"<d:href>[^<]*/([^/<]+)</d:href>", r.stdout)))
|
|
w.say(f"PROPFIND files of {t['uid']} -> {code}; {name} visible={name in names}; listing={names}")
|