관리자 로고 화면과 제작 매뉴얼의 그림 도구 이름 정리, 키 없으면 만들기 칸 숨김

This commit is contained in:
블리어 committed 2026-12-01 02:35:07 +00:00
1 parent 1ab3778bb3
commit 2116ef5607
7 files changed
+29 -22

No files matched your search

+5 -5
View File
@@ -1,6 +1,6 @@
"""로고 그림 관리(관리자 페이지 '로고' 메뉴).
관리자가 올린 그림이나 제미나이로 만든 후보를 골라 홈페이지 로고와 파비콘 및 홈 화면 아이콘을 바꾼다.
관리자가 올린 그림이나 후보 그림을 골라 홈페이지 로고와 파비콘 및 홈 화면 아이콘을 바꾼다.
크기별 PNG는 관리자 브라우저가 만들어 보내고 서버는 PNG 형식과 크기만 확인해 데이터 폴더에 둔다.
바꾼 그림이 없으면 web 폴더의 기본 로고를 그대로 준다. 새 파이썬 패키지는 쓰지 않는다.
@@ -95,12 +95,12 @@ def gemini_image(key, model, prompt):
detail = ""
error.close()
names = {400: "요청 형식 또는 모델", 401: "키", 403: "키 권한", 404: "모델 이름", 429: "사용 한도"}
last = "제미나이 오류 " + str(error.code) + " (" + names.get(error.code, "서버") + "): " + detail[:200]
last = "그림 만들기 오류 " + str(error.code) + " (" + names.get(error.code, "서버") + "): " + detail[:200]
if error.code == 400 and index == 0:
continue
raise RuntimeError(last)
except (urllib.error.URLError, TimeoutError, ValueError) as error:
raise RuntimeError("제미나이에 연결하지 못했습니다: " + str(error)[:150])
raise RuntimeError("그림 만들기 서버에 연결하지 못했습니다: " + str(error)[:150])
texts = []
for candidate in data.get("candidates", []):
for part in candidate.get("content", {}).get("parts", []):
@@ -213,7 +213,7 @@ def setup(app, prefix, root, data_dir, db, administrator, payload, throttle):
temp = brand / "logo.json.tmp"
temp.write_text(json.dumps(meta, ensure_ascii=False))
temp.replace(brand / "logo.json")
log(actor["member"], "logo", "올린 그림" if source == "upload" else "제미나이 후보 " + str(candidate))
log(actor["member"], "logo", "올린 그림" if source == "upload" else "후보 " + str(candidate))
return {"custom": meta}
@app.post(prefix + "/api/admin/brand-logo-reset")
@@ -272,7 +272,7 @@ def setup(app, prefix, root, data_dir, db, administrator, payload, throttle):
if type(count) is not int or not 1 <= count <= 4:
raise HTTPException(400, "한 번에 1~4장까지 만들 수 있습니다.")
if not gemini_key():
raise HTTPException(409, "제미나이 키가 아직 설정되지 않았습니다. 보조 서버에서 duty-gemini-key.sh로 키를 넣어 주세요.")
raise HTTPException(409, "그림 만들기 키가 아직 설정되지 않았습니다.")
with job_lock:
if any(job["state"] == "running" for job in jobs.values()):
raise HTTPException(409, "이미 후보를 만들고 있습니다. 끝난 뒤 다시 눌러 주세요.")