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:
newbie 2026-11-28 12:04:10 +08:00
parent f15e6e4f6d
commit 285e52cbe1
2 changed files with 57 additions and 18 deletions

View File

@ -144,11 +144,11 @@
"name": "ds-harness-remote-fast", "name": "ds-harness-remote-fast",
"title": "ds-harness-remote-fast · 远程极速版", "title": "ds-harness-remote-fast · 远程极速版",
"icon": "icons/remote-fast.png", "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", "author": "newbie",
"homepage": "https://git.qyhhh.top/DeepsSeekHarness/ds-harness-remote-fast", "homepage": "https://github.com/rainow/ds-harness-remote-fast",
"repository": { "repository": {
"url": "https://git.qyhhh.top/DeepsSeekHarness/ds-harness-remote-fast" "url": "https://github.com/rainow/ds-harness-remote-fast"
}, },
"metadata": { "metadata": {
"keywords": [ "keywords": [
@ -162,11 +162,11 @@
"versions": [ "versions": [
{ {
"version": "0.6.8-fast.1", "version": "0.6.8-fast.1",
"publishTimestamp": 1795776040, "publishTimestamp": 1795665151,
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.qyhhh.top/DeepsSeekHarness/ds-harness-remote-fast", "url": "https://github.com/rainow/ds-harness-remote-fast",
"commit": "5ed03f82b53f908c4c1941e9f08c1511d095978e" "commit": "20188ec9044a4b4add15651ba89f240dd96a4a42"
}, },
"engines": {} "engines": {}
} }

View File

@ -1,10 +1,12 @@
// Regenerate the QQ plugin market index (DSH plugin-market index format 1). // 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 // The index lists the four QQ-dsh component plugins, plus one external plugin
// source is a git source pinned to the repo HEAD commit; versions are read // (ds-harness-remote-fast) whose canonical source is GitHub's rainow fork, not
// live from each repo's package.json, so re-running this after a release is // our Gitea mirror. Each entry's install source is a git source pinned to the
// the whole maintenance story. The Gitea repos are public, so the branch // repo HEAD commit; versions are read live from each repo's package.json, so
// endpoints are read anonymously. Output: ./index.json next to this script. // 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 // 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 // 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 API = 'https://git.qyhhh.top/api/v1'
const WEB = 'https://git.qyhhh.top/DeepsSeekHarness' const WEB = 'https://git.qyhhh.top/DeepsSeekHarness'
const GITHUB = 'https://api.github.com'
const PLUGINS = [ const PLUGINS = [
{ {
@ -66,23 +69,59 @@ const PLUGINS = [
icon: 'icons/remote-fast.png', icon: 'icons/remote-fast.png',
repo: 'ds-harness-remote-fast', repo: 'ds-harness-remote-fast',
branch: 'lite', branch: 'lite',
github: true,
owner: 'rainow',
title: 'ds-harness-remote-fast · 远程极速版', 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'], 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) { 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}`) if (!response.ok) throw new Error(`branch lookup failed for ${repo}/${branch}: HTTP ${response.status}`)
const body = await response.json() const body = await response.json()
return { commit: body.commit.id, timestamp: Math.floor(Date.parse(body.commit.timestamp) / 1000) } 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 = [] const plugins = []
for (const plugin of PLUGINS) { for (const plugin of PLUGINS) {
const head = await headOf(plugin.repo, plugin.branch) const onGithub = plugin.github === true
const pkgResponse = await fetch(`${API}/repos/DeepsSeekHarness/${plugin.repo}/contents/package.json?ref=${head.commit}`) 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}`) if (!pkgResponse.ok) throw new Error(`package.json fetch failed for ${plugin.repo}: HTTP ${pkgResponse.status}`)
const pkgFile = await pkgResponse.json() const pkgFile = await pkgResponse.json()
const pkg = JSON.parse(Buffer.from(pkgFile.content, 'base64').toString('utf8')) const pkg = JSON.parse(Buffer.from(pkgFile.content, 'base64').toString('utf8'))
@ -94,14 +133,14 @@ for (const plugin of PLUGINS) {
icon: plugin.icon, icon: plugin.icon,
description: plugin.description, description: plugin.description,
author: 'newbie', author: 'newbie',
homepage: `${WEB}/${plugin.repo}`, homepage: web,
repository: { url: `${WEB}/${plugin.repo}` }, repository: { url: web },
metadata: { keywords: plugin.keywords, labels: [], sortKeys: {} }, metadata: { keywords: plugin.keywords, labels: [], sortKeys: {} },
versions: [ versions: [
{ {
version: version, version: version,
publishTimestamp: head.timestamp, publishTimestamp: head.timestamp,
source: { type: 'git', url: `${WEB}/${plugin.repo}`, commit: head.commit }, source: { type: 'git', url: web, commit: head.commit },
engines: {}, engines: {},
}, },
], ],