Skip to content

Latest commit

 

History

History
155 lines (120 loc) · 4.1 KB

配置说明.md

File metadata and controls

155 lines (120 loc) · 4.1 KB

配置说明

git_platform 源类型配置

git_platform 字段用于指定软件更新的源类型,支持以下三种值:

1. "github" - GitHub 源(默认)

使用 GitHub 仓库作为更新源。

配置示例:

{
    "git_platform": "github",
    "github_repo": "https://github.com/shellsec/softgitup",
    "git_mirrors": [
        "https://gh-proxy.com/https://raw.githubusercontent.com/shellsec/softgitup"
    ]
}

特点:

  • 从 GitHub 仓库下载文件
  • 支持镜像源(git_mirrors)作为备用
  • 如果镜像源失败,会尝试其他镜像源

2. "gitlab" - GitLab 源

使用 GitLab 仓库作为更新源。

配置示例:

{
    "git_platform": "gitlab",
    "gitlab_repo": "https://gitlab.com/your-username/softgitup"
}

特点:

  • 从 GitLab 仓库下载文件
  • 使用 GitLab 的 raw 文件访问格式
  • 支持镜像源作为备用

3. "remote" - 远程/自定义 URL 源

使用任意 URL 地址的服务器作为更新源。

配置示例:

{
    "git_platform": "remote",
    "remote_server": "http://your-server-url:8000"
}

支持的 URL 格式:

  • http://localhost:8000 - 本地服务器
  • http://127.0.0.1:8000 - 本地服务器(IP形式)
  • http://192.168.1.100:8000 - 局域网服务器
  • http://example.com:8000 - 任意域名服务器
  • https://your-domain.com/software - HTTPS 服务器

特点:

  • 支持任意 HTTP/HTTPS URL 地址
  • 不限于 localhost 或内网 IP
  • 直接使用配置的 URL,不进行 IP 检测
  • 必须配置 local_server 字段,否则会报错
  • 不会自动回退到远程源

配置字段说明

git_platform

  • 类型:字符串
  • 可选值:"github"、"gitlab"、"remote"
  • 默认值:"github"
  • 说明:指定更新源的类型

github_repo

  • 类型:字符串
  • 说明:GitHub 仓库地址(当 git_platform 为 "github" 时使用)

gitlab_repo

  • 类型:字符串
  • 说明:GitLab 仓库地址(当 git_platform 为 "gitlab" 时使用)

remote_server

  • 类型:字符串
  • 说明:远程或自定义服务器 URL(当 git_platform 为 "remote" 时必须配置)
  • 格式:完整的 HTTP/HTTPS URL,例如 http://example.com:8000

git_mirrors

  • 类型:字符串数组
  • 说明:镜像源列表(用于 "github" 和 "gitlab" 模式)
  • 用途:当主源失败时,按顺序尝试镜像源

使用场景

场景 1:使用 GitHub(默认)

适用于大多数情况,从 GitHub 仓库获取更新。

场景 2:使用 GitLab

适用于使用 GitLab 托管代码的情况。

场景 3:使用本地服务器

适用于:

  • 内网环境,无法访问外网
  • 需要快速更新,使用本地服务器
  • 使用自定义的文件服务器
  • 完全离线环境

注意事项

  1. remote 模式必须配置 remote_server:如果 git_platform 设置为 "remote",但没有配置 remote_server,程序会报错并退出。

  2. remote 模式不支持自动回退:与 github 和 gitlab 模式不同,remote 模式不会自动回退到其他源。确保服务器可用。

  3. URL 格式要求:remote_server 必须是完整的 URL,包含协议(http:// 或 https://)。

  4. 路径结构:无论使用哪种模式,服务器上的文件路径结构应该保持一致:

    software/
    ├── list.txt
    ├── 软件名1/
    │   └── 文件...
    └── 软件名2/
        └── 文件...
    

配置示例对比

GitHub 模式

{
    "git_platform": "github",
    "github_repo": "https://github.com/shellsec/softgitup",
    "git_mirrors": ["https://gh-proxy.com/..."]
}

GitLab 模式

{
    "git_platform": "gitlab",
    "gitlab_repo": "https://gitlab.com/your-username/softgitup"
}

Remote 模式

{
    "git_platform": "remote",
    "remote_server": "http://your-server-url:8000"
}