vibestats 1.3.6 → 1.3.7
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/dist/index.js +17 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2327,6 +2327,19 @@ function resolveShareApiBaseUrl(baseUrl) {
|
|
|
2327
2327
|
return baseUrl;
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
|
+
function normalizeHostedShareUrl(url, baseUrl) {
|
|
2331
|
+
try {
|
|
2332
|
+
const base = new URL(baseUrl);
|
|
2333
|
+
if (base.hostname !== VIBESTATS_PUBLIC_HOST) return url;
|
|
2334
|
+
const parsed = new URL(url);
|
|
2335
|
+
const apiHost = new URL(VIBESTATS_SHARE_API_ORIGIN).hostname;
|
|
2336
|
+
if (parsed.hostname !== apiHost) return url;
|
|
2337
|
+
const normalizedPath = parsed.pathname === "/vibestats" ? "/" : parsed.pathname.startsWith("/vibestats/") ? parsed.pathname.slice("/vibestats".length) : parsed.pathname;
|
|
2338
|
+
return `${base.origin}${normalizedPath}${parsed.search}${parsed.hash}`;
|
|
2339
|
+
} catch {
|
|
2340
|
+
return url;
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2330
2343
|
async function publishArtifact(artifact, baseUrl, legacyUrl) {
|
|
2331
2344
|
try {
|
|
2332
2345
|
const apiUrl = new URL("/vibestats/shares", resolveShareApiBaseUrl(baseUrl));
|
|
@@ -2347,9 +2360,9 @@ async function publishArtifact(artifact, baseUrl, legacyUrl) {
|
|
|
2347
2360
|
return {
|
|
2348
2361
|
id: data.id || data.slug,
|
|
2349
2362
|
slug: data.slug,
|
|
2350
|
-
url: data.url,
|
|
2351
|
-
shortUrl: data.shortUrl,
|
|
2352
|
-
imageUrl: data.imageUrl
|
|
2363
|
+
url: normalizeHostedShareUrl(data.url, baseUrl),
|
|
2364
|
+
shortUrl: normalizeHostedShareUrl(data.shortUrl, baseUrl),
|
|
2365
|
+
imageUrl: data.imageUrl ? normalizeHostedShareUrl(data.imageUrl, baseUrl) : null
|
|
2353
2366
|
};
|
|
2354
2367
|
} catch {
|
|
2355
2368
|
return null;
|
|
@@ -2566,7 +2579,7 @@ async function publishArtifactWithFallback(artifact, baseUrl, fallbackUrl, prefe
|
|
|
2566
2579
|
var main = defineCommand({
|
|
2567
2580
|
meta: {
|
|
2568
2581
|
name: "vibestats",
|
|
2569
|
-
version: "1.3.
|
|
2582
|
+
version: "1.3.7",
|
|
2570
2583
|
description: "AI coding stats - usage tracking and annual wrapped for Claude Code & Codex"
|
|
2571
2584
|
},
|
|
2572
2585
|
args: {
|