@promptbook/remote-server 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
|
@@ -31,7 +31,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
31
31
|
* @generated
|
|
32
32
|
* @see https://github.com/webgptorg/promptbook
|
|
33
33
|
*/
|
|
34
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
34
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-11';
|
|
35
35
|
/**
|
|
36
36
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
37
37
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1491,57 +1491,6 @@ function isValidPromptbookVersion(version) {
|
|
|
1491
1491
|
return true;
|
|
1492
1492
|
}
|
|
1493
1493
|
|
|
1494
|
-
/**
|
|
1495
|
-
* Checks if an URL is reserved for private networks or localhost.
|
|
1496
|
-
*
|
|
1497
|
-
* Note: There are two simmilar functions:
|
|
1498
|
-
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
1499
|
-
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
1500
|
-
*
|
|
1501
|
-
* @public exported from `@promptbook/utils`
|
|
1502
|
-
*/
|
|
1503
|
-
function isHostnameOnPrivateNetwork(hostname) {
|
|
1504
|
-
if (hostname === 'example.com' ||
|
|
1505
|
-
hostname === 'localhost' ||
|
|
1506
|
-
hostname.endsWith('.localhost') ||
|
|
1507
|
-
hostname.endsWith('.local') ||
|
|
1508
|
-
hostname.endsWith('.test') ||
|
|
1509
|
-
hostname === '127.0.0.1' ||
|
|
1510
|
-
hostname === '::1') {
|
|
1511
|
-
return true;
|
|
1512
|
-
}
|
|
1513
|
-
if (hostname.includes(':')) {
|
|
1514
|
-
// IPv6
|
|
1515
|
-
var ipParts = hostname.split(':');
|
|
1516
|
-
return ipParts[0] === 'fc00' || ipParts[0] === 'fd00' || ipParts[0] === 'fe80';
|
|
1517
|
-
}
|
|
1518
|
-
else {
|
|
1519
|
-
// IPv4
|
|
1520
|
-
var ipParts = hostname.split('.').map(function (part) { return Number.parseInt(part, 10); });
|
|
1521
|
-
return (ipParts[0] === 10 ||
|
|
1522
|
-
(ipParts[0] === 172 && ipParts[1] >= 16 && ipParts[1] <= 31) ||
|
|
1523
|
-
(ipParts[0] === 192 && ipParts[1] === 168));
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
/**
|
|
1528
|
-
* Checks if an IP address or hostname is reserved for private networks or localhost.
|
|
1529
|
-
*
|
|
1530
|
-
* Note: There are two simmilar functions:
|
|
1531
|
-
* - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
|
|
1532
|
-
* - `isHostnameOnPrivateNetwork` which tests just hostname
|
|
1533
|
-
*
|
|
1534
|
-
* @param {string} ipAddress - The IP address to check.
|
|
1535
|
-
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
1536
|
-
* @public exported from `@promptbook/utils`
|
|
1537
|
-
*/
|
|
1538
|
-
function isUrlOnPrivateNetwork(url) {
|
|
1539
|
-
if (typeof url === 'string') {
|
|
1540
|
-
url = new URL(url);
|
|
1541
|
-
}
|
|
1542
|
-
return isHostnameOnPrivateNetwork(url.hostname);
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
1494
|
/**
|
|
1546
1495
|
* Tests if given string is valid URL.
|
|
1547
1496
|
*
|
|
@@ -1584,16 +1533,19 @@ function isValidPipelineUrl(url) {
|
|
|
1584
1533
|
if (!isValidUrl(url)) {
|
|
1585
1534
|
return false;
|
|
1586
1535
|
}
|
|
1587
|
-
if (!url.startsWith('https://')) {
|
|
1536
|
+
if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
|
|
1588
1537
|
return false;
|
|
1589
1538
|
}
|
|
1590
1539
|
if (url.includes('#')) {
|
|
1591
1540
|
// TODO: [🐠]
|
|
1592
1541
|
return false;
|
|
1593
1542
|
}
|
|
1543
|
+
/*
|
|
1544
|
+
Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
|
|
1594
1545
|
if (isUrlOnPrivateNetwork(url)) {
|
|
1595
1546
|
return false;
|
|
1596
1547
|
}
|
|
1548
|
+
*/
|
|
1597
1549
|
return true;
|
|
1598
1550
|
}
|
|
1599
1551
|
/**
|