← ver.4y4.app

クライアント実装ガイド

GET /api/{製品番号}/version.jsonを呼び出して、手元のビルドが最新かどうかを判定します。認証不要、Cache-Control: public, max-age=60。

レスポンス

{
  "latest_version": "2.1.0",
  "download_url": "https://example.com/app-2.1.0.exe",
  "min_required_version": "1.5.0",
  "is_force_update": false,
  "release_notes": "・新機能の追加\n・不具合修正",
  "release_date": "2026-08-01T10:00:00Z",
  "file_size_bytes": 45120000,
  "checksum": { "algorithm": "sha256", "hash": "..." }
}

複数プラットフォーム

1つのバージョンが複数の配布ファイルを持つ場合、platforms 配列が追加されます。既存の download_url は変わりません — 代表の1件を指し続けるので、この配列を知らないクライアントはそのまま動作します。

{
  "latest_version": "2.1.0",
  "download_url": "https://example.com/app-2.1.0.exe",   // ← 代表。従来どおり
  "is_force_update": false,
  "platforms": [
    { "os": "windows", "arch": "x64", "label": "Windows (64-bit)",
      "download_url": "https://example.com/app-2.1.0.exe",
      "file_size_bytes": 45120000,
      "checksum": { "algorithm": "sha256", "hash": "..." } },
    { "os": "macos", "arch": "universal", "label": "macOS (Universal)",
      "download_url": "https://example.com/app-2.1.0.dmg" }
  ]
}

ダウンロードページ

製品ごとに /r/{アカウント}/{製品} のダウンロードページを公開できます (管理画面で「公開する」にチェック)。同じ内容は/r/{アカウント}/{製品}.json でも取得できるので、自前のサイトから 説明文・アイコン・ダウンロードリンクを読み込んで描画することもできます。

こちらは人間とサイト構築者向けで、上の version.json とは別物です。 アプリからの更新確認には必ず version.json を使ってください (説明文や画像URLを含まないぶん軽く、契約として安定しています)。

実装の要点

curl

curl https://ver.4y4.app/api/00000001/version.json

Python

import requests
from packaging.version import Version

CURRENT_VERSION = "2.0.0"

def check_update():
    try:
        res = requests.get(
            "https://ver.4y4.app/api/00000001/version.json", timeout=5
        )
        res.raise_for_status()
        data = res.json()
    except requests.RequestException:
        # 取得失敗はブロックしない。現在のビルドで動作を継続する。
        return None

    latest = data.get("latest_version")
    if not latest:
        return None

    min_required = data.get("min_required_version")
    must_update = data.get("is_force_update", False) or (
        min_required and Version(CURRENT_VERSION) < Version(min_required)
    )

    if Version(CURRENT_VERSION) < Version(latest):
        return {"latest": latest, "must_update": bool(must_update), "data": data}
    return None

製品を登録・公開するには サインイン してください。