npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zlooks.cn/bilibili-server

v1.1.5

Published

Bilibili 业务工作台,包含邀请制短链管理,以及 Android / Electron 账号登录、设备退出、状态检查和自动维护。页面复用现有黑白 Studio 与 Ant Design,位于同一个 Gateway Host。账号列表为 `/bilibili/accounts`,设备详情为 `/bilibili/accounts/[uid]`;原有短链与使用资格入口保留。

Readme

Bilibili Server

Bilibili 业务工作台,包含邀请制短链管理,以及 Android / Electron 账号登录、设备退出、状态检查和自动维护。页面复用现有黑白 Studio 与 Ant Design,位于同一个 Gateway Host。账号列表为 /bilibili/accounts,设备详情为 /bilibili/accounts/[uid];原有短链与使用资格入口保留。

账号维护的数据库、凭据配置、并发和通知说明见 账号维护。首次启用前在 Registry 配置所在机器执行 zlooks-bilibili-server accounts-key,然后重启本服务;所有副本共享同一份密钥配置。

OIDC 客户端可通过 Gateway 的 GET /-/cn.zlooks.bilibili.server/api/oidc/accounts 获取自己的全部账号,按 Android/Electron 和设备状态筛选,不分页。所有 Bilibili OIDC API 均检查当前用户的邀请码使用期限,未兑换或到期返回 403,续期后下一次请求恢复。调用方式及安全返回结构见 OIDC 账号查询;现有网页 API 继续使用 web-auth。

只有Zlooks登录用户能使用自己的数据;管理员创建邀请码,用户兑换后的使用截止时间等于邀请码的绝对截止时间。兑换没有显式锁,PostgreSQL事务和条件更新确保同码重试幂等、其他用户不能再领、续期不会缩短当前期限。明文码仅创建时返回,管理员自行分发。

MCP统一使用bilibili:admin作用域:

  • bilibili.get-configuration:只读查询跳转服务的域名和投递状态;新建短链复用该域名。
  • bilibili.create-invitation:{ expiresAt: "2027-01-01T00:00:00.000Z", label?: "备注" }。
  • bilibili.list-invitations:分页查询兑换状态,不返回旧明文码。
  • Resource bilibili://configuration 和Prompt bilibili.maintain 提供只读上下文与维护流程;仅支持Tools的客户端可用bilibili.get-maintenance-guide。

新建短链调用 Bilibili 的分享接口,生成方式枚举为 zhihu(知乎跳板)和 app(App 内置跳转,仅支持 App 内)。先生成七位大小写英文字母 hash(A–Z/a–z),使用已配置 bilibili.redirect.domain/{hash} 作为两种包装方案的目标;表单中的网址保留为最终目标。buvid 每次使用随机 UUID;其余请求字段固定。接口必须返回有效的 data.content HTTPS b23.tv 地址才创建成功,缺失或无效时返回安全失败信息。生成过程限制为 20 秒、响应最多 16 KiB,并保留取消信号。

数据库保存原始目标、完整 b23.tv 地址、生成方式和跳转方式。生成成功后目标和生成方式不可修改;跳转方式枚举为 direct 和 triple;直接跳转通过 /{hash} 从 Redis 读取最终目标并返回 302,三连页面返回已选 B「轻甜」引导页,按首次/再次访问展示提示、自动打开及手动兜底。三连页源码不含目标,继续访问时通过 /{hash}/target 再次校验 Redis 中的有效期和状态后取址。浏览器访问记忆不等于 B站三连状态校验。列表、详情和复制都使用实际返回的地址。旧记录不自动生成外部短链,缺失地址时清楚展示旧版状态。

管理服务自己的 Redis 记录为 zlooks:bilibili:short-links:{hash},通过现有事务投影和生命周期工作器写入,按版本防止旧值覆盖,可由 PostgreSQL 当前快照重建。链接投影同时通过已有 epoch/版本协议发布到跳转服务的 zlooks:link-routing:link:{hash},携带最终目标和跳转枚举;两份缓存均成功后才确认投递。七位公开 hash 区分大小写;已有十位标识仅保留数据读取,不作为公开路由,数据库列不缩短。

