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 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
@@ -26,6 +26,8 @@ magpie plugin add /path/to/magpie-multi-usage
26
26
 
27
27
  在 Magpie 侧边栏打开 **Multi-Device Usage**(**多端用量**)——本地用量零配置自动加载。
28
28
 
29
+ Magpie 桌面端和 Web 端的模型与供应商标签页均支持加载内置厂商图标。
30
+
29
31
  ## 多端中继配置
30
32
 
31
33
  ### 1. 创建专用私有 GitHub 仓库
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magpie-multi-usage",
3
- "version": "0.3.0",
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",
@@ -468,7 +468,7 @@ export function buildDeviceManifest({
468
468
  deviceId,
469
469
  displayName,
470
470
  platform = process.platform,
471
- pluginVersion = "0.3.0",
471
+ pluginVersion = "0.3.1",
472
472
  revision = 1,
473
473
  updatedAt = new Date().toISOString(),
474
474
  snapshots = [],
@@ -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.0",
227
+ pluginVersion = "0.3.1",
228
228
  } = {}) {
229
229
  const normalizedRepo = normalizeRepo(repo);
230
230
  if (!normalizedRepo) {
@@ -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.0";
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
- // The Host header has already passed the loopback host allowlist.
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
- "default-src 'self'",
395
- `script-src 'self' ${loopbackOrigin} 'nonce-${nonce}'`,
396
- `style-src 'self' ${loopbackOrigin} 'unsafe-inline'`,
397
- "img-src 'self' data:",
398
- `connect-src 'self' ${loopbackOrigin}`,
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;
@@ -160,7 +160,7 @@ export function createSyncEngine({
160
160
  fetchImpl = globalThis.fetch,
161
161
  apiBaseUrl,
162
162
  gatewayBaseUrl,
163
- pluginVersion = "0.3.0",
163
+ pluginVersion = "0.3.1",
164
164
  timeZone,
165
165
  now = () => Date.now(),
166
166
  storeFactory = createGitHubRelayStore,