Bloret Launcher · API Reference

公开 API 文档

本文档以当前网站服务端实现为准,覆盖版本信息、快速下载、插件商店、登录状态、媒体上传、评分与评论回复接口。插件商店部分包含权限、字段校验、审核状态和一键安装协议。

Base URL:当前站点域名JSON UTF-8更新:2026-08-14

通用约定

示例中的 https://launcher.example.com 代表当前部署的站点地址。除 manifest 和安装链接接口外,插件商店接口通常返回统一外层对象:成功时包含 success: true,失败时包含 success: falseerror

认证方式:插件商店的写入接口使用 Bloret PassPort 登录后生成的 HttpOnly 会话 Cookie。浏览器请求会自动携带 Cookie;第三方服务端调用时需要在同一会话中保存 Cookie。本文不展示任何密钥、数据库凭据或生产配置。

启动器信息

GET/api/info

读取当前正式版、测试版、各平台下载地址、提示语和活动信息。无需登录。

curl https://launcher.example.com/api/info

返回字段:latestVersiondescriptionnewVersionDescriptionbetadownloadsBLTipsactivity

GET/api/fastdownload

读取快速下载配置。无需登录。

fetch('/api/fastdownload').then(r => r.json())

返回对象包含 enabledversions 数组;服务端未配置时返回 {"enabled":false,"versions":[]}

登录与会话

GET/apps/auth/login

将浏览器重定向到 Bloret PassPort 授权页。可选参数 return_to 指定登录后返回的站内路径。

GET /apps/auth/login?return_to=%2Fapps%2Fmine
GET/apps/auth/callback

PassPort 授权回调入口。用户同意后携带一次性 codestate,服务端验证成功后写入会话 Cookie 并跳回原页面。该接口由 PassPort 调用,不建议业务代码直接模拟。

GET/apps/api/me

查询当前会话。无需登录也可调用。

{
  "success": true,
  "loggedIn": true,
  "user": { "username": "example", "avatar": "https://...", "admin": false }
}

未登录时返回 loggedIn: falseuser: null

POST/apps/auth/logout

清除当前会话 Cookie。无需请求体。

curl -X POST -b cookies.txt -c cookies.txt https://launcher.example.com/apps/auth/logout

成功返回 {"success":true}GET /apps/auth/logout 也可用于浏览器跳转退出,退出后回到插件商店。

插件商店 API

插件提交后状态为 pending,管理员审核通过后变为 approved,驳回后为 rejected。未登录访客只能看到已上架插件;作者可查看和修改自己的记录,管理员可查看全部记录。

插件字段

字段类型要求与说明
idstring必填,3–128 个字符,只允许字母、数字、点、下划线、连字符。
namestring必填,插件显示名称。
versionstring必填,插件版本号。
authorstring可选,展示用作者名;提交者账号由会话确定。
description / longDescriptionstring简短描述和详细描述。
downloadstring必填,必须是 HTTPS ZIP 直链。
sha256string可选,必须是 64 位小写或大写十六进制 SHA-256 值。
urlstring可选,必须是 HTTPS 主页链接。
iconstring可选,HTTPS 图片链接或站内绝对路径。
permissions / tagsstring[] 或 string权限和标签;字符串可用逗号、中文逗号或空格分隔。
screenshotsarray最多 8 张,元素可为 URL 字符串或 {url,webpUrl};链接必须是 HTTPS 或站内路径。
GET/apps/api/plugins

列出当前调用者可见的插件。

查询参数说明
q按 id、名称、作者、简介或标签模糊搜索。
tag按标签精确筛选,不区分大小写。
sortupdated(默认)、ratinginstalls
public=1只返回已上架插件。
scope=mine需要登录,只返回当前用户提交的插件。
scope=admin需要管理员权限,返回全部插件。
statuspendingapprovedrejected 筛选;管理员和对应作者可查看非公开记录。
curl 'https://launcher.example.com/apps/api/plugins?q=shader&sort=rating'

{
  "success": true,
  "plugins": [{
    "id": "example.shader", "name": "Example Shader", "version": "1.2.0",
    "author": "Example Team", "description": "...", "download": "https://.../plugin.zip",
    "permissions": ["minecraft:read"], "tags": ["shader"], "status": "approved",
    "installCount": 12, "ratingAvg": 4.5, "ratingCount": 2, "featured": false
  }]
}
GET/apps/api/plugins/:id

读取插件详情。已上架插件公开;待审核或已驳回插件仅对作者和管理员可见。添加 ?include=related?related=1 时返回最多 6 个相关插件。