新建短链经过本服务跳转入口,启停、删除及用户资格变更在缓存同步后控制访问,单链到期由入口按时间判断。历史直连目标的 b23 地址无法改成新链路,也不受本地状态控制;不自动重签。第三方 App 真机行为需要单独验证。并发或响应不确定时,提供方可能签发未被使用的额外地址;数据库创建编号仍保证只保存一个结果,通常重试直接复用该结果。

列表默认按创建时间倒序,编辑不会改变排序;桌面和手机列表均展示生成方式、跳转方式。桌面搜索与筛选位于 Tabs 右侧,不再显示排序下拉;账号页区分分享域名 b23.tv 与配置中的跳转域名。

Registry使用顶层postgres、redis和已有public-host配置;启动加载~/.zlooks.cn/.env。首次启动只同步本服务拥有的数据表。

安装后先执行管理服务自己的交互配置命令:

zlooks-bilibili-server config

输入跳转服务端口和完整 HTTP(S) Origin 并确认,命令通过 Hile Registry 写入 ~/.registry/configs/zlooks.cn.config.yaml 的 bilibili 组,保留其他配置组。MCP 不再提供域名修改能力。源码环境可在构建后执行 node packages/bilibili-server/dist/command/index.js config,无需启动服务或数据库。

bilibili:
  server:
    port: 8912
  redirect:
    domain: http://localhost:8912

bilibili.redirect.domain 是跳转域名配置的唯一来源;管理服务订阅配置并将派生快照投递到跳转缓存,同域名重复同步不增加版本。跳转服务从同一配置组读取 bilibili.server.port,只使用 Redis,不连接数据库。修改域名经 Registry 自动生效,但已生成的 b23 链路仍指向原域名,不会自动重签,变更需保留原域名的承接能力。生成期间域名变化会使该次创建失败,避免保存指向过期域名的结果。修改监听端口后需要重启跳转服务。

升级时将旧 bilibili.domain(更早为 links.domain)移至 bilibili.redirect.domain,将 bilibili-short-link-redirect.http.port(更早为 link-redirect.http.port)移至 bilibili.server.port,删除已迁移的旧组,并一同更新两个服务。MCP Provider 为 bilibili,管理员 scope 为 bilibili:admin。数据库表、邀请密钥摘要和 Redis 键保持原有名称与数据,无需重建链接或资格。

pnpm --filter @zlooks.cn/bilibili-server build
pnpm --filter @zlooks.cn/bilibili-server verify:rsc
pnpm --filter @zlooks.cn/bilibili-server test
pnpm --filter @zlooks.cn/bilibili-server start

真实PostgreSQL并发验证使用隔离的临时集群,不读取机器数据库配置。先在仓库外安装[email protected],再运行:

pnpm --filter @zlooks.cn/bilibili-server exec node test/helpers/verify-postgres.mjs \
  /absolute/path/node_modules/embedded-postgres/dist/index.js

脚本不创建操作系统用户,关闭时删除自己创建的数据库目录;验证双连接兑换、期限单调递增、创建重试、投影确认与删除恢复。常规测试还验证Micro/MCP/HOM边界、权限与RSC凭据隔离。

同样传入上述模块路径运行 test/helpers/verify-routing-lifecycle.mjs,可验证隔离 PostgreSQL、Redis、Registry、真实 Micro 与生产 HTTP Controller 的完整服务链路;不会使用机器上的业务配置或数据库。使用已构建产物运行 node --conditions=react-server test/helpers/verify-rsc.mjs,验证三个 RSC 路由的匿名、故障和登录状态及凭据隔离。详细边界与验证记录见仓库 docs/short-links.md。