douyinWEB/scripts/_remote_fix_opsneko_chrome.py
2026-09-13 22:10:49 -05:00

23 lines
731 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Run on physical: rewrite ops compose + force recreate with Chrome env."""
from __future__ import annotations
import sys
sys.path.insert(0, "/opt/douyinWEB/backend")
from app import ops_neko
from app import ops_neko_db
max_slot = max(ops_neko_db.max_slot(), 1)
text = ops_neko._render_compose(max_slot)
ops_neko._compose_path().write_text(text, encoding="utf-8")
print("ENV_USER", "ENV_USER" in text)
print("LIVE_OPS", "NEKO_LIVE_OPS_EXTENSION" in text)
print("\n".join(text.splitlines()[:60]))
was = {i for i in range(1, max_slot + 1) if ops_neko._container_running(i)}
was.add(1)
print("resume", sorted(was))
print(ops_neko.sync_compose(start_slots=was, force_recreate=True))