GET/apps/api/plugins/:id/manifest.json

返回给启动器使用的精简清单,仅限已上架插件,允许跨域。

{ "name": "Example Shader", "master": "Example Team", "download": "https://.../plugin.zip", "version": "1.2.0" }
POST/apps/api/plugins

提交插件,需要登录。Content-Type 为 application/json。新插件进入 pending 状态。

curl -X POST -b cookies.txt https://launcher.example.com/apps/api/plugins \
  -H 'Content-Type: application/json' \
  -d '{
    "id":"example.shader", "name":"Example Shader", "version":"1.2.0",
    "author":"Example Team", "description":"一个示例插件",
    "download":"https://downloads.example.com/example-shader-1.2.0.zip",
    "sha256":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
    "permissions":["minecraft:read"], "tags":["shader"]
  }'
PATCH/apps/api/plugins/:id

修改插件,需要登录。作者可修改自己的插件;管理员可修改任意插件并设置 featured。已上架插件由作者修改时会生成待审核更新,不会立即覆盖线上版本。

PATCH /apps/api/plugins/example.shader
Content-Type: application/json

{ "version":"1.2.1", "description":"修复加载问题" }
POST/apps/api/plugins/:id/review

审核插件,仅管理员可用。请求体中的 action 必须为 approvereject;驳回时可传 reason

{ "action": "approve" }

{ "action": "reject", "reason": "下载地址无法访问" }
POST/apps/api/plugins/:id/install-click

记录一次安装点击,无需登录。仅已上架插件可计数。

{ "success": true, "installCount": 13 }
GET/apps/api/plugins/:id/install-link

生成启动器一键安装数据,无需登录,仅限已上架插件。返回自定义协议链接、下载地址、SHA-256 和本地启动器 propose 请求体。

{
  "success": true,
  "install_url": "bloret://plugin/install?download=https%3A%2F%2F...&id=example.shader&source=store",
  "download": "https://downloads.example.com/example-shader-1.2.0.zip",
  "sha256": "...",
  "propose": { "download":"https://...", "id":"example.shader", "source":"store" }
}

媒体上传

POST/apps/api/media/upload

需要登录,使用 multipart/form-data 上传一个名为 image 的图片文件。支持 JPG、PNG、GIF、WebP,单文件最大 8 MiB。接口会转发到配置的图床并返回绝对 URL。

curl -X POST -b cookies.txt https://launcher.example.com/apps/api/media/upload \
  -F 'image=@./screenshot.png'

{ "success": true, "data": {
  "url": "https://img.bloret.net/...",
  "webpUrl": "https://img.bloret.net/...webp",
  "timestamp": 1710000000, "md5": "...", "filename": "screenshot.png"
} }

评分与评论回复

GET/apps/api/plugins/:id/ratings

读取已可见插件的评分统计和分页评论。可选查询参数 limit(1–50,默认 20)与 offset(默认 0)。登录用户会额外得到 myRating

{ "success":true, "avg":4.5, "count":2, "distribution":{"1":0,"2":0,"3":0,"4":1,"5":1}, "ratings":[], "limit":20, "offset":0, "myRating":null }
PUT/apps/api/plugins/:id/ratings

需要登录,为已上架插件新增或更新当前用户评分。stars 必须是 1–5 的整数,comment 最多 500 字。

{ "stars": 5, "comment": "安装简单,运行稳定。" }
DELETE/apps/api/plugins/:id/ratings

需要登录,删除当前用户对该插件的评分。

POST/apps/api/plugins/:id/ratings/:ratingUser/replies

需要登录,回复指定用户的评论。请求体可使用 body 或兼容字段 comment,最多 500 字。

{ "body": "感谢反馈,我们会在下个版本修复。" }
DELETE/apps/api/plugins/:id/ratings/replies/:replyId

需要登录,仅回复作者本人或管理员可以删除回复。

错误与权限

状态码含义常见场景
400请求或字段校验失败缺少字段、URL 不是 HTTPS、stars 不在 1–5、图片类型不支持。
401未登录调用需要登录的提交、修改、评分、上传接口。
403无权限普通用户调用管理员审核接口,或修改他人插件/回复。
404资源不存在或不可见插件不存在、未上架,或当前用户无权查看。
502上游图床失败媒体上传时图床返回错误。
500服务端错误数据库或配置读取异常。
{ "success": false, "error": "需要管理员权限", "code": "FORBIDDEN" }

安全建议:下载地址和插件主页使用 HTTPS;不要把会话 Cookie、PassPort 密钥、数据库密码或任何配置令牌写进前端代码、插件清单或公开文档。