# servicehub **Repository Path**: belowthetree/servicehub ## Basic Information - **Project Name**: servicehub - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-24 - **Last Updated**: 2026-07-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ServiceHub — Amiba 远程服务仓库 本目录是 Amiba 的远程服务仓库,托管于 [Gitee](https://gitee.com/belowthetree/servicehub)。Amiba 客户端通过仓库的 `index.json` 索引文件发现、浏览和安装服务。 ## 目录结构 ``` servicehub/ ├── index.json # 根索引(必须) ├── README.md # 本文件 ├── user.pet_world/ # 服务目录(以服务 ID 命名) │ ├── manifest.json # 服务清单(必须) │ ├── index.html # 入口文件(必须) │ ├── style.css │ ├── app.js │ └── ... ├── user.xxx/ # 其他服务... └── games/ # 可选:分类文件夹 ├── index.json # 子目录索引 └── user.snake_game/ └── ... ``` ## 如何添加新服务 ### 1. 创建服务目录 以服务 ID 为目录名(如 `user.my_app`),放入服务文件。**至少需要两个文件:** | 文件 | 说明 | |------|------| | `manifest.json` | 服务清单,定义 id/name/version/description/permissions | | `index.html` | 服务入口页面 | `manifest.json` 示例: ```json { "id": "user.my_app", "name": "我的应用", "version": "1.0.0", "description": "一个很棒的服务", "permissions": ["storage", "notification"] } ``` ### 2. 更新 index.json 在对应目录的 `index.json` 中注册新服务。找到 `services` 数组,添加一项: ```json { "id": "user.my_app", "files": [ "manifest.json", "index.html", "style.css", "app.js" ] } ``` > `files` 数组列出了消费者需要下载的所有文件(包含子目录中的文件,如 `components/foo.js`)。 ### 3. 提交到仓库 将新增/修改的文件 push 到 Gitee 仓库的 `master` 分支即可。 --- ## index.json 格式 ### 完整格式 ```json { "name": "ServiceHub", "services": [ { "id": "user.pet_world", "files": ["manifest.json", "index.html", "style.css", "app.js"] } ], "folders": [ { "name": "游戏", "path": "games", "description": "游戏类服务" } ] } ``` | 字段 | 类型 | 必填 | 说明 | |------|------|------|------| | `name` | string | 否 | 当前目录的显示名称,根目录建议填写 | | `services` | array | 是 | 当前目录下的服务列表 | | `services[].id` | string | 是 | 服务唯一标识,与目录名一致 | | `services[].files` | string[] | 是 | 需要下载的所有文件列表(相对路径) | | `folders` | array | 否 | 子文件夹列表,用于多级分类 | | `folders[].name` | string | 是 | 文件夹显示名称 | | `folders[].path` | string | 是 | 子目录路径(相对于当前 index.json) | | `folders[].description` | string | 否 | 文件夹描述 | ### 向后兼容 不含 `name` 和 `folders` 字段的旧格式 `index.json` 仍然受支持: ```json { "services": [...] } ``` --- ## 多级目录 每个文件夹都可以包含自己的 `index.json`,格式与根索引完全相同。这意味着你可以递归嵌套任意层级,例如: ``` servicehub/ ├── index.json → { folders: [{ path: "tools" }, { path: "games" }] } ├── tools/ │ ├── index.json → { services: [...], folders: [...] } │ └── ... └── games/ ├── index.json → { services: [...], folders: [{ path: "puzzle" }] } └── puzzle/ ├── index.json → { services: [...] } └── ... ``` 客户端会展示面包屑导航,用户可以逐级深入浏览。