@iobroker/repochecker 5.19.10 → 5.19.11

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
@@ -25,6 +25,10 @@ Example:
25
25
  Placeholder for the next version (at the beginning of the line):
26
26
  ### **WORK IN PROGRESS**
27
27
  -->
28
+ ### 5.19.11 (2026-07-13)
29
+
30
+ - (Copilot) Send `OWN_GITHUB_TOKEN` only for GitHub URLs to avoid forwarding it to jsDelivr.
31
+
28
32
  ### 5.19.10 (2026-07-13)
29
33
 
30
34
  - (mcm1957) Workflow runs older than 90 days now emit a single suggestion instead of one per job log (S3056)
@@ -30,10 +30,6 @@ axios.defaults.headers.common = {
30
30
  Expires: '0',
31
31
  };
32
32
 
33
- if (process.env.OWN_GITHUB_TOKEN) {
34
- axios.defaults.headers.common['Authorization'] = `Bearer ${process.env.OWN_GITHUB_TOKEN}`;
35
- }
36
-
37
33
  const common = require('./common.js');
38
34
  const M8900__Dependabot = require('./M8900__Dependabot.js');
39
35
 
package/lib/common.js CHANGED
@@ -8,12 +8,28 @@ const fs = require('node:fs/promises');
8
8
  const compareVersions = require('compare-versions');
9
9
  const semver = require('semver');
10
10
  const semverValid = require('semver/functions/valid');
11
+ const githubToken = process.env.OWN_GITHUB_TOKEN;
11
12
 
12
13
  let gDebug = false;
13
14
  let gInfo = true;
14
15
  let gSuccess = false;
15
16
  let gLocal = false;
16
17
  let gStrict = false;
18
+ const githubHostnames = new Set([
19
+ 'github.com',
20
+ 'api.github.com',
21
+ 'gist.github.com',
22
+ 'codeload.github.com',
23
+ 'raw.githubusercontent.com',
24
+ 'gist.githubusercontent.com',
25
+ 'objects.githubusercontent.com',
26
+ 'uploads.github.com',
27
+ 'avatars.githubusercontent.com',
28
+ 'camo.githubusercontent.com',
29
+ 'media.githubusercontent.com',
30
+ 'user-images.githubusercontent.com',
31
+ 'private-user-images.githubusercontent.com',
32
+ ]);
17
33
 
18
34
  // Cache for getFilesList and getFile functions
19
35
  const filesListCache = new Map();
@@ -27,9 +43,26 @@ axios.defaults.headers.common = {
27
43
  // Authorization: process.env.OWN_GITHUB_TOKEN ? `token ${process.env.OWN_GITHUB_TOKEN}` : 'none',
28
44
  };
29
45
 
30
- if (process.env.OWN_GITHUB_TOKEN) {
31
- info('using authorization defined by OWN_GITHUB_TOKEN');
32
- axios.defaults.headers.common['Authorization'] = `Bearer ${process.env.OWN_GITHUB_TOKEN}`;
46
+ if (githubToken) {
47
+ info('using authorization defined by OWN_GITHUB_TOKEN for github URLs');
48
+ const githubAuthorization = 'Bearer ' + githubToken;
49
+ axios.interceptors.request.use(request => {
50
+ let parsedUrl;
51
+ try {
52
+ if (request?.url) {
53
+ parsedUrl = new URL(request.url, request.baseURL || undefined);
54
+ }
55
+ } catch {
56
+ parsedUrl = undefined;
57
+ }
58
+ const hostname = parsedUrl?.hostname?.toLowerCase();
59
+ const isGitHubUrl = !!hostname && githubHostnames.has(hostname);
60
+ if (isGitHubUrl) {
61
+ request.headers = request.headers || {};
62
+ request.headers.Authorization = githubAuthorization;
63
+ }
64
+ return request;
65
+ }, error => Promise.reject(error));
33
66
  }
34
67
 
35
68
  // function log(msg) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.19.10",
2
+ "version": "5.19.11",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "ajv": "^8.20.0",