Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

notices: the release carries the third-party licence notices

yetonee8c7dddcb4ad
diff --git a/Makefile b/Makefile
index 6d846c560..1e9005a42 100644
--- a/Makefile
+++ b/Makefile
@@ -63,6 +63,7 @@ app: build
@cp magpie magpie.app/Contents/MacOS/magpie
@cp build/darwin/magpie.icns magpie.app/Contents/Resources/magpie.icns
@cp build/darwin/Assets.car magpie.app/Contents/Resources/Assets.car
+ @cp THIRD_PARTY_NOTICES magpie.app/Contents/Resources/THIRD_PARTY_NOTICES
@sed 's/@VERSION@/$(VERSION)/' build/darwin/Info.plist > magpie.app/Contents/Info.plist
@echo " magpie.app"
diff --git a/internal/cli/main.go b/internal/cli/main.go
index 478780037..b9ea1484f 100644
--- a/internal/cli/main.go
+++ b/internal/cli/main.go
@@ -21,6 +21,7 @@ import (
"github.com/yetone/magpie/internal/gateway"
"github.com/yetone/magpie/internal/imagemcp"
"github.com/yetone/magpie/internal/netproxy"
+ "github.com/yetone/magpie/internal/notices"
"github.com/yetone/magpie/internal/pluginrt"
"github.com/yetone/magpie/internal/proc"
"github.com/yetone/magpie/internal/profile"
@@ -147,6 +148,7 @@ const usage = `magpie — one place to pick every agent's model
magpie update auto [on|off] [download|notify] [30m|1h|6h|24h]
whether the app looks for updates by itself, how often (6h), and whether
it downloads one at once or only says it is out (notify: for metered networks)
+ magpie licenses the third-party notices of what magpie is built with
agents: claude (cc), codex, gemini, opencode (oc), mimocode, deveco, pi, goose, cursor, zed, copilot, crush, aside
`
@@ -175,6 +177,9 @@ func Main(v string) {
case "-h", "--help", "help":
fmt.Print(usage)
return
+ case "licenses":
+ fmt.Print(notices.Text)
+ return
}
}
fmt.Fprintln(os.Stderr, "magpie:", err)
@@ -416,6 +421,9 @@ func run(args []string) error {
case "-v", "--version", "version":
fmt.Println("magpie", version)
return nil
+ case "licenses":
+ fmt.Print(notices.Text)
+ return nil
case "ls", "list":
// in the order the app lists them; those hidden there come last, dimmed
shown, hidden := settings.Arrange(settings.Load(), agent.Detected(), func(a *agent.Agent) string { return a.ID })
diff --git a/internal/gui/api.go b/internal/gui/api.go
index 92ea2033e..47b742a47 100644
--- a/internal/gui/api.go
+++ b/internal/gui/api.go
@@ -43,6 +43,7 @@ import (
"github.com/yetone/magpie/internal/mcpauth"
"github.com/yetone/magpie/internal/middleware"
"github.com/yetone/magpie/internal/netproxy"
+ "github.com/yetone/magpie/internal/notices"
"github.com/yetone/magpie/internal/plugin"
"github.com/yetone/magpie/internal/profile"
"github.com/yetone/magpie/internal/provider"
@@ -116,6 +117,11 @@ func cliBehindRoutes(mux *http.ServeMux) {
mux.HandleFunc("GET /api/cli", func(rw http.ResponseWriter, r *http.Request) {
writeJSON(rw, update.ReadCLI())
})
+ // Settings › About's Open-source licenses: the notices this binary
+ // carries (notices.Text, THIRD_PARTY_NOTICES)
+ mux.HandleFunc("GET /api/notices", func(rw http.ResponseWriter, r *http.Request) {
+ writeJSON(rw, map[string]string{"text": notices.Text})
+ })
mux.HandleFunc("POST /api/cli", func(rw http.ResponseWriter, r *http.Request) {
var in struct {
Shell string `json:"shell"`
diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css
index ae60822f2..0b7e71940 100644
--- a/internal/gui/assets/app.css
+++ b/internal/gui/assets/app.css
@@ -4382,3 +4382,5 @@ body .row.agent .ag-prefs .row.pref .who { display: block; }
.sess-pick.led-more { padding: 0 6px; }
.sess-pick.led-more svg { transform: none; }
.sess-tools .led-rename { flex: none; width: 180px; height: 26px; padding: 0 8px; border-radius: 7px; font-size: 12px; }
+/* Settings › About › Open-source licenses: the notices, as written */
+.notices-text { margin: 0; font: 11px/1.5 var(--code); white-space: pre-wrap; overflow-wrap: anywhere; }
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index 7b1f66dda..d8d3895be 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -17848,6 +17848,23 @@ function askReset(q) {
}
// closes a confirmation, nothing more (its Cancel, or an OK that only dismisses)
function cancelAsk(e) { e.stopPropagation(); closeConfirmAsk(); }
+// THIRD_PARTY_NOTICES, which every build carries
+async function showNotices() {
+ let text;
+ try { text = (await api("notices")).text; } catch (e) { status(e.message, "err"); return; }
+ const ed = el("div", "editor wide notices");
+ const head = el("div", "ehead");
+ head.append(el("b", "", t("Open-source licenses")));
+ const bar = el("div", "bar");
+ const ok = el("button", "text primary", t("Done"));
+ ok.onclick = cancelAsk;
+ bar.append(el("span", "grow"), ok);
+ ed.append(head, el("pre", "notices-text", text), bar);
+ confirmAsk = ed;
+ openModal(ed);
+ $("#modal").classList.add("lib");
+ ok.focus({ preventScroll: true });
+}
function closeConfirmAsk() {
if (!confirmAsk) return;
// Escape and the backdrop must not expose row actions while a bulk write
@@ -19592,6 +19609,9 @@ function renderSettings() {
const site = el("button", "text", t("Open"));
site.onclick = () => api("open", { url: "https://usemagpie.ai" }).catch(() => {});
row(t("Website"), t("downloads, docs and what's new"), "usemagpie.ai", site);
+ const lic = el("button", "text", t("View"));
+ lic.onclick = showNotices;
+ row(t("Open-source licenses"), t("the notices of the code and data magpie is built with"), "", lic);
const join = el("button", "discord");
join.innerHTML = DISCORD_SVG;
join.append(el("span", "", t("Join Discord")));
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index 8be2f299d..7fbd035af 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -2542,7 +2542,7 @@ const I18N = {
"Couldn't add the plugin {spec}: {error}": "无法添加插件 {spec}:{error}",
"Library brought in and written into the agents": "资源库已导入,并已写入各 agent",
"{agent} couldn't get {what}: {error}": "{agent} 未能写入 {what}:{error}",
- "Website": "官网", "downloads, docs and what's new": "下载、文档和更新内容", "Community": "社区", "questions, ideas and feedback, on Discord or GitHub": "提问、想法和反馈,Discord 或 GitHub 都可以", "Join Discord": "加入 Discord",
+ "Website": "官网", "Open-source licenses": "开源许可", "the notices of the code and data magpie is built with": "magpie 所用代码和数据的许可声明", "downloads, docs and what's new": "下载、文档和更新内容", "Community": "社区", "questions, ideas and feedback, on Discord or GitHub": "提问、想法和反馈,Discord 或 GitHub 都可以", "Join Discord": "加入 Discord",
"Copy": "复制",
"Copied": "已复制",
"Region": "区域",
@@ -6570,7 +6570,7 @@ const I18N = {
"Couldn't add the plugin {spec}: {error}": "無法新增外掛 {spec}:{error}",
"Library brought in and written into the agents": "資源庫已匯入,並已寫入各 agent",
"{agent} couldn't get {what}: {error}": "{agent} 未能寫入 {what}:{error}",
- "Website": "官網", "downloads, docs and what's new": "下載、文件和更新內容", "Community": "社群",
+ "Website": "官網", "Open-source licenses": "開源授權", "the notices of the code and data magpie is built with": "magpie 所用程式碼和資料的授權聲明", "downloads, docs and what's new": "下載、文件和更新內容", "Community": "社群",
"questions, ideas and feedback, on Discord or GitHub": "提問、想法和反饋,Discord 或 GitHub 都可以",
"Join Discord": "加入 Discord",
"Copy": "複製",
@@ -10598,7 +10598,7 @@ const I18N = {
"Couldn't add the plugin {spec}: {error}": "プラグイン {spec} を追加できませんでした:{error}",
"Library brought in and written into the agents": "ライブラリを取り込み、エージェントに書き込みました",
"{agent} couldn't get {what}: {error}": "{agent} に {what} を書き込めませんでした:{error}",
- "Website": "公式サイト", "downloads, docs and what's new": "ダウンロード、ドキュメント、更新内容", "Community": "コミュニティ",
+ "Website": "公式サイト", "Open-source licenses": "オープンソースライセンス", "the notices of the code and data magpie is built with": "magpie が使用するコードとデータのライセンス表記", "downloads, docs and what's new": "ダウンロード、ドキュメント、更新内容", "Community": "コミュニティ",
"questions, ideas and feedback, on Discord or GitHub": "質問、アイデア、フィードバックは Discord または GitHub で",
"Join Discord": "Discord に参加",
"Copy": "コピー",
@@ -14636,7 +14636,7 @@ const I18N = {
"Couldn't add the plugin {spec}: {error}": "Die Erweiterung {spec} konnte nicht hinzugefügt werden: {error}",
"Library brought in and written into the agents": "Bibliothek importiert und in die Agenten geschrieben",
"{agent} couldn't get {what}: {error}": "{agent} konnte {what} nicht übernehmen: {error}",
- "Website": "Website", "downloads, docs and what's new": "Downloads, Dokumentation und Neuigkeiten", "Community": "Community",
+ "Website": "Website", "Open-source licenses": "Open-Source-Lizenzen", "the notices of the code and data magpie is built with": "die Lizenzhinweise des Codes und der Daten, mit denen magpie gebaut ist", "downloads, docs and what's new": "Downloads, Dokumentation und Neuigkeiten", "Community": "Community",
"questions, ideas and feedback, on Discord or GitHub": "Fragen, Ideen und Feedback auf Discord oder GitHub",
"Join Discord": "Discord beitreten",
"Copy": "Kopieren",
diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go
index 1e61a724c..3511a4cd0 100644
--- a/internal/gui/core_budget_test.go
+++ b/internal/gui/core_budget_test.go
@@ -16,7 +16,7 @@ import (
// raises them and says why in its commit.
const (
appScriptBudget = 1_310_460 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24); 1,321,336 with Codex's one subagent model, its card's square saying plainly what each choice does and a row with a name in its sheet, where two squares read alike (the owner), the Agents page's, which the tray panel draws too, the core's own, with no room added (10-24); 1,321,424 with Settings › Models' Image generation MCP server row beside Image recognition's (JonahFu on X), the two drawn by one helper (mcpRow), Settings' own, with no room added (10-25); 1,321,994 with a provider of the user's set never to rest for a limit (zoecats), the provider editor's Advanced row, the core's own editor, with no room added (10-25); 1,322,289 with Settings › Privacy's Keep a key's form under Mask secrets (Charles Cao on X), Settings' own row, with no room added (10-25); 1,322,537 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,323,401 with the tray panel drawing its last allowances at once and asking for them beside the state (#3160, #3134), the tray panel's, the core's own, and the 4 bytes 84c50f032 added, with no room added (10-25); 1,326,105 with many releases' notes merged into one list by kind, each line with its version (the owner), in the update sheet and What's new, with no room added (10-25); 1,321,319 with Settings › Observability moved out to its plugin (plugins/otel/page.js) and its Langfuse setup there (an X user), the budget lowered to it (10-26); a quota card whose window is used but names no reset no longer saying "Not used yet" (windy on Discord) raised it to 1,321,347, and back to 1,321,319 with Settings' model pickers sharing one row helper (modelOpt) where six kept their own copy, no raise (10-26); 1,325,845 with every slow page's skeletons getting magpie's bird hopping bar to bar (skelBird, the owner after the Plugins page's README), one bird for the window over whatever page or dialog is loading, the core's own, with no room added (10-26); 1,310,129 with Settings › Network and sharing's gateway rows (its port, bare ids, local network, allowed addresses, web pages) moved out to the gateway plugin (plugins/gateway/settings.js), the budget lowered to it (10-27); 1,310,269 with Test models naming the first model that failed and its error in the status line, where it said only how many (ysm119 on Discord), the provider editor's, the core's own, with no room added (10-27); 1,310,460 with Settings › About's Website row linking usemagpie.ai (the owner), Settings' own row, with no room added (10-27); 1,309,669 with a pool's Stop at the caps and Check usage near a cap ticks under a provider's accounts (plugins#349), the core's own editor, its account rows' Remove and add rows each drawn by one helper (forgetOf, addRow), with no room added (10-28)
- coreScriptBudget = 1_526_556 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25); 1,534,312 with the tray panel's last allowances drawn at once (#3160, #3134), with no room added (10-25); 1,537,016 with many releases' notes merged into one list by kind (the owner), in app.js, with no room added (10-25); 1,542,244 with a plugin's README loading under magpie's bird bouncing down its lines instead of pulsing bars (the owner), the Plugins page's, in plugins.js, with no room added (10-26); 1,542,418 with a page plugin's sidebar tab coming and going as it is installed, switched on or off, or removed, instead of on the Plugins page's next load (the owner), in plugins.js, with no room added (10-26); 1,537,645 with Settings › Observability moved out to plugins/otel, lowered to it (10-26); 1,537,673 with a used window with no reset not "Not used yet" (windy on Discord), and back to 1,537,645 with Settings' model pickers sharing modelOpt (10-26); 1,541,967 with every slow page's skeletons getting magpie's bird (skelBird, the owner), in app.js, the README's bird sharing its drawing and styles, with no room added (10-26); 1,526,251 with Settings' gateway rows moved out to plugins/gateway/settings.js, lowered to it (10-27); 1,526,391 with Test models naming the first failed model and its error (ysm119 on Discord), in app.js, with no room added (10-27); 1,526,556 with About's Website row (the owner), in app.js, with no room added (10-27); 1,526,500 with a pool's cap ticks (plugins#349), in app.js, with no room added (10-28)
+ coreScriptBudget = 1_527_245 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25); 1,534,312 with the tray panel's last allowances drawn at once (#3160, #3134), with no room added (10-25); 1,537,016 with many releases' notes merged into one list by kind (the owner), in app.js, with no room added (10-25); 1,542,244 with a plugin's README loading under magpie's bird bouncing down its lines instead of pulsing bars (the owner), the Plugins page's, in plugins.js, with no room added (10-26); 1,542,418 with a page plugin's sidebar tab coming and going as it is installed, switched on or off, or removed, instead of on the Plugins page's next load (the owner), in plugins.js, with no room added (10-26); 1,537,645 with Settings › Observability moved out to plugins/otel, lowered to it (10-26); 1,537,673 with a used window with no reset not "Not used yet" (windy on Discord), and back to 1,537,645 with Settings' model pickers sharing modelOpt (10-26); 1,541,967 with every slow page's skeletons getting magpie's bird (skelBird, the owner), in app.js, the README's bird sharing its drawing and styles, with no room added (10-26); 1,526,251 with Settings' gateway rows moved out to plugins/gateway/settings.js, lowered to it (10-27); 1,526,391 with Test models naming the first failed model and its error (ysm119 on Discord), in app.js, with no room added (10-27); 1,526,556 with About's Website row (the owner), in app.js, with no room added (10-27); 1,526,500 with a pool's cap ticks (plugins#349), in app.js, with no room added (10-28); 1,527,245 with About's Open-source licenses row and dialog (the owner), in app.js, with no room added (10-28)
)
func TestCoreScriptBudget(t *testing.T) {
diff --git a/internal/gui/tests/about-notices.test.cjs b/internal/gui/tests/about-notices.test.cjs
new file mode 100644
index 000000000..9802aae5f
--- /dev/null
+++ b/internal/gui/tests/about-notices.test.cjs
@@ -0,0 +1,50 @@
+const assert = require("node:assert/strict");
+const { test } = require("node:test");
+const { chromium, webkit } = require("playwright");
+const { fixture } = require("./fixtures/caller-keys.cjs");
+const { openPart } = require("./reader.cjs");
+
+// Every build carries moejs's third-party notices (THIRD_PARTY_NOTICES,
+// embedded in the binary); Settings › About's Open-source licenses shows
+// them whole, scrolled inside the dialog, in every language and at the tray
+// panel's width.
+const words = {
+ en: "Open-source licenses", zh: "开源许可", "zh-TW": "開源授權", ja: "オープンソースライセンス", de: "Open-Source-Lizenzen",
+};
+const text = "magpie third-party notices\n" + "x".repeat(300) + "\n" + "line\n".repeat(400) + "4. V8 (ported code)\n";
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ for (const lang of Object.keys(words)) {
+ for (const width of [1100, 420]) {
+ test(`${engine} ${lang} ${width}: About shows the third-party notices`, async (t) => {
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ t.after(() => browser.close());
+ const page = await (await browser.newContext({ viewport: { width, height: 800 }, reducedMotion: "reduce" })).newPage();
+ page.setDefaultTimeout(6000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ await page.route("**/*", fixture(lang, "light", []));
+ await page.route("**/api/notices", (r) => r.fulfill({ json: { text } }));
+ await page.goto("http://magpie.test/");
+ await page.locator("#prefs").click();
+ await openPart(page, "about");
+ const row = page.locator("#about .row", { has: page.locator(".who", { hasText: words[lang] }) });
+ await row.locator("button.text").click();
+ const pre = page.locator("#modal .notices-text");
+ await pre.waitFor();
+ assert.equal(await pre.textContent(), text);
+ assert.equal(await page.locator("#modal .ehead b").textContent(), words[lang]);
+ // the long text scrolls in the dialog, which stays inside the window
+ const fits = await page.evaluate(() => {
+ const d = document.querySelector("#modal").firstElementChild.getBoundingClientRect();
+ const body = document.querySelector("#modal .ebody");
+ return { inside: d.right <= innerWidth && d.bottom <= innerHeight, scrolls: body.scrollHeight > body.clientHeight, wide: document.documentElement.scrollWidth <= innerWidth };
+ });
+ assert.deepEqual(fits, { inside: true, scrolls: true, wide: true });
+ await page.locator("#modal .bar button.primary").click();
+ await page.locator("#modal").waitFor({ state: "hidden" });
+ assert.deepEqual(errors, []);
+ });
+ }
+ }
+}
diff --git a/internal/notices/notices.go b/internal/notices/notices.go
new file mode 100644
index 000000000..3ddb5cfd7
--- /dev/null
+++ b/internal/notices/notices.go
@@ -0,0 +1,8 @@
+// Package notices holds the third-party notices every magpie binary
+// carries: THIRD_PARTY_NOTICES at the repository's root, which package main
+// embeds and hands over before anything runs. `magpie licenses` prints it,
+// and Settings › About shows it.
+package notices
+
+// Text is THIRD_PARTY_NOTICES, set by package main.
+var Text string
diff --git a/main.go b/main.go
index 2c3e3bb85..b6e07608d 100644
--- a/main.go
+++ b/main.go
@@ -3,7 +3,10 @@
package main
import (
+ _ "embed"
+
"github.com/yetone/magpie/internal/cli"
+ "github.com/yetone/magpie/internal/notices"
// the built-in plugins, registered with the runtime (internal/pluginrt)
_ "github.com/yetone/magpie/plugins/all"
)
@@ -12,4 +15,14 @@ import (
// Dockerfile, magpie-releases), so it stays in package main.
var version = "dev"
-func main() { cli.Main(version) }
+// the notices of what is compiled into every build (moejs's Intl data and
+// code), carried by the binary itself, since most release assets are a
+// bare binary
+//
+//go:embed THIRD_PARTY_NOTICES
+var thirdParty string
+
+func main() {
+ notices.Text = thirdParty
+ cli.Main(version)
+}
diff --git a/main_test.go b/main_test.go
new file mode 100644
index 000000000..0c1885c5d
--- /dev/null
+++ b/main_test.go
@@ -0,0 +1,35 @@
+package main
+
+import (
+ "os"
+ "strings"
+ "testing"
+)
+
+// moejs compiles Intl's CLDR, Unicode, ICU and V8 material into every build
+// and asks a program that includes it to carry sections 1 to 4 of its
+// notices. The binary carries THIRD_PARTY_NOTICES; this holds it to the
+// moejs version go.mod builds with, so an upgrade copies the new notices.
+func TestNoticesFollowMoejs(t *testing.T) {
+ b, err := os.ReadFile("go.mod")
+ if err != nil {
+ t.Fatal(err)
+ }
+ var v string
+ for _, l := range strings.Split(string(b), "\n") {
+ if f := strings.Fields(l); len(f) >= 2 && f[0] == "github.com/MoeForge/moejs" {
+ v = f[1]
+ }
+ }
+ if v == "" {
+ t.Fatal("go.mod requires no github.com/MoeForge/moejs")
+ }
+ if !strings.Contains(thirdParty, "THIRD_PARTY_NOTICES at "+v+",") {
+ t.Errorf("THIRD_PARTY_NOTICES is not moejs %s's: copy sections 1 to 4 of its notices", v)
+ }
+ for _, s := range []string{"1. Unicode CLDR", "2. Unicode Character Database", "3. ICU", "4. V8"} {
+ if !strings.Contains(thirdParty, "\n"+s) {
+ t.Errorf("THIRD_PARTY_NOTICES has no section %q", s)
+ }
+ }
+}