summaryrefslogtreecommitdiff
path: root/includes/external/addressbook/node_modules/validator/lib/isURL.js
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
committerRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
commit953ddd82e48dd206cef5ac94456549aed13b3ad5 (patch)
tree8f003106ee2e7f422e5a22d2ee04d0db302e66c0 /includes/external/addressbook/node_modules/validator/lib/isURL.js
parent62a9199846b0c07c03218703b33e8385764f42d9 (diff)
downloadpluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.gz
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.bz2
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.zip
Updated 30 files and deleted 2976 files (automated)
Diffstat (limited to 'includes/external/addressbook/node_modules/validator/lib/isURL.js')
-rw-r--r--includes/external/addressbook/node_modules/validator/lib/isURL.js212
1 files changed, 0 insertions, 212 deletions
diff --git a/includes/external/addressbook/node_modules/validator/lib/isURL.js b/includes/external/addressbook/node_modules/validator/lib/isURL.js
deleted file mode 100644
index 5351c5b..0000000
--- a/includes/external/addressbook/node_modules/validator/lib/isURL.js
+++ /dev/null
@@ -1,212 +0,0 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = isURL;
-
-var _assertString = _interopRequireDefault(require("./util/assertString"));
-
-var _isFQDN = _interopRequireDefault(require("./isFQDN"));
-
-var _isIP = _interopRequireDefault(require("./isIP"));
-
-var _merge = _interopRequireDefault(require("./util/merge"));
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
-
-function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
-
-function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
-
-function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
-
-function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
-
-function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
-
-/*
-options for isURL method
-
-require_protocol - if set as true isURL will return false if protocol is not present in the URL
-require_valid_protocol - isURL will check if the URL's protocol is present in the protocols option
-protocols - valid protocols can be modified with this option
-require_host - if set as false isURL will not check if host is present in the URL
-require_port - if set as true isURL will check if port is present in the URL
-allow_protocol_relative_urls - if set as true protocol relative URLs will be allowed
-validate_length - if set as false isURL will skip string length validation (IE maximum is 2083)
-
-*/
-var default_url_options = {
- protocols: ['http', 'https', 'ftp'],
- require_tld: true,
- require_protocol: false,
- require_host: true,
- require_port: false,
- require_valid_protocol: true,
- allow_underscores: false,
- allow_trailing_dot: false,
- allow_protocol_relative_urls: false,
- allow_fragments: true,
- allow_query_components: true,
- validate_length: true
-};
-var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;
-
-function isRegExp(obj) {
- return Object.prototype.toString.call(obj) === '[object RegExp]';
-}
-
-function checkHost(host, matches) {
- for (var i = 0; i < matches.length; i++) {
- var match = matches[i];
-
- if (host === match || isRegExp(match) && match.test(host)) {
- return true;
- }
- }
-
- return false;
-}
-
-function isURL(url, options) {
- (0, _assertString.default)(url);
-
- if (!url || /[\s<>]/.test(url)) {
- return false;
- }
-
- if (url.indexOf('mailto:') === 0) {
- return false;
- }
-
- options = (0, _merge.default)(options, default_url_options);
-
- if (options.validate_length && url.length >= 2083) {
- return false;
- }
-
- if (!options.allow_fragments && url.includes('#')) {
- return false;
- }
-
- if (!options.allow_query_components && (url.includes('?') || url.includes('&'))) {
- return false;
- }
-
- var protocol, auth, host, hostname, port, port_str, split, ipv6;
- split = url.split('#');
- url = split.shift();
- split = url.split('?');
- url = split.shift();
- split = url.split('://');
-
- if (split.length > 1) {
- protocol = split.shift().toLowerCase();
-
- if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {
- return false;
- }
- } else if (options.require_protocol) {
- return false;
- } else if (url.slice(0, 2) === '//') {
- if (!options.allow_protocol_relative_urls) {
- return false;
- }
-
- split[0] = url.slice(2);
- }
-
- url = split.join('://');
-
- if (url === '') {
- return false;
- }
-
- split = url.split('/');
- url = split.shift();
-
- if (url === '' && !options.require_host) {
- return true;
- }
-
- split = url.split('@');
-
- if (split.length > 1) {
- if (options.disallow_auth) {
- return false;
- }
-
- if (split[0] === '') {
- return false;
- }
-
- auth = split.shift();
-
- if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) {
- return false;
- }
-
- var _auth$split = auth.split(':'),
- _auth$split2 = _slicedToArray(_auth$split, 2),
- user = _auth$split2[0],
- password = _auth$split2[1];
-
- if (user === '' && password === '') {
- return false;
- }
- }
-
- hostname = split.join('@');
- port_str = null;
- ipv6 = null;
- var ipv6_match = hostname.match(wrapped_ipv6);
-
- if (ipv6_match) {
- host = '';
- ipv6 = ipv6_match[1];
- port_str = ipv6_match[2] || null;
- } else {
- split = hostname.split(':');
- host = split.shift();
-
- if (split.length) {
- port_str = split.join(':');
- }
- }
-
- if (port_str !== null && port_str.length > 0) {
- port = parseInt(port_str, 10);
-
- if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {
- return false;
- }
- } else if (options.require_port) {
- return false;
- }
-
- if (options.host_whitelist) {
- return checkHost(host, options.host_whitelist);
- }
-
- if (host === '' && !options.require_host) {
- return true;
- }
-
- if (!(0, _isIP.default)(host) && !(0, _isFQDN.default)(host, options) && (!ipv6 || !(0, _isIP.default)(ipv6, 6))) {
- return false;
- }
-
- host = host || ipv6;
-
- if (options.host_blacklist && checkHost(host, options.host_blacklist)) {
- return false;
- }
-
- return true;
-}
-
-module.exports = exports.default;
-module.exports.default = exports.default; \ No newline at end of file