등록 화면: 작품 수정(사진 재배치·삭제·추가, 항목 편집, 저장/배포) + 배포 시 재빌드
This commit is contained in:
1 parent
f2ae889795
commit
a6835e943a
4 files changed
+372
-15
No files matched your search
+19
-1
@@ -40,6 +40,7 @@ DEFAULT_MOBILE = os.environ.get("TEAMAT_DEFAULT_PAGE", "").strip().lower() in ("
|
||||
TOKEN_FILE = Path(os.environ.get("TEAMAT_CONFIG_DIR") or (Path.home() / ".config" / "teamat-studio")) / "token"
|
||||
|
||||
import register as reg # 휴대폰 등록 흐름(사진 인박스·판독·발행)
|
||||
import update as upd # 등록된 작품 고치기
|
||||
|
||||
LIST_KEYS = {"gallery"}
|
||||
|
||||
@@ -817,6 +818,19 @@ class Handler(BaseHTTPRequestHandler):
|
||||
except RuntimeError as error:
|
||||
self.send_json({"ok": False, "error": str(error)}, 502)
|
||||
return
|
||||
if path == "/api/update":
|
||||
helpers = {"build": build, "git_commit": git_commit, "deploy": deploy, "push": push}
|
||||
try:
|
||||
result = upd.update_product(self.read_json(), helpers)
|
||||
result["live_url"] = SITE_URL + str(result.get("url") or "")
|
||||
self.send_json(result)
|
||||
except FileNotFoundError as error:
|
||||
self.send_json({"ok": False, "error": str(error)}, 404)
|
||||
except ValueError as error:
|
||||
self.send_json({"ok": False, "error": str(error)}, 400)
|
||||
except RuntimeError as error:
|
||||
self.send_json({"ok": False, "error": str(error)}, 500)
|
||||
return
|
||||
if path == "/api/deploy":
|
||||
payload = self.read_json()
|
||||
drafts = reg.pending_drafts()
|
||||
@@ -824,8 +838,12 @@ class Handler(BaseHTTPRequestHandler):
|
||||
self.send_json({"ok": False, "needs_force": True, "drafts": drafts,
|
||||
"error": "커밋하지 않은 초안이 있어 배포를 멈췄습니다: " + ", ".join(drafts)}, 409)
|
||||
return
|
||||
built, build_log = build()
|
||||
if not built:
|
||||
self.send_json({"ok": False, "log": build_log[-500:]}, 500)
|
||||
return
|
||||
ok, log = deploy()
|
||||
self.send_json({"ok": ok, "log": log[-500:], "head": head_sha()})
|
||||
self.send_json({"ok": ok, "log": (build_log.splitlines()[0] + " · " + log)[-500:], "head": head_sha()})
|
||||
return
|
||||
if path == "/api/publish":
|
||||
helpers = {"build": build, "git_commit": git_commit, "deploy": deploy, "push": push}
|
||||
|
||||
Reference in new issue
Block a user