Added setCookie function
This commit is contained in:
parent
4e5be60e84
commit
2fb876f1fb
@ -3,6 +3,15 @@
|
|||||||
if(getCookie("apiUri") != ""){
|
if(getCookie("apiUri") != ""){
|
||||||
apiUri = getCookie("apiUri");
|
apiUri = getCookie("apiUri");
|
||||||
}
|
}
|
||||||
|
setCookie("apiUri", apiUri);
|
||||||
|
|
||||||
|
function setCookie(cname, cvalue) {
|
||||||
|
const d = new Date();
|
||||||
|
d.setTime(d.getTime() + (365*24*60*60*1000));
|
||||||
|
let expires = "expires="+ d.toUTCString();
|
||||||
|
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/;samesite=strict";
|
||||||
|
}
|
||||||
|
|
||||||
function getCookie(cname) {
|
function getCookie(cname) {
|
||||||
let name = cname + "=";
|
let name = cname + "=";
|
||||||
let decodedCookie = decodeURIComponent(document.cookie);
|
let decodedCookie = decodeURIComponent(document.cookie);
|
||||||
@ -78,6 +87,12 @@ async function GetWaitingJobs(){
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function GetMonitorJobs(){
|
||||||
|
var uri = `${apiUri}/Jobs/MonitorJobs`;
|
||||||
|
let json = await GetData(uri);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
async function GetProgress(jobId){
|
async function GetProgress(jobId){
|
||||||
var uri = `${apiUri}/Jobs/Progress?jobId=${jobId}`;
|
var uri = `${apiUri}/Jobs/Progress?jobId=${jobId}`;
|
||||||
let json = await GetData(uri);
|
let json = await GetData(uri);
|
||||||
@ -139,8 +154,8 @@ function UpdateKomga(komgaUrl, komgaAuth){
|
|||||||
PostData(uri);
|
PostData(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdateKavita(kavitaUrl, kavitaUser, kavitaPass){
|
function UpdateKavita(kavitaUrl, kavitaUsername, kavitaPassword){
|
||||||
var uri = `${apiUri}/LibraryConnectors/Update?libraryConnector=Kavita&kavitaUrl=${kavitaUrl}&kavitaUser=${kavitaUser}&kavitaPass={kavitaPass}`;
|
var uri = `${apiUri}/LibraryConnectors/Update?libraryConnector=Kavita&kavitaUrl=${kavitaUrl}&kavitaUsername=${kavitaUsername}&kavitaPassword={kavitaPassword}`;
|
||||||
PostData(uri);
|
PostData(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user