PluginSourceSettingsModule · packages/server/src/plugin/mirror-settings.ts:99

PluginMirrorSettings

component

No JSDoc comment in source yet.

API

@Component({
  contributes: {
    "PluginConfigProvider.groups": [
      {
        // Written out, not named from a constant: a contribution is data the host reads
        // without running the package.
        id: "plugin-mirrors",
        // Drawn inside the Plugin Sources card (source-settings.ts), after the plugin-index
        // field: one card on screen, saved under its own key (`plugin-config:plugin-mirrors`).
        parent: "plugin-sources",
        order: 2,
        properties: {
          mirrors: {
            type: "list",
            title: "Plugin mirrors",
            titleZh: "插件镜像",
            description:
              "The mirrors to try after each source's own URL when GitHub or the npm registry is unreachable, in order: the npm registry mirror serves npm packages and the index's npm-published tarballs; the GitHub mirrors serve the published index and its release assets. Everything a mirror serves is verified against the entry's sha512, just like the canonical source. Empty (the default) tries the source's own URL only.",
            descriptionZh:
              "GitHub 或 npm registry 不可达时,在每个源地址之后按顺序尝试的镜像:npm registry 镜像供给 npm 包与索引发布到 npm 的 tarball;GitHub 镜像供给发布索引与其 release 资产。镜像供给的一切同样按条目的 sha512 核验。留空(默认)只走源自己的地址。",
            default: [],
            // The page draws one picker per entry from these choices (items.options); the
            // server still holds a list of ids and `mirrorRulesOf` filters what it reads.
            items: {
              options: [
                {
                  value: "npm-registry",
                  title: "npm registry mirror (npmmirror)",
                  titleZh: "npm registry 镜像(npmmirror)",
                },
                {
                  value: "github-raw",
                  title: "GitHub raw via jsDelivr (fastly)",
                  titleZh: "GitHub raw 经 jsDelivr(fastly)",
                },
                {
                  value: "github-proxy",
                  title: "GitHub proxy (gh-proxy.com)",
                  titleZh: "GitHub 代理(gh-proxy.com)",
                },
              ],
            },
            // The ids the group knows; the page draws them as the choices a line can be.
            maxItems: 3,
          },
        },
      },
    ],
  },
})
export class PluginMirrorSettings {
  @Use() private readonly pluginConfig!: PluginConfig;
  setup(): void;
}

Dependencies & Wiring

Extracted from class decorators
@Userequires (1)
pluginConfig: PluginConfig

Contributes

{
  "PluginConfigProvider.groups": [
    {
      "id": "plugin-mirrors",
      "parent": "plugin-sources",
      "order": 2,
      "properties": {
        "mirrors": {
          "type": "list",
          "title": "Plugin mirrors",
          "titleZh": "插件镜像",
          "description": "The mirrors to try after each source's own URL when GitHub or the npm registry is unreachable, in order: the npm registry mirror serves npm packages and the index's npm-published tarballs; the GitHub mirrors serve the published index and its release assets. Everything a mirror serves is verified against the entry's sha512, just like the canonical source. Empty (the default) tries the source's own URL only.",
          "descriptionZh": "GitHub 或 npm registry 不可达时,在每个源地址之后按顺序尝试的镜像:npm registry 镜像供给 npm 包与索引发布到 npm 的 tarball;GitHub 镜像供给发布索引与其 release 资产。镜像供给的一切同样按条目的 sha512 核验。留空(默认)只走源自己的地址。",
          "default": [],
          "items": {
            "options": [
              {
                "value": "npm-registry",
                "title": "npm registry mirror (npmmirror)",
                "titleZh": "npm registry 镜像(npmmirror)"
              },
              {
                "value": "github-raw",
                "title": "GitHub raw via jsDelivr (fastly)",
                "titleZh": "GitHub raw 经 jsDelivr(fastly)"
              },
              {
                "value": "github-proxy",
                "title": "GitHub proxy (gh-proxy.com)",
                "titleZh": "GitHub 代理(gh-proxy.com)"
              }
            ]
          },
          "maxItems": 3
        }
      }
    }
  ]
}

Target slots: PluginConfigProvider.groups

Methods (1)

setup

setup(): void
@returnsvoid