diff options
author | RaindropsSys <contact@minteck.org> | 2023-07-17 14:08:41 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-07-17 14:08:41 +0200 |
commit | d0da20e18bf39cd98c1a2773e3a08e8e320d6450 (patch) | |
tree | 0809782ccba92bbd76bb44a80a6d40bdaeb2f0ab /includes/external/signal/node_modules/axios/lib/helpers/isURLSameOrigin.js | |
parent | 5eb6a557c44462e7d9d752f3bc97a078ef205bc0 (diff) | |
download | pluralconnect-d0da20e18bf39cd98c1a2773e3a08e8e320d6450.tar.gz pluralconnect-d0da20e18bf39cd98c1a2773e3a08e8e320d6450.tar.bz2 pluralconnect-d0da20e18bf39cd98c1a2773e3a08e8e320d6450.zip |
Updated includes/jobs/PKFronters.php and added 147 files (automated)
Diffstat (limited to 'includes/external/signal/node_modules/axios/lib/helpers/isURLSameOrigin.js')
-rw-r--r-- | includes/external/signal/node_modules/axios/lib/helpers/isURLSameOrigin.js | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/includes/external/signal/node_modules/axios/lib/helpers/isURLSameOrigin.js b/includes/external/signal/node_modules/axios/lib/helpers/isURLSameOrigin.js new file mode 100644 index 0000000..18db03b --- /dev/null +++ b/includes/external/signal/node_modules/axios/lib/helpers/isURLSameOrigin.js @@ -0,0 +1,67 @@ +'use strict'; + +import utils from './../utils.js'; +import platform from '../platform/index.js'; + +export default platform.isStandardBrowserEnv ? + +// Standard browser envs have full support of the APIs needed to test +// whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + const msie = /(msie|trident)/i.test(navigator.userAgent); + const urlParsingNode = document.createElement('a'); + let originURL; + + /** + * Parse a URL to discover it's components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + let href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })(); |