🗝
summary refs log tree commit diff
path: root/nginx/handoff.html
diff options
context:
space:
mode:
authormia <mia@mia.jetzt>2024-06-08 22:56:05 -0700
committermia <mia@mia.jetzt>2024-06-08 22:56:05 -0700
commit8cf813ff033bbc98a7dd40db6ac11e2e35c7e997 (patch)
treea451059194cbd4ba90993ebdaced4749448ec4df /nginx/handoff.html
downloadasylum-8cf813ff033bbc98a7dd40db6ac11e2e35c7e997.tar.gz
asylum-8cf813ff033bbc98a7dd40db6ac11e2e35c7e997.zip
initial commit
Diffstat (limited to 'nginx/handoff.html')
-rw-r--r--nginx/handoff.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/nginx/handoff.html b/nginx/handoff.html
new file mode 100644
index 0000000..c160580
--- /dev/null
+++ b/nginx/handoff.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html style="align-items: center; background-color: darkcyan; display: flex; height: 100%">
+	<head>
+		<title>Handoff</title>
+		<script>
+			(async () => {
+				const response = await fetch("https://dissociate.mia.jetzt/handoff", { credentials: "include" });
+				if (response.status == 200) {
+					const data = await response.json();
+					if (data.expiresIn < 300) {
+						console.log("token expiring soon, reauthenticating");
+						location = "https://dissociate.mia.jetzt/logout";
+					}
+					await fetch(`/.nginx/cookie?token=${data.token}&max_age=${data.expiresIn - 60}`);
+					location = "/";
+				} else {
+					console.log("not authenticated, redirecting");
+					location = "https://dissociate.mia.jetzt/login";
+				}
+			})()
+		</script>
+	</head>
+	<body style="background-color: whitesmoke; color: black; filter: drop-shadow(0.5em 0.7em); margin: auto; padding: 1em">
+		<p style="font-family: serif; font-size: large; margin: 0">Performing authenticated handoff</p>
+	</body>
+</html>