Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function _openWebBrowserAsync(startUrl, returnUrl) {
// $FlowIssue: Flow thinks the awaited result can be a promise
let result = await openAuthSessionAsync(startUrl, returnUrl);
if (result.type === 'cancel' || result.type === 'dismiss') {
return { type: result.type };
}
return result;
}
function getStartUrl(authUrl, returnUrl) {
async function _openWebBrowserAsync(startUrl, returnUrl) {
// $FlowIssue: Flow thinks the awaited result can be a promise
let result = await openAuthSessionAsync(startUrl, returnUrl);
if (result.type === 'cancel' || result.type === 'dismiss') {
return { type: result.type };
}
return result;
}
function getStartUrl(authUrl, returnUrl) {
async function _openWebBrowserAsync(startUrl, returnUrl) {
// $FlowIssue: Flow thinks the awaited result can be a promise
let result = await openAuthSessionAsync(startUrl, returnUrl);
if (result.type === 'cancel' || result.type === 'dismiss') {
return { type: result.type };
}
return result;
}
} );
// First, determine whether the site is multisite or not.
const multisite = await this.multisiteCheck;
// Prepare the browser.
const baseUrl = url.replace( /\/$/, '' ) + '/wp-admin';
const adminUrl = new URI( multisite ? baseUrl + '/network/plugin-install.php' : url + '/plugin-install.php' );
const installUrl = adminUrl.addQuery( {
tab: 'search',
type: 'term',
s: 'connect'
} );
// Open the browser and wait.
openAuthSessionAsync( '' + installUrl ).then( this.onCheck );
}