unroll complex code

This commit is contained in:
pypy
2020-01-13 21:56:41 +09:00
parent 3d27fc5ca1
commit 45d4f26458

View File

@@ -728,10 +728,15 @@ CefSharp.BindObjectAsync(
}
*/
API.login = function (params) {
var auth = `${params.username}:${params.password}`;
auth = encodeURIComponent(auth);
auth = auth.replace(/%([0-9A-F]{2})/gu, (_, s) => String.fromCharCode(parseInt(s, 16)));
auth = auth.replace('%', '%25');
auth = btoa(auth);
return this.call(`auth/user?apiKey=${this.cachedConfig.clientApiKey}`, {
method: 'GET',
headers: {
Authorization: `Basic ${btoa(encodeURIComponent(`${params.username}:${params.password}`).replace(/%([0-9A-F]{2})/gu, (_, s) => String.fromCharCode(parseInt(s, 16))).replace('%', '%25'))}`
Authorization: `Basic ${auth}`
}
}).then((json) => {
var args = {