added slider and some ui fixes

This commit is contained in:
David Meincke
2023-05-30 17:10:35 +02:00
parent 28631e8251
commit e3515901e4
13 changed files with 281 additions and 297 deletions
+26 -3
View File
@@ -1,4 +1,22 @@
var apiUrl = "https://codeeditor-api.davidssoft.com/";
//var apiUrl = "https://codeeditor-api.azurewebsites.net/";
export function hasSession() {
var localstorageSessionId = localStorage.getItem("sessionId");
if (!localstorageSessionId) {
return false;
}
else {
var expiration = localStorage.getItem("sessionIdExpiration");
if (expiration) {
return !sessionIsExpired(expiration);
}
else {
return false;
}
}
}
function getSessionId() {
var localstorageSessionId = localStorage.getItem("sessionId");
@@ -10,9 +28,7 @@ function getSessionId() {
var expiration = localStorage.getItem("sessionIdExpiration");
if (expiration) {
var expirationDate = new Date(expiration);
if (dateDiff(expirationDate, new Date()) > 120) {
if (sessionIsExpired(expiration)) {
return setNewSession();
}
else {
@@ -27,6 +43,10 @@ function getSessionId() {
}
}
function sessionIsExpired(expiration: string) {
return dateDiff(new Date(expiration), new Date()) > 120;
}
function setNewSession() {
var newSessionId = uuidv4();
localStorage.setItem("sessionIdExpiration", (new Date()).toString());
@@ -76,6 +96,9 @@ export function setSessionData(language: string, input: any, onSet?: () => void)
else if (language.toLowerCase() == "css") {
type = 2;
}
else {
type = 3;
}
fetch(apiUrl + "session/set", {
method: "POST",