aotrautils 0.0.157 → 0.0.160

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.0.0.000 (17/07/2022-04:26:28)»*/
3
+ /*utils COMMONS library associated with aotra version : «1.0.0.000 (17/07/2022-14:14:39)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -4828,7 +4828,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4828
4828
 
4829
4829
 
4830
4830
 
4831
- /*utils CLIENT library associated with aotra version : «1.0.0.000 (17/07/2022-04:26:28)»*/
4831
+ /*utils CLIENT library associated with aotra version : «1.0.0.000 (17/07/2022-14:14:39)»*/
4832
4832
  /*-----------------------------------------------------------------------------*/
4833
4833
  /* ## Utility global methods in a browser (htmljs) client environment.
4834
4834
  *
@@ -5253,7 +5253,7 @@ function bringElementSelectedToPosition(elementSlct, x, y,/* OPTIONAL */delay,/*
5253
5253
  function getSelectedText(textComponent){
5254
5254
 
5255
5255
  var selectedText="";
5256
- if (textComponent.tagName.toLowerCase() == "textarea"){
5256
+ if (textComponent.tagName.toLowerCase()=="textarea"){
5257
5257
 
5258
5258
  // IE version
5259
5259
  if (document.selection != undefined){
@@ -5280,7 +5280,7 @@ function getSelectedText(textComponent){
5280
5280
 
5281
5281
  } else if (typeof document.selection != "undefined"){
5282
5282
  // IE version
5283
- if (document.selection.type == "Text"){
5283
+ if (document.selection.type=="Text"){
5284
5284
  selectedText=document.selection.createRange().htmlText;
5285
5285
  }
5286
5286
  }
@@ -5792,7 +5792,7 @@ function getTextWordsExtract(textStrParam, wordsNumber,/* OPTIONAL */wordPositio
5792
5792
  var s=split[j];
5793
5793
  if (s.length<1)
5794
5794
  continue;
5795
- if (s.length == 1 && new RegExp("[^\\wàâäéèêëìîïòôöùûüç]", "igm").test(s))
5795
+ if (s.length==1 && new RegExp("[^\\wàâäéèêëìîïòôöùûüç]", "igm").test(s))
5796
5796
  continue;
5797
5797
  split2.push(s);
5798
5798
  }
@@ -6211,7 +6211,7 @@ function getCookie(cookieName){
6211
6211
  if (cookieStart != -1){
6212
6212
  cookieStart=cookieStart + cookieName.length + 1;
6213
6213
  let cookieEnd=document.cookie.indexOf(";", cookieStart);
6214
- if (cookieEnd == -1){
6214
+ if (cookieEnd==-1){
6215
6215
  cookieEnd=document.cookie.length;
6216
6216
  }
6217
6217
  return unescape(document.cookie.substring(cookieStart, cookieEnd));
@@ -6268,7 +6268,7 @@ function validateFilesExtensions(self, acceptedFilesTypesString){
6268
6268
  if (!empty(acceptedFilesTypes)){
6269
6269
  acceptedFilesExtensionsRegExpStr+="(";
6270
6270
  for(var i=0; i<acceptedFilesTypes.length; i++){
6271
- acceptedFilesExtensionsRegExpStr+=(acceptedFilesExtensionsRegExpStr == "(" ? "" : "|") + "\." + (acceptedFilesTypes[i].split(PATH_SEPARATOR)[1]);
6271
+ acceptedFilesExtensionsRegExpStr+=(acceptedFilesExtensionsRegExpStr=="(" ? "" : "|") + "\." + (acceptedFilesTypes[i].split(PATH_SEPARATOR)[1]);
6272
6272
  }
6273
6273
  acceptedFilesExtensionsRegExpStr+=")";
6274
6274
  }
@@ -6451,7 +6451,7 @@ function htmlColorCodeToDecimalArray(hexColorCodeParam){
6451
6451
 
6452
6452
  /*private*/function componentToHex(c){
6453
6453
  var hex=c.toString(16);
6454
- return hex.length == 1 ? "0" + hex : hex;
6454
+ return hex.length==1 ? "0" + hex : hex;
6455
6455
  }
6456
6456
  /*public*/function rgb2Hex(r, g, b){
6457
6457
  return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
@@ -7858,14 +7858,14 @@ function filterPoints(allPoints ,ctx/*DBG*/){
7858
7858
  if(!isArray(mediaHandler.video)){
7859
7859
  mediaHandler.video.srcObject=stream;
7860
7860
  // NO : DOES NOT WORK (CREATES A BLANK IMAGE !) mediaHandler.video.muted=true;
7861
- // STUPID WORKAROUND : Because apparently, if volume == 0 or video is muted, then the image data is all black !!!
7861
+ // STUPID WORKAROUND : Because apparently, if volume==0 or video is muted, then the image data is all black !!!
7862
7862
  mediaHandler.video.volume=0.0000000000001;
7863
7863
  // mediaHandler.video.autoplay=true;
7864
7864
  }else{
7865
7865
  foreach(mediaHandler.video,(v)=>{
7866
7866
  v.srcObject=stream;
7867
7867
  // NO : DOES NOT WORK (CREATES A BLANK IMAGE !) v.muted=true;
7868
- // STUPID WORKAROUND : Because apparently, if volume == 0 or video is muted, then the image data is all black !!!
7868
+ // STUPID WORKAROUND : Because apparently, if volume==0 or video is muted, then the image data is all black !!!
7869
7869
  v.volume=0.0000000000001;
7870
7870
  // v.autoplay=true;
7871
7871
  });
@@ -9373,7 +9373,7 @@ function arrayFromString(strParam,compressResult=true,precisionFraction=null,isS
9373
9373
  //var webcamHandler=new Object();
9374
9374
  //
9375
9375
  //var videoTag=document.getElementById(videoTagId);
9376
- //if (videoTag == null){
9376
+ //if (videoTag==null){
9377
9377
  // var backgroundContainerDiv=document.getElementById(AOTRA_SCREEN_DIV_ID) ? document.getElementById(AOTRA_SCREEN_DIV_ID) : document.body;
9378
9378
  //
9379
9379
  // videoTag=document.createElement("video");
@@ -11249,8 +11249,8 @@ function getPointsFromSVGDString(str){
11249
11249
  case "M": case "L": case "l":
11250
11250
  let arr = paths[i].split(/\s/g).filter(function(v) { return v.length > 0 });
11251
11251
  for(let t = 0, AL=arr.length ; t<AL ; t+=2) {
11252
- x = (keys[i] == "l" ? x : 0) + parseFloat(arr[t]);
11253
- y = (keys[i] == "l" ? y : 0) + parseFloat(arr[t+1]);
11252
+ x = (keys[i]=="l" ? x : 0) + parseFloat(arr[t]);
11253
+ y = (keys[i]=="l" ? y : 0) + parseFloat(arr[t+1]);
11254
11254
  points.push({x:x,y:y});
11255
11255
  }
11256
11256
  break;
@@ -11678,7 +11678,7 @@ createFusrodaClient=function(doOnClientReady, doOnDataReception, urlParam=null,
11678
11678
 
11679
11679
 
11680
11680
 
11681
- /*utils GEOMETRY library associated with aotra version : «1.0.0.000 (17/07/2022-04:26:28)»*/
11681
+ /*utils GEOMETRY library associated with aotra version : «1.0.0.000 (17/07/2022-14:14:39)»*/
11682
11682
  /*-----------------------------------------------------------------------------*/
11683
11683
 
11684
11684
 
@@ -12884,7 +12884,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
12884
12884
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
12885
12885
 
12886
12886
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
12887
- /*utils SERVER library associated with aotra version : «1.0.0.000 (17/07/2022-04:26:28)»*/
12887
+ /*utils SERVER library associated with aotra version : «1.0.0.000 (17/07/2022-14:14:39)»*/
12888
12888
  /*-----------------------------------------------------------------------------*/
12889
12889
 
12890
12890
 
@@ -13823,7 +13823,7 @@ WebsocketImplementation={
13823
13823
 
13824
13824
  launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /*OPTIONAL*/sslOptions=null){
13825
13825
 
13826
- const EXCLUDED_FILENAMES_PARTS=[".saltkey."];
13826
+ const EXCLUDED_FILENAMES_PARTS=[".keyHash."];
13827
13827
 
13828
13828
 
13829
13829
  if(typeof(https)==="undefined"){
@@ -13863,7 +13863,7 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /
13863
13863
  const urlFile="." + url;
13864
13864
 
13865
13865
  let filePath=urlFile.indexOf("?")!==-1?urlFile.split("?")[0]:urlFile;
13866
- if(filePath == "./") filePath="./index.html";
13866
+ if(filePath=="./") filePath="./index.html";
13867
13867
 
13868
13868
  let extname=path.extname(filePath);
13869
13869
  let contentType="text/html";
@@ -13871,7 +13871,7 @@ launchNodeHTTPServer=function(port, doOnConnect=null, doOnFinalizeServer=null, /
13871
13871
 
13872
13872
  fs.readFile(filePath, function(error, fileContent){
13873
13873
  if(error){
13874
- if(error.code == "ENOENT"){
13874
+ if(error.code=="ENOENT"){
13875
13875
  // TRACE
13876
13876
  console.log("ERROR 404 file not found :"+filePath);
13877
13877
 
@@ -13958,7 +13958,7 @@ initNodeServer=function(doOnClientConnection=null, doOnFinalizeServer=null, /*OP
13958
13958
  console.log("Server launched.");
13959
13959
  console.log("Usage : node <server.js> conf {port:[port], sslCertPath:[ssl certificate path | unsecure ], sslKeyPath:[ssl key path], serverConfig:[JSON server configuration]}");
13960
13960
  console.log("Or (to generate password hash) : node <server.js> hash <clientId@repositoryName> <clearTextSecretString>");
13961
- // EXAMPLE : node orita-srv.js hash orita.global@saltkey 1234567890
13961
+ // EXAMPLE : node orita-srv.js hash orita.global@keyHash 1234567890
13962
13962
  console.log("Server launched.");
13963
13963
 
13964
13964
  // We read the command-line arguments if needed :
@@ -14003,41 +14003,41 @@ initNodeServer=function(doOnClientConnection=null, doOnFinalizeServer=null, /*OP
14003
14003
  aotraNodeServer.serverManager={ start:()=>{/*DEFAULT START FUNCTION, WILL BE OVERRIDEN LATER*/}};
14004
14004
 
14005
14005
  if(isHashAsked){
14006
- // We isntanciate a temporary persister just to read the saltkey file:
14006
+ // We instanciate a temporary persister just to read the key hash file:
14007
14007
  const persister=getPersister("./");
14008
14008
  let persisterIdSplits=persisterId.split("@");
14009
14009
  if(empty(persisterIdSplits) || persisterIdSplits.length!=2){
14010
14010
  // TRACE
14011
- console.log("ERROR : No persister repository IDs provided correctly. Cannot read saltkey. Aborting hash generation.");
14011
+ console.log("ERROR : No persister repository IDs provided correctly. Cannot read key hash. Aborting hash generation.");
14012
14012
  return aotraNodeServer;
14013
14013
  }
14014
14014
  const persisterClientId=persisterIdSplits[0];
14015
14015
  const persisterRepositoryName=persisterIdSplits[1];
14016
- let globalSaltkeyObject=persister.readTreeObjectFromFile(persisterClientId, persisterRepositoryName);
14017
- if(!globalSaltkeyObject || !globalSaltkeyObject.saltkey){
14016
+ let globalKeyHashObject=persister.readTreeObjectFromFile(persisterClientId, persisterRepositoryName);
14017
+ if(!globalKeyHashObject || !globalKeyHashObject.keyHash){
14018
14018
  // TRACE
14019
- console.log("WARN : No saltkey found. Generating one now.");
14020
- globalSaltkeyObject={saltkey:getUUID(), hashes:[]};
14021
- persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,globalSaltkeyObject,false,()=>{
14019
+ console.log("WARN : No key hash found. Generating one now.");
14020
+ globalKeyHashObject={keyHash:getUUID(), hashes:[]};
14021
+ persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,globalKeyHashObject,false,()=>{
14022
14022
  // TRACE
14023
- console.log("INFO : Saltkey generated and saved successfully.");
14023
+ console.log("INFO : Key hash generated and saved successfully.");
14024
14024
  });
14025
14025
  }
14026
- const globalSaltkey=globalSaltkeyObject.saltkey;
14026
+ const globalKeyHash=globalKeyHashObject.keyHash;
14027
14027
 
14028
14028
  let firstHash=getHashedString(clearTextParam);
14029
14029
 
14030
- let generatedHash=getHashedString( firstHash + globalSaltkey, true);// (we use the heavy treatment thing.)
14031
- globalSaltkeyObject.hashes.push(generatedHash);
14030
+ let generatedHash=getHashedString( firstHash + globalKeyHash, true);// (we use the heavy treatment thing.)
14031
+ globalKeyHashObject.hashes.push(generatedHash);
14032
14032
 
14033
14033
  // We update the repository :
14034
- persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,globalSaltkeyObject,false,()=>{
14034
+ persister.saveDataToFileForClient(persisterClientId,persisterRepositoryName,globalKeyHashObject,false,()=>{
14035
14035
  // TRACE
14036
14036
  console.log("INFO : Hash added to repository and saved successfully.");
14037
14037
  });
14038
14038
 
14039
14039
  // OUTPUT
14040
- console.log("Here is your key : share it with your clients but DO NOT LEAK IT !\n********************\n"+clearTextParam+"\n********************\n");
14040
+ console.log("Here is your key : share it with your main clients but DO NOT LEAK IT !\n********************\n"+clearTextParam+"\n********************\n");
14041
14041
 
14042
14042
  return aotraNodeServer;
14043
14043
  }
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.157",
3
+ "version": "0.0.160",
4
4
  "main": "aotrautils.build.js",
5
5
  "description": "A library for vanilla javascript utils (client-side) used in aotra javascript CMS",
6
6
  "author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",