var fixUrl = function(url) { var fixed = ""; if (url.substring(0,2) == "//") { fixed = "http:" + url; } else if ((url.substring(0,1) == "/") && (typeof fileRef.linkedFrom != 'undefined')) { // Absolute path var linked = new Uri(fileRef.linkedFrom); fixed = linked.protocol() + '://' + linked.host(); if (linked.port().length > 0) { fixed += ':' + linked.port(); } fixed += url; } else if ((url.substring(0,4) != 'http') && (typeof fileRef.linkedFrom != 'undefined')) { // Relative path var linked = new Uri(fileRef.linkedFrom); fixed = linked.protocol() + '://' + linked.host(); if (linked.port().length > 0) { fixed += ':' + linked.port(); } var parts = linked.path().split("/"); var filename = parts[parts.length - 1]; if ((filename != null) && (filename.length != 0)) { parts.pop(); } fixed += parts.join('/') + '/' + url; } else { fixed = url; } return fixed; };
var filenameForUrl = function(url) { var uri = new Uri(url); var parts = uri.path().split("/"); var filename = parts[parts.length - 1]; if ((filename === null) || (filename.length === 0)) { var d = new Date(); filename = "AutoGen_" + d.getTime() + ".js"; } return filename; };
placeholderSrc: computed('placeholderPath', function() { if (attributeMap.src === 'src') { return null; } const client = get(this, '_client'); const placeholderPathURI = new URI(get(this, 'placeholderPath')); const placeholderURL = client.buildURL(placeholderPathURI.path(), { ...placeholderPathURI.queryPairs.reduce((memo, param) => { memo[param[0]] = param[1]; return memo; }, {}) }); return placeholderURL; }),
var augmentHeaders = function (headers, relativeUri) { var uri = new Uri(relativeUri); var query = qs.parse(uri.uriParts.query); var userKey = null; if (context.userKey) { userKey = context.userKey; } else if (context.userId) { addon.logger.warn("httpRequest userId is deprecated: please use the userKey attribute"); userKey = context.userId; } var httpMethod = method === 'del' ? 'delete' : method; var jwtPayload = createJwtPayload({ 'method': httpMethod, 'path' : uri.path(), 'query' : query }, userKey), jwtToken = jwt.encode(jwtPayload, clientSettings.sharedSecret, 'HS256'); headers['Authorization'] = "JWT " + jwtToken; };