Skip to content

Commit 2c2afaa

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents d949615 + 9d0ef4e commit 2c2afaa

File tree

3 files changed

+42
-42
lines changed

3 files changed

+42
-42
lines changed

devops/demo/landing-page/nginx.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ http {
2323
location / {
2424
root /opt/nginx/webroot;
2525
index index.html;
26+
add_header Content-Security-Policy "default-src 'none'; script-src 'self'; style-src 'self'; font-src 'self'; img-src 'self' https://securedrop.org;" always;
2627
}
2728
}
2829
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Add "copy to clipboard" functionality to all copy buttons
2+
document.querySelectorAll(".copy-btn").forEach(btn => {
3+
btn.addEventListener("click", () => {
4+
const selector = btn.dataset.target;
5+
const text = document.querySelector(selector).textContent.trim();
6+
navigator.clipboard.writeText(text);
7+
8+
// Display exactly one ephemeral success message
9+
const cell = btn.parentNode;
10+
const existing = cell.querySelector(".copiedtip");
11+
if (existing) {
12+
existing.remove();
13+
}
14+
const tip = document.createElement("span");
15+
tip.className = "copiedtip";
16+
tip.textContent = "Copied to clipboard!";
17+
cell.appendChild(tip);
18+
setTimeout(() => tip.remove(), 2500);
19+
});
20+
});
21+
22+
// Cycle through TOTP codes
23+
function updateOTP() {
24+
const secret = document.getElementById("totpsecretvalue").textContent.trim();
25+
const totp = new jsOTP.totp();
26+
document.getElementById("totpvalue").textContent = totp.getOtp(secret);
27+
28+
const epoch = Math.round(new Date().getTime() / 1000.0);
29+
const remaining = 30 - (epoch % 30);
30+
const seconds = `${remaining}`.padStart(2, "0");
31+
document.getElementById("totpttl").textContent = `(:${seconds} remaining)`;
32+
33+
if (remaining < 10) {
34+
document.getElementById("totp").classList.add("expiring");
35+
} else {
36+
document.getElementById("totp").classList.remove("expiring");
37+
}
38+
}
39+
updateOTP();
40+
setInterval(updateOTP, 1000);

devops/demo/landing-page/webroot/index.html

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -63,47 +63,6 @@ <h1>Demo Server</h1>
6363
</tbody>
6464
</table>
6565
<script src="/assets/js/jsOTP.js"></script>
66-
<script>
67-
// Add "copy to clipboard" functionality to all copy buttons
68-
document.querySelectorAll(".copy-btn").forEach(btn => {
69-
btn.addEventListener("click", () => {
70-
const selector = btn.dataset.target;
71-
const text = document.querySelector(selector).textContent.trim();
72-
navigator.clipboard.writeText(text);
73-
74-
// Display exactly one ephemeral success message
75-
const cell = btn.parentNode;
76-
const existing = cell.querySelector(".copiedtip");
77-
if (existing) {
78-
existing.remove();
79-
}
80-
const tip = document.createElement("span");
81-
tip.className = "copiedtip";
82-
tip.textContent = "Copied to clipboard!";
83-
cell.appendChild(tip);
84-
setTimeout(() => tip.remove(), 2500);
85-
});
86-
});
87-
88-
// Cycle through TOTP codes
89-
function updateOTP() {
90-
const secret = document.getElementById("totpsecretvalue").textContent.trim();
91-
const totp = new jsOTP.totp();
92-
document.getElementById("totpvalue").textContent = totp.getOtp(secret);
93-
94-
const epoch = Math.round(new Date().getTime() / 1000.0);
95-
const remaining = 30 - (epoch % 30);
96-
const seconds = `${remaining}`.padStart(2, "0");
97-
document.getElementById("totpttl").textContent = `(:${seconds} remaining)`;
98-
99-
if (remaining < 10) {
100-
document.getElementById("totp").classList.add("expiring");
101-
} else {
102-
document.getElementById("totp").classList.remove("expiring");
103-
}
104-
}
105-
updateOTP();
106-
setInterval(updateOTP, 1000);
107-
</script>
66+
<script src="/assets/js/demo.js"></script>
10867
</body>
10968
</html>

0 commit comments

Comments
 (0)