contentful-cli
Advanced tools
Comparing version 3.0.13 to 3.1.0
@@ -15,3 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.handler = exports.login = exports.builder = exports.desc = exports.command = void 0; | ||
exports.handler = exports.login = exports.builder = exports.desc = exports.command = exports.getOauthURL = void 0; | ||
const open_1 = __importDefault(require("open")); | ||
@@ -27,4 +27,12 @@ const inquirer_1 = __importDefault(require("inquirer")); | ||
const APP_ID = '9f86a1d54f3d6f85c159468f5919d6e5d27716b3ed68fd01bd534e3dea2df864'; | ||
const REDIRECT_URI = 'https://www.contentful.com/developers/cli-oauth-page/'; | ||
const oAuthURL = `https://be.contentful.com/oauth/authorize?response_type=token&client_id=${APP_ID}&redirect_uri=${REDIRECT_URI}&scope=content_management_manage&action=cli`; | ||
const getOauthURL = (host) => { | ||
const REDIRECT_URI = 'https://www.contentful.com/developers/cli-oauth-page/'; | ||
let oAuthURL = `https://be.contentful.com/oauth/authorize?response_type=token&client_id=${APP_ID}&redirect_uri=${REDIRECT_URI}&scope=content_management_manage&action=cli`; | ||
if (host) { | ||
const url = host.replace('api.', ''); | ||
oAuthURL = `https://be.${url}/oauth/authorize?response_type=token&client_id=${APP_ID}&redirect_uri=${REDIRECT_URI}&scope=content_management_manage&action=cli`; | ||
} | ||
return oAuthURL; | ||
}; | ||
exports.getOauthURL = getOauthURL; | ||
exports.command = 'login'; | ||
@@ -46,3 +54,3 @@ exports.desc = 'Login to Contentful'; | ||
const login = ({ context, managementToken: managementTokenFlag }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const { managementToken } = context; | ||
const { managementToken, host } = context; | ||
let token; | ||
@@ -65,2 +73,3 @@ if (managementTokenFlag) { | ||
} | ||
const oAuthURL = (0, exports.getOauthURL)(host); | ||
// We open the browser window only on Windows and OSX since this might fail or open the wrong browser on Linux. | ||
@@ -67,0 +76,0 @@ if (['win32', 'darwin'].includes(process.platform)) { |
{ | ||
"name": "contentful-cli", | ||
"version": "3.0.13", | ||
"version": "3.1.0", | ||
"description": "Contentful CLI tool", | ||
@@ -5,0 +5,0 @@ "main": "dist/contentful.js", |
@@ -15,5 +15,15 @@ import open from 'open' | ||
'9f86a1d54f3d6f85c159468f5919d6e5d27716b3ed68fd01bd534e3dea2df864' | ||
const REDIRECT_URI = 'https://www.contentful.com/developers/cli-oauth-page/' | ||
const oAuthURL = `https://be.contentful.com/oauth/authorize?response_type=token&client_id=${APP_ID}&redirect_uri=${REDIRECT_URI}&scope=content_management_manage&action=cli` | ||
export const getOauthURL = (host?: string) => { | ||
const REDIRECT_URI = 'https://www.contentful.com/developers/cli-oauth-page/' | ||
let oAuthURL = `https://be.contentful.com/oauth/authorize?response_type=token&client_id=${APP_ID}&redirect_uri=${REDIRECT_URI}&scope=content_management_manage&action=cli` | ||
if (host) { | ||
const url = host.replace('api.', '') | ||
oAuthURL = `https://be.${url}/oauth/authorize?response_type=token&client_id=${APP_ID}&redirect_uri=${REDIRECT_URI}&scope=content_management_manage&action=cli` | ||
} | ||
return oAuthURL | ||
} | ||
export const command = 'login' | ||
@@ -41,2 +51,3 @@ | ||
managementToken?: string | ||
host?: string | ||
} | ||
@@ -53,3 +64,3 @@ | ||
}: LoginProps) => { | ||
const { managementToken } = context | ||
const { managementToken, host } = context | ||
@@ -88,2 +99,4 @@ let token | ||
const oAuthURL = getOauthURL(host) | ||
// We open the browser window only on Windows and OSX since this might fail or open the wrong browser on Linux. | ||
@@ -90,0 +103,0 @@ if (['win32', 'darwin'].includes(process.platform)) { |
{ | ||
"name": "contentful-cli", | ||
"version": "3.0.13", | ||
"version": "3.1.0", | ||
"description": "Contentful CLI tool", | ||
@@ -5,0 +5,0 @@ "main": "dist/contentful.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
480841
11818