Przeglądaj źródła

Fix URL bug

Specify URL for querying in shields.
master
TheoryOfNekomata 4 lat temu
rodzic
commit
f666805425
3 zmienionych plików z 6 dodań i 3 usunięć
  1. +4
    -1
      getBadgeUrl.js
  2. +1
    -1
      index.js
  3. +1
    -1
      loadBrands.js

+ 4
- 1
getBadgeUrl.js Wyświetl plik

@@ -1,3 +1,4 @@
const path = require('path')
const RESOLVE = require('./resolve.json')
const loadBrands = require('./loadBrands')
const getLibraryColor = require('./getLibraryColor')
@@ -27,6 +28,7 @@ module.exports = async ({
label: repo,
style,
labelColor,
url: new URL(path.join(repo, 'raw', 'branch', process.env.MAIN_BRANCH, 'package.json'), process.env.REPO_BASE_URL),
}).toString()
return badgeUrl
case 'dependency':
@@ -42,7 +44,8 @@ module.exports = async ({
logo: libraryInfo.name,
logoColor,
style,
})
url: new URL(path.join(repo, 'raw', 'branch', process.env.MAIN_BRANCH, 'package.json'), process.env.REPO_BASE_URL),
}).toString()
return badgeUrl
default:
break


+ 1
- 1
index.js Wyświetl plik

@@ -30,7 +30,7 @@ const server = http.createServer(async (req, res) => {

const response = await axios({
method: 'GET',
url: badgeUrl,
url: badgeUrl.toString(),
responseType: 'stream'
})
res.writeHead(200, { 'content-type': 'image/svg+xml', })


+ 1
- 1
loadBrands.js Wyświetl plik

@@ -38,7 +38,7 @@ const fetchBrands = () => new Promise(async (resolve, reject) => {

module.exports = () => new Promise((resolve, reject) => {
fs.readFile(process.env.BRANDS_JSON_FILE_PATH, async (err, file) => {
if (err.code === 'ENOENT') {
if (err && err.code === 'ENOENT') {
const result = await fetchBrands()
resolve(result)
return


Ładowanie…
Anuluj
Zapisz