hyperswitch
Advanced tools
Comparing version 0.10.5 to 0.11.0
@@ -7,3 +7,3 @@ 'use strict'; | ||
// Swagger-ui helpfully exporting the absolute path of its dist directory | ||
const docRoot = `${require('swagger-ui').dist}/`; | ||
const docRoot = `${require('swagger-ui-dist').getAbsoluteFSPath()}/`; | ||
const HTTPError = require('./exports').HTTPError; | ||
@@ -27,14 +27,35 @@ | ||
const cfg = hyper.config; | ||
const css = ` | ||
/* Removes Swagger's image from the header bar */ | ||
.topbar-wrapper .link img { | ||
display: none; | ||
} | ||
/* Adds the application's name in the header bar */ | ||
.topbar-wrapper .link::after { | ||
content: "${cfg.ui_name}"; | ||
} | ||
/* Removes input field and explore button from header bar */ | ||
.swagger-ui .topbar .download-url-wrapper { | ||
display: none; | ||
} | ||
/* Modifies the font in the information area */ | ||
.swagger-ui .info li, .swagger-ui .info p, .swagger-ui .info table { | ||
font-size: 16px; | ||
line-height: 1.4em; | ||
} | ||
/* Removes authorize button and section */ | ||
.scheme-container { | ||
display: none | ||
} | ||
`; | ||
body = body.toString() | ||
.replace(/((?:src|href)=['"])/g, '$1?path=') | ||
// Some self-promotion | ||
.replace(/<a id="logo".*?<\/a>/, | ||
`<a id="logo" href="${cfg.ui_url}">${cfg.ui_name}</a>`) | ||
.replace(/<\/style>/, `${css}\n </style>`) | ||
.replace(/<title>[^<]*<\/title>/, `<title>${cfg.ui_title}</title>`) | ||
// Replace the default url with ours, switch off validation & | ||
// limit the size of documents to apply syntax highlighting to | ||
.replace(/docExpansion: "none"/, 'docExpansion: "list", ' + | ||
'validatorUrl: null, ' + | ||
'highlightSizeThreshold: 10000') | ||
.replace(/ url: url,/, 'url: "?spec",'); | ||
.replace(/dom_id: '#swagger-ui'/, 'dom_id: "#swagger-ui", ' + | ||
'docExpansion: "none", defaultModelsExpandDepth: -1, validatorUrl: null, displayRequestDuration: true') | ||
.replace(/"https:\/\/petstore.swagger.io\/v2\/swagger.json"/, '"?spec"'); | ||
} | ||
@@ -46,3 +67,4 @@ | ||
body = body.toString() | ||
.replace(/underscore-min\.map/, '?path=lib/underscore-min.map'); | ||
.replace(/underscore-min\.map/, '?path=lib/underscore-min.map') | ||
.replace(/sourceMappingURL=/, 'sourceMappingURL=/?path='); | ||
} else if (/\.png$/.test(reqPath)) { | ||
@@ -56,3 +78,5 @@ contentType = 'image/png'; | ||
contentType = 'text/css'; | ||
body = body.toString().replace(/\.\.\/(images|fonts)\//g, '?path=$1/'); | ||
body = body.toString() | ||
.replace(/\.\.\/(images|fonts)\//g, '?path=$1/') | ||
.replace(/sourceMappingURL=/, 'sourceMappingURL=/?path='); | ||
} | ||
@@ -65,3 +89,3 @@ return P.resolve({ | ||
"script-src 'self' 'unsafe-inline'; connect-src *; " + | ||
"style-src 'self' 'unsafe-inline'; img-src 'self'; font-src 'self';" | ||
"style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self';" | ||
}, | ||
@@ -68,0 +92,0 @@ body |
{ | ||
"name": "hyperswitch", | ||
"version": "0.10.5", | ||
"version": "0.11.0", | ||
"description": "REST API creation framework", | ||
@@ -37,3 +37,3 @@ "main": "index.js", | ||
"swagger-router": "^0.7.2", | ||
"swagger-ui": "git+https://github.com/wikimedia/swagger-ui#master" | ||
"swagger-ui-dist": "^3.22.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "devDependencies": { |
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable and can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
182365
4242
0
3
+ Addedswagger-ui-dist@^3.22.0
+ Addedswagger-ui-dist@3.52.5(transitive)
- Removedswagger-ui@git+https://github.com/wikimedia/swagger-ui#master