82eef7b7cf
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
21 lines
1.4 KiB
Python
21 lines
1.4 KiB
Python
import re, os, time, urllib.parse
|
|
import walk as w
|
|
OUT = open(f"{w.EV}/G/T1-teardown-9202.txt", "w", buffering=1)
|
|
def say(*a):
|
|
w.say(*a); OUT.write(" ".join(map(str, a)) + "\n")
|
|
w.login()
|
|
for app in ("docmost", "nextcloud"):
|
|
code = w.remove(app); say(f"remove {app} -> {code}")
|
|
sess = open(f"{w.SC}/sess{os.getpid()}.txt").read().strip(); csrf = open(f"{w.SC}/csrf{os.getpid()}.txt").read().strip()
|
|
h = w.page("/kept-data")
|
|
items = re.findall(r'name="path" value="([^"]+)"', h)
|
|
say("kept items before:", sorted(set(items)))
|
|
for p in sorted(set(items)):
|
|
if "/nextcloud" not in p and "/docmost" not in p:
|
|
continue # only what THIS session made; the older leftovers stay as they were found
|
|
r = w.sh(["curl", "-sk", "-D", "-", "-o", "/dev/null", "-H", w.HOSTHDR, "-H", f"Cookie: {sess}", "-X", "POST",
|
|
"--data-urlencode", f"_csrf={csrf}", "--data-urlencode", f"path={p}", "--data-urlencode", "confirm=Nextcloud", f"{w.BASE}/kept-data/delete"])
|
|
loc = re.search(r"(?im)^location:\s*(\S+)", r.stdout or ""); say("delete", p, "->", urllib.parse.unquote(loc.group(1) if loc else "?")[:160])
|
|
say("kept items after:", sorted(set(re.findall(r'name="path" value="([^"]+)"', w.page("/kept-data")))))
|
|
say("left on 9202:", w.guest("docker ps -a --format '{{.Names}}' | grep -iE 'docmost|nextcloud'; docker volume ls -q | grep -iE 'docmost|nextcloud'; ls /mnt/felhom-drives/scratch_hdd/kept 2>&1; ls /mnt/felhom-drives/scratch_hdd/appdata"))
|