magpie-multi-usage 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/package.json +1 -1
- package/src/aggregator.mjs +1 -1
- package/src/github-store.mjs +1 -1
- package/src/http-server.mjs +7 -8
- package/src/sync-engine.mjs +1 -1
package/README.md
CHANGED
|
@@ -26,6 +26,8 @@ magpie plugin add /path/to/magpie-multi-usage
|
|
|
26
26
|
|
|
27
27
|
Open **Multi-Device Usage** (**多端用量**) in the Magpie sidebar — local usage loads automatically with zero setup.
|
|
28
28
|
|
|
29
|
+
Bundled vendor logos load in the Models and Providers tabs in Magpie Desktop and Magpie Web.
|
|
30
|
+
|
|
29
31
|
## Multi-device relay setup
|
|
30
32
|
|
|
31
33
|
### 1. Create a dedicated private GitHub repository
|
package/README.zh-CN.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magpie-multi-usage",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Multi-device token usage dashboard plugin for Magpie using a dedicated private GitHub repository relay (no decryption passphrase required).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|
package/src/aggregator.mjs
CHANGED
package/src/github-store.mjs
CHANGED
|
@@ -224,7 +224,7 @@ export function createGitHubRelayStore({
|
|
|
224
224
|
apiBaseUrl = DEFAULT_API_BASE_URL,
|
|
225
225
|
fetchImpl = globalThis.fetch,
|
|
226
226
|
timeoutMs = 15000,
|
|
227
|
-
pluginVersion = "0.3.
|
|
227
|
+
pluginVersion = "0.3.1",
|
|
228
228
|
} = {}) {
|
|
229
229
|
const normalizedRepo = normalizeRepo(repo);
|
|
230
230
|
if (!normalizedRepo) {
|
package/src/http-server.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import { createSyncEngine } from "./sync-engine.mjs";
|
|
|
19
19
|
|
|
20
20
|
export const TOKEN_HEADER = "x-multi-usage-token";
|
|
21
21
|
export const DEFAULT_PORT = DEFAULT_CONFIG.port;
|
|
22
|
-
export const PLUGIN_VERSION = "0.3.
|
|
22
|
+
export const PLUGIN_VERSION = "0.3.1";
|
|
23
23
|
|
|
24
24
|
const MAX_JSON_BODY_BYTES = 256 * 1024;
|
|
25
25
|
const ALLOWED_RANGES = new Set(["today", "7d", "30d", "all"]);
|
|
@@ -387,15 +387,14 @@ export async function startHttpServer({
|
|
|
387
387
|
: template.replace("</head>", `${bootstrapTag}\n</head>`);
|
|
388
388
|
|
|
389
389
|
// WebKit can fail to match 'self' inside Magpie's opaque-origin iframe.
|
|
390
|
-
|
|
391
|
-
const loopbackOrigin = `http://${req.headers.host.trim().toLowerCase()}`;
|
|
390
|
+
const loopbackSources = `http://127.0.0.1:${actualPort} http://localhost:${actualPort}`;
|
|
392
391
|
sendResponse(res, 200, "text/html; charset=utf-8", html, {
|
|
393
392
|
"Content-Security-Policy": [
|
|
394
|
-
|
|
395
|
-
`script-src 'self' ${
|
|
396
|
-
`style-src 'self' ${
|
|
397
|
-
|
|
398
|
-
`connect-src 'self' ${
|
|
393
|
+
`default-src 'self' ${loopbackSources}`,
|
|
394
|
+
`script-src 'self' ${loopbackSources} 'nonce-${nonce}'`,
|
|
395
|
+
`style-src 'self' ${loopbackSources} 'unsafe-inline'`,
|
|
396
|
+
`img-src 'self' data: ${loopbackSources}`,
|
|
397
|
+
`connect-src 'self' ${loopbackSources}`,
|
|
399
398
|
].join("; "),
|
|
400
399
|
});
|
|
401
400
|
return;
|
package/src/sync-engine.mjs
CHANGED