@promptbook/remote-client 0.85.0-10 → 0.85.0-12
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/esm/index.es.js
CHANGED
|
@@ -19,7 +19,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
19
19
|
* @generated
|
|
20
20
|
* @see https://github.com/webgptorg/promptbook
|
|
21
21
|
*/
|
|
22
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
22
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-11';
|
|
23
23
|
/**
|
|
24
24
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
25
25
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3698,57 +3698,6 @@ var postprocessCommandParser = {
|
|
|
3698
3698
|
},
|
|
3699
3699
|
};
|
|
3700
3700
|
|
|
3701
|
-
/**
|
|
3702
|
-
* Checks if an URL is reserved for private networks or localhost.
|
|
3703
|
-
*
|
|
3704
|
-
* Note: There are two simmilar functions:
|
|
3705
|
-
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
3706
|
-
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
3707
|
-
*
|
|
3708
|
-
* @public exported from `@promptbook/utils`
|
|
3709
|
-
*/
|
|
3710
|
-
function isHostnameOnPrivateNetwork(hostname) {
|
|
3711
|
-
if (hostname === 'example.com' ||
|
|
3712
|
-
hostname === 'localhost' ||
|
|
3713
|
-
hostname.endsWith('.localhost') ||
|
|
3714
|
-
hostname.endsWith('.local') ||
|
|
3715
|
-
hostname.endsWith('.test') ||
|
|
3716
|
-
hostname === '127.0.0.1' ||
|
|
3717
|
-
hostname === '::1') {
|
|
3718
|
-
return true;
|
|
3719
|
-
}
|
|
3720
|
-
if (hostname.includes(':')) {
|
|
3721
|
-
// IPv6
|
|
3722
|
-
var ipParts = hostname.split(':');
|
|
3723
|
-
return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
|
|
3724
|
-
}
|
|
3725
|
-
else {
|
|
3726
|
-
// IPv4
|
|
3727
|
-
var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
|
|
3728
|
-
return (ipParts[0] === 10 ||
|
|
3729
|
-
(ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
|
|
3730
|
-
(ipParts[0] === 192 && ipParts[1] === 168));
|
|
3731
|
-
}
|
|
3732
|
-
}
|
|
3733
|
-
|
|
3734
|
-
/**
|
|
3735
|
-
* Checks if an IP address or hostname is reserved for private networks or localhost.
|
|
3736
|
-
*
|
|
3737
|
-
* Note: There are two simmilar functions:
|
|
3738
|
-
* - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
|
|
3739
|
-
* - `isHostnameOnPrivateNetwork` which tests just hostname
|
|
3740
|
-
*
|
|
3741
|
-
* @param {string} ipAddress - The IP address to check.
|
|
3742
|
-
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
3743
|
-
* @public exported from `@promptbook/utils`
|
|
3744
|
-
*/
|
|
3745
|
-
function isUrlOnPrivateNetwork(url) {
|
|
3746
|
-
if (typeof url === 'string') {
|
|
3747
|
-
url = new URL(url);
|
|
3748
|
-
}
|
|
3749
|
-
return isHostnameOnPrivateNetwork(url.hostname);
|
|
3750
|
-
}
|
|
3751
|
-
|
|
3752
3701
|
/**
|
|
3753
3702
|
* Tests if given string is valid pipeline URL URL.
|
|
3754
3703
|
*
|
|
@@ -3762,16 +3711,19 @@ function isValidPipelineUrl(url) {
|
|
|
3762
3711
|
if (!isValidUrl(url)) {
|
|
3763
3712
|
return false;
|
|
3764
3713
|
}
|
|
3765
|
-
if (!url.startsWith('https://')) {
|
|
3714
|
+
if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
|
|
3766
3715
|
return false;
|
|
3767
3716
|
}
|
|
3768
3717
|
if (url.includes('#')) {
|
|
3769
3718
|
// TODO: [🐠]
|
|
3770
3719
|
return false;
|
|
3771
3720
|
}
|
|
3721
|
+
/*
|
|
3722
|
+
Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
|
|
3772
3723
|
if (isUrlOnPrivateNetwork(url)) {
|
|
3773
3724
|
return false;
|
|
3774
3725
|
}
|
|
3726
|
+
*/
|
|
3775
3727
|
return true;
|
|
3776
3728
|
}
|
|
3777
3729
|
/**
|