stock.exdev.co.kr로 접속 url 변경

This commit is contained in:
Macbook
2026-06-17 10:00:34 +09:00
parent 58cf1e1ec7
commit 37533764ee
46 changed files with 354 additions and 75 deletions
+66
View File
@@ -0,0 +1,66 @@
#!/usr/bin/env bash
# Desktop updater latest.json — HTTPS·HTTP 무결성 (Caddy 역프록시 빈 응답 감지)
set -euo pipefail
BASE_URL="${DESKTOP_UPDATE_BASE_URL:-https://stock.exdev.co.kr/desktop/updates}"
BASE_URL="${BASE_URL%/}"
HTTPS_URL="${DESKTOP_PUBLISHED_LATEST_URL:-${BASE_URL}/latest.json}"
HTTP_URL="$(printf '%s' "$HTTPS_URL" | sed 's|^https://|http://|')"
log() { echo "[verify-updater-endpoint] $*"; }
warn() { log "WARN: $*"; }
fail() { log "FAIL: $*"; exit 1; }
fetch_body() {
local url="$1"
curl -sf --connect-timeout 8 --max-time 15 "$url" 2>/dev/null || true
}
parse_manifest() {
local body="$1"
printf '%s' "$body" | node -e "
let d=''; process.stdin.on('data',c=>d+=c);
process.stdin.on('end',()=>{
try {
const j=JSON.parse(d);
const n=Object.keys(j.platforms||{}).length;
console.log((j.version||'')+' '+n);
} catch { console.log('PARSE_ERR 0'); }
});
" 2>/dev/null || echo "PARSE_ERR 0"
}
log "HTTPS → $HTTPS_URL"
log "HTTP → $HTTP_URL"
HTTPS_BODY="$(fetch_body "$HTTPS_URL")"
HTTP_BODY="$(fetch_body "$HTTP_URL")"
HTTPS_SIZE="${#HTTPS_BODY}"
HTTP_SIZE="${#HTTP_BODY}"
log "HTTPS size=${HTTPS_SIZE}B HTTP size=${HTTP_SIZE}B"
if [[ "$HTTPS_SIZE" -lt 8 && "$HTTP_SIZE" -ge 8 ]]; then
read -r HTTP_VER HTTP_PLAT <<< "$(parse_manifest "$HTTP_BODY")"
fail "HTTPS latest.json 이 비어 있습니다 (${HTTPS_SIZE}B). HTTP는 v${HTTP_VER} (${HTTP_SIZE}B, platforms=${HTTP_PLAT}) — Caddy(443) → gc-frontend:80 역프록시를 점검하세요."
fi
if [[ "$HTTPS_SIZE" -lt 8 && "$HTTP_SIZE" -lt 8 ]]; then
fail "latest.json 이 HTTPS·HTTP 모두 비어 있습니다 — Desktop Jenkins publish 후 scripts/publish-desktop-update.sh 실행 필요"
fi
BODY="$HTTPS_BODY"
[[ "$HTTPS_SIZE" -lt 8 ]] && BODY="$HTTP_BODY"
read -r VER PLAT <<< "$(parse_manifest "$BODY")"
if [[ "$VER" == "PARSE_ERR" || -z "$VER" ]]; then
fail "latest.json JSON 파싱 실패 (HTTPS ${HTTPS_SIZE}B / HTTP ${HTTP_SIZE}B)"
fi
if [[ "${PLAT:-0}" -eq 0 ]]; then
warn "latest.json v${VER} — platforms 비어 있음 (서명된 updater bundle 없음). 자동 업데이트는 실패할 수 있습니다."
exit 2
fi
log "OK v${VER} platforms=${PLAT} (HTTPS ${HTTPS_SIZE}B)"
exit 0