Added aeskeyshare and fixed html files to be more standard-complient

This commit is contained in:
Tracker-Friendly 2024-04-29 01:45:22 +01:00
parent a1ae521b56
commit 8299915502
8 changed files with 74 additions and 69 deletions

View File

@ -275,6 +275,10 @@ func main() {
c.HTML(200, "dashboard.html", gin.H{}) c.HTML(200, "dashboard.html", gin.H{})
}) })
router.GET("/aeskeyshare", func(c *gin.Context) {
c.HTML(200, "keyshare.html", gin.H{})
})
router.GET("/.well-known/openid-configuration", func(c *gin.Context) { router.GET("/.well-known/openid-configuration", func(c *gin.Context) {
c.HTML(200, "openid.html", gin.H{}) c.HTML(200, "openid.html", gin.H{})
}) })

24
static/js/aeskeyshare.js Normal file
View File

@ -0,0 +1,24 @@
window.addEventListener("message", function(event) {
try {
let data = JSON.parse(event.data);
const access_token = data["access_token"];
const redirect_uri = data["redirect_uri"];
fetch("https://auth.hectabit.org/api/isloggedin", {
method: "POST",
body: JSON.stringify({
access_token: access_token
})
})
.then((response) => {
if (response.status === 200) {
console.log("Key is valid");
let newtab = window.open(redirect_uri);
newtab.postMessage(localStorage.getItem("DONOTSHARE-password"), "*");
window.close();
}
});
} catch {
console.log("Error parsing JSON");
}
});

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Burgerauth</title>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="icon" href="/static/svg/favicon.svg">
</head>
<p>Redirecting...</p>
<script src="/static/js/aeskeyshare.js"></script>

View File

@ -1,8 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/static/css/dashboard.css" media=""> <link rel="stylesheet" href="/static/css/dashboard.css" media="">
<script src="/static/js/dashboard.js"></script> <script src="/static/js/dashboard.js"></script>
<title>Dashboard</title>
</head> </head>
<body> <body>
<div class="newoauth"> <div class="newoauth">

View File

@ -1,28 +1,19 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>Login - Hectabit</title> <title>Login - Burgerauth</title>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../static/css/style.css" /> <link rel="stylesheet" type="text/css" href="/static/css/style.css" />
<script src="../static/js/hash-wasm.js"></script> <script src="/static/js/hash-wasm.js"></script>
<link rel="icon" href="../static/svg/favicon.svg"> <link rel="icon" href="/static/svg/favicon.svg">
<script>
if (window.location.href.endsWith('/index.html')) {
if (window.location.origin !== null) {
var currentUrl = window.location.href;
var newUrl = currentUrl.replace('/index.html', '');
window.location.href = newUrl;
}
}
</script>
</head> </head>
<body> <body>
<p class="credit">Image by perga (@pergagreen on discord)</p> <p class="credit">Image by perga (@pergagreen on discord)</p>
<img src="/static/img/background.jpg" class="background"> <img src="/static/img/background.jpg" class="background" alt="">
<div class="inoutdiv"> <div class="inoutdiv">
<h2 class="w300">Login</h2> <h2 class="w300">Login</h2>
<p id="statusBox"></p> <p id="statusBox"></p>
@ -33,8 +24,8 @@
<button id="backButton" class="hidden">Back</button> <button id="backButton" class="hidden">Back</button>
<br> <br>
<br> <br>
<p>Don't have an account? If so, <a href="#" id="signuprdirButton">Create one here!</a></p> <p>Don't have an account? If so, <a href="/signup" id="signuprdirButton">Create one here!</a></p>
<a href="#" id="privacyButton">Privacy &amp; Terms</a> <a href="/privacy" id="privacyButton">Privacy &amp; Terms</a>
</div> </div>
<script type="text/javascript" src="../static/js/login.js"></script> <script type="text/javascript" src="../static/js/login.js"></script>

View File

@ -1,25 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>Burgernotes</title> <title>Burgerauth</title>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="icon" href="../static/svg/favicon.svg"> <link rel="icon" href="/static/svg/favicon.svg">
<script> </head>
if (window.location.href.endsWith('/index.html')) { <p>Logging out...</p>
if (window.location.origin !== null) {
var currentUrl = window.location.href;
var newUrl = currentUrl.replace('/index.html', '');
window.location.href = newUrl;
}
}
</script>
<head>
Logging out..
<script> <script>
localStorage.removeItem("DONOTSHARE-secretkey") localStorage.removeItem("DONOTSHARE-secretkey")
localStorage.removeItem("DONOTSHARE-password") localStorage.removeItem("DONOTSHARE-password")
localStorage.removeItem("CACHE-username") localStorage.removeItem("CACHE-username")
window.location.replace("../login") window.location.replace("/login")
</script> </script>

View File

@ -1,22 +1,14 @@
<html> <html lang="en">
<head> <head>
<title>Authorize application</title> <title>Authorize application</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../static/css/style.css" media=""> <link rel="stylesheet" type="text/css" href="/static/css/style.css" media="">
<script src="../static/js/hash-wasm.js"></script> <script src="/static/js/hash-wasm.js"></script>
<link rel="icon" href="../static/svg/favicon.svg"> <link rel="icon" href="/static/svg/favicon.svg">
<script> <script>
var client_id, redirect_uri, response_type, state, code, codemethod, secret_key, expires; let client_id, redirect_uri, response_type, state, code, codemethod, secret_key, expires;
if (window.location.href.endsWith('/index.html')) {
if (window.location.origin !== null) {
var currentUrl = window.location.href;
var newUrl = currentUrl.replace('/index.html', '');
window.location.href = newUrl;
}
}
if (localStorage.getItem("DONOTSHARE-secretkey") === null) { if (localStorage.getItem("DONOTSHARE-secretkey") === null) {
window.location.replace("/login" + window.location.search) window.location.replace("/login" + window.location.search)
@ -26,7 +18,7 @@
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
var statusBox = document.getElementById("statusBox"); const statusBox = document.getElementById("statusBox");
// Get URL parameters // Get URL parameters
if (urlParams.has('client_id')) { if (urlParams.has('client_id')) {
@ -52,8 +44,8 @@
// Get DONOTSHARE-secretkey from localStorage // Get DONOTSHARE-secretkey from localStorage
secret_key = localStorage.getItem("DONOTSHARE-secretkey"); secret_key = localStorage.getItem("DONOTSHARE-secretkey");
var now = new Date(); const now = new Date();
var expireTime = now.getTime() + (21 * 1000); // 21 seconds from now const expireTime = now.getTime() + (21 * 1000); // 21 seconds from now
expires = new Date(expireTime).toUTCString(); expires = new Date(expireTime).toUTCString();
}); });
@ -68,14 +60,14 @@
<body> <body>
<p class="credit">Image by perga (@pergagreen on discord)</p> <p class="credit">Image by perga (@pergagreen on discord)</p>
<img src="/static/img/background.jpg" class="background"> <img src="/static/img/background.jpg" class="background" alt="">
<div class="inoutdiv"> <div class="inoutdiv">
<h2 class="w300">Authorise Application</h2> <h2 class="w300">Authorise Application</h2>
<p id="statusBox">Loading...</p> <p id="statusBox">Loading...</p>
<br> <br>
<div style="display: flex;justify-content: center;"> <div style="display: flex;justify-content: center;">
<button onclick="oauth();" style="margin: 0;width: 100%;margin-right: 2.5px;">Allow</button> <button onclick="oauth();" style="width: 100%;margin: 0 3px 0 0;">Allow</button>
<button onclick="window.location.replace('https://www.hectabit.org');" style="margin: 0;width: 100%;margin-left: 2.5px;">Deny</button> <button onclick="window.location.replace('https://www.hectabit.org');" style="width: 100%;margin: 0 0 0 3px;">Deny</button>
</div> </div>
</div> </div>
</body> </body>

View File

@ -1,28 +1,19 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>Signup - Hectabit</title> <title>Signup - Burgerauth</title>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../static/css/style.css" /> <link rel="stylesheet" type="text/css" href="/static/css/style.css" />
<script src="../static/js/hash-wasm.js"></script> <script src="/static/js/hash-wasm.js"></script>
<link rel="icon" href="../static/svg/favicon.svg"> <link rel="icon" href="/static/svg/favicon.svg">
<script>
if (window.location.href.endsWith('/index.html')) {
if (window.location.origin !== null) {
var currentUrl = window.location.href;
var newUrl = currentUrl.replace('/index.html', '');
window.location.href = newUrl;
}
}
</script>
</head> </head>
<body> <body>
<p class="credit">Image by perga (@pergagreen on discord)</p> <p class="credit">Image by perga (@pergagreen on discord)</p>
<img src="/static/img/background.jpg" class="background"> <img src="/static/img/background.jpg" class="background" alt="">
<div class="inoutdiv"> <div class="inoutdiv">
<h2 class="w300">Signup</h2> <h2 class="w300">Signup</h2>
<p>Signup for an account</p> <p>Signup for an account</p>
@ -30,9 +21,9 @@
<input id="usernameBox" type="text" placeholder="Username"> <input id="usernameBox" type="text" placeholder="Username">
<input id="passwordBox" type="password" placeholder="Password"><br> <input id="passwordBox" type="password" placeholder="Password"><br>
<button id="signupButton">Signup</button><br><br> <button id="signupButton">Signup</button><br><br>
<p>Already have an account? If so, <a href="#" id="loginButton">Login</a> instead!</p> <p>Already have an account? If so, <a href="/login" id="loginButton">Login</a> instead!</p>
<p>Please note that it's impossible to reset your password, do not forget it!</p> <p>Please note that it's impossible to reset your password, do not forget it!</p>
<a href="#" id="privacyButton">Privacy &amp; Terms</a> <a href="/privacy" id="privacyButton">Privacy &amp; Terms</a>
</div> </div>
<script type="text/javascript" src="../static/js/signup.js"></script> <script type="text/javascript" src="../static/js/signup.js"></script>
</body> </body>