aotrautils-srv 0.0.1796 → 0.0.1802
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1_29072022-2359 (11/11/2025-18:20:31)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -1618,7 +1618,7 @@ aotest.profile=function(rootObject,methodName,visited=[]){
|
|
|
1618
1618
|
|
|
1619
1619
|
|
|
1620
1620
|
//================================================================
|
|
1621
|
-
//=================
|
|
1621
|
+
//================= Thread control utility methods =================
|
|
1622
1622
|
//================================================================
|
|
1623
1623
|
|
|
1624
1624
|
|
|
@@ -3868,7 +3868,7 @@ Math.makeMultipleOf=function(bruteValue, multiple,/*OPTIONAL*/roundingMode){
|
|
|
3868
3868
|
|
|
3869
3869
|
|
|
3870
3870
|
getTimer=function(callback, delay){
|
|
3871
|
-
return new
|
|
3871
|
+
return new SimpleTimer(callback, delay);
|
|
3872
3872
|
// let self={
|
|
3873
3873
|
// timerId:null,
|
|
3874
3874
|
// start:null,
|
|
@@ -3893,14 +3893,14 @@ getTimer=function(callback, delay){
|
|
|
3893
3893
|
|
|
3894
3894
|
|
|
3895
3895
|
//Usage :
|
|
3896
|
-
//var timer=new
|
|
3896
|
+
//var timer=new SimpleTimer(function(){
|
|
3897
3897
|
//alert("Done!");
|
|
3898
3898
|
//}, 1000);
|
|
3899
3899
|
//
|
|
3900
3900
|
//timer.pause();
|
|
3901
3901
|
////Do some stuff...
|
|
3902
3902
|
//timer.resume();
|
|
3903
|
-
var
|
|
3903
|
+
var SimpleTimer=function(callback, delay){
|
|
3904
3904
|
var timerId, start, remaining=delay;
|
|
3905
3905
|
|
|
3906
3906
|
this.pause=function(){
|
|
@@ -5002,6 +5002,38 @@ window.splitURL=(urlOrigin)=>{
|
|
|
5002
5002
|
return {protocol:protocol, host:host, port:port, isSecure:isSecure};
|
|
5003
5003
|
};
|
|
5004
5004
|
|
|
5005
|
+
window.getPathExtension=(path)=>{
|
|
5006
|
+
const splits = path.split(".");
|
|
5007
|
+
if(splits.length <= 1)
|
|
5008
|
+
return "";
|
|
5009
|
+
return splits.pop();
|
|
5010
|
+
}
|
|
5011
|
+
|
|
5012
|
+
window.getBasePath=(pathParam, fileSeparator="/")=>{
|
|
5013
|
+
// Clean :
|
|
5014
|
+
const path=pathParam.replace(/\/{2,}/gim,"/");
|
|
5015
|
+
const splits = path.split(fileSeparator);
|
|
5016
|
+
if(splits.length <= 1)
|
|
5017
|
+
return path;
|
|
5018
|
+
// We remove the last part, corresponding to the file name:
|
|
5019
|
+
return splits.slice(0,-1).join(fileSeparator)+fileSeparator;
|
|
5020
|
+
}
|
|
5021
|
+
|
|
5022
|
+
window.getPathFileName=(path, fileSeparator="/", removeExtension=false)=>{
|
|
5023
|
+
const splits = path.split(fileSeparator);
|
|
5024
|
+
if(splits.length <= 0)
|
|
5025
|
+
return "";
|
|
5026
|
+
let fileNameWithExtension=splits.pop();
|
|
5027
|
+
if(empty(fileNameWithExtension))
|
|
5028
|
+
return "";
|
|
5029
|
+
if(!removeExtension)
|
|
5030
|
+
return fileNameWithExtension;
|
|
5031
|
+
const fileNameSplits = fileNameWithExtension.split(".");
|
|
5032
|
+
if(fileNameSplits.length <= 0)
|
|
5033
|
+
return "";
|
|
5034
|
+
return fileNameSplits[0];
|
|
5035
|
+
}
|
|
5036
|
+
|
|
5005
5037
|
|
|
5006
5038
|
|
|
5007
5039
|
// MUST REMAIN AT THE END OF THIS LIBRARY FILE !
|
|
@@ -5012,7 +5044,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
5012
5044
|
|
|
5013
5045
|
|
|
5014
5046
|
|
|
5015
|
-
/*utils AI library associated with aotra version : «1_29072022-2359 (
|
|
5047
|
+
/*utils AI library associated with aotra version : «1_29072022-2359 (11/11/2025-18:20:31)»*/
|
|
5016
5048
|
/*-----------------------------------------------------------------------------*/
|
|
5017
5049
|
|
|
5018
5050
|
|
|
@@ -5158,7 +5190,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
|
|
|
5158
5190
|
|
|
5159
5191
|
|
|
5160
5192
|
|
|
5161
|
-
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (
|
|
5193
|
+
/*utils CONSOLE library associated with aotra version : «1_29072022-2359 (11/11/2025-18:20:31)»*/
|
|
5162
5194
|
/*-----------------------------------------------------------------------------*/
|
|
5163
5195
|
|
|
5164
5196
|
|
|
@@ -5582,7 +5614,12 @@ WebsocketImplementation={
|
|
|
5582
5614
|
return null;
|
|
5583
5615
|
}
|
|
5584
5616
|
|
|
5585
|
-
clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{
|
|
5617
|
+
clientSocket=new WebSocket(serverURL+":"+port,/*WORKAROUND:*/{
|
|
5618
|
+
// CAUTION : SECURITY BREACH :
|
|
5619
|
+
// BUT ALSO NECESSARY TO ALLOW SELF-SIGNED CERTIFICATES USAGE WITH THE YESBOT SYSTEM !
|
|
5620
|
+
rejectUnauthorized:false, // (THIS IS A KNOWN SECURITY BREACH)
|
|
5621
|
+
secure: isSecure
|
|
5622
|
+
});
|
|
5586
5623
|
}else{
|
|
5587
5624
|
// NOW : socket.io :
|
|
5588
5625
|
//client on server-side:
|
|
@@ -5620,6 +5657,11 @@ WebsocketImplementation={
|
|
|
5620
5657
|
// BROWSER CLIENT MODE ONLY :
|
|
5621
5658
|
let clientSocket;
|
|
5622
5659
|
if(!WebsocketImplementation.useSocketIOImplementation){
|
|
5660
|
+
// CAUTION : PARAMETER rejectUnauthorized:false WILL DO NOTHING,
|
|
5661
|
+
// BECAUSE THIS IS COMPLETLY HANDLED BY THE BROWSER SECURITY POLICY !
|
|
5662
|
+
// SO TO CLEAR THE SSL ERROR :
|
|
5663
|
+
// - FIRST GO TO THE HTTPS:// SERVER ADDRESS WITH BROWSER
|
|
5664
|
+
// - THEN ADD THE SECURITY EXCEPTION IN THE BROWSER !
|
|
5623
5665
|
clientSocket=new WebSocket(serverURL+":"+port,["ws","wss"]);
|
|
5624
5666
|
}else if(typeof(io)!=="undefined"){
|
|
5625
5667
|
// OLD SYNTAX :clientSocket=io.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
@@ -5638,7 +5680,7 @@ WebsocketImplementation={
|
|
|
5638
5680
|
|
|
5639
5681
|
launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /*OPTIONAL*/sslOptions=null, httpHandlerParam=null, addCORSHeader=ADD_CORS_HEADER){
|
|
5640
5682
|
|
|
5641
|
-
const EXCLUDED_FILENAMES_PARTS=[".keyHash."];
|
|
5683
|
+
const EXCLUDED_FILENAMES_PARTS=[".keyHash.",".pem"];
|
|
5642
5684
|
|
|
5643
5685
|
|
|
5644
5686
|
|
|
@@ -5905,8 +5947,8 @@ initNodeServerInfrastructureWrapper=function(doOnClientConnection=null, doOnFina
|
|
|
5905
5947
|
}else{
|
|
5906
5948
|
try{
|
|
5907
5949
|
sslOptions={
|
|
5908
|
-
cert: fs.readFileSync(certPath),
|
|
5909
|
-
key: fs.readFileSync(keyPath),
|
|
5950
|
+
cert: fs.readFileSync(certPath, {encoding: "utf8"}),
|
|
5951
|
+
key: fs.readFileSync(keyPath, {encoding: "utf8"}),
|
|
5910
5952
|
};
|
|
5911
5953
|
}catch(exception){
|
|
5912
5954
|
// TRACE
|
|
@@ -7322,7 +7364,14 @@ class NodeServerInstance{
|
|
|
7322
7364
|
}
|
|
7323
7365
|
|
|
7324
7366
|
close(doOnCloseServer){
|
|
7325
|
-
if(!this.serverSocket)
|
|
7367
|
+
if(!this.serverSocket){
|
|
7368
|
+
//TRACE
|
|
7369
|
+
lognow("WARN : Server socket is null ! Cannot close an inexistant serer socket. Attempting to close attached HTTP server anyway.");
|
|
7370
|
+
lognow("WARN : THIS MAY CAUSE A MEMORY LEAK !!!");
|
|
7371
|
+
if(!this.listenableServer) return;
|
|
7372
|
+
this.listenableServer.close(doOnCloseServer);
|
|
7373
|
+
return;
|
|
7374
|
+
}
|
|
7326
7375
|
this.serverSocket.close(()=>{
|
|
7327
7376
|
if(!this.listenableServer) return;
|
|
7328
7377
|
this.listenableServer.close(doOnCloseServer);
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1802",
|
|
4
4
|
"main": "aotrautils-srv.build.js",
|
|
5
5
|
"description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
|
|
6
6
|
"author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",
|