31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Desktop ShortsPage: remove global busy disable (UI only)."""
|
|
from pathlib import Path
|
|
import re
|
|
|
|
p = Path(r"c:\Users\admin\Desktop\douyinWEB\desktop\src\pages\ShortsPage.tsx")
|
|
t = p.read_text(encoding="utf-8")
|
|
# Keep busy for spinners if used, but stop disabling all buttons
|
|
t2 = re.sub(r"\s*disabled=\{busy\}", "", t)
|
|
t2 = t2.replace("disabled={busy || ", "disabled={")
|
|
t2 = t2.replace("disabled={busy||", "disabled={")
|
|
# Remove setBusy lock around ops — keep API calls
|
|
t2 = t2.replace(" setBusy(true);\n", "")
|
|
t2 = t2.replace(" setBusy(true);\n", "")
|
|
t2 = t2.replace(" setBusy(true);\n", "")
|
|
t2 = re.sub(
|
|
r"\n(\s*)\} finally \{\n\1 setBusy\(false\);\n\1\}",
|
|
r"\n\1}",
|
|
t2,
|
|
)
|
|
t2 = re.sub(r"\n(\s*)setBusy\(false\);\n", "\n", t2)
|
|
# If busy state unused except spinner, leave state — or replace busy ? spinner with false
|
|
# Check leftover
|
|
p.write_text(t2, encoding="utf-8")
|
|
print("disabled busy", t2.count("disabled={busy}"))
|
|
print("setBusy", t2.count("setBusy"))
|
|
for i, line in enumerate(t2.splitlines(), 1):
|
|
if re.search(r"(?<![\w.])busy(?![\w])", line) and "uploadBusy" not in line and "status?.busy" not in line:
|
|
if "busy=" in line or "{busy" in line or "busy ?" in line or "[busy" in line or "setBusy" in line:
|
|
print(i, line.strip()[:120])
|