@promptbook/website-crawler 0.85.0-9 → 0.85.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
<blockquote style="color: #ff8811">
|
|
28
|
-
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
29
|
-
</blockquote>
|
|
30
|
-
|
|
31
27
|
## 📦 Package `@promptbook/website-crawler`
|
|
32
28
|
|
|
33
29
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
package/esm/index.es.js
CHANGED
|
@@ -29,7 +29,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
29
29
|
* @generated
|
|
30
30
|
* @see https://github.com/webgptorg/promptbook
|
|
31
31
|
*/
|
|
32
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
32
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-16';
|
|
33
33
|
/**
|
|
34
34
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
35
35
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1789,57 +1789,6 @@ function isValidPromptbookVersion(version) {
|
|
|
1789
1789
|
return true;
|
|
1790
1790
|
}
|
|
1791
1791
|
|
|
1792
|
-
/**
|
|
1793
|
-
* Checks if an URL is reserved for private networks or localhost.
|
|
1794
|
-
*
|
|
1795
|
-
* Note: There are two simmilar functions:
|
|
1796
|
-
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
1797
|
-
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
1798
|
-
*
|
|
1799
|
-
* @public exported from `@promptbook/utils`
|
|
1800
|
-
*/
|
|
1801
|
-
function isHostnameOnPrivateNetwork(hostname) {
|
|
1802
|
-
if (hostname === 'example.com' ||
|
|
1803
|
-
hostname === 'localhost' ||
|
|
1804
|
-
hostname.endsWith('.localhost') ||
|
|
1805
|
-
hostname.endsWith('.local') ||
|
|
1806
|
-
hostname.endsWith('.test') ||
|
|
1807
|
-
hostname === '127.0.0.1' ||
|
|
1808
|
-
hostname === '::1') {
|
|
1809
|
-
return true;
|
|
1810
|
-
}
|
|
1811
|
-
if (hostname.includes(':')) {
|
|
1812
|
-
// IPv6
|
|
1813
|
-
var ipParts = hostname.split(':');
|
|
1814
|
-
return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
|
|
1815
|
-
}
|
|
1816
|
-
else {
|
|
1817
|
-
// IPv4
|
|
1818
|
-
var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
|
|
1819
|
-
return (ipParts[0] === 10 ||
|
|
1820
|
-
(ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
|
|
1821
|
-
(ipParts[0] === 192 && ipParts[1] === 168));
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
/**
|
|
1826
|
-
* Checks if an IP address or hostname is reserved for private networks or localhost.
|
|
1827
|
-
*
|
|
1828
|
-
* Note: There are two simmilar functions:
|
|
1829
|
-
* - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
|
|
1830
|
-
* - `isHostnameOnPrivateNetwork` which tests just hostname
|
|
1831
|
-
*
|
|
1832
|
-
* @param {string} ipAddress - The IP address to check.
|
|
1833
|
-
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
1834
|
-
* @public exported from `@promptbook/utils`
|
|
1835
|
-
*/
|
|
1836
|
-
function isUrlOnPrivateNetwork(url) {
|
|
1837
|
-
if (typeof url === 'string') {
|
|
1838
|
-
url = new URL(url);
|
|
1839
|
-
}
|
|
1840
|
-
return isHostnameOnPrivateNetwork(url.hostname);
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
1792
|
/**
|
|
1844
1793
|
* Tests if given string is valid pipeline URL URL.
|
|
1845
1794
|
*
|
|
@@ -1853,16 +1802,19 @@ function isValidPipelineUrl(url) {
|
|
|
1853
1802
|
if (!isValidUrl(url)) {
|
|
1854
1803
|
return false;
|
|
1855
1804
|
}
|
|
1856
|
-
if (!url.startsWith('https://')) {
|
|
1805
|
+
if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
|
|
1857
1806
|
return false;
|
|
1858
1807
|
}
|
|
1859
1808
|
if (url.includes('#')) {
|
|
1860
1809
|
// TODO: [🐠]
|
|
1861
1810
|
return false;
|
|
1862
1811
|
}
|
|
1812
|
+
/*
|
|
1813
|
+
Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
|
|
1863
1814
|
if (isUrlOnPrivateNetwork(url)) {
|
|
1864
1815
|
return false;
|
|
1865
1816
|
}
|
|
1817
|
+
*/
|
|
1866
1818
|
return true;
|
|
1867
1819
|
}
|
|
1868
1820
|
/**
|