Skip to content

Commit

Permalink
Bug fixes, changes to API cookie saving and notification graphic.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreag00 authored Jun 16, 2022
1 parent 257ae74 commit 8307185
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Scriptable-JS/Tim-CID.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let CID = CID

let band = [0,0,7,1,3,0,20][~~(CID / 10)];
let band = [,,7,1,3,,20][~~(CID / 10)];

return{band};

Expand Down
2 changes: 1 addition & 1 deletion Scriptable-JS/Vodafone-CID.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let CID = CID

let band = [0,20,0,3,1,7,0,0,0,8,0,20,0,3,1,7][~~(CID / 10)];
let band = [,20,,3,1,7,,,,8,,20,,3,1,7][~~(CID / 10)];

return{band};

Expand Down
2 changes: 1 addition & 1 deletion Scriptable-JS/iliad-CID.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let CID = CID

let band = [0,0,1,0,"7 COVID",0,7,28,3][~~(CID / 10)];
let band = [,,1,,"7 COVID",,7,28,3][~~(CID / 10)];

return{band};

Expand Down
38 changes: 24 additions & 14 deletions Scriptable-JS/lteitaly-query.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
var cookies = Keychain.get("cookie");
var newcookies = ""

let req2 = new Request("https://lteitaly.it/internal/v3/api.php");
req2.method = "POST";
req2.headers = { "Content-Type": "application/json;charset=UTF-8", "Cookie": cookies, "Referer": "https://lteitaly.it" };
req2.body = "[\"databyenb3\",\"MNC\",\"eNBR\"]";
let json = await req2.loadJSON();
let req2 = new Request("https://lteitaly.it/internal/v3/api.php");
req2.method = "POST";
req2.headers = { "Content-Type": "application/json;charset=UTF-8", "Cookie": cookies, "Referer": "https://lteitaly.it" };
req2.body = "[\"databyenb3\",\"MNC\",\"eNBR\"]";
let json = await req2.loadJSON();

let statusCode = req2.response['statusCode'];
req2.response.cookies;

for (const cookie of req2.response.cookies) {
newcookies += cookie.name + "=" + cookie.value + "; ";
}

if (statusCode == 200) {
let Name = json[0]
let LTE_Bands = json[1].split("~").filter(it => it).join(", ")
let NR_Bands = json[2].split("~").filter(it => it).join(", ")
Keychain.remove("cookie");
Keychain.set("cookie",newcookies);

let associateIndex = ["AAU mmWave","TDD sub-6GHz","FDD","DSS","Altro"];
let associateDigit = ["Off","Presente","Passivo","Inter-site","Permessi","Altro"];
let NR_Info = [...json[3]].map((it, index) => [associateIndex[index], associateDigit[it]].join(": ")).join(", ")
let statusCode = req2.response['statusCode'];

return{Name,LTE_Bands,NR_Bands,NR_Info};
if (statusCode == 200) {
let Name = json[0]
let LTE_Bands = json[1].split("~").filter(it => it).join(", ")
let NR_Bands = json[2].split("~").filter(it => it).join(", ")

let associateIndex = ["- AAU mmWave","- TDD Sub-6GHz","- FDD","- DSS","- Altro"];
let associateDigit = ["No","","Passivo","Intersite","Autorizzato","Ignoto"];
let NR_Info = [...json[3]].map((it, index) => [associateIndex[index], associateDigit[it]]).filter(it => it[1] !== 'No').map(it => it.join(" ")).join("\n")

return{Name,LTE_Bands,NR_Bands,NR_Info};
Script.complete();
} else {
return{statusCode};
Expand Down
Binary file modified ShorteNB.shortcut
Binary file not shown.
4 changes: 2 additions & 2 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Corretto un problema con le domande di setup, la cui assenza non faceva eseguire lo shortcut.
Corretto un problema con l'autenticazione di LTE Italy (spero), cambiata la grafica della notifica e bug fixes vari.

N.B.: questa versione è una beta e potrebbe presentare bug oltre a non essere completa.
DISCLAIMER: questa versione è una beta e potrebbe presentare bug oltre a non essere completa.
2 changes: 1 addition & 1 deletion link
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://www.icloud.com/shortcuts/f7bec12407ab4d528abe6096e05ac1ee
https://www.icloud.com/shortcuts/11f101adb1a44e45b322d70baafe9e14
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b3
b4

0 comments on commit 8307185

Please sign in to comment.