Back to home

w1661884010-jpg

dsh-plugin-github-market

DSH web client plugin: browse GitHub dsh-plugin topic repositories (fuzzy search, sort, favorites, install-command copy, optional token)

Stars
1
Language
JavaScript
Created
Aug 14, 2026
Updated
Aug 14, 2026

Introduction

dsh-plugin-github-market

DSH web 客户端插件:在设置面板中浏览 GitHub 上带有 dsh-plugin topic 的插件仓库。

功能

  • GitHub 插件市场:设置(Settings)面板中的「GitHub 插件市场」页面,默认按 Star 数展示 topic:dsh-plugin 仓库
  • 模糊搜索:输入框即时按名称 / 描述 / 标签 / 语言多词模糊过滤;回车后把关键字发给 GitHub Search API 做全局查询
  • 排序:按 Star 数或最近更新排序
  • 打开仓库:每条卡片可点击在新标签页打开 GitHub 仓库
  • 复制安装命令:一键复制 dsh plugin --profile web add github:<owner>/<repo>
  • 本地收藏:收藏夹存在浏览器 localStorage(键 dsh-plugin-github-market.favorites),可在「收藏」页签查看
  • GitHub Token(可选):市场页顶部输入 Token → 保存 → 测试连接。Token 只存本浏览器(localStorage 键 dsh-plugin-github-market.token),只发给 api.github.com;限流从匿名 60 次/小时提升到 5000 次/小时

安装

# 1. 把本包加入 web profile(file: 路径按你的实际位置调整)
dsh plugin --profile web add "file:<本目录绝对路径>"

# 2. 在 profile 用户补丁层启用插件行
#    编辑 ~/.dsh/profiles/web/cordis.patch.yml,追加:
#    - insert:
#        - id: ui-github-market
#          name: 'dsh-plugin-github-market'

# 3. 重启 web profile 使 loader 生效
#    关闭当前 dsh web 进程后重新运行 dsh web

数据与限流

  • 数据来自 GitHub Search API(GET /search/repositories?q=topic:dsh-plugin ...),浏览器直连
  • 匿名访问限流 60 次/小时/IP;插件对每次搜索响应做 10 分钟 localStorage 缓存
  • 遇到 403/429 会显示中文提示,稍后再试或等缓存过期即可

开发

  • 插件是纯客户端 bundle(lib/client.js),手写、无构建工具链
  • 冒烟测试:node tests/bundle-smoke.test.mjs(仓库根目录)
  • 修改 lib/client.js 后重启 dsh web 生效;若在 DSH 源码仓库里跑 pnpm run dev:web,client HMR 会自动热重载