🗝
summary refs log tree commit diff
path: root/nginx/handoff.html
diff options
context:
space:
mode:
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>