gitlab-badge-proxy 0.1.2 → 0.1.3
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/src/app.d.ts.map +1 -1
- package/dist/src/app.js +2 -0
- package/dist/src/gitlab.d.ts.map +1 -1
- package/dist/src/gitlab.js +9 -0
- package/package.json +1 -1
package/dist/src/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAoBtD,OAAO,EACL,eAAe,EAkBhB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAoBtD,OAAO,EACL,eAAe,EAkBhB,MAAM,YAAY,CAAC;AAyWpB,wBAAgB,SAAS,CAAC,SAAS,GAAE,MAAM,MAAmB,GAAG,IAAI,CAyNpE;AAED,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,eAAO,MAAM,GAAG,4EAAc,CAAC"}
|
package/dist/src/app.js
CHANGED
|
@@ -98,6 +98,8 @@ async function proxyGitlabApi(config, projectPath, subpath, search) {
|
|
|
98
98
|
const upstream = `${config.gitlabUrl}/api/v4/projects/${encodeURIComponent(projectPath)}${subpath ? `/${subpath}` : ""}${search}`;
|
|
99
99
|
try {
|
|
100
100
|
const response = await fetch(upstream, { headers: { "PRIVATE-TOKEN": config.gitlabToken } });
|
|
101
|
+
// Server-side only (stdout), never echoed back to the client.
|
|
102
|
+
console.log(`gitlab-badge-proxy: GET ${upstream} -> ${response.status}`);
|
|
101
103
|
const text = await response.text();
|
|
102
104
|
const maxAge = response.ok ? config.cacheMaxAgeSeconds : 30;
|
|
103
105
|
let body = text;
|
package/dist/src/gitlab.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitlab.d.ts","sourceRoot":"","sources":["../../src/gitlab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"gitlab.d.ts","sourceRoot":"","sources":["../../src/gitlab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AA4CD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAIjC;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAOxB;AAED,yGAAyG;AACzG,wBAAsB,cAAc,CAClC,MA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M,GAAG,IAAI,CAAC,CAQxB;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKhG;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAOxG;AAED,iGAAiG;AACjG,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAEvG;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGtG;AAID,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CASxB"}
|
package/dist/src/gitlab.js
CHANGED
|
@@ -4,7 +4,16 @@ async function gitlabRequest(config, projectPath, path) {
|
|
|
4
4
|
const response = await fetch(url, {
|
|
5
5
|
headers: { "PRIVATE-TOKEN": config.gitlabToken },
|
|
6
6
|
});
|
|
7
|
+
// Server-side only (stdout), never echoed back to the client - shows the exact upstream call this
|
|
8
|
+
// request triggered, for anyone watching the proxy's own logs to debug a GitLab-side issue.
|
|
9
|
+
console.log(`gitlab-badge-proxy: GET ${url} -> ${response.status}`);
|
|
7
10
|
if (!response.ok) {
|
|
11
|
+
// GitLab's own error body (e.g. `{"message":"401 Unauthorized"}`) plus the token's length (never
|
|
12
|
+
// its value) are usually enough to tell "GITLAB_TOKEN isn't set" (length 0) apart from "it's set
|
|
13
|
+
// but wrong/expired/missing scope" (non-zero length, still 401/403) from the logs alone.
|
|
14
|
+
const body = await response.text().catch(() => "<unreadable response body>");
|
|
15
|
+
console.error(`gitlab-badge-proxy: GitLab API error ${response.status} for ${url} ` +
|
|
16
|
+
`(GITLAB_TOKEN length: ${config.gitlabToken.length}): ${body.slice(0, 300)}`);
|
|
8
17
|
throw new Error(`GitLab API responded with ${response.status}`);
|
|
9
18
|
}
|
|
10
19
|
return response;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitlab-badge-proxy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Server-side proxy that turns private GitLab pipeline/coverage status into public SVG badges, without ever exposing the GitLab instance's URL to clients.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|