Pre-pull
This commit is contained in:
63
auth/auth.js
63
auth/auth.js
@@ -6,6 +6,14 @@ const SwalConfig = {
|
||||
color: "#79F257",
|
||||
background: "#022601",
|
||||
buttonsStyling: false,
|
||||
showClass: {
|
||||
backdrop: 'swal2-noanimation',
|
||||
popup: '',
|
||||
icon: ''
|
||||
},
|
||||
hideClass: {
|
||||
popup: '',
|
||||
}
|
||||
};
|
||||
|
||||
const invalidChars = ["/", "\\", ">", "<", ":", "*", "|", '"', "'", "?", "\0"];
|
||||
@@ -35,7 +43,12 @@ const post = (url, data, callback) => {
|
||||
},
|
||||
data: data
|
||||
};
|
||||
$.ajax(settings).done(callback);
|
||||
$.ajax(settings).done((data) => {
|
||||
if (typeof data.token !== "undefined") {
|
||||
localStorage.setItem("tty_token", data.token);
|
||||
}
|
||||
callback(data);
|
||||
});
|
||||
};
|
||||
|
||||
const saveFile = (name, type, data) => {
|
||||
@@ -240,6 +253,54 @@ const logout = () => {
|
||||
window.location.href = "/?msg=End%20Of%20Line.";
|
||||
};
|
||||
|
||||
const gemini = () => {
|
||||
var payload = {
|
||||
token: localStorage.getItem("tty_token"),
|
||||
act: "gemproxy",
|
||||
enable: "get"
|
||||
};
|
||||
post(USE_ORIGIN + "/auth/api/index.php", payload, (response) => {
|
||||
console.dir(response.data);
|
||||
$.get(USE_ORIGIN + "/auth/gem.html", (ui) => {
|
||||
ui = ui.replace("checked", response.data?"checked":"");
|
||||
console.log(ui);
|
||||
Swal.fire({
|
||||
...SwalConfig,
|
||||
title: "Gemini Settings",
|
||||
html: ui,
|
||||
willClose: (doc) => {
|
||||
switch(doc.getElementsByTagName("input")[0].checked){
|
||||
case true:
|
||||
payload.enable = "yes";
|
||||
break;
|
||||
case false:
|
||||
payload.enable = "no";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
payload.token = localStorage.getItem("tty_token");
|
||||
post(USE_ORIGIN + "/auth/api/index.php", payload, (set_response) => {
|
||||
if(set_response.error){
|
||||
Swal.fire({
|
||||
...SwalConfig,
|
||||
title: "Config Failed",
|
||||
text: set_response.error,
|
||||
});
|
||||
}else {
|
||||
Swal.fire({
|
||||
...SwalConfig,
|
||||
title: "Success",
|
||||
text: set_response.data,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
$(() => {
|
||||
// On Page Load
|
||||
// Override domain
|
||||
|
||||
Reference in New Issue
Block a user