Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove token from html #8

Merged
merged 6 commits into from
Jan 28, 2025
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
283 changes: 204 additions & 79 deletions token.html
Original file line number Diff line number Diff line change
@@ -1,80 +1,176 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en-us">

<head>

<!-- Meta -->
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Token</title>
<meta name="description" content="Local EGA in Norway">

<!-- The compiled CSS file -->
<link rel="stylesheet" href="css/production.css">

<!-- Web fonts -->
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,400i,700|Source+Serif+Pro:700" rel="stylesheet">

<!-- favicon.ico. Place these in the root directory. -->
<link rel="shortcut icon" href="/img/favicon.ico">

</head>

<body class="has-animations">

<head>
<!-- Meta -->
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1" />

<title>Token</title>
<meta name="description" content="Local EGA in Norway" />

<!-- The compiled CSS file -->
<link rel="stylesheet" href="css/production.css" />

<!-- Web fonts -->
<link
href="https://fonts.googleapis.com/css?family=Montserrat:400,400i,700|Source+Serif+Pro:700"
rel="stylesheet"
/>

<!-- favicon.ico. Place these in the root directory. -->
<link rel="shortcut icon" href="/img/favicon.ico" />

<style>
.btn:hover {
transform: translateY(-1px);
box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}
body {
background: #f9fafb;
}
</style>
</head>

<body class="has-animations">
<div class="container pt3 mt2 text--gray align--center">
<div class="grid-column align--left">
<a href="/" class="link"><img class="logo" style="max-height: 100px; vertical-align: -2em; margin: 20px;" src="/img/EGA_submarcas_Norway.svg" alt="Federated EGA Norway node"></a>
<a href="/docs.html" class="link link--text" style="margin: 8px;">Docs and Info</a>
<a href="/pp.html" class="link link--text" style="margin: 8px;">Privacy Policy</a>
<a href="/tos.html" class="link link--text" style="margin: 8px;">Terms of Service</a>
<a href="mailto:[email protected]" class="link link--text" style="margin: 8px;">Contact Us</a>
<a href="/about.html" class="link link--text" style="margin: 8px;">About</a>
</div>
<div class="grid-column align--left">
<a href="/" class="link"
><img
class="logo"
style="max-height: 100px; vertical-align: -2em; margin: 20px"
src="/img/EGA_submarcas_Norway.svg"
alt="Federated EGA Norway node"
/></a>
<a href="/docs.html" class="link link--text" style="margin: 8px"
>Docs and Info</a
>
<a href="/pp.html" class="link link--text" style="margin: 8px"
>Privacy Policy</a
>
<a href="/tos.html" class="link link--text" style="margin: 8px"
>Terms of Service</a
>
<a
href="mailto:[email protected]"
class="link link--text"
style="margin: 8px"
>Contact Us</a
>
<a href="/about.html" class="link link--text" style="margin: 8px"
>About</a
>
</div>
</div>

<!-- Header -->
<header class="align--center pt3">
<div class="container--lg border--bottom pb3">
<h1 class="mb2">Federated EGA Norway node</h1>
<h2 class="mt3">Token for: </h2>
<p class="text--primary-color bold" id="sub"></p>
</div>
<div class="container--lg">
<h1 class="mb2">Federated EGA Norway node</h1>
</div>
</header>

<main>

<!-- Feature list -->
<div class="container mt2">
<code id="token" class="align--justify align--center-on-mobile text--gray" style="overflow-wrap: break-word; max-width: 100px">
</code>
<div class="grid-row pt1 mt1">
<div class="grid-column align--center align--center-on-mobile">
<button class="btn" data-clipboard-target="#token">
Copy to clipboard
</button>
<!-- Token section -->
<div class="container mt4">
<div class="grid-row">
<div class="grid-column align--center">
<!-- Success state -->
<div
id="tokenInterface"
style="
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
"
>
<div style="display: flex; align-items: center; gap: 1.5rem">
<div style="display: flex; align-items: center">
<h2 style="font-size: 1.2rem; margin: 0; color: #666">
Token for:
</h2>
<p
class="text--primary-color bold"
id="sub"
style="font-size: 1.2rem; margin: 0 0 0 0.5rem"
></p>
</div>

<button
class="btn"
style="
background: #465be5;
padding: 12px 24px;
transition: all 0.2s ease;
border: none;
color: white;
"
>
Copy Token
</button>
</div>
<p
id="copyStatus"
style="
display: none;
color: #10b981;
margin: 0;
font-size: 0.9rem;
"
>
Token copied to clipboard!
</p>
</div>
</div>

<!-- Error state -->
<p
id="errorStatus"
style="
display: none;
color: #dc2626;
margin: 0;
font-size: 0.9rem;
"
>
Error retrieving token. Please try again later.
</p>
</div>
</div>
</div>
</main>

<!-- Footer -->
<footer class="pt1 pb3 align--center-on-mobile">
<div class="container">
<div class="grid-row">
<div class="grid-column mt2 align--left align--center-on-mobile">
<ul class="no-bullets list--inline">
<li class="mr1"><a href="mailto:[email protected]" class="text"><img class="icon" src="/img/mail.svg" alt="Contact">[email protected]</a></li>
</ul>
</div>
</div>
<div class="grid-column mt2 span-half">
<p class="small">Design by <a href="https://www.papayatemplates.com" class="link link--text">Papaya</a>. Illustrations from&nbsp;<a href="https://undraw.co/" class="link link--text">Undraw</a>.</p>
</div>
<div class="container">
<div class="grid-row">
<div class="grid-column mt2 align--left align--center-on-mobile">
<ul class="no-bullets list--inline">
<li class="mr1">
<a href="mailto:[email protected]" class="text"
><img
class="icon"
src="/img/mail.svg"
alt="Contact"
/>[email protected]</a
>
</li>
</ul>
</div>
</div>
<div class="grid-column mt2 span-half">
<p class="small">
Design by
<a href="https://www.papayatemplates.com" class="link link--text"
>Papaya</a
>. Illustrations from&nbsp;<a
href="https://undraw.co/"
class="link link--text"
>Undraw</a
>.
</p>
</div>
</div>
</footer>

<!-- Scroll reveal -->
Expand All @@ -84,29 +180,58 @@ <h2 class="mt3">Token for: </h2>
<script src="js/production.js"></script>

<!-- Cookies popup -->
<script type="text/javascript" id="cookieinfo" src="js/cookieinfo.min.js" data-moreinfo="/pp.html"></script>
<script
type="text/javascript"
id="cookieinfo"
src="js/cookieinfo.min.js"
data-moreinfo="/pp.html"
></script>

<!-- Copy to clipboard button -->
<script src="js/clipboard.min.js"></script>

<script type="text/javascript">
fetch('/token')
.then(response => response.text())
.then(responseText => {
const base64Url = responseText.split('.')[1];
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
const jsonPayload = decodeURIComponent(atob(base64).split('').map(function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
document.getElementById("sub").innerHTML = JSON.parse(jsonPayload)['sub'];
document.getElementById("token").innerHTML = responseText;
new ClipboardJS('.btn');
})
.catch(error => {
console.error('Fetch error:', error);
});
fetch("/token", {
headers: {
"Content-Type": "application/json",
},
})
.then((response) => {
if (!response.ok) {
throw new Error("Failed to fetch token");
}
return response.text();
})
.then((responseText) => {
const base64Url = responseText.split(".")[1];
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
const jsonPayload = decodeURIComponent(
atob(base64)
.split("")
.map(function (c) {
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
})
.join("")
);
document.getElementById("sub").innerHTML =
JSON.parse(jsonPayload)["sub"];
const clipboard = new ClipboardJS(".btn", {
text: () => responseText,
});

clipboard.on("success", function (e) {
const copyStatus = document.getElementById("copyStatus");
copyStatus.style.display = "block";
setTimeout(() => {
copyStatus.style.display = "none";
}, 2000);
});
})
.catch((error) => {
console.error("Fetch error:", error);
document.getElementById("tokenInterface").style.display = "none";
document.getElementById("errorStatus").style.display = "block";
});
</script>

</body>
</body>
</html>