market: point ds-harness-remote-fast at upstream rainow repo
- index entry homepage/repository/git source -> https://github.com/rainow/ds-harness-remote-fast - make-index.mjs: read this plugin from GitHub API (branch lite), retry transient resets, use contents API instead of raw.githubusercontent.com (raw host is unreliable here)
This commit is contained in:
parent
f15e6e4f6d
commit
285e52cbe1
12
index.json
12
index.json
|
|
@ -144,11 +144,11 @@
|
|||
"name": "ds-harness-remote-fast",
|
||||
"title": "ds-harness-remote-fast · 远程极速版",
|
||||
"icon": "icons/remote-fast.png",
|
||||
"description": "ds-harness-remote 的极速分支(rainow):主机端首屏快照裁剪,解决大会话帧超限断连;服务端与客户端不用换,加密与配对与原版一致。本仓库为本机中转快照,源头是 GitHub 上的 rainow/ds-harness-remote-fast。",
|
||||
"description": "ds-harness-remote 的极速分支(rainow):主机端首屏快照裁剪,解决大会话帧超限断连;服务端与客户端不用换,加密与配对与原版一致。安装源为 GitHub 上的 rainow/ds-harness-remote-fast。",
|
||||
"author": "newbie",
|
||||
"homepage": "https://git.qyhhh.top/DeepsSeekHarness/ds-harness-remote-fast",
|
||||
"homepage": "https://github.com/rainow/ds-harness-remote-fast",
|
||||
"repository": {
|
||||
"url": "https://git.qyhhh.top/DeepsSeekHarness/ds-harness-remote-fast"
|
||||
"url": "https://github.com/rainow/ds-harness-remote-fast"
|
||||
},
|
||||
"metadata": {
|
||||
"keywords": [
|
||||
|
|
@ -162,11 +162,11 @@
|
|||
"versions": [
|
||||
{
|
||||
"version": "0.6.8-fast.1",
|
||||
"publishTimestamp": 1795776040,
|
||||
"publishTimestamp": 1795665151,
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://git.qyhhh.top/DeepsSeekHarness/ds-harness-remote-fast",
|
||||
"commit": "5ed03f82b53f908c4c1941e9f08c1511d095978e"
|
||||
"url": "https://github.com/rainow/ds-harness-remote-fast",
|
||||
"commit": "20188ec9044a4b4add15651ba89f240dd96a4a42"
|
||||
},
|
||||
"engines": {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
// Regenerate the QQ plugin market index (DSH plugin-market index format 1).
|
||||
//
|
||||
// The index lists the four QQ-dsh component plugins. Each entry's install
|
||||
// source is a git source pinned to the repo HEAD commit; versions are read
|
||||
// live from each repo's package.json, so re-running this after a release is
|
||||
// the whole maintenance story. The Gitea repos are public, so the branch
|
||||
// endpoints are read anonymously. Output: ./index.json next to this script.
|
||||
// The index lists the four QQ-dsh component plugins, plus one external plugin
|
||||
// (ds-harness-remote-fast) whose canonical source is GitHub's rainow fork, not
|
||||
// our Gitea mirror. Each entry's install source is a git source pinned to the
|
||||
// repo HEAD commit; versions are read live from each repo's package.json, so
|
||||
// re-running this after a release is the whole maintenance story. The repos are
|
||||
// public, so the endpoints are read anonymously. Output: ./index.json next to
|
||||
// this script.
|
||||
//
|
||||
// Why git and not the org's Gitea npm registry (tried 2026-11-12, reverted
|
||||
// the same day): Gitea's npm registry strips the `dsh` field from the
|
||||
|
|
@ -23,6 +25,7 @@ import { fileURLToPath } from 'node:url'
|
|||
|
||||
const API = 'https://git.qyhhh.top/api/v1'
|
||||
const WEB = 'https://git.qyhhh.top/DeepsSeekHarness'
|
||||
const GITHUB = 'https://api.github.com'
|
||||
|
||||
const PLUGINS = [
|
||||
{
|
||||
|
|
@ -66,23 +69,59 @@ const PLUGINS = [
|
|||
icon: 'icons/remote-fast.png',
|
||||
repo: 'ds-harness-remote-fast',
|
||||
branch: 'lite',
|
||||
github: true,
|
||||
owner: 'rainow',
|
||||
title: 'ds-harness-remote-fast · 远程极速版',
|
||||
description: 'ds-harness-remote 的极速分支(rainow):主机端首屏快照裁剪,解决大会话帧超限断连;服务端与客户端不用换,加密与配对与原版一致。本仓库为本机中转快照,源头是 GitHub 上的 rainow/ds-harness-remote-fast。',
|
||||
description: 'ds-harness-remote 的极速分支(rainow):主机端首屏快照裁剪,解决大会话帧超限断连;服务端与客户端不用换,加密与配对与原版一致。安装源为 GitHub 上的 rainow/ds-harness-remote-fast。',
|
||||
keywords: ['remote', '远程', 'fast'],
|
||||
},
|
||||
]
|
||||
|
||||
// Transient resets to GitHub are common from this host; retry a few times
|
||||
// with a growing pause before giving up (the unattended updater relies on it).
|
||||
async function fetchRetry(url, options = {}, attempts = 5) {
|
||||
let lastError
|
||||
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
||||
try {
|
||||
return await fetch(url, options)
|
||||
} catch (error) {
|
||||
lastError = error
|
||||
if (attempt < attempts) await new Promise((resolve) => setTimeout(resolve, attempt * 500))
|
||||
}
|
||||
}
|
||||
throw lastError
|
||||
}
|
||||
|
||||
async function headOf(repo, branch) {
|
||||
const response = await fetch(`${API}/repos/DeepsSeekHarness/${repo}/branches/${encodeURIComponent(branch)}`)
|
||||
const response = await fetchRetry(`${API}/repos/DeepsSeekHarness/${repo}/branches/${encodeURIComponent(branch)}`)
|
||||
if (!response.ok) throw new Error(`branch lookup failed for ${repo}/${branch}: HTTP ${response.status}`)
|
||||
const body = await response.json()
|
||||
return { commit: body.commit.id, timestamp: Math.floor(Date.parse(body.commit.timestamp) / 1000) }
|
||||
}
|
||||
|
||||
async function githubHead(owner, repo, branch) {
|
||||
const response = await fetchRetry(`${GITHUB}/repos/${owner}/${repo}/commits/${encodeURIComponent(branch)}`, {
|
||||
headers: { Accept: 'application/vnd.github+json', 'User-Agent': 'dsh-market-index' },
|
||||
})
|
||||
if (!response.ok) throw new Error(`github commit lookup failed for ${owner}/${repo}@${branch}: HTTP ${response.status}`)
|
||||
const body = await response.json()
|
||||
return { commit: body.sha, timestamp: Math.floor(Date.parse(body.commit.committer.date) / 1000) }
|
||||
}
|
||||
|
||||
const plugins = []
|
||||
for (const plugin of PLUGINS) {
|
||||
const head = await headOf(plugin.repo, plugin.branch)
|
||||
const pkgResponse = await fetch(`${API}/repos/DeepsSeekHarness/${plugin.repo}/contents/package.json?ref=${head.commit}`)
|
||||
const onGithub = plugin.github === true
|
||||
const head = onGithub ? await githubHead(plugin.owner, plugin.repo, plugin.branch) : await headOf(plugin.repo, plugin.branch)
|
||||
const web = onGithub ? `https://github.com/${plugin.owner}/${plugin.repo}` : `${WEB}/${plugin.repo}`
|
||||
// Read package.json through each host's API. For GitHub we deliberately use
|
||||
// the contents API (api.github.com), not raw.githubusercontent.com: the raw
|
||||
// host resets TLS connections from this machine while the API stays reliable.
|
||||
const pkgUrl = onGithub
|
||||
? `${GITHUB}/repos/${plugin.owner}/${plugin.repo}/contents/package.json?ref=${head.commit}`
|
||||
: `${API}/repos/DeepsSeekHarness/${plugin.repo}/contents/package.json?ref=${head.commit}`
|
||||
const pkgResponse = await fetchRetry(pkgUrl, onGithub
|
||||
? { headers: { Accept: 'application/vnd.github+json', 'User-Agent': 'dsh-market-index' } }
|
||||
: {})
|
||||
if (!pkgResponse.ok) throw new Error(`package.json fetch failed for ${plugin.repo}: HTTP ${pkgResponse.status}`)
|
||||
const pkgFile = await pkgResponse.json()
|
||||
const pkg = JSON.parse(Buffer.from(pkgFile.content, 'base64').toString('utf8'))
|
||||
|
|
@ -94,14 +133,14 @@ for (const plugin of PLUGINS) {
|
|||
icon: plugin.icon,
|
||||
description: plugin.description,
|
||||
author: 'newbie',
|
||||
homepage: `${WEB}/${plugin.repo}`,
|
||||
repository: { url: `${WEB}/${plugin.repo}` },
|
||||
homepage: web,
|
||||
repository: { url: web },
|
||||
metadata: { keywords: plugin.keywords, labels: [], sortKeys: {} },
|
||||
versions: [
|
||||
{
|
||||
version: version,
|
||||
publishTimestamp: head.timestamp,
|
||||
source: { type: 'git', url: `${WEB}/${plugin.repo}`, commit: head.commit },
|
||||
source: { type: 'git', url: web, commit: head.commit },
|
||||
engines: {},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue