free-tokens: AIHOT Token 羊毛 page (#885)

New page plugin: AIHOT's Token 羊毛 (free model allowances), sorted into "ready" / "plugin to set up" / "no plugin" against the user's own magpie plugins. Only the vendors in src/allowlist.js are shown; anything else (relays included) is dropped before it reaches the page.

AIHOT's written approval (2026-11-10) is quoted on the PR: free, no ads or sponsors, each user reads it once on their own computer, no proxy, mirror or redistribution, credited in the footer.

Run at 07da91b0 (on mote):
- bun test packages/free-tokens: 62 pass. bun scripts/check.mjs free-tokens: ok.
- The page served with magpie's page CSP in a sandbox="allow-scripts" frame, Chromium and WebKit: tiles 1/2/1 for a fixture of MiniMax (signed in, checked in today), ZCode (installed, not signed in), Zed (not installed), DeepSeek (no plugin) and an unlisted relay (dropped); install popover gives @magpie-community/opencode-zed-auth, login popover "magpie plugin login zcode"; a title holding <img onerror> is shown as text; brand icons load; no dialog.
- Every mapped package checked: 8 on npm, 5 on the dist branch, and each pid is the package's provider id.
- Broken by hand: checkin null guard removed, title unescaped, Zed's npm name unscoped; each turns a test red.

Not tried: a real magpie window with the plugin installed, and the live aihot.news route (no network in the run).

Co-authored-by: sljdxde <sljdxde@users.noreply.github.com>
This commit is contained in:
Mingchen Yu
2026-11-10 09:28:19 +08:00
committed by GitHub
co-authored by sljdxde
parent 7b52e3fc47
commit 7262e70c6c
51 changed files with 1024 additions and 0 deletions
+1
View File
@@ -179,6 +179,7 @@ These add a page to magpie's window, in the app and in `magpie web`, under Plugi
| Package | Page | Reads |
|---|---|---|
| [usage](packages/usage) | Usage glance: calls, errors, tokens and cost for today, 7 or 30 days, and the models behind them | `usage:summary` |
| [free-tokens](packages/free-tokens) | AIHOT's Token freebies in three tiers (already configured and usable / needs one more plugin / no plugin yet), with the plugin to install or the exact login step for each | none; its host part reads ~/.config/magpie (providers/checkin) on open and fetches aihot.news/free-tokens.data |
| [day-card](packages/day-card) | Day card: a day of your usage drawn as a card (tokens, cost, each agent and its models, streak, average day), copied as a picture or saved as a PNG | `usage:day` |
| [powercontext](packages/powercontext) | Connection settings for an independently deployed PowerContext service | None |
| [nowledge-mem](packages/nowledge-mem) | Connection settings, recall and capture switches, a real connection test, and the scope of what is sent | None |
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Mingchen Yu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+10
View File
@@ -0,0 +1,10 @@
This package bundles brand icons copied from magpie's own assets
(magpie: https://github.com/yetone/magpie, MIT License).
Those icons originate from lobe-icons (https://github.com/lobehub/lobe-icons),
MIT License, Copyright (c) 2023 LobeHub.
License: https://github.com/lobehub/lobe-icons/blob/master/LICENSE
The token freebies shown at runtime come from AIHOT (https://aihot.news/free-tokens),
fetched directly on each user's machine at runtime. No AIHOT data is bundled with
this package.
+9
View File
@@ -0,0 +1,9 @@
# @magpie-community/page-free-tokens
AIHOT「Token 羊毛」页面:在 magpie 窗口里分三档看各家大模型的免费额度——**已配置可用** / **有插件待配置** / **暂无插件**,并对每条给出该装的插件或登录路径。
数据来自 [AIHOT · Token 羊毛](https://aihot.news/free-tokens),每个用户在自己的电脑上打开页面时直连读一次(不代理、不镜像、不随包分发、不后台轮询)。只展示官方厂商额度(`src/allowlist.js`);图标用 magpie 自带品牌图标,其余首字母色块。页脚署名「数据源:AIHOT」并链回。
> 已取得 AIHOT 书面授权(2026-11-10):免费、不接广告/赞助、每用户本机打开时读一次、不做代理/镜像/数据分发。
安装:`magpie plugin add @magpie-community/page-free-tokens`。测试:`bun test`(100% 行覆盖)。
+6
View File
@@ -0,0 +1,6 @@
// magpie-free-tokens host part:仅在页面打开(宿主启动)时拉一次 AIHOT、读本机 magpie、写 page/data.js。
// 只导出 default {id, server}(不带任何命名导出,免得被 check.mjs 当插件函数调用)。
import { refresh } from "./src/refresh.js";
const server = async (input) => { await refresh(input); return {}; };
export default { id: "free-tokens", server };
+47
View File
@@ -0,0 +1,47 @@
{
"name": "@magpie-community/page-free-tokens",
"version": "0.1.0",
"description": "AIHOT Token 羊毛:在 magpie 里看哪些羊毛已配置可用、哪些差个插件、哪些还没插件。",
"type": "module",
"main": "./index.js",
"files": [
"index.js",
"src/",
"page/",
"!page/data.js",
"README.md",
"NOTICE",
"LICENSE",
"test/"
],
"keywords": [
"magpie",
"magpie-page",
"magpie-plugin",
"free-tokens",
"aihot",
"token"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/magpie-community/plugins.git",
"directory": "packages/free-tokens"
},
"magpie": {
"name": "Token 羊毛",
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0IiByb2xlPSJpbWciIGFyaWEtbGFiZWw9IlRva2VuIOe+iuavmyI+CiAgPHJlY3Qgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0IiByeD0iMTYiIGZpbGw9IiM0ZjQ2ZTUiLz4KICA8Y2lyY2xlIGN4PSIyOS41IiBjeT0iMzUuNSIgcj0iMTUiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZmZmZiIgc3Ryb2tlLXdpZHRoPSIzLjQiLz4KICA8cGF0aCBkPSJNMjMuOCAyOS4yIEwyOS41IDM2LjIgTDM1LjIgMjkuMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmZmZmIiBzdHJva2Utd2lkdGg9IjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgogIDxwYXRoIGQ9Ik0yOS41IDM2LjIgVjQ0LjQiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZmZmZiIgc3Ryb2tlLXdpZHRoPSIzIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICA8cGF0aCBkPSJNMjQuNiAzOS4yIEgzNC40IE0yNC42IDQyLjQgSDM0LjQiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZmZmZiIgc3Ryb2tlLXdpZHRoPSIzIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICA8cGF0aCBkPSJNNDcgMTEuNSBsMiA1LjEgNS4xIDIgLTUuMSAyIC0yIDUuMSAtMiAtNS4xIC01LjEgLTIgNS4xIC0yIHoiIGZpbGw9IiNmZmZmZmYiLz4KPC9zdmc+Cg==",
"summary": {
"en": "AIHOT Token freebies: which you can use now, which need a magpie plugin, which have none.",
"zh": "AIHOT 的 Token 羊毛:哪些已能用、哪些差个插件、哪些还没插件。"
},
"page": {
"title": "Token 羊毛",
"file": "page/index.html",
"icon": "page/icon.svg",
"titles": {
"en": "Token Freebies"
}
}
}
}
+94
View File
@@ -0,0 +1,94 @@
// Token 羊毛 · 紧凑三档视图(classic script;只读;跟随 magpie 主题;无外链、无网络请求)。
// 依赖先加载的 view.js(window.FTView)。用 classic 而非 module:magpie 页面 frame 为 sandbox=allow-scripts,
// origin 为 null,module script 走 CORS 会被拒(见 review)。
(function () {
"use strict";
if (!window.FTView) { document.addEventListener("DOMContentLoaded", () => { const el = document.getElementById("list"); if (el) el.innerHTML = '<div class="empty">页面资源加载失败(view.js 未加载)</div>'; }); return; }
const V = window.FTView;
const { esc, bucketOf, counts, summaryHtml, rowHtml, actionOf } = V;
const hasBridge = typeof window.magpie !== "undefined" && window.magpie && window.magpie.ready;
function previewBridge() { const dark = window.matchMedia && matchMedia("(prefers-color-scheme: dark)").matches; return { ready: Promise.resolve({ dark }), theme: { dark }, options: { get: async () => ({}), set: async (o) => o }, read: async () => ({}), onTheme() {} }; }
const MAG = hasBridge ? window.magpie : previewBridge();
const TABS = [["ready", "已配置可用", "已装好并登录,可直接用"], ["setup", "有插件待配置", "有插件,还没装或没登录"], ["none", "暂无插件", "还没有对应的 magpie 插件"]];
const TAB_HINT = {
ready: "这些羊毛对应的供应商已在你的 magpie 里登录,可以直接使用;标「今日可领」的记得去签到。",
setup: "点「安装插件」会给出可粘贴的包名;到 magpie「插件 → 发现 → 已有想装的?」粘贴添加(页面无法直接跳转安装)。",
none: "这些还没有对应的 magpie 插件;「复制链接」可在浏览器打开来源。",
};
const $ = (s, r = document) => r.querySelector(s);
const $$ = (s, r = document) => Array.from(r.querySelectorAll(s));
let meta, deals, mapping, demoState, icons = {};
let DATA_REF = null, wired = false;
const state = { tab: "ready", q: "" };
function applyData(d) { meta = d.meta || {}; deals = Array.isArray(d.deals) ? d.deals : []; mapping = d.mapping || {}; demoState = d.demoState || { installed: {}, configKnown: true, checkinKnown: true }; icons = d.icons || {}; DATA_REF = d; }
function showUnavailable() { applyData({ meta: {}, deals: [], mapping: {}, demoState: { installed: {}, configKnown: true, checkinKnown: true } }); showMessage("数据源暂不可用(AIHOT 无法访问)。稍后重试。"); }
function applyTheme(dark) { document.documentElement.dataset.theme = dark ? "dark" : "light"; }
function renderSummary(c) { $("#summary").innerHTML = summaryHtml(meta, deals.length, c); }
function renderBuckets(c) { const el = $("#buckets"); el.innerHTML = TABS.map(([k, label]) => `<button type="button" class="tile ${state.tab === k ? "on" : ""}" data-tab="${k}" aria-pressed="${state.tab === k}"><span class="k">${esc(label)}</span><span class="v">${c[k]}</span></button>`).join(""); $$(".tile", el).forEach((b) => (b.onclick = () => { state.tab = b.dataset.tab; render(); })); }
function renderList() {
const q = state.q.trim().toLowerCase();
const rows = deals.filter((d) => bucketOf(d, mapping, demoState).key === state.tab)
.filter((d) => !q || (d.provider + " " + d.title + " " + (d.tags || []).join(" ")).toLowerCase().includes(q))
.sort((a, b) => (b.yuan || 0) - (a.yuan || 0) || a.provider.localeCompare(b.provider));
const list = $("#list"); list.innerHTML = rows.map((d) => rowHtml(d, { mapping, demoState, icons })).join("");
$("#empty").style.display = rows.length ? "none" : "block";
$$(".avatar.logo img", list).forEach((img) => img.addEventListener("error", () => { const d = img.parentNode; d.className = "avatar gen"; d.style.background = d.getAttribute("data-col") || "#4f46e5"; d.textContent = d.getAttribute("data-ini") || "?"; }));
$$("[data-act]", list).forEach((btn) => btn.addEventListener("click", (e) => { e.stopPropagation(); onAction(btn); }));
}
function render() {
if (!deals) return;
const c = counts(deals, mapping, demoState); renderSummary(c); renderBuckets(c);
$("#tabhint").innerHTML = esc(TAB_HINT[state.tab] || ""); renderList();
let when = ""; try { when = new Date(meta.generatedAt).toLocaleString("zh-CN", { timeZone: "Asia/Shanghai", hour12: false }); } catch { when = String(meta.generatedAt); }
const warn = demoState.configKnown ? "" : " · 读取本机 magpie 配置失败,档位可能不准";
$("#footNote").textContent = `三档:已配置可用 / 有插件待配置 / 暂无插件;数据取自 AIHOT 实时 · ${when}(北京时间)${warn}。数据源:AIHOT · https://aihot.news/free-tokens`;
}
function showMessage(msg) { $("#list").innerHTML = `<div class="empty">${esc(msg)}</div>`; $("#empty").style.display = "none"; }
function onAction(btn) { const a = actionOf(btn.dataset); if (a) popover(a); }
async function copyText(txt) { try { if (navigator.clipboard && navigator.clipboard.writeText) { await navigator.clipboard.writeText(txt); return true; } } catch {} try { const ta = document.createElement("textarea"); ta.value = txt; ta.style.position = "fixed"; ta.style.top = "-1000px"; document.body.appendChild(ta); ta.focus(); ta.select(); const ok = document.execCommand("copy"); ta.remove(); return ok; } catch { return false; } }
function closePop() { const p = $("#pop-wrap"); if (p) p.remove(); }
function popover({ title, steps, copyText: ct }) {
closePop();
const wrap = document.createElement("div"); wrap.id = "pop-wrap"; wrap.className = "pop-wrap";
wrap.innerHTML = `<div class="pop"><div class="pop-h">${esc(title)}</div>${steps && steps.length ? `<ol class="pop-steps">${steps.map((s) => `<li>${esc(s)}</li>`).join("")}</ol>` : ""}${ct ? `<div class="pop-copy"><input readonly value="${esc(ct)}" spellcheck="false"><button class="pop-btn" data-copy>复制</button></div><div class="pop-tip" data-tip></div>` : ""}<div class="pop-foot"><button class="pop-close">关闭</button></div></div>`;
document.body.appendChild(wrap);
const input = wrap.querySelector("input"), tip = wrap.querySelector("[data-tip]");
if (input) { input.focus(); input.select(); const tryCopy = async () => { const ok = await copyText(ct); if (tip) tip.textContent = ok ? "已复制到剪贴板" : "已全选,请按 ⌘C / Ctrl+C 手动复制"; }; tryCopy(); wrap.querySelector("[data-copy]").onclick = async () => { await tryCopy(); input.focus(); input.select(); }; }
wrap.querySelector(".pop-close").onclick = closePop;
wrap.addEventListener("click", (e) => { if (e.target === wrap) closePop(); });
}
function wire() { if (wired) return; wired = true; $("#q").addEventListener("input", (e) => { state.q = e.target.value; renderList(); }); }
function boot() { const d = window.__FREE_TOKENS__; if (!d) return false; if (d.error) { showUnavailable(); return true; } applyData(d); render(); return true; }
let tick = 0, tried = 0;
function inject() {
if (!hasBridge) return;
const s = document.createElement("script"); s.src = "data.js?t=" + Date.now() + "-" + (tick++);
s.onload = () => { const d = window.__FREE_TOKENS__; if (!d || d === DATA_REF) return; if (d.error) { showUnavailable(); } else { applyData(d); render(); } };
s.onerror = () => {};
document.head.appendChild(s);
}
MAG.ready.then((theme) => {
applyTheme(!!(theme && theme.dark));
if (MAG.onTheme) MAG.onTheme((t) => applyTheme(!!(t && t.dark)));
wire();
if (hasBridge) {
inject();
// 仅在有需要时重试几次(宿主可能稍后才写 data.js),不无限轮询
const timer = setInterval(() => {
const d = window.__FREE_TOKENS__;
if (DATA_REF || (d && d.error) || ++tried >= 8) { clearInterval(timer); return; }
inject();
}, 2000);
}
if (!boot()) { showMessage("数据准备中…"); setTimeout(() => { if (!DATA_REF) { const d = window.__FREE_TOKENS__; if (d && d.error) showUnavailable(); else showMessage("数据未就绪(请确认 AIHOT 可访问后重新打开此页)。"); } }, 16000); }
});
})();
@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Baidu</title><path d="M8.859 11.735c1.017-1.71 4.059-3.083 6.202.286 1.579 2.284 4.284 4.397 4.284 4.397s2.027 1.601.73 4.684c-1.24 2.956-5.64 1.607-6.005 1.49l-.024-.009s-1.746-.568-3.776-.112c-2.026.458-3.773.286-3.773.286l-.045-.001c-.328-.01-2.38-.187-3.001-2.968-.675-3.028 2.365-4.687 2.592-4.968.226-.288 1.802-1.37 2.816-3.085zm.986 1.738v2.032h-1.64s-1.64.138-2.213 2.014c-.2 1.252.177 1.99.242 2.148.067.157.596 1.073 1.927 1.342h3.078v-7.514l-1.394-.022zm3.588 2.191l-1.44.024v3.956s.064.985 1.44 1.344h3.541v-5.3h-1.528v3.979h-1.46s-.466-.068-.553-.447v-3.556zM9.82 16.715v3.06H8.58s-.863-.045-1.126-1.049c-.136-.445.02-.959.088-1.16.063-.203.353-.671.951-.85H9.82zm9.525-9.036c2.086 0 2.646 2.06 2.646 2.742 0 .688.284 3.597-2.309 3.655-2.595.057-2.704-1.77-2.704-3.08 0-1.374.277-3.317 2.367-3.317zM4.24 6.08c1.523-.135 2.645 1.55 2.762 2.513.07.625.393 3.486-1.975 4-2.364.515-3.244-2.249-2.984-3.544 0 0 .28-2.797 2.197-2.969zm8.847-1.483c.14-1.31 1.69-3.316 2.931-3.028 1.236.285 2.367 1.944 2.137 3.37-.224 1.428-1.345 3.313-3.095 3.082-1.748-.226-2.143-1.823-1.973-3.424zM9.425 1c1.307 0 2.364 1.519 2.364 3.398 0 1.879-1.057 3.4-2.364 3.4s-2.367-1.521-2.367-3.4C7.058 2.518 8.118 1 9.425 1z" fill="#2932E1" fill-rule="nonzero"></path></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>BaiLian</title><path d="M6.336 8.919v6.162l5.335-3.083L6.337 8.92z" fill="#1C54E3"></path><path d="M21.394 5.288s-.006-.006-.01-.006L17.01 2.754 6.336 8.92l5.335 3.082 9.701-5.6.016-.01a.635.635 0 00.006-1.1v-.003z" fill="#AA9AFF"></path><path d="M21.71 12.465a.62.62 0 00-.316.085s-.006 0-.009.003l-4.375 2.528 5.05 2.915h.006a2.06 2.06 0 00.28-1.04v-3.855a.637.637 0 00-.636-.636z" fill="#00EAD1"></path><path d="M22.06 17.996l-5.05-2.915L6.34 21.242l4.27 2.465s.016.006.022.012a2.102 2.102 0 002.093 0c.006-.003.016-.006.022-.012l8.538-4.93c.003 0 .006-.003.01-.006.321-.183.589-.45.775-.772h-.006l-.004-.003z" fill="#00CEC9"></path><path d="M11.672 11.998l-5.336 3.083-1.444.832-3.605 2.083H1.28c.173.303.416.555.709.738l.078.044.016.01.02.012 4.232 2.442 10.671-6.161-5.335-3.082z" fill="#00EAD1"></path><path d="M12.74.29c-.1-.06-.208-.107-.315-.148-.02-.006-.038-.016-.057-.022a2.121 2.121 0 00-.7-.12c-.233 0-.457.038-.668.11l-.031.01a2.196 2.196 0 00-.372.17L2.068 5.222s-.003 0-.006.003c-.324.183-.592.451-.781.773h.006l5.049 2.918L17.01 2.758 12.74.29z" fill="#7347FF"></path><path d="M1.287 6.001H1.28A2.06 2.06 0 001 7.041v9.915c0 .378.1.735.28 1.043h.007l5.049-2.918V8.919l-5.05-2.918z" fill="#0423DA"></path></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Cloudflare</title><path d="M16.493 17.4c.135-.52.08-.983-.161-1.338-.215-.328-.592-.519-1.05-.519l-8.663-.109a.148.148 0 01-.135-.082c-.027-.054-.027-.109-.027-.163.027-.082.108-.164.189-.164l8.744-.11c1.05-.054 2.153-.9 2.556-1.937l.511-1.31c.027-.055.027-.11.027-.164C17.92 8.91 15.66 7 12.942 7c-2.503 0-4.628 1.638-5.381 3.903a2.432 2.432 0 00-1.803-.491c-1.21.109-2.153 1.092-2.287 2.32-.027.328 0 .628.054.9C1.56 13.688 0 15.326 0 17.319c0 .19.027.355.027.545 0 .082.08.137.161.137h15.983c.08 0 .188-.055.215-.164l.107-.437" fill="#F38020"></path><path d="M19.238 11.75h-.242c-.054 0-.108.054-.135.109l-.35 1.2c-.134.52-.08.983.162 1.338.215.328.592.518 1.05.518l1.855.11c.054 0 .108.027.135.082.027.054.027.109.027.163-.027.082-.108.164-.188.164l-1.91.11c-1.05.054-2.153.9-2.557 1.937l-.134.355c-.027.055.026.137.107.137h6.592c.081 0 .162-.055.162-.137.107-.41.188-.846.188-1.31-.027-2.62-2.153-4.777-4.762-4.777" fill="#FCAD32"></path></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>DeepSeek</title><path d="M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z" fill="#4D6BFE"></path></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Doubao</title><path d="M5.31 15.756c.172-3.75 1.883-5.999 2.549-6.739-3.26 2.058-5.425 5.658-6.358 8.308v1.12C1.501 21.513 4.226 24 7.59 24a6.59 6.59 0 002.2-.375c.353-.12.7-.248 1.039-.378.913-.899 1.65-1.91 2.243-2.992-4.877 2.431-7.974.072-7.763-4.5l.002.001z" fill="#1E37FC"></path><path d="M22.57 10.283c-1.212-.901-4.109-2.404-7.397-2.8.295 3.792.093 8.766-2.1 12.773a12.782 12.782 0 01-2.244 2.992c3.764-1.448 6.746-3.457 8.596-5.219 2.82-2.683 3.353-5.178 3.361-6.66a2.737 2.737 0 00-.216-1.084v-.002z" fill="#37E1BE"></path><path d="M14.303 1.867C12.955.7 11.248 0 9.39 0 7.532 0 5.883.677 4.545 1.807 2.791 3.29 1.627 5.557 1.5 8.125v9.201c.932-2.65 3.097-6.25 6.357-8.307.5-.318 1.025-.595 1.569-.829 1.883-.801 3.878-.932 5.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z" fill="#A569FF"></path><path d="M17.305 4.961a199.47 199.47 0 01-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648 2.786.869 5.617 3.288.395 6.185 1.898 7.396 2.8-1.306-1.275-3.475-3.487-5.266-5.323z" fill="#1E37FC"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>HuaweiCloud</title><path d="M10.341 17.042s.062-.061 0-.061C7.516 10.902 3.646 6.22 3.646 6.22S1.557 8.168 1.68 10.174c.061 1.52 1.228 2.37 1.228 2.37 1.843 1.763 6.266 4.012 7.31 4.499h.123zm-.737 1.52c0-.061-.123-.061-.123-.061l-7.371.243c.798 1.398 2.15 2.492 3.563 2.188.983-.243 3.194-1.763 3.87-2.25.123-.12.061-.12.061-.12zm.123-.67c.062-.06 0-.12 0-.12C6.471 15.581.206 12.3.206 12.3c-.553 1.763.184 3.161.184 3.161.798 1.702 2.334 2.189 2.334 2.189.676.303 1.413.303 1.413.303h5.529c.061 0 .061-.06.061-.06zm.492-14.831c-.308 0-1.168.243-1.168.243-1.965.486-2.395 2.249-2.395 2.249-.369 1.094 0 2.31 0 2.31.675 2.857 3.87 7.598 4.545 8.57l.062.062c.061 0 .061-.061.061-.061C12.43 5.796 10.22 3.06 10.22 3.06zm2.457 13.373c.061 0 .123-.061.123-.061.737-1.033 3.87-5.714 4.545-8.57 0 0 .369-1.399 0-2.31 0 0-.491-1.764-2.457-2.25 0 0-.553-.121-1.167-.243 0 0-2.211 2.796-1.106 13.312 0 .122.062.122.062.122zm1.72 2.067s-.062 0-.062.06v.122c.738.486 2.826 2.006 3.87 2.249 0 0 1.905.669 3.563-2.188l-7.371-.243zm9.398-6.261s-6.265 3.343-9.521 5.531c0 0-.062.06-.062.122 0 0 0 .06.062.06h5.651s.553 0 1.29-.303c0 0 1.536-.487 2.396-2.25 0-.06.737-1.458.184-3.16zM13.66 17.042s.061.06.122 0c1.045-.547 5.468-2.736 7.31-4.499 0 0 1.168-.911 1.23-2.37.122-2.067-1.967-3.951-1.967-3.951s-3.87 4.559-6.695 10.698c0 0-.062.06 0 .122z" fill="#C7000B"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Hunyuan</title><circle cx="12" cy="12" fill="#0055E9" r="12"></circle><path d="M12 0c.518 0 1.028.033 1.528.096A6.188 6.188 0 0112.12 12.28l-.12.001c-2.99 0-5.242 2.179-5.554 5.11-.223 2.086.353 4.412 2.242 6.146C3.672 22.1 0 17.479 0 12 0 5.373 5.373 0 12 0z" fill="#A8DFF5"></path><path d="M5.286 5a2.438 2.438 0 01.682 3.38c-3.962 5.966-3.215 10.743 2.648 15.136C3.636 22.056 0 17.452 0 12c0-1.787.39-3.482 1.09-5.006.253-.435.525-.872.817-1.311A2.438 2.438 0 015.286 5z" fill="#0055E9"></path><path d="M12.98.04c.272.021.543.053.81.093.583.106 1.117.254 1.538.44 6.638 2.927 8.07 10.052 1.748 15.642a4.125 4.125 0 01-5.822-.358c-1.51-1.706-1.3-4.184.357-5.822.858-.848 3.108-1.223 4.045-2.441 1.257-1.634 2.122-6.009-2.523-7.506L12.98.039z" fill="#00BCFF"></path><path d="M13.528.096A6.187 6.187 0 0112 12.281a5.75 5.75 0 00-1.71.255c.147-.905.595-1.784 1.321-2.501.858-.848 3.108-1.223 4.045-2.441 1.27-1.651 2.14-6.104-2.676-7.554.184.014.367.033.548.056z" fill="#ECECEE"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.0 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Minimax</title><defs><linearGradient id="lobe-icons-minimax-_R_0_" x1="0%" x2="100.182%" y1="50.057%" y2="50.057%"><stop offset="0%" stop-color="#E2167E"></stop><stop offset="100%" stop-color="#FE603C"></stop></linearGradient></defs><path d="M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z" fill="url(#lobe-icons-minimax-_R_0_)" fill-rule="nonzero"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>ModelScope</title><path d="M0 7.967h2.667v2.667H0zM8 10.633h2.667V13.3H8z" fill="#36CED0"></path><path d="M0 10.633h2.667V13.3H0zM2.667 13.3h2.666v2.667H8v2.666H2.667V13.3zM2.667 5.3H8v2.667H5.333v2.666H2.667V5.3zM10.667 13.3h2.667v2.667h-2.667z" fill="#624AFF"></path><path d="M24 7.967h-2.667v2.667H24zM16 10.633h-2.667V13.3H16z" fill="#36CED0"></path><path d="M24 10.633h-2.667V13.3H24zM21.333 13.3h-2.666v2.667H16v2.666h5.333V13.3zM21.333 5.3H16v2.667h2.667v2.666h2.666V5.3z" fill="#624AFF"></path></svg>

After

Width:  |  Height:  |  Size: 632 B

@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>opencode</title><path d="M16 6H8v12h8V6zm4 16H4V2h16v20z"></path></svg>

After

Width:  |  Height:  |  Size: 235 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.1 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>SenseNova</title><path d="M23 8.333h-7.333v7.334H23V8.333z" fill="#06FDB7"></path><path d="M1 1v14.667h7.333V8.333h7.334V1H1z" fill="#5B2AD8"></path><path d="M14.038 4.333h.17l1.459 1.456v.17l-1.63-1.626zM13.224 4.333h.17l2.273 2.268v.17l-2.443-2.438zM12.41 4.333h.17l3.087 3.08v.17l-3.257-3.25zM11.596 4.333h.17l3.9 3.892v.108h-.06l-4.01-4zM10.782 4.333h.17l4.01 4h-.17l-4.01-4zM9.968 4.333h.17l4.009 4h-.17l-4.01-4zM9.154 4.333h.17l4.009 4h-.17l-4.01-4zM8.34 4.333h.17l4.01 4h-.17l-4.01-4zM7.521 4.333h.17l4.01 4h-.17l-4.01-4zM6.707 4.333h.17l4.01 4h-.17l-4.01-4zM5.892 4.333h.17l4.009 4h-.17l-4.01-4zM5.077 4.333h.17l4.01 4h-.17l-4.01-4zM4.333 4.403v-.07h.1l4.01 4h-.11v.06l-4-3.99zM4.333 5.215v-.17l4 3.991v.17l-4-3.99zM4.333 6.027v-.17l4 3.991v.17l-4-3.99zM4.333 6.84v-.17l4 3.99v.17l-4-3.99zM4.333 7.652v-.17l4 3.99v.17l-4-3.99zM4.333 8.464v-.17l4 3.99v.17l-4-3.99zM4.333 9.276v-.17l4 3.991v.17l-4-3.991zM4.333 10.088v-.17l4 3.991v.17l-4-3.991zM4.333 10.9v-.17l4 3.991v.17l-4-3.991zM4.333 11.712v-.17l4 3.991v.134h-.036l-3.964-3.955zM4.333 12.526v-.17l3.318 3.31h-.17l-3.148-3.14zM4.333 13.34v-.169l2.502 2.496h-.17L4.333 13.34zM4.333 14.152v-.169l1.688 1.684h-.17l-1.518-1.514zM4.333 14.965v-.17l.874.872h-.17l-.704-.702zM15.667 5.146l-.815-.813h.17l.645.644v.169z" fill="#06FDB7"></path><path d="M23 15.667h-7.333V23H23v-7.333z" fill="#5B2AD8"></path><path d="M15.667 15.667H8.333V23h7.334v-7.333z" fill="#06FDB7"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>SiliconCloud</title><path clip-rule="evenodd" d="M22.956 6.521H12.522c-.577 0-1.044.468-1.044 1.044v3.13c0 .577-.466 1.044-1.043 1.044H1.044c-.577 0-1.044.467-1.044 1.044v4.174C0 17.533.467 18 1.044 18h10.434c.577 0 1.044-.467 1.044-1.043v-3.13c0-.578.466-1.044 1.043-1.044h9.391c.577 0 1.044-.467 1.044-1.044V7.565c0-.576-.467-1.044-1.044-1.044z" fill="#6E29F6" fill-rule="evenodd"></path></svg>

After

Width:  |  Height:  |  Size: 520 B

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Stepfun</title><path d="M22.012 0h1.032v.927H24v.968h-.956V3.78h-1.032V1.896h-1.878v-.97h1.878V0zM2.6 12.371V1.87h.969v10.502h-.97zm10.423.66h10.95v.918h-6.208v9.579h-4.742V13.03zM5.629 3.333v12.356H0v4.51h10.386V8L20.859 8l-.003-4.668-15.227.001z" fill="url(#lobe-icons-stepfun-_R_0_)" fill-rule="evenodd"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-stepfun-_R_0_" x1="1.646" x2="18.342" y1="1.916" y2="22.091"><stop stop-color="#01A9FF"></stop><stop offset="1" stop-color="#0160FF"></stop></linearGradient></defs></svg>

After

Width:  |  Height:  |  Size: 676 B

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>TencentCloud</title><path d="M20.0483 17.1416C19.6945 17.4914 18.987 18.0161 17.7488 18.0161C17.2182 18.0161 16.5991 18.0161 16.3338 18.0161C15.98 18.0161 13.3268 18.0161 10.143 18.0161C12.4424 15.8298 14.3881 13.9932 14.565 13.8183C14.7419 13.6434 15.1841 13.2061 15.6263 12.8563C16.5107 12.0692 17.2182 11.9817 17.8373 11.9817C18.7217 11.9817 19.4292 12.3316 20.0483 12.8563C21.2864 13.9932 21.2864 16.0047 20.0483 17.1416ZM21.5518 11.457C20.6674 10.495 19.3408 9.88281 17.9257 9.88281C16.6875 9.88281 15.6263 10.3201 14.6534 11.0197C14.2997 11.3695 13.769 11.7194 13.3268 12.2441C12.9731 12.5939 5.36719 19.9401 5.36719 19.9401C5.80939 20.0276 6.34003 20.0276 6.78223 20.0276C7.22443 20.0276 16.0685 20.0276 16.4222 20.0276C17.1298 20.0276 17.6604 20.0276 18.191 19.9401C19.3408 19.8527 20.4905 19.4154 21.4633 18.5409C23.4975 16.6168 23.4975 13.381 21.5518 11.457Z" fill="#00A3FF"></path><path d="M9.1701 10.9323C8.19726 10.2326 7.22442 9.88281 6.07469 9.88281C4.65965 9.88281 3.33304 10.495 2.44864 11.457C0.502952 13.4685 0.502952 16.6168 2.53708 18.6283C3.42148 19.4154 4.30589 19.8527 5.36717 19.9401L7.4013 18.0161C7.04754 18.0161 6.60533 18.0161 6.25157 18.0161C5.10185 17.9287 4.39433 17.5789 3.95212 17.1416C2.71396 15.9172 2.71396 13.9932 3.86368 12.7688C4.48277 12.1566 5.19029 11.8943 6.07469 11.8943C6.60533 11.8943 7.4013 11.9817 8.19726 12.7688C8.55102 13.1186 9.52386 13.8183 9.87763 14.1681H9.96607L11.2927 12.8563V12.7688C10.6736 12.1566 9.70075 11.3695 9.1701 10.9323Z" fill="#00C8DC"></path><path d="M18.4564 8.74536C17.4836 6.12171 14.9188 4.28516 12.0003 4.28516C8.5511 4.28516 5.80945 6.82135 5.27881 9.96973C5.54413 9.96973 5.80945 9.88228 6.16321 9.88228C6.51697 9.88228 6.95917 9.96973 7.31294 9.96973C7.75514 7.78336 9.70082 6.20917 12.0003 6.20917C13.946 6.20917 15.6263 7.34608 16.4223 9.00773C16.4223 9.00773 16.5107 9.09518 16.5107 9.00773C17.1298 8.92027 17.8373 8.74536 18.4564 8.74536C18.4564 8.83282 18.4564 8.83282 18.4564 8.74536Z" fill="#006EFF"></path></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

+1
View File
@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>TRAE</title><path d="M24 20.541H3.428v-3.426H0V3.4h24V20.54zM3.428 17.115h17.144V6.827H3.428v10.288zm8.573-5.196l-2.425 2.424-2.424-2.424 2.424-2.424 2.425 2.424zm6.857-.001l-2.424 2.423-2.425-2.423 2.425-2.425 2.424 2.425z"></path></svg>

After

Width:  |  Height:  |  Size: 402 B

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Volcengine</title><path d="M19.44 10.153l-2.936 11.586a.215.215 0 00.214.261h5.87a.215.215 0 00.214-.261l-2.95-11.586a.214.214 0 00-.412 0zM3.28 12.778l-2.275 8.96A.214.214 0 001.22 22h4.532a.212.212 0 00.214-.165.214.214 0 000-.097l-2.276-8.96a.214.214 0 00-.41 0z" fill="#00E5E5"></path><path d="M7.29 5.359L3.148 21.738a.215.215 0 00.203.261h8.29a.214.214 0 00.215-.261L7.7 5.358a.214.214 0 00-.41 0z" fill="#006EFF"></path><path d="M14.44.15a.214.214 0 00-.41 0L8.366 21.739a.214.214 0 00.214.261H19.9a.216.216 0 00.171-.078.214.214 0 00.044-.183L14.439.15z" fill="#006EFF"></path><path d="M10.278 7.741L6.685 21.736a.214.214 0 00.214.264h7.17a.215.215 0 00.214-.264L10.688 7.741a.214.214 0 00-.41 0z" fill="#00E5E5"></path></svg>

After

Width:  |  Height:  |  Size: 858 B

@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8" ?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="64.0003" height="64"><defs><linearGradient id="gradient_0" gradientTransform="matrix(3.91889e-15 64 -64.0003 3.91887e-15 32.0002 -1.95943e-15)" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#0EC7A8"/><stop offset="1" stop-color="#00C885"/></linearGradient></defs><rect fill="url(#gradient_0)" width="64.0003" height="64" rx="13.8106" ry="13.8106"/><defs><filter id="filter_0" x="-3" y="13" width="78" height="69" filterUnits="userSpaceOnUse"><feGaussianBlur stdDeviation="4.4002" result="blur"/></filter></defs><g transform="matrix(1 0 0 1 18 18)" filter="url(#filter_0)"><clipPath id="clip_0"><path d="M63.9867 13.197Q63.9935 13.3503 63.9969 13.5037Q64.0003 13.6571 64.0003 13.8106L64.0003 50.1894Q64.0003 55.91 59.9553 59.955Q55.9103 64 50.1898 64L13.8106 64Q8.09 64 4.045 59.955Q0 55.91 0 50.1894L0 13.8106Q0 13.6571 0.0034 13.5037Q0.0068 13.3503 0.0136 13.197L63.9867 13.197Z" clip-rule="evenodd"/></clipPath><g clip-path="url(#clip_0)"><circle fill="#FFE255" fill-opacity="0.49" transform="matrix(1 0 0 1 14.7525 31.197)" cx="20.5928" cy="20.5928" r="20.5928"/></g></g><clipPath id="clip_1"><rect width="64.0003" height="64" rx="13.8106" ry="13.8106"/></clipPath><g clip-path="url(#clip_1)"><defs><linearGradient id="gradient_1" gradientTransform="matrix(4.35136e-15 60.044 78.3872 0 39.1936 -2.86512e-06)" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#FFF" stop-opacity="0.8"/><stop offset="0.4377" stop-color="#FFF"/><stop offset="1" stop-color="#FFF"/></linearGradient></defs><path fill="url(#gradient_1)" fill-opacity="1" transform="matrix(0.866025 -0.5 0.5 0.866025 -7.25994 37.2434)" d="M10.4632 2.7569C11.0168 1.0854 11.4183 0.4342 12.0804 0.1628C12.482 0 13.4155 0.1302 14.4249 0.4884C16.9539 1.411 21.7513 4.6672 26.755 8.8677L27.276 9.3018L29.1971 8.9111C32.3882 8.2598 34.3961 8.0211 37.9128 7.9017C41.5815 7.7714 45.4237 8.1405 49.4831 9.0196L50.7856 9.3018L52.3051 8.0645C57.7647 3.6035 62.4102 0.6729 64.798 0.1845C65.6229 0.0109 65.6663 0.0109 66.0788 0.2171C66.7517 0.5427 67.1642 1.1939 67.6418 2.6918C68.7597 6.1867 69.4978 12.4712 69.3675 17.3989L69.3133 19.3092L70.1056 20.5031C70.8654 21.6645 71.9833 23.7918 72.3741 24.8121C72.5477 25.2788 72.5912 25.3114 73.0145 25.3765C74.9248 25.6696 76.694 27.7644 77.5731 30.7926C78.3655 33.517 78.3872 37.4027 77.6382 40.203C77.508 40.648 77.1498 41.5597 76.835 42.211C75.7171 44.4903 74.0022 45.8362 72.1896 45.8471C71.8205 45.847 71.7771 45.8796 71.3864 46.5743C70.0538 48.9871 68.2229 51.1078 65.931 52.9197L65.931 18.983L12.3947 18.983L12.3947 53.6887C12.3876 53.6834 12.3806 53.6781 12.3735 53.6727C9.8011 51.7407 7.2938 48.8536 6.165 46.5308C5.872 45.9122 5.8069 45.847 5.3727 45.7385C3.0608 45.1632 1.1397 42.4932 0.3473 38.7703C0.0326 37.2833 0 34.0597 0.2822 32.5075C0.9551 28.8823 2.7352 26.2882 5.0905 25.4851C5.6983 25.2788 5.72 25.268 6.0456 24.5191C6.5775 23.2926 7.5001 21.5559 8.1947 20.4922L8.8351 19.4937L8.8677 15.8793C8.9328 10.257 9.4755 5.8177 10.4632 2.7569ZM12.5027 53.7693C16.8022 56.9564 22.7683 58.8585 31.0748 59.6967C34.5807 60.044 42.7971 60.0114 46.4874 59.6207C53.3471 58.9152 59.0672 57.2654 63.1482 54.8341C63.7166 54.4938 64.2642 54.1388 64.7905 53.7693L12.5027 53.7693Z" fill-rule="evenodd"/><path fill="#FFF" transform="matrix(0.866025 -0.5 0.5 0.866025 29.5937 50.1354)" d="M6.4145 3.2072L6.4145 10.1152Q6.4145 11.4436 5.4751 12.383Q4.5357 13.3224 3.2072 13.3224L3.2072 13.3224Q1.8788 13.3224 0.9394 12.383Q0 11.4436 0 10.1152L0 3.2072Q0 1.8788 0.9394 0.9394Q1.8788 0 3.2072 0L3.2072 0Q4.5357 0 5.4751 0.9394Q6.4145 1.8788 6.4145 3.2072Z"/><path fill="#FFF" transform="matrix(0.866025 -0.5 0.5 0.866025 46.9001 40.1434)" d="M6.4145 3.2072L6.4145 10.1152Q6.4145 11.4436 5.4751 12.383Q4.5357 13.3224 3.2072 13.3224L3.2072 13.3224Q1.8788 13.3224 0.9394 12.383Q0 11.4436 0 10.1152L0 3.2072Q0 1.8788 0.9394 0.9394Q1.8788 0 3.2072 0L3.2072 0Q4.5357 0 5.4751 0.9394Q6.4145 1.8788 6.4145 3.2072Z"/></g></svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

+1
View File
@@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 96 96" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Zed</title><path clip-rule="evenodd" d="M9 6C7.34315 6 6 7.34315 6 9V75H0V9C0 4.02944 4.02944 0 9 0H89.3787C93.3878 0 95.3955 4.84715 92.5607 7.68198L43.0551 57.1875H57V51H63V58.6875C63 61.1728 60.9853 63.1875 58.5 63.1875H37.0551L26.7426 73.5H73.5V36H79.5V73.5C79.5 76.8137 76.8137 79.5 73.5 79.5H20.7426L10.2426 90H87C88.6569 90 90 88.6569 90 87V21H96V87C96 91.9706 91.9706 96 87 96H6.62132C2.61224 96 0.604504 91.1529 3.43934 88.318L52.7574 39H39V45H33V37.5C33 35.0147 35.0147 33 37.5 33H58.7574L69.2574 22.5H22.5V60H16.5V22.5C16.5 19.1863 19.1863 16.5 22.5 16.5H75.2574L85.7574 6H9Z"/></svg>

After

Width:  |  Height:  |  Size: 760 B

@@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Zhipu</title><path d="M11.991 23.503a.24.24 0 00-.244.248.24.24 0 00.244.249.24.24 0 00.245-.249.24.24 0 00-.22-.247l-.025-.001zM9.671 5.365a1.697 1.697 0 011.099 2.132l-.071.172-.016.04-.018.054c-.07.16-.104.32-.104.498-.035.71.47 1.279 1.186 1.314h.366c1.309.053 2.338 1.173 2.286 2.523-.052 1.332-1.152 2.38-2.478 2.327h-.174c-.715.018-1.274.64-1.239 1.368 0 .124.018.23.053.337.209.373.54.658.96.8.75.23 1.517-.125 1.9-.782l.018-.035c.402-.64 1.17-.96 1.92-.711.854.284 1.378 1.226 1.099 2.167a1.661 1.661 0 01-2.077 1.102 1.711 1.711 0 01-.907-.711l-.017-.035c-.2-.323-.463-.58-.851-.711l-.056-.018a1.646 1.646 0 00-1.954.746 1.66 1.66 0 01-1.065.764 1.677 1.677 0 01-1.989-1.279c-.209-.906.332-1.83 1.257-2.043a1.51 1.51 0 01.296-.035h.018c.68-.071 1.151-.622 1.116-1.333a1.307 1.307 0 00-.227-.693 2.515 2.515 0 01-.366-1.403 2.39 2.39 0 01.366-1.208c.14-.195.21-.444.227-.693.018-.71-.506-1.261-1.186-1.332l-.07-.018a1.43 1.43 0 01-.299-.07l-.05-.019a1.7 1.7 0 01-1.047-2.114 1.68 1.68 0 012.094-1.101zm-5.575 10.11c.26-.264.639-.367.994-.27.355.096.633.379.728.74.095.362-.007.748-.267 1.013-.402.41-1.053.41-1.455 0a1.062 1.062 0 010-1.482zm14.845-.294c.359-.09.738.024.992.297.254.274.344.665.237 1.025-.107.36-.396.634-.756.718-.551.128-1.1-.22-1.23-.781a1.05 1.05 0 01.757-1.26zm-.064-4.39c.314.32.49.753.49 1.206 0 .452-.176.886-.49 1.206-.315.32-.74.5-1.185.5-.444 0-.87-.18-1.184-.5a1.727 1.727 0 010-2.412 1.654 1.654 0 012.369 0zm-11.243.163c.364.484.447 1.128.218 1.691a1.665 1.665 0 01-2.188.923c-.855-.36-1.26-1.358-.907-2.228a1.68 1.68 0 011.33-1.038c.593-.08 1.183.169 1.547.652zm11.545-4.221c.368 0 .708.2.892.524.184.324.184.724 0 1.048a1.026 1.026 0 01-.892.524c-.568 0-1.03-.47-1.03-1.048 0-.579.462-1.048 1.03-1.048zm-14.358 0c.368 0 .707.2.891.524.184.324.184.724 0 1.048a1.026 1.026 0 01-.891.524c-.569 0-1.03-.47-1.03-1.048 0-.579.461-1.048 1.03-1.048zm10.031-1.475c.925 0 1.675.764 1.675 1.706s-.75 1.705-1.675 1.705-1.674-.763-1.674-1.705c0-.942.75-1.706 1.674-1.706zm-2.626-.684c.362-.082.653-.356.761-.718a1.062 1.062 0 00-.238-1.028 1.017 1.017 0 00-.996-.294c-.547.14-.881.7-.752 1.257.13.558.675.907 1.225.783zm0 16.876c.359-.087.644-.36.75-.72a1.062 1.062 0 00-.237-1.019 1.018 1.018 0 00-.985-.301 1.037 1.037 0 00-.762.717c-.108.361-.017.754.239 1.028.245.263.606.377.953.305l.043-.01zM17.19 3.5a.631.631 0 00.628-.64c0-.355-.279-.64-.628-.64a.631.631 0 00-.628.64c0 .355.28.64.628.64zm-10.38 0a.631.631 0 00.628-.64c0-.355-.28-.64-.628-.64a.631.631 0 00-.628.64c0 .355.279.64.628.64zm-5.182 7.852a.631.631 0 00-.628.64c0 .354.28.639.628.639a.63.63 0 00.627-.606l.001-.034a.62.62 0 00-.628-.64zm5.182 9.13a.631.631 0 00-.628.64c0 .355.279.64.628.64a.631.631 0 00.628-.64c0-.355-.28-.64-.628-.64zm10.38.018a.631.631 0 00-.628.64c0 .355.28.64.628.64a.631.631 0 00.628-.64c0-.355-.279-.64-.628-.64zm5.182-9.148a.631.631 0 00-.628.64c0 .354.279.639.628.639a.631.631 0 00.628-.64c0-.355-.28-.64-.628-.64zm-.384-4.992a.24.24 0 00.244-.249.24.24 0 00-.244-.249.24.24 0 00-.244.249c0 .142.122.249.244.249zM11.991.497a.24.24 0 00.245-.248A.24.24 0 0011.99 0a.24.24 0 00-.244.249c0 .133.108.236.223.247l.021.001zM2.011 6.36a.24.24 0 00.245-.249.24.24 0 00-.244-.249.24.24 0 00-.244.249.24.24 0 00.244.249zm0 11.263a.24.24 0 00-.243.248.24.24 0 00.244.249.24.24 0 00.244-.249.252.252 0 00-.244-.248zm19.995-.018a.24.24 0 00-.245.248.24.24 0 00.245.25.24.24 0 00.244-.25.252.252 0 00-.244-.248z" fill="#3859FF" fill-rule="nonzero"></path></svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

+8
View File
@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-label="Token 羊毛">
<rect width="64" height="64" rx="16" fill="#4f46e5"/>
<circle cx="29.5" cy="35.5" r="15" fill="none" stroke="#ffffff" stroke-width="3.4"/>
<path d="M23.8 29.2 L29.5 36.2 L35.2 29.2" fill="none" stroke="#ffffff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M29.5 36.2 V44.4" fill="none" stroke="#ffffff" stroke-width="3" stroke-linecap="round"/>
<path d="M24.6 39.2 H34.4 M24.6 42.4 H34.4" fill="none" stroke="#ffffff" stroke-width="3" stroke-linecap="round"/>
<path d="M47 11.5 l2 5.1 5.1 2 -5.1 2 -2 5.1 -2 -5.1 -5.1 -2 5.1 -2 z" fill="#ffffff"/>
</svg>

After

Width:  |  Height:  |  Size: 718 B

+31
View File
@@ -0,0 +1,31 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Token 羊毛</title>
<link rel="stylesheet" href="style.css">
<script src="_magpie/bridge.js"></script>
<script src="view.js" defer></script>
<script src="app.js" defer></script>
</head>
<body>
<header class="top">
<div>
<h1>Token 羊毛</h1>
<p class="sub">看你的 magpie:哪些羊毛已能用、哪些差个插件、哪些还没插件 · 数据源 AIHOT</p>
</div>
</header>
<p class="summary" id="summary"></p>
<div class="tiles" id="buckets"></div>
<p class="hint" id="tabhint"></p>
<label class="find">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5"/></svg>
<input id="q" type="search" placeholder="在这一档里搜索厂商或羊毛…" autocomplete="off">
</label>
<div class="list" id="list"></div>
<p class="empty" id="empty" style="display:none">这一档没有符合条件的羊毛</p>
<p class="foot-note" id="footNote"></p>
<div class="toast" id="toast"></div>
</body>
</html>
+113
View File
@@ -0,0 +1,113 @@
/* 跟随 magpie 主题:优先用宿主注入的 --magpie-* 变量;无 bridge 时用回退值。 */
:root {
--bg: var(--magpie-bg, #ffffff);
--fg: var(--magpie-fg, #1d1d1f);
--fg-2: var(--magpie-fg-2, var(--magpie-muted, #6e6e73));
--muted: var(--magpie-muted, #6e6e73);
--line: var(--magpie-line, #e5e5ea);
--card: var(--magpie-card, #f6f6f7);
--pill: var(--magpie-pill, var(--magpie-card, #f0f0f2));
--accent: var(--magpie-accent, #4f46e5);
--accent-soft: var(--magpie-accent-soft, rgba(79, 70, 229, .12));
--accent-fg: var(--magpie-accent-fg, #ffffff);
--green: var(--magpie-green, #15803d);
--amber: var(--magpie-amber, #b45309);
--red: var(--magpie-red, #d70015);
--font: var(--magpie-font, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif);
}
@media (prefers-color-scheme: dark) {
:root { --bg: var(--magpie-bg, #1a1a1c); --fg: var(--magpie-fg, #ececef); --fg-2: var(--magpie-fg-2, var(--magpie-muted, #b4b4bc)); --muted: var(--magpie-muted, #9a9aa2); --line: var(--magpie-line, #33333a); --card: var(--magpie-card, #242428); --pill: var(--magpie-pill, #2c2c31); }
}
:root[data-theme="dark"] {
--bg: var(--magpie-bg, #1a1a1c); --fg: var(--magpie-fg, #ececef); --fg-2: var(--magpie-fg-2, var(--magpie-muted, #b4b4bc)); --muted: var(--magpie-muted, #9a9aa2); --line: var(--magpie-line, #33333a); --card: var(--magpie-card, #242428); --pill: var(--magpie-pill, #2c2c31);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
padding: 20px 24px 32px;
font: 13px/1.45 var(--font);
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
h1 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.summary { margin: 12px 0 12px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.summary b { color: var(--fg); font-weight: 600; }
.summary .sep { margin: 0 6px; opacity: .6; }
/* 三个计数:官方 .tile 风格 */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 6px; }
.tile {
display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
background: var(--card); border: 1px solid var(--line); border-radius: 10px;
padding: 10px 12px; text-align: left; color: inherit; cursor: pointer; min-width: 0;
transition: border-color .14s ease, background .14s ease;
}
.tile:hover:not(.on) { border-color: color-mix(in srgb, var(--fg) 16%, var(--line)); }
.tile.on { border-color: var(--accent); background: var(--accent-soft); }
.tile .k { font-size: 12px; color: var(--muted); line-height: 1.2; }
.tile .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile.on .v { color: var(--accent); }
.hint { margin: 10px 0 12px; min-height: 1.45em; font-size: 12px; color: var(--muted); }
.find { display: flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; margin-bottom: 6px; color: var(--muted); }
.find:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.find input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--fg); font-size: 12.5px; }
.find input::placeholder { color: var(--muted); }
.list { margin-top: 2px; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.avatar { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; overflow: hidden; font-size: 12px; font-weight: 600; color: #fff; }
.avatar.logo { background: #ffffff; border: 1px solid var(--line); }
.avatar.logo img { width: 19px; height: 19px; object-fit: contain; }
:root[data-theme="dark"] .avatar.logo { background: #eef0f4; border-color: #3a3a42; }
.rmain { min-width: 0; }
.rprov { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); overflow: hidden; }
.tag { flex: none; font-size: 10.5px; font-weight: 500; padding: 0 6px; height: 16px; line-height: 16px; border-radius: 5px; background: var(--pill); color: var(--fg-2); }
.rtitle { font-size: 13px; font-weight: 500; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rsub { display: flex; align-items: center; gap: 5px; margin-top: 1px; font-size: 12px; color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--amber); }
.dot.mut { background: var(--muted); opacity: .55; }
.rright { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.rval { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rval small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.cta { font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--fg-2); background: var(--card); border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px; cursor: pointer; transition: background .14s, color .14s, border-color .14s; }
.cta:hover { color: var(--fg); border-color: color-mix(in srgb, var(--fg) 16%, var(--line)); }
.cta.primary { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.cta.primary:hover { color: var(--accent-fg); background: var(--accent); }
.empty { color: var(--muted); margin: 14px 0; font-size: 13px; }
.foot-note { color: var(--muted); font-size: 11.5px; line-height: 1.5; margin: 16px 0 0; }
/* 气泡(安装 / 登录 / 复制链接) */
.pop-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .22); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.pop { width: 440px; max-width: 92vw; max-height: 82vh; overflow: auto; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .22); }
.pop-h { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.pop-steps { margin: 0 0 10px; padding-left: 18px; font-size: 12.5px; line-height: 1.55; color: var(--fg-2); }
.pop-copy { display: flex; gap: 6px; align-items: center; }
.pop-copy input { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; color: var(--fg); font-family: var(--magpie-code, ui-monospace, Menlo, monospace); font-size: 12px; }
.pop-btn { font-size: 12px; color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.pop-tip { min-height: 1.3em; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.pop-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.pop-close { font-size: 12px; color: var(--fg-2); background: var(--card); border: 1px solid var(--line); border-radius: 7px; padding: 4px 12px; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg); font-size: 12px; padding: 6px 12px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .18s; }
.toast.show { opacity: 1; }
@media (max-width: 560px) {
body { padding: 16px 16px 24px; }
.tiles { gap: 8px; }
.tile { padding: 8px 10px; }
.tile .v { font-size: 18px; }
}
+58
View File
@@ -0,0 +1,58 @@
// 纯渲染逻辑(无 DOM/网络)。浏览器里作为 classic <script> 执行,挂到 window.FTView;
// Bun 单测 import 时挂到 globalThis.FTView(无导出,纯副作用)。
(function (root) {
const KIND = { daily: "每天", monthly: "每月", once: "新人", limited: "限时", free: "免费" };
const esc = (s) => String(s == null ? "" : s).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }[c]));
const safeUrl = (u) => { try { const x = new URL(String(u || "")); return x.protocol === "https:" ? x.href : null; } catch { return null; } };
const colorFor = (n) => { const P = ["#4f46e5", "#0d9488", "#b45309", "#7c3aed", "#be123c", "#0369a1", "#15803d", "#c2410c", "#9333ea", "#0f766e", "#b91c1c", "#1d4ed8"]; let h = 0; for (const c of String(n)) h = (h * 31 + c.codePointAt(0)) >>> 0; return P[h % P.length]; };
const initials = (n) => { const s = String(n || "?").trim(); if (/^[\x00-\x7F]/.test(s)) { const w = s.split(/\s+/); return (w[0][0] + (w[1] ? w[1][0] : "")).toUpperCase(); } return s.slice(0, 1); };
const fmtYuan = (y) => { const n = +y; if (!isFinite(n)) return ""; return n >= 100 ? String(Math.round(n)) : n.toFixed(2).replace(/\.?0+$/, ""); };
function resolvePid(d, m) { const pid = m.pid; if (Array.isArray(pid)) { if (/qoder\.com/.test(d.url || "")) return "qoder"; if (/qoder\.cn/.test(d.url || "")) return "qoder-cn"; return pid[0]; } return pid; }
function bucketOf(d, mapping, demoState) {
const m = mapping[d.provider];
if (!m) return { key: "none" };
if (!demoState.configKnown) return { key: "setup", mode: "install", m, unknown: true };
const st = demoState.installed[resolvePid(d, m)];
if (!st) return { key: "setup", mode: "install", m };
if (!st.signedIn) return { key: "setup", mode: "login", m };
return { key: "ready", m, checkin: d.kind === "daily" ? st.checkin : null };
}
function counts(deals, mapping, demoState) { const c = { ready: 0, setup: 0, none: 0 }; for (const d of deals) c[bucketOf(d, mapping, demoState).key]++; return c; }
function avatarHtml(provider, icons) { const src = icons[provider]; if (src) return `<div class="avatar logo" data-ini="${esc(initials(provider))}" data-col="${colorFor(provider)}"><img src="${esc(src)}" alt=""></div>`; return `<div class="avatar gen" style="background:${colorFor(provider)}">${esc(initials(provider))}</div>`; }
function summaryHtml(meta, total, c) { return `今天还能领 <b>¥${esc(meta.todayClaimable)}</b><span class="sep">·</span>共 <b>${total}</b> 项羊毛<span class="sep">·</span>已配置可用 <b>${c.ready}</b> · 待配置 <b>${c.setup}</b> · 暂无插件 <b>${c.none}</b>`; }
// 安装/登录气泡的文案(纯函数,便于单测:确保用完整 npm 包名,不用短名)
function installSteps(npm) { return ["在 magpie「插件 → 发现」页最下方「已有想装的?」输入框,粘贴下面的包名,点「安装」", `(终端方式:magpie plugin add ${npm})`]; }
function loginSteps(name, pid) { return [`magpie →「插件 → 已安装」,找到「${name}」那一行`, "点该行「登录」,按提示完成(浏览器 / 设备码)"]; }
function actionOf(ds) {
if (!ds || !ds.act) return null;
if (ds.act === "install") return { title: `安装插件:${ds.name}`, steps: installSteps(ds.npm), copyText: ds.npm };
if (ds.act === "login") return { title: `登录:${ds.name}`, steps: loginSteps(ds.name, ds.pid), copyText: ds.pid ? `magpie plugin login ${ds.pid}` : "" };
if (ds.act === "copy") { const url = safeUrl(ds.url); return url ? { title: "来源链接", steps: ["页面沙盒不能直接打开外链,复制后到浏览器打开。"], copyText: url } : null; }
return null;
}
function rowHtml(d, ctx) {
const { mapping, demoState, icons } = ctx;
const b = bucketOf(d, mapping, demoState);
const yuan = d.yuan != null ? `¥${fmtYuan(d.yuan)}` : (d.label || d.face || "");
const yuanSub = d.yuan != null && (d.label || d.face) ? `<small>${esc(d.label || d.face)}</small>` : "";
const url = safeUrl(d.url);
let sub = "", act = "";
if (b.key === "ready") {
if (d.kind === "daily" && b.checkin != null) {
if (b.checkin === "claimed" || b.checkin === "done") sub = `<span class="dot ok"></span>今日已领`;
else if (b.checkin === "none") sub = `<span class="dot warn"></span>今日可领`;
else sub = `<span class="dot ok"></span>可用`;
} else sub = `<span class="dot ok"></span>可用`;
} else if (b.key === "setup") {
sub = `<span class="dot mut"></span>插件:${esc(b.m.name)}`;
const pid = resolvePid(d, b.m);
act = `<button class="cta primary" data-act="${b.mode}" data-name="${esc(b.m.name)}" data-npm="${esc(b.m.npm)}" data-pid="${esc(pid)}">${b.mode === "login" ? "去登录" : "安装插件"}</button>`;
} else {
sub = `<span class="dot mut"></span>暂无可用插件`;
act = url ? `<button class="cta" data-act="copy" data-url="${esc(url)}">复制链接</button>` : "";
}
return `<div class="row">${avatarHtml(d.provider, icons)}<div class="rmain"><div class="rprov">${esc(d.provider)} <span class="tag">${esc(KIND[d.kind] || d.kind || "")}</span></div><div class="rtitle">${esc(d.title)}</div><div class="rsub">${sub}</div></div><div class="rright"><div class="rval">${esc(yuan)}${yuanSub}</div>${act}</div></div>`;
}
const api = { KIND, esc, safeUrl, colorFor, initials, fmtYuan, resolvePid, bucketOf, counts, avatarHtml, summaryHtml, installSteps, loginSteps, actionOf, rowHtml };
root.FTView = api;
})(typeof globalThis !== "undefined" ? globalThis : this);
+17
View File
@@ -0,0 +1,17 @@
import { decodeTurboStream } from "./turbo.js";
const URL = "https://aihot.news/free-tokens.data";
// fetchImpl 可注入,方便离线单测
export async function fetchFreeTokens(fetchImpl) {
const f = fetchImpl || globalThis.fetch;
const signal = (typeof AbortSignal !== "undefined" && AbortSignal.timeout) ? AbortSignal.timeout(15000) : undefined;
const res = await f(URL, {
signal,
headers: {
"User-Agent": "magpie-free-tokens/0.1 (+local-desktop-plugin)", // 诚实 UA,不伪装浏览器
"Accept": "text/plain",
"Accept-Encoding": "gzip, br",
},
});
if (!res.ok) throw new Error(`AIHOT ${res.status} ${res.statusText || ""}`.trim());
return decodeTurboStream(await res.text());
}
+10
View File
@@ -0,0 +1,10 @@
// 只展示 AIHOT 上「厂商/平台自己的官方额度」,不展示第三方中转站。
// 新增官方厂商需在此登记;不在名单里的 provider 一律不发到页面(安全默认拒绝)。
export const OFFICIAL_PROVIDERS = new Set([
"豆包", "华为云 OfficeAce", "商汤小浣熊", "腾讯 ima",
"Cloudflare", "fal", "MiniMax", "阿里云 Qoder", "字节 TRAE", "腾讯 WorkBuddy",
"WPS 灵犀", "蚂蚁百灵", "腾讯 EdgeOne", "书生·端砚", "腾讯云 ADP",
"ElevenLabs", "Zed", "百度千帆", "阿里云百炼", "超算互联网", "DeepSeek",
"腾讯云 TokenHub", "火山方舟", "华为云码道", "腾讯云开发", "智谱 AutoClaw",
"智谱 ZCode", "商汤日日新", "OpenCode", "阶跃星辰", "SoMark",
]);
+68
View File
@@ -0,0 +1,68 @@
import { MAPPING } from "./mapping.js";
import { BRAND } from "./icons.js";
import { OFFICIAL_PROVIDERS } from "./allowlist.js";
const KINDS = new Set(["daily", "monthly", "once", "limited", "free"]);
function todayBJ() { return new Date().toLocaleDateString("en-CA", { timeZone: "Asia/Shanghai" }); }
const RANK = { claimed: 4, done: 3, inactive: 2, failed: 1 };
function checkinFor(checkin, pid) {
if (checkin == null) return null; // 未知:文件读失败
let best = "none";
const today = todayBJ();
for (const [k, v] of Object.entries(checkin)) {
if (!(k === pid || k.startsWith(pid + "|"))) continue;
if (!v) continue;
if (v.day && v.day !== today) continue;
const o = v.outcome;
if (o && RANK[o] && RANK[o] > (RANK[best] || 0)) best = o;
}
return best;
}
function buildState(local) {
const installed = {};
if (local.providers != null) {
for (const p of local.providers) {
if (!p || !p.id) continue;
installed[p.id] = { signedIn: !!p.signedIn, checkin: checkinFor(local.checkin, p.id), name: p.name || p.id };
}
}
return { installed, configKnown: local.providers != null, checkinKnown: local.checkin != null };
}
function safeUrl(u) { try { const x = new URL(String(u || "")); return x.protocol === "https:" ? x.href : null; } catch { return null; } }
// 只保留规范字段并做脱敏:kind 限白名单、url 限 https
function pick(x) {
return {
id: typeof x.id === "string" ? x.id : String(x.id ?? ""),
kind: KINDS.has(x.kind) ? x.kind : "other",
title: String(x.title ?? ""),
provider: String(x.provider ?? "").trim(),
detail: String(x.detail ?? ""),
url: safeUrl(x.url),
tags: Array.isArray(x.tags) ? x.tags.filter((t) => typeof t === "string") : [],
endsAt: typeof x.endsAt === "string" ? x.endsAt : null,
validity: String(x.validity ?? ""),
verifiedAt: typeof x.verifiedAt === "string" ? x.verifiedAt : null,
yuan: typeof x.yuan === "number" ? x.yuan : null,
label: String(x.label ?? ""),
face: String(x.face ?? ""),
counted: x.counted === true,
};
}
function countKinds(ds) { const c = {}; for (const d of ds) c[d.kind] = (c[d.kind] || 0) + 1; return c; }
export function buildPayload(ftData, local) {
// 只保留官方厂商(白名单),杜绝第三方中转站进入 magpie
const raw = (ftData.deals || []).filter((x) => x && OFFICIAL_PROVIDERS.has(String(x.provider ?? "").trim()));
const deals = raw.map(pick);
const priced = deals.filter((d) => d.yuan != null);
const today = Math.round(deals.filter((d) => d.counted && d.yuan != null).reduce((s, d) => s + d.yuan, 0));
const meta = {
generatedAt: new Date().toISOString(), source: "aihot.news/free-tokens",
todayClaimable: today, faceTotal: +priced.reduce((s, d) => s + d.yuan, 0).toFixed(2),
pricedCount: priced.length, monthlyClaimed: 0, totalDeals: deals.length, kindCounts: countKinds(deals), basis: ftData.basis || null,
};
const icons = {};
for (const d of deals) { if (BRAND[d.provider] && !icons[d.provider]) icons[d.provider] = "brand/" + BRAND[d.provider]; }
return { meta, deals, mapping: MAPPING, demoState: buildState(local), icons };
}
+24
View File
@@ -0,0 +1,24 @@
// 厂商 → magpie 自带品牌图标(来自 magpie internal/gui/assets/icons,已拷到 page/brand/)。
// 不在表里的厂商,前端用“首字母/首字”色块兜底。
export const BRAND = {
"豆包": "doubao-color.svg",
"Cloudflare": "cloudflare-color.svg",
"MiniMax": "minimax-color.svg",
"阿里云 Qoder": "qoder.svg",
"字节 TRAE": "trae.svg",
"腾讯 WorkBuddy": "workbuddy-color.svg",
"百度千帆": "baidu-color.svg",
"阿里云百炼": "bailian-color.svg",
"DeepSeek": "deepseek-color.svg",
"腾讯云 TokenHub": "hunyuan-color.svg",
"火山方舟": "volcengine-color.svg",
"华为云码道": "huaweicloud-color.svg",
"腾讯云开发": "tencentcloud-color.svg",
"智谱 AutoClaw": "zhipu-color.svg",
"智谱 ZCode": "zcode.png",
"商汤日日新": "sensenova-color.svg",
"OpenCode": "opencode.svg",
"阶跃星辰": "stepfun-color.svg",
"书生·端砚": "internlm-color.svg",
"Zed": "zed.svg",
};
+26
View File
@@ -0,0 +1,26 @@
import fs from "node:fs";
import path from "node:path";
import os from "node:os";
// 配置目录:magpie 通过 input.directory 传的是 settings.Dir()
// (internal/plugin/host.go:1160;portable 时=数据目录,否则 ~/.config/magpie),直接信任它。
// 其余仅作离线/测试兜底,绝不回落到宿主工作目录。
export function configDir(input, homedir = os.homedir()) {
if (process.env.MAGPIE_CONFIG_DIR) return process.env.MAGPIE_CONFIG_DIR;
if (input && input.directory) return input.directory;
if (process.env.XDG_CONFIG_HOME) return path.join(process.env.XDG_CONFIG_HOME, "magpie");
return path.join(homedir, ".config", "magpie");
}
// 读本机状态:文件缺失 = 空(fresh);存在但解析失败 = null(未知,不做签到判断)。
export function readLocal(dir) {
const read = (f) => {
try { return { ok: true, val: JSON.parse(fs.readFileSync(path.join(dir, f), "utf8")) }; }
catch (e) { return { ok: false, missing: e && e.code === "ENOENT" }; }
};
const pv = read("plugin-providers.json");
const ck = read("plugin-checkin.json");
const providers = pv.ok ? (Array.isArray(pv.val) ? pv.val : []) : (pv.missing ? [] : null);
const checkin = ck.ok ? (ck.val && typeof ck.val === "object" && !Array.isArray(ck.val) ? ck.val : {}) : (ck.missing ? {} : null);
return { providers, checkin, dir };
}
+16
View File
@@ -0,0 +1,16 @@
// AIHOT 羊毛 → magpie 插件。一律用完整 npm 包名(magpie plugin add <npm>),不使用短名(短名可能指向被抢注的无作用域包)。
export const MAPPING = {
"豆包": { pid: "doubao-work", npm: "@magpie-community/opencode-doubao-work-auth", name: "豆包工作", checkin: false },
"Cloudflare": { pid: "cloudflare-workers-ai", npm: "@magpie-community/opencode-cloudflare-workers-ai-auth", name: "Cloudflare Workers AI", checkin: false },
"MiniMax": { pid: "minimax-code", npm: "@magpie-community/opencode-minimax-auth", name: "MiniMax Code", checkin: true },
"阿里云 Qoder": { pid: ["qoder", "qoder-cn"], npm: "@magpie-community/opencode-qoder-auth", name: "Qoder", checkin: true },
"字节 TRAE": { pid: "trae-cn", npm: "@magpie-community/opencode-trae-auth", name: "Trae", checkin: true },
"腾讯 WorkBuddy": { pid: "workbuddy", npm: "@magpie-community/opencode-workbuddy-auth", name: "WorkBuddy", checkin: true },
"书生·端砚": { pid: "intern-inkstone", npm: "@magpie-community/opencode-inkstone-auth", name: "书生·端砚", checkin: true },
"Zed": { pid: "zed", npm: "@magpie-community/opencode-zed-auth", name: "Zed", checkin: false },
"华为云码道": { pid: "codearts", npm: "@magpie-community/opencode-codearts-auth", name: "CodeArts", checkin: true },
"智谱 AutoClaw": { pid: "autoclaw-cn", npm: "@magpie-community/opencode-autoclaw-auth", name: "AutoClaw", checkin: true },
"智谱 ZCode": { pid: "zcode", npm: "@magpie-community/opencode-zcode-auth", name: "ZCode", checkin: true },
"商汤日日新": { pid: "sensenova-token-plan", npm: "@magpie-community/opencode-sensenova-auth", name: "SenseNova", checkin: false },
"OpenCode": { pid: "opencode-zen-free", npm: "@magpie-community/opencode-zen-free-auth", name: "OpenCode Zen Free", checkin: false },
};
+27
View File
@@ -0,0 +1,27 @@
// host 刷新逻辑(独立模块,便于单测;index.js 只导出 default,避免被 check.mjs 当插件调用)。
import fs from "node:fs";
import { fileURLToPath } from "node:url";
import { fetchFreeTokens } from "./aihot.js";
import { configDir, readLocal } from "./inventory.js";
import { buildPayload } from "./classify.js";
function defaultDataPath() { return process.env.FREE_TOKENS_DATA_PATH || fileURLToPath(new URL("../page/data.js", import.meta.url)); }
function writeAtomic(file, text) { const t = file + ".tmp"; fs.writeFileSync(t, text); fs.renameSync(t, file); }
export async function refresh(input, opts = {}) {
const dir = (opts.configDir || configDir)(input);
const local = (opts.readLocal || readLocal)(dir);
const getFt = opts.fetchFreeTokens || fetchFreeTokens;
const path = opts.dataPath || defaultDataPath();
let payload;
try {
payload = buildPayload(await getFt(), local);
} catch (e) {
writeAtomic(path, "window.__FREE_TOKENS__ = { error: true, meta: { generatedAt: " + JSON.stringify(new Date().toISOString()) + " } };\n");
console.error("[free-tokens] fetch failed:", e.message);
return null;
}
writeAtomic(path, "window.__FREE_TOKENS__ = " + JSON.stringify(payload) + ";\n");
console.error(`[free-tokens] data.js: ${payload.deals.length} deals · ${Object.keys(payload.demoState.installed).length} providers${payload.demoState.configKnown ? "" : " · config unknown"}`);
return payload;
}
+26
View File
@@ -0,0 +1,26 @@
// free-tokens.data 的 turbo-stream v2「flatten」解码器(零依赖)。
// 结构:JSON 数组,下标即引用 id;对象写成 {"_<keyId>": <valueId>}(key/value 皆为数组下标);
// 负数内联常量(<0 → null)。本数据无 Date 对象,时间均为 ISO 字符串 / 毫秒数。
export function decodeTurboStream(text) {
let A;
try { A = JSON.parse(text); } catch (e) { throw new Error("free-tokens.data 不是合法 JSON: " + e.message); }
if (!Array.isArray(A)) throw new Error("free-tokens.data 结构异常(非数组)");
const ref = (i) => (typeof i === "number" && i < 0 ? null : (typeof i === "number" ? hydrate(A[i]) : hydrate(i)));
function hydrate(v) {
if (Array.isArray(v)) return v.map((x) => (typeof x === "number" ? ref(x) : hydrate(x)));
if (v && typeof v === "object") {
const out = {};
for (const [k, val] of Object.entries(v)) {
const value = typeof val === "number" ? ref(val) : hydrate(val);
if (k.charCodeAt(0) === 95 /* _ */) out[A[Number(k.slice(1))]] = value;
else out[k] = value;
}
return out;
}
return v;
}
const root = hydrate(A[0]);
const ft = root["free-tokens"] || (root.root && root.root["free-tokens"]);
if (!ft || !ft.data || !Array.isArray(ft.data.deals)) throw new Error("free-tokens 数据缺失(deals 未找到)");
return ft.data; // { deals, ended, basis, serverNow, expiresAt }
}
+19
View File
@@ -0,0 +1,19 @@
import { test } from "bun:test";
import assert from "node:assert/strict";
import { fetchFreeTokens } from "../src/aihot.js";
const flat = JSON.stringify([{ _1: 2 }, "free-tokens", { _3: 4 }, "data", { _5: 6 }, "deals", []]);
test("fetch ok decodes body and sends honest UA", async () => {
let seen = null;
const fake = async (url, init) => { seen = { url, init }; return { ok: true, status: 200, text: async () => flat }; };
const d = await fetchFreeTokens(fake);
assert.deepEqual(d, { deals: [] });
assert.match(seen.url, /aihot\.news\/free-tokens\.data/);
assert.match(seen.init.headers["User-Agent"], /magpie-free-tokens/);
assert.equal(seen.init.headers.Accept, "text/plain");
});
test("non-ok throws", async () => {
const fake = async () => ({ ok: false, status: 500, statusText: "Server Error" });
await assert.rejects(() => fetchFreeTokens(fake), /AIHOT 500/);
});
+35
View File
@@ -0,0 +1,35 @@
import { test } from "bun:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import { fileURLToPath } from "node:url";
import { BRAND } from "../src/icons.js";
import { MAPPING } from "../src/mapping.js";
import { OFFICIAL_PROVIDERS } from "../src/allowlist.js";
import "../page/view.js";
const pageDir = fileURLToPath(new URL("../page/", import.meta.url));
test("every brand icon file exists in page/brand", () => {
for (const [prov, file] of Object.entries(BRAND)) assert.ok(fs.existsSync(pageDir + "brand/" + file), `${prov} -> ${file}`);
});
test("index.html local assets exist (except magpie bridge & generated data.js)", () => {
const html = fs.readFileSync(pageDir + "index.html", "utf8");
const refs = [...html.matchAll(/(?:src|href)="([^"]+)"/g)].map((m) => m[1]).filter((u) => !/^(https?:|data:|#)/.test(u));
for (const r of refs) { if (r.startsWith("_magpie/") || r === "data.js") continue; assert.ok(fs.existsSync(pageDir + r), `missing asset: ${r}`); }
});
test("load order: view.js before app.js", () => {
const html = fs.readFileSync(pageDir + "index.html", "utf8");
assert.ok(html.indexOf("view.js") >= 0 && html.indexOf("app.js") > html.indexOf("view.js"));
});
test("every mapping provider is in the official allowlist (else it'd never show)", () => {
for (const k of Object.keys(MAPPING)) assert.ok(OFFICIAL_PROVIDERS.has(k), `mapping provider not allowlisted: ${k}`);
});
test("allowlist non-empty; kept vendor present; dropped providers excluded", () => {
assert.ok(OFFICIAL_PROVIDERS.size > 0);
assert.ok(OFFICIAL_PROVIDERS.has("DeepSeek"));
for (const p of ["Nace AI", "硅基流动", "秒悟 Meoo", "魔搭社区"]) assert.ok(!OFFICIAL_PROVIDERS.has(p), `should be dropped: ${p}`);
});
test("view KIND covers every classify kind", () => {
const V = globalThis.FTView;
for (const k of ["daily", "monthly", "once", "limited", "free"]) assert.ok(V.KIND[k], `missing KIND ${k}`);
});
@@ -0,0 +1,92 @@
import { test, afterAll } from "bun:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { buildPayload } from "../src/classify.js";
import { readLocal } from "../src/inventory.js";
const today = new Date().toLocaleDateString("en-CA", { timeZone: "Asia/Shanghai" });
const deal = (o = {}) => ({ id: "x", kind: "daily", title: "t", provider: "DeepSeek", detail: "", url: "https://example.com/a", tags: ["a"], endsAt: null, validity: "", verifiedAt: "2026-11-09T00:00:00Z", yuan: null, label: "", face: "", counted: true, ...o });
const ft = (deals) => ({ deals, basis: { usdCny: 6.67 } });
const TMP = [];
const mkTmp = (p) => { const d = fs.mkdtempSync(path.join(os.tmpdir(), p)); TMP.push(d); return d; };
afterAll(() => { for (const d of TMP) { try { fs.rmSync(d, { recursive: true, force: true }); } catch {} } });
test("meta sums: today counts only counted yuan; faceTotal all priced", () => {
const p = buildPayload(ft([deal({ provider: "DeepSeek", yuan: 10, counted: true }), deal({ provider: "Zed", yuan: 5, counted: false }), deal({ provider: "MiniMax", yuan: null })]), { providers: [], checkin: {} });
assert.equal(p.meta.todayClaimable, 10);
assert.equal(p.meta.faceTotal, 15);
assert.equal(p.meta.pricedCount, 2);
assert.equal(p.meta.totalDeals, 3);
assert.equal(p.meta.kindCounts.daily, 3);
});
test("allowlist drops non-official provider", () => {
const p = buildPayload(ft([deal({ provider: "某中转站" }), deal({ provider: "DeepSeek" })]), { providers: [], checkin: {} });
assert.deepEqual(p.deals.map((d) => d.provider), ["DeepSeek"]);
});
test("icons deduped per provider", () => {
const p = buildPayload(ft([deal({ provider: "豆包" }), deal({ provider: "豆包", id: "y" })]), { providers: [], checkin: {} });
assert.equal(Object.keys(p.icons).length, 1);
assert.match(p.icons["豆包"], /^brand\//);
});
test("pick sanitizes kind/url/tags/endsAt/yuan", () => {
const p = buildPayload(ft([deal({ kind: "<img src=x>", url: "javascript:alert(1)", tags: ["ok", 5], endsAt: 123, yuan: "9" })]), { providers: [], checkin: {} });
const d = p.deals[0];
assert.equal(d.kind, "other");
assert.equal(d.url, null);
assert.deepEqual(d.tags, ["ok"]);
assert.equal(d.endsAt, null);
assert.equal(d.yuan, null);
});
test("http url dropped, https kept", () => {
const p = buildPayload(ft([deal({ url: "http://x/y" }), deal({ provider: "Zed", url: "https://ok/z" })]), { providers: [], checkin: {} });
assert.equal(p.deals[0].url, null);
assert.equal(p.deals[1].url, "https://ok/z");
});
test("three tiers with installed+claimed", () => {
const local = { providers: [{ id: "qoder-cn", name: "Qoder CN", signedIn: true }], checkin: { "qoder-cn|a": { day: today, outcome: "claimed" } } };
const p = buildPayload(ft([deal({ provider: "阿里云 Qoder", url: "https://docs.qoder.cn/x" }), deal({ provider: "Zed" }), deal({ provider: "DeepSeek" })]), local);
assert.equal(p.demoState.configKnown, true);
assert.equal(p.demoState.installed["qoder-cn"].checkin, "claimed");
const t = (d) => { const m = p.mapping[d.provider]; if (!m) return "none"; const pid = Array.isArray(m.pid) ? (/qoder\.com/.test(d.url || "") ? "qoder" : /qoder\.cn/.test(d.url || "") ? "qoder-cn" : m.pid[0]) : m.pid; const st = p.demoState.installed[pid]; return !st ? "setup" : st.signedIn ? "ready" : "setup"; };
assert.deepEqual(p.deals.map(t), ["ready", "setup", "none"]);
});
test("config unknown when providers unreadable; checkin unknown when null", () => {
const dir = mkTmp("ft-cl-");
fs.writeFileSync(path.join(dir, "plugin-providers.json"), "{bad");
fs.writeFileSync(path.join(dir, "plugin-checkin.json"), "{bad");
const p = buildPayload(ft([deal({ provider: "阿里云 Qoder", url: "https://docs.qoder.cn/x" })]), readLocal(dir));
assert.equal(p.demoState.configKnown, false);
assert.equal(p.demoState.checkinKnown, false);
});
test("empty/missing deals => empty list", () => {
const p = buildPayload({}, { providers: [], checkin: {} });
assert.deepEqual(p.deals, []);
assert.equal(p.meta.totalDeals, 0);
});
test("checkin null guard: providers valid + checkin null => unknown, no throw", () => {
const p = buildPayload(ft([deal({ provider: "阿里云 Qoder", url: "https://qoder.cn/x" })]), { providers: [{ id: "qoder-cn", signedIn: true }], checkin: null });
assert.equal(p.demoState.checkinKnown, false);
assert.equal(p.demoState.installed["qoder-cn"].checkin, null);
});
test("counted must be exactly true (undefined counted excluded from today)", () => {
const p = buildPayload(ft([{ id: "x", kind: "daily", title: "t", provider: "DeepSeek", url: "https://e/x", tags: [], endsAt: null, validity: "", verifiedAt: null, yuan: 7, label: "", face: "", evidence: "official" }]), { providers: [], checkin: {} });
assert.equal(p.meta.todayClaimable, 0);
assert.equal(p.meta.faceTotal, 7);
assert.equal(p.deals[0].counted, false);
});
test("provider whitespace trimmed and still allowlisted", () => {
const p = buildPayload(ft([deal({ provider: " DeepSeek " })]), { providers: [], checkin: {} });
assert.equal(p.deals.length, 1);
assert.equal(p.deals[0].provider, "DeepSeek");
});
+46
View File
@@ -0,0 +1,46 @@
import { test, afterAll } from "bun:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { refresh } from "../src/refresh.js";
import pkg from "../index.js";
const TMP = [];
const tmp = () => { const d = fs.mkdtempSync(path.join(os.tmpdir(), "ft-idx-")); TMP.push(d); return d; };
afterAll(() => { for (const d of TMP) { try { fs.rmSync(d, { recursive: true, force: true }); } catch {} } });
const deal = { id: "x", kind: "daily", title: "t", provider: "DeepSeek", detail: "", url: "https://e/x", tags: [], endsAt: null, validity: "", verifiedAt: "2026-11-09T00:00:00Z", yuan: 3, label: "", face: "", counted: true };
test("refresh success writes payload (opts injected)", async () => {
const out = path.join(tmp(), "data.js");
const p = await refresh({}, { configDir: () => "/x", readLocal: () => ({ providers: [], checkin: {} }), fetchFreeTokens: async () => ({ deals: [deal], basis: {} }), dataPath: out });
assert.equal(p.meta.totalDeals, 1);
assert.match(fs.readFileSync(out, "utf8"), /__FREE_TOKENS__/);
});
test("refresh failure writes error marker, returns null", async () => {
const out = path.join(tmp(), "data.js");
const p = await refresh({}, { configDir: () => "/x", readLocal: () => ({ providers: [], checkin: {} }), fetchFreeTokens: async () => { throw new Error("boom"); }, dataPath: out });
assert.strictEqual(p, null);
assert.match(fs.readFileSync(out, "utf8"), /error: true/);
});
test("refresh default dataPath via env", async () => {
const out = path.join(tmp(), "data.js");
const old = process.env.FREE_TOKENS_DATA_PATH; process.env.FREE_TOKENS_DATA_PATH = out;
try { await refresh({}, { configDir: () => "/x", readLocal: () => ({ providers: [], checkin: {} }), fetchFreeTokens: async () => ({ deals: [], basis: {} }) }); assert.ok(fs.existsSync(out)); }
finally { if (old === undefined) delete process.env.FREE_TOKENS_DATA_PATH; else process.env.FREE_TOKENS_DATA_PATH = old; }
});
test("default server covers defaults (no network)", async () => {
const home = tmp(); const out = path.join(home, "data.js");
const of = globalThis.fetch;
globalThis.fetch = async () => { throw new Error("no net"); };
const oldEnv = { HOME: process.env.HOME, FREE_TOKENS_DATA_PATH: process.env.FREE_TOKENS_DATA_PATH, XDG_CONFIG_HOME: process.env.XDG_CONFIG_HOME };
process.env.HOME = home; process.env.FREE_TOKENS_DATA_PATH = out; delete process.env.XDG_CONFIG_HOME;
try {
const r = await pkg.server({ directory: path.join(home, "work") });
assert.deepEqual(r, {});
assert.match(fs.readFileSync(out, "utf8"), /error: true/);
} finally {
globalThis.fetch = of;
for (const k of Object.keys(oldEnv)) { if (oldEnv[k] === undefined) delete process.env[k]; else process.env[k] = oldEnv[k]; }
}
});
@@ -0,0 +1,42 @@
import { test, afterAll } from "bun:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { configDir, readLocal } from "../src/inventory.js";
const TMP = [];
const tmp = () => { const d = fs.mkdtempSync(path.join(os.tmpdir(), "ft-inv-")); TMP.push(d); return d; };
afterAll(() => { for (const d of TMP) { try { fs.rmSync(d, { recursive: true, force: true }); } catch {} } });
const withEnv = (env, fn) => { const old = {}; for (const k of Object.keys(env)) { old[k] = process.env[k]; if (env[k] === undefined) delete process.env[k]; else process.env[k] = env[k]; } try { return fn(); } finally { for (const k of Object.keys(old)) { if (old[k] === undefined) delete process.env[k]; else process.env[k] = old[k]; } } };
test("configDir: input.directory (settings.Dir) wins", () => withEnv({ MAGPIE_CONFIG_DIR: undefined, XDG_CONFIG_HOME: undefined }, () => {
const d = tmp(); fs.writeFileSync(path.join(d, "plugin-providers.json"), "[]");
assert.equal(configDir({ directory: d }), d);
}));
test("configDir: MAGPIE_CONFIG_DIR wins", () => withEnv({ MAGPIE_CONFIG_DIR: undefined }, () => {
const d = tmp(); fs.writeFileSync(path.join(d, "plugin-providers.json"), "[]");
assert.equal(withEnv({ MAGPIE_CONFIG_DIR: d }, () => configDir({})), d);
}));
test("configDir: XDG fallback", () => withEnv({ MAGPIE_CONFIG_DIR: undefined }, () => {
const x = tmp(); fs.mkdirSync(path.join(x, "magpie")); fs.writeFileSync(path.join(x, "magpie", "plugin-providers.json"), "[]");
assert.equal(withEnv({ XDG_CONFIG_HOME: x }, () => configDir({})), path.join(x, "magpie"));
}));
test("configDir: home fallback when no input (injected empty home)", () => withEnv({ MAGPIE_CONFIG_DIR: undefined, XDG_CONFIG_HOME: undefined }, () => {
const h = tmp();
const got = configDir({}, h);
assert.equal(got, path.join(h, ".config", "magpie"));
}));
test("configDir: trusts input.directory even without files (portable fresh)", () => withEnv({ MAGPIE_CONFIG_DIR: undefined, XDG_CONFIG_HOME: undefined }, () => {
assert.equal(configDir({ directory: "/portable/data" }, "/home/u"), "/portable/data");
}));
test("readLocal: valid providers + checkin", () => {
const d = tmp(); fs.writeFileSync(path.join(d, "plugin-providers.json"), JSON.stringify([{ id: "z", signedIn: true }])); fs.writeFileSync(path.join(d, "plugin-checkin.json"), JSON.stringify({ "z|a": { outcome: "claimed" } }));
const l = readLocal(d); assert.equal(l.providers.length, 1); assert.equal(l.checkin["z|a"].outcome, "claimed");
});
test("readLocal: missing files => empty, not null", () => { const l = readLocal(tmp()); assert.deepEqual(l.providers, []); assert.deepEqual(l.checkin, {}); });
test("readLocal: corrupt providers => null (unknown)", () => { const d = tmp(); fs.writeFileSync(path.join(d, "plugin-providers.json"), "{bad"); assert.equal(readLocal(d).providers, null); });
test("readLocal: providers non-array => []", () => { const d = tmp(); fs.writeFileSync(path.join(d, "plugin-providers.json"), "{}"); assert.deepEqual(readLocal(d).providers, []); });
test("readLocal: corrupt checkin => null (unknown)", () => { const d = tmp(); fs.writeFileSync(path.join(d, "plugin-checkin.json"), "{bad"); assert.equal(readLocal(d).checkin, null); });
test("readLocal: checkin array => {}", () => { const d = tmp(); fs.writeFileSync(path.join(d, "plugin-checkin.json"), "[]"); assert.deepEqual(readLocal(d).checkin, {}); });
@@ -0,0 +1,11 @@
import { test } from "bun:test";
import assert from "node:assert/strict";
import { MAPPING } from "../src/mapping.js";
test("every mapping npm is a scoped package (never a bare short name)", () => {
for (const [k, v] of Object.entries(MAPPING)) {
assert.match(v.npm, /^@[a-z0-9][\w.-]*\/[a-z0-9][\w.-]*$/i, `${k}: npm=${v.npm}`);
assert.equal(v.cli, undefined, `${k}: cli field must be removed`);
assert.ok(v.pid && v.name, `${k}: pid/name`);
}
});
+48
View File
@@ -0,0 +1,48 @@
import { test } from "bun:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import { fileURLToPath } from "node:url";
const pageDir = fileURLToPath(new URL("../page/", import.meta.url));
const app = fs.readFileSync(pageDir + "app.js", "utf8");
const html = fs.readFileSync(pageDir + "index.html", "utf8");
const pkg = JSON.parse(fs.readFileSync(fileURLToPath(new URL("../package.json", import.meta.url)), "utf8"));
test("page never touches the network", () => {
assert.ok(!/\bfetch\s*\(/.test(app), "app.js must not call fetch");
assert.ok(!/XMLHttpRequest|WebSocket|EventSource/.test(app), "no network APIs");
assert.ok(!/window\.open/.test(app), "no window.open (sandbox has no popups)");
});
test("page only reads declared permissions (none)", () => {
assert.ok(!/magpie\.read\s*\(/.test(app), "page must not call magpie.read");
assert.ok(!pkg.magpie.permissions || pkg.magpie.permissions.length === 0);
});
test("page uses classic scripts, not ES modules (sandbox origin null)", () => {
assert.ok(!/type=["']module["']/.test(html), "index.html must not load module scripts");
assert.match(html, /<script src="view\.js"/);
assert.match(html, /<script src="app\.js"/);
assert.ok(!/\bimport\s+[^;]*from\s+["']\.\//.test(app), "app.js must not use ESM import");
assert.match(app, /window\.FTView/);
});
test("no inline event handlers (CSP)", () => {
assert.ok(!/\son[a-z]+\s*=\s*["']/i.test(html), "index.html inline handlers");
assert.ok(!/onerror\s*=\s*["']/.test(app), "inline onerror in app.js");
});
test("html has no missing scripts / dead _blank links / theme toggle", () => {
assert.ok(!html.includes("mock-data.js"));
assert.ok(!html.includes('target="_blank"'));
assert.ok(!/id="themeBtn"/.test(html));
});
test("no mock content committed", () => {
assert.ok(!/__MOCK__|mock-data/.test(app + html));
assert.ok(!fs.existsSync(pageDir + "mock-data.js"));
assert.ok(!fs.existsSync(fileURLToPath(new URL("../data/snapshot.json", import.meta.url))));
});
test("package declares page + NOTICE", () => {
assert.equal(pkg.magpie.page.file, "page/index.html");
assert.ok(pkg.files.includes("NOTICE"));
if (String(pkg.name).startsWith("@magpie-community/")) assert.equal(pkg.repository.directory, "packages/free-tokens");
});
test("app.js delegates click decisions to view.actionOf", () => {
assert.match(app, /actionOf\(btn\.dataset\)/);
});
+22
View File
@@ -0,0 +1,22 @@
import { test } from "bun:test";
import assert from "node:assert/strict";
import { decodeTurboStream } from "../src/turbo.js";
const valid = JSON.stringify([{ _1: 2 }, "free-tokens", { _3: 4 }, "data", { _5: 6 }, "deals", []]);
const missing = JSON.stringify([{ _1: 2 }, "free-tokens", {}]);
const negRef = JSON.stringify([{ _1: 2 }, "x", -5]);
test("decodes valid flatten into ft.data", () => {
assert.deepEqual(decodeTurboStream(valid), { deals: [] });
});
test("bad JSON throws", () => assert.throws(() => decodeTurboStream("{oops"), /不是合法 JSON/));
test("non-array throws", () => assert.throws(() => decodeTurboStream("{}"), /结构异常/));
test("missing deals throws", () => assert.throws(() => decodeTurboStream(missing), /数据缺失/));
test("negative ref resolves to null then missing throws (covers ref<0)", () => assert.throws(() => decodeTurboStream(negRef), /数据缺失/));
test("plain key object branch (covers out[k]) and scalar element", () => {
const plainKey = JSON.stringify([{ a: 1 }, "zz"]);
assert.throws(() => decodeTurboStream(plainKey), /数据缺失/);
const scalar = JSON.stringify([{ _1: 2 }, "free-tokens", { _3: 4 }, "data", { _5: 6 }, "deals", ["s"]]);
assert.deepEqual(decodeTurboStream(scalar), { deals: ["s"] });
});
+74
View File
@@ -0,0 +1,74 @@
import { test } from "bun:test";
import assert from "node:assert/strict";
import "../page/view.js";
const V = globalThis.FTView;
const MAP = { "阿里云 Qoder": { pid: ["qoder", "qoder-cn"], npm: "@magpie-community/opencode-qoder-auth", name: "Qoder" } };
const ctx = (over = {}) => ({ mapping: MAP, demoState: { configKnown: true, installed: {} }, icons: {}, ...over });
test("V is exposed as a global (classic script)", () => { assert.ok(V && typeof V.rowHtml === "function"); });
test("esc / safeUrl / colorFor / initials / fmtYuan", () => {
assert.equal(V.esc(`<a>&"'`), "&lt;a&gt;&amp;&quot;&#39;");
assert.equal(V.safeUrl("javascript:alert(1)"), null);
assert.equal(V.safeUrl("https://a/b"), "https://a/b");
assert.match(V.colorFor("abc"), /^#/);
assert.equal(V.initials("Deep Seek"), "DS"); assert.equal(V.initials("豆包"), "豆"); assert.equal(V.initials(""), "?");
assert.equal(V.fmtYuan(120), "120"); assert.equal(V.fmtYuan(12.5), "12.5"); assert.equal(V.fmtYuan("x"), "");
});
test("resolvePid array/nonarray", () => {
assert.equal(V.resolvePid({ url: "https://qoder.com/x" }, MAP["阿里云 Qoder"]), "qoder");
assert.equal(V.resolvePid({ url: "https://qoder.cn/x" }, MAP["阿里云 Qoder"]), "qoder-cn");
assert.equal(V.resolvePid({ url: "https://other/x" }, MAP["阿里云 Qoder"]), "qoder");
assert.equal(V.resolvePid({}, { pid: "z" }), "z");
});
test("bucketOf tiers", () => {
const D = { provider: "阿里云 Qoder", url: "https://qoder.cn/x", kind: "daily" };
assert.equal(V.bucketOf({ provider: "X" }, MAP, { configKnown: true, installed: {} }).key, "none");
assert.equal(V.bucketOf(D, MAP, { configKnown: false, installed: {} }).key, "setup");
assert.equal(V.bucketOf(D, MAP, { configKnown: true, installed: {} }).key, "setup");
assert.equal(V.bucketOf(D, MAP, { configKnown: true, installed: { "qoder-cn": { signedIn: false } } }).mode, "login");
const r = V.bucketOf(D, MAP, { configKnown: true, installed: { "qoder-cn": { signedIn: true, checkin: "claimed" } } });
assert.equal(r.key, "ready"); assert.equal(r.checkin, "claimed");
assert.equal(V.bucketOf({ ...D, kind: "monthly" }, MAP, { configKnown: true, installed: { "qoder-cn": { signedIn: true } } }).checkin, null);
});
test("counts", () => { const c = V.counts([{ provider: "X" }, { provider: "阿里云 Qoder", url: "https://qoder.cn/x", kind: "daily" }], MAP, { configKnown: true, installed: { "qoder-cn": { signedIn: true } } }); assert.equal(c.none, 1); assert.equal(c.ready, 1); });
test("avatarHtml icon vs fallback", () => { assert.match(V.avatarHtml("豆包", { "豆包": "brand/x.svg" }), /avatar logo/); const g = V.avatarHtml("豆包", {}); assert.match(g, /avatar gen/); assert.match(g, /豆/); });
test("summaryHtml", () => { const s = V.summaryHtml({ todayClaimable: 201 }, 50, { ready: 14, setup: 8, none: 28 }); assert.match(s, /¥201/); assert.match(s, /50/); });
test("rowHtml ready checkin states + yuan", () => {
const b = { provider: "阿里云 Qoder", url: "https://qoder.cn/x", kind: "daily", title: "t", yuan: 12, label: "≈12" };
const r = (checkin) => V.rowHtml(b, ctx({ demoState: { configKnown: true, installed: { "qoder-cn": { signedIn: true, checkin } } } }));
assert.match(r("claimed"), /今日已领/); assert.match(r("done"), /今日已领/); assert.match(r("none"), /今日可领/); assert.match(r(null), /可用/); assert.match(r("failed"), /可用/); assert.match(r("inactive"), /可用/);
assert.match(r("claimed"), /¥12/); assert.match(r("claimed"), /<small>≈12<\/small>/);
assert.match(V.rowHtml({ ...b, kind: "monthly" }, ctx({ demoState: { configKnown: true, installed: { "qoder-cn": { signedIn: true } } } })), /可用/);
});
test("rowHtml setup install/login buttons", () => {
const b = { provider: "阿里云 Qoder", url: "https://qoder.cn/x", kind: "daily", title: "t" };
const ins = V.rowHtml(b, ctx());
assert.match(ins, /安装插件/); assert.match(ins, /data-npm="@magpie-community\/opencode-qoder-auth"/); assert.match(ins, /data-pid="qoder-cn"/);
assert.match(V.rowHtml(b, ctx({ demoState: { configKnown: true, installed: { "qoder-cn": { signedIn: false } } } })), /去登录/);
});
test("rowHtml none with/without url", () => {
assert.match(V.rowHtml({ provider: "X", url: "https://e/x", kind: "daily", title: "t" }, ctx()), /复制链接/);
assert.ok(!/复制链接/.test(V.rowHtml({ provider: "X", url: "javascript:1", kind: "daily", title: "t" }, ctx())));
});
test("rowHtml escapes kind/title (xss)", () => {
const r = V.rowHtml({ provider: "X", kind: "<img>", title: "<b>evil</b>", url: "https://e/x" }, ctx({ mapping: {} }));
assert.ok(!/<img>/.test(r)); assert.match(r, /&lt;img&gt;/);
assert.ok(!/<b>/.test(r)); assert.match(r, /&lt;b&gt;evil&lt;\/b&gt;/);
});
test("installSteps uses full npm; loginSteps given", () => {
const s = V.installSteps("@magpie-community/opencode-zed-auth");
assert.match(s[1], /magpie plugin add @magpie-community\/opencode-zed-auth/);
const l = V.loginSteps("Qoder", "qoder-cn"); assert.match(l[0], /Qoder/);
});
test("actionOf builds install/login/copy payloads from dataset", () => {
const ins = V.actionOf({ act: "install", name: "Zed", npm: "@magpie-community/opencode-zed-auth" });
assert.equal(ins.copyText, "@magpie-community/opencode-zed-auth");
assert.match(ins.steps[1], /magpie plugin add @magpie-community\/opencode-zed-auth/);
const lg = V.actionOf({ act: "login", name: "Qoder", pid: "qoder-cn" });
assert.equal(lg.copyText, "magpie plugin login qoder-cn");
const cp = V.actionOf({ act: "copy", url: "https://e/x" }); assert.equal(cp.copyText, "https://e/x");
assert.equal(V.actionOf({ act: "copy", url: "javascript:1" }), null);
assert.equal(V.actionOf({ act: "weird" }), null);
assert.equal(V.actionOf(null), null);
});
+2
View File
@@ -245,6 +245,8 @@
},
{ "package": "@magpie-community/opencode-astudio-auth", "name": "AStudio", "providers": ["astudio"], "community": true,
"summary": { "en": "Unofficial AStudio (iFLYTEK Astron Studio): sign in through a browser (each account gets its own pool slot), reuse the desktop sign-in, or paste a token, to serve its Responses model gateway with the live model catalog, daily login-points check-in (read from the credit ledger) and points balance with spark-point expiry. Differs from Providers Hub's hub-astudio, which signs in on a local page (SMS, password or WeChat QR) and calls chat/completions; on one account both share the same daily points pool.", "zh": "非官方 AStudio(科大讯飞 Astron Studio):支持浏览器登录(每个账号占账号池一格)、复用桌面端登录态或粘贴凭据,接入其模型网关,含实时模型目录、每日登录积分签到(按积分流水判定)与积分余额/星火到期时间。与 Providers Hub 的 hub-astudio 不同:那边在本地登录页用短信、密码或微信扫码登录,走 chat/completions;同一账号两边共用一个每日积分池。" } },
{ "package": "@magpie-community/page-free-tokens", "name": "Token 羊毛", "kind": "page", "community": true,
"summary": { "en": "AIHOT's Token freebies in magpie's window, in three tiers: already configured and usable, needs one more plugin, or no plugin yet.", "zh": "AIHOT 的 Token 羊毛,在 magpie 窗口里分三档:已配置可用 / 差一个插件 / 暂无插件。" } },
{ "package": "@magpie-community/opencode-agnes-code-auth", "name": "Agnes Code", "providers": ["agnes-code"], "community": true,
"summary": { "en": "Unofficial Agnes Code desktop: reuse the desktop sign-in for its OpenAI-compatible gateway, with the live model catalog, daily credit check-in and points balance. Desktop decryption is Windows-only; a paste-token method covers the rest. Differs from opencode-agnes-auth (`agnes`), which signs in to Agnes AI international in Chrome and meters that product's plans and USD balance: this one serves the Agnes Code desktop product and its daily credits.", "zh": "非官方 Agnes Code 桌面端:复用桌面端登录态接入其 OpenAI 兼容网关,含实时模型目录、每日积分签到与余额显示。桌面端解密仅限 Windows,其余平台用粘贴 accessToken。与 opencode-agnes-auth(`agnes`)不同:那边在 Chrome 里登录 Agnes AI 国际版、显示该产品的套餐与美元余额;本包服务 Agnes Code 桌面端产品与它的每日积分。" } },
{ "package": "@magpie-community/opencode-tabbit-auth", "name": "Tabbit", "icon": "https://web.tabbit.com/favicon.ico", "providers": ["tabbit"], "community": true,