Skip to content

开发者中心 dev.cardputer.cc:网页上传 deb + 本地解析 + 抢占式包名归属(独立仓库源码)#12

Closed
eggfly wants to merge 1 commit into
mainfrom
cursor/dev-portal-web-upload-2efb
Closed

开发者中心 dev.cardputer.cc:网页上传 deb + 本地解析 + 抢占式包名归属(独立仓库源码)#12
eggfly wants to merge 1 commit into
mainfrom
cursor/dev-portal-web-upload-2efb

Conversation

@eggfly

@eggfly eggfly commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

背景

按需求实现「面向开发者的网页上传入口」完整源码(dev-portal/ 目录)。设计为独立 public 仓库(建议 CardputerZero/dev-portal)的内容——我的 token 无建仓权限(administration 只有 read),仓库建好后把这个目录推过去即可(或给我权限我来做)。

功能对照需求

需求 实现
直接上传 deb 拖拽/点选 .deb,同域 POST 到 Worker(Cloudflare Worker 架构,无 CORS 问题)
自动解析开发者/图标/包名/版本/desktop/邮箱 纯浏览器本地解析site/debparse.js:ar + tar + gzip/xz/zstd 前端解包),选中文件立即展示预览卡片,不用先上传
GitHub 登录验证邮箱真实性 OAuth user:email scope 读取已验证邮箱列表;deb 的 Maintainer 邮箱必须 ∈ 已验证邮箱(或 noreply 地址)
抢占式包名归属 新包名首次提交即占有;已有包名只有线上包 Maintainer 邮箱对应的账号可更新/下架;ADMIN_LOGINS 管理员可管理任意包。归属状态直接读线上 APT 索引,无需数据库
相同版本提示 前端预检 + Worker 预检 + CI 权威校验三层,版本重复/倒退都会被拦截并提示
恶意文件初步报告 浏览器端即时报告 + CI 端 dpkg-deb 权威扫描:setuid/setgid、设备文件、路径穿越、安装路径白名单、非 arm64 ELF、maintainer 脚本危险模式(`curl
过审后更新商店 JSON 校验通过自动开发布 PR,AUTO_MERGE="true"(可关)自动合并 → 现有 update-index.yml 管线更新 APT 索引与 registry
token 保密 bot PAT / OAuth secret / 会话密钥全部在 Worker secrets;用户 OAuth token 用完即弃不落盘

架构

浏览器(本地解析+预检)→ Worker dev.cardputer.cc(登录会话、归属/版本预检、存 buffer Release、repository_dispatch)→ packages 仓库 Actions(dpkg-deb 权威校验 + store 元数据 + 自动 PR/合并,失败开 issue @提交者)→ 现有 apt-pool/索引管线。

信任模型:客户端解析只做体验层,一切以 CI 的服务端校验为准。

已验证

  • 解析器用线上真实包实测:2048_0.1.0(xz)、nc2000_1.0.3(zstd)均正确解出图标/字段/清单
  • node --test:4 个用例全过(干净包、gzip/zstd 变体、恶意包 flag、dpkg 版本语义)
  • 两个 workflow:YAML 解析、每个 run 脚本 bash -n、内嵌 Python 编译均通过

部署待办(人工)

  1. CardputerZero/dev-portal 仓库并推入本目录内容
  2. wrangler deploy + 4 个 secret(README 有完整步骤);GitHub OAuth App callback 指 https://dev.cardputer.cc/auth/callback
  3. packages-workflows/ 两个文件复制进 CardputerZero/packages

⚠️ 权限说明

组织已安装 Cursor App(All repositories),但我当前运行实例的 token 仍只覆盖本仓库(对 CardputerZero/packages 推送实测仍 403,建仓 API 403——installation token 是按启动时的仓库签发的)。从 CardputerZero 组织的仓库(或加了权限后的新会话)发起的 agent 应该就能直接操作了;也可以手动建好空仓库后告诉我再试。

Open in Web Open in Cursor 

…pection

Complete source for a standalone public repo (CardputerZero/dev-portal),
Cloudflare Worker architecture with no database:

- site/debparse.js: pure-browser .deb parser (ar/tar + gzip/xz/zstd) that
  extracts control fields, .desktop entry, app icon, maintainer email and a
  file listing, and produces a preliminary safety report (setuid/device
  files/path escapes/foreign-arch ELF/dangerous maintainer-script patterns);
  includes dpkg-semantics version comparison. Verified against real packages
  from the live apt pool (xz and zstd) plus fixture-based node tests.
- worker/: same-origin Worker serving the static portal and the API. GitHub
  OAuth login with user:email scope reads verified emails for identity;
  first-submitter-owns-the-name policy and version-monotonicity pre-checks
  against the published APT index; uploads go to the packages repo's buffer
  release via the bot token, then repository_dispatch hands off to CI.
- packages-workflows/: authoritative dpkg-deb validation (integrity, control,
  .desktop, structure and safety scan, verified-email ownership, version
  bump), store metadata from app-builder.json or generated from the deb,
  auto-created publish PR with optional auto-merge, unpublish flow with
  ownership re-verification, and failure feedback via issues mentioning the
  submitter.
- Cloudflare deploy workflow and Chinese deployment guide.

Co-authored-by: eggfly <lihaohua90@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants