@tryghost/admin-api
Advanced tools
+10
-9
@@ -7,2 +7,3 @@ const axios = require('axios'); | ||
| const supportedVersions = ['v2', 'v3', 'canary']; | ||
| const name = '@tryghost/admin-api'; | ||
@@ -41,3 +42,3 @@ module.exports = function GhostAdminAPI(options) { | ||
| // eslint-disable-next-line | ||
| console.warn('GhostAdminAPI\'s `host` parameter is deprecated, please use `url` instead'); | ||
| console.warn(`${name}: The 'host' parameter is deprecated, please use 'url' instead`); | ||
| if (!config.url) { | ||
@@ -49,24 +50,24 @@ config.url = config.host; | ||
| if (!config.version) { | ||
| throw new Error('GhostAdminAPI Config Missing: @tryghost/admin-api requires a "version" like "v2"'); | ||
| throw new Error(`${name} Config Missing: 'version' is required. E.g. ${supportedVersions.join(',')}`); | ||
| } | ||
| if (!supportedVersions.includes(config.version)) { | ||
| throw new Error('GhostAdminAPI Config Invalid: @tryghost/admin-api does not support the supplied version'); | ||
| throw new Error(`${name} Config Invalid: 'version' ${config.version} is not supported`); | ||
| } | ||
| if (!config.url) { | ||
| throw new Error('GhostAdminAPI Config Missing: @tryghost/admin-api requires a "url" like "https://site.com" or "https://site.com/blog"'); | ||
| throw new Error(`${name} Config Missing: 'url' is required. E.g. 'https://site.com'`); | ||
| } | ||
| if (!/https?:\/\//.test(config.url)) { | ||
| throw new Error('GhostAdminAPI Config Invalid: @tryghost/admin-api requires a "url" with a protocol like "https://site.com" or "https://site.com/blog"'); | ||
| throw new Error(`${name} Config Invalid: 'url' ${config.url} requires a protocol. E.g. 'https://site.com'`); | ||
| } | ||
| if (config.url.endsWith('/')) { | ||
| throw new Error('GhostAdminAPI Config Invalid: @tryghost/admin-api requires a "url" without a trailing slash like "https://site.com" or "https://site.com/blog"'); | ||
| throw new Error(`${name} Config Invalid: 'url' ${config.url} must not have a trailing slash. E.g. 'https://site.com'`); | ||
| } | ||
| if (config.ghostPath.endsWith('/') || config.ghostPath.startsWith('/')) { | ||
| throw new Error('GhostAdminAPI Config Invalid: @tryghost/admin-api requires a "ghostPath" without a leading or trailing slash like "ghost"'); | ||
| throw new Error(`${name} Config Invalid: 'ghostPath' ${config.ghostPath} must not have a leading or trailing slash. E.g. 'ghost'`); | ||
| } | ||
| if (!config.key) { | ||
| throw new Error('GhostAdminAPI Config Invalid: @tryghost/admin-api requires a "key" to be supplied'); | ||
| throw new Error(`${name} Config Invalid: 'key' ${config.key} must have 26 hex characters`); | ||
| } | ||
| if (!/[0-9a-f]{24}:[0-9a-f]{64}/.test(config.key)) { | ||
| throw new Error('GhostAdminAPI Config Invalid: @tryghost/admin-api requires a "key" in following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters'); | ||
| throw new Error(`${name} Config Invalid: 'key' ${config.key} must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters`); | ||
| } | ||
@@ -73,0 +74,0 @@ |
+2
-2
| { | ||
| "name": "@tryghost/admin-api", | ||
| "version": "1.1.2", | ||
| "version": "1.2.0", | ||
| "repository": "https://github.com/TryGhost/Ghost-SDK/tree/master/packages/admin-api", | ||
@@ -33,3 +33,3 @@ "author": "Ghost Foundation", | ||
| }, | ||
| "gitHead": "cec7e0183304d3fc44c46f8a518cd20a17bb2de2" | ||
| "gitHead": "fb7ef9d2bc2575103cebbe44e036538ebf3adad8" | ||
| } |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
305
0.33%13820
-1.12%