diff --git a/README.md b/README.md
index 7fe9d9b..fbdd113 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,7 @@ Warrant canary available at /etc/ttyserver/canary
* [ ] Canary description popup?
* [ ] Shift-Click for Keygen Options
* [ ] Download SSH Public Key on fingerprint click?
+* [ ] Better font scaling for long text
## Completed TODO:
* Change Sign Up to Log In
diff --git a/auth/api/index.php b/auth/api/index.php
index 4a540f7..3ba1396 100644
--- a/auth/api/index.php
+++ b/auth/api/index.php
@@ -61,6 +61,71 @@ if (isset($_REQUEST["act"])) {
returnError("Incorrect Verify Query");
}
break;
+ case "gemproxy":
+ if (isset($_REQUEST["token"])){
+ // Verify Encrypted Token
+ $EncTokenData = $_REQUEST["token"];
+ $TokenData = verifyEncToken($EncTokenData);
+ if (gettype($TokenData) == "string") {
+ // Invalid Token
+ returnError($TokenData);
+ }else{
+ // Valid Token
+ if (isset($_REQUEST["enable"])){
+ if (!userExists($TokenData["MastodonData"]->username)){
+ returnError("User Home Directory Not Found, try making a new SSH key.");
+ } else {
+ switch ($_REQUEST["enable"]){
+ case "yes":
+ shell_exec("/usr/bin/sudo /etc/ttyserver/bin/toggleProxy enable \"".$TokenData["MastodonData"]->username."\"");
+ returnSuccess("Gemini Proxy Enabled", buildEncToken($TokenData["AuthToken"],
+ $TokenData["UserID"],
+ $_SERVER["REMOTE_ADDR"],
+ $_SERVER["HTTP_USER_AGENT"]));
+ break;
+ case "no":
+ $result = trim(shell_exec("/usr/bin/sudo /etc/ttyserver/bin/toggleProxy disable \"".$TokenData["MastodonData"]->username."\""));
+ switch($result){
+ case "done":
+ returnSuccess("Gemini Proxy Disabled", buildEncToken($TokenData["AuthToken"],
+ $TokenData["UserID"],
+ $_SERVER["REMOTE_ADDR"],
+ $_SERVER["HTTP_USER_AGENT"]
+ ));
+ break;
+ case "no_perm":
+ returnError("Gemini Proxy Disable Failed, error_p");
+ break;
+ case "no_dir":
+ returnError("Gemini Directory Not Found");
+ break;
+ default:
+ returnError("Gemini Proxy Disable Failed, error_u");
+ break;
+ }
+
+
+ break;
+ case "get":
+ $result = trim(shell_exec("/usr/bin/sudo /etc/ttyserver/bin/toggleProxy get \"".$TokenData["MastodonData"]->username."\""));
+ returnSuccess(($result == "enabled"), buildEncToken($TokenData["AuthToken"],
+ $TokenData["UserID"],
+ $_SERVER["REMOTE_ADDR"],
+ $_SERVER["HTTP_USER_AGENT"]
+ ));
+ break;
+ default:
+ returnError("Incorrect Gemini Proxy Query");
+ break;
+ }
+ }
+ }else {
+ returnError("Incorrect Gemini Proxy Query");
+ }
+
+ }
+ }
+ break;
default:
returnError("Incorrect Action Query");
break;
diff --git a/auth/auth.js b/auth/auth.js
index 30fb8a3..252c259 100644
--- a/auth/auth.js
+++ b/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
diff --git a/elements/head.php b/elements/head.php
index 601b16e..60f5ff0 100644
--- a/elements/head.php
+++ b/elements/head.php
@@ -9,6 +9,7 @@
+
diff --git a/index.js b/index.js
index 72ad795..c95312e 100644
--- a/index.js
+++ b/index.js
@@ -50,6 +50,8 @@ const failMsg = (msg) => {
...SwalConfig,
title: "Error!",
text: msg,
+ }).then(() => {
+ window.location.replace("/");
});
}
diff --git a/style.css b/style.css
index 96a945d..0e7b663 100644
--- a/style.css
+++ b/style.css
@@ -8,6 +8,11 @@
src: url("/Assets/Fonts/C64-Rounded.ttf") format("truetype");
}
+@font-face {
+ font-family: Space;
+ src: url("/Assets/Fonts/SpaceGrotesk.ttf") format("truetype");
+}
+
body {
background-color: black;
background-image: url("/Assets/wallpaper4k.png");
@@ -53,7 +58,8 @@ span {
.button {
margin: 8px;
}
-.button > button {
+
+.button>button {
background-color: #377326;
color: #79F257;
border: 1px solid #5AA637;
@@ -68,7 +74,7 @@ span {
color: #377326;
}
-.copyright > a {
+.copyright>a {
color: #377326;
text-decoration: none;
}
@@ -85,7 +91,9 @@ span {
display: none;
}
-.swal2-confirm, .swal2-deny, .swal2-cancel {
+.swal2-confirm,
+.swal2-deny,
+.swal2-cancel {
border: 1px solid #79F257;
background-color: #377326;
color: #79F257;
@@ -98,6 +106,10 @@ span {
background-color: #022601;
}
+.swal2-html-container {
+ overflow: hidden !important;
+}
+
.footerbutton {
background: none;
border: none;
@@ -107,9 +119,11 @@ span {
td {
border: 1px solid #3a4c35;
}
+
td:first-child {
border-left: 2px solid #3a4c35;
}
+
.fingerprintTable {
width: 100%;
border-collapse: collapse;
@@ -132,3 +146,68 @@ td:first-child {
.emoji {
height: 2em;
}
+
+.switch {
+ position: relative;
+ display: inline-block;
+ width: 60px;
+ height: 34px;
+}
+
+.switch input {
+ opacity: 0;
+ width: 0;
+ height: 0;
+}
+
+.slider {
+ position: absolute;
+ cursor: pointer;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: #3a4c35;
+ -webkit-transition: .4s;
+ transition: .4s;
+}
+
+.slider:before {
+ position: absolute;
+ content: "";
+ height: 26px;
+ width: 26px;
+ left: 4px;
+ bottom: 4px;
+ background-color: #79F257;
+ -webkit-transition: .4s;
+ transition: .4s;
+}
+
+input:checked+.slider {
+ background-color: #377326;
+}
+
+input:focus+.slider {
+ box-shadow: 0 0 1px #377326;
+}
+
+input:checked+.slider:before {
+ -webkit-transform: translateX(26px);
+ -ms-transform: translateX(26px);
+ transform: translateX(26px);
+}
+
+.slider.round {
+ border-radius: 34px;
+}
+
+.slider.round:before {
+ border-radius: 50%;
+}
+
+.name {
+ font-family: Space, Courier, monospace;
+ white-space: nowrap;
+ font-size: 2vw;
+}