added slider and some ui fixes
This commit is contained in:
+26
-3
@@ -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",
|
||||
|
||||
@@ -12,5 +12,6 @@ export function GetOutputFrameUrl(): string {
|
||||
}
|
||||
else {
|
||||
return "https://outputframe.davidmeincke.dk/";
|
||||
//return "https://codeeditoroutput.z16.web.core.windows.net/";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user