fix token request (GET not POST)

This commit is contained in:
2023-08-18 21:44:49 -07:00
parent f65905c9bd
commit 06b2ca9b74
6 changed files with 7 additions and 94 deletions

58
dist/index.js vendored
View File

@@ -1794,59 +1794,6 @@ function isLoopbackAddress(host) {
}
//# sourceMappingURL=proxy.js.map
/***/ }),
/***/ 632:
/***/ ((module) => {
module.exports = (data, opts = {}) => {
const {
sorted, skipIndex, ignorenull, skipBracket, useDot, whitespace = '+'
} = opts;
const encode = value => String(value)
.replace(/[^ !'()~*]/gu, encodeURIComponent)
.replace(/ /g, whitespace)
.replace(/[!'()~*]/g, ch =>
`%${ch.charCodeAt().toString(16).slice(-2).toUpperCase()}`);
const keys = (obj, keyarr = Object.keys(obj)) =>
sorted ? keyarr.sort() : keyarr;
const filterjoin = arr => arr.filter(e => e).join('&');
const objnest = (name, obj) => filterjoin(keys(obj).map(key => useDot
? nest(`${name}.${key}`, obj[key])
: nest(`${name}[${key}]`, obj[key])));
const arrnest = (name, arr, brackets = skipBracket ? '' : '[]') => arr.length
? filterjoin(arr.map((elem, index) => skipIndex
? nest(name + brackets, elem)
: nest(name + '[' + index + ']', elem)))
: encode(name + brackets);
const setnest = (name, set) => filterjoin(
Array.from(set).map(elem => nest(name, elem)));
const nest = (name, value, type = typeof value, f = null) => {
if (value === f)
f = ignorenull ? f : encode(name) + '=' + f;
else if (/string|number|boolean/.test(type))
f = encode(name) + '=' + encode(value);
else if (Array.isArray(value))
f = arrnest(name, value);
else if (value instanceof Set)
f = setnest(name, value);
else if (type === 'object')
f = objnest(name, value);
return f;
};
return data && filterjoin(keys(data).map(key => nest(key, data[key])));
};
/***/ }),
/***/ 294:
@@ -2917,7 +2864,6 @@ const core = __nccwpck_require__(186);
const http = __nccwpck_require__(685);
const https = __nccwpck_require__(687);
const querystring = __nccwpck_require__(477);
const form_urlencoded = __nccwpck_require__(632);
const req_timeout_ms = 30_000;
const manifest_media_type = 'application/vnd.docker.distribution.manifest.v2+json';
@@ -3012,9 +2958,9 @@ async function get_token(www_authenticate, input) {
password: input.password,
};
const { status, headers, body } = await http_req('POST', params.realm, {
const { status, headers, body } = await http_req('GET', params.realm + '?' + querystring.stringify(query_params), {
'content-type': 'application/x-www-form-urlencoded',
}, form_urlencoded(query_params));
});
if (status !== 200) {
console.error('get token response', { status, headers, body });