Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions static/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ function ajax_submit_paste(c,e) {
var statusDiv = document.getElementById("paste-status");
statusDiv.innerHTML = `
<p>Paste created with ID: ${response.id}</p>
<p>You can access it <a href="/${response.id}?secret=${secret}">here</a></p>
<p>Paste was encrypted using secret ${secret}</p>
<p>You can access it <a href="/${response.id}#${secret}">here</a></p>
`;
statusDiv.hidden = false;
} else {
Expand Down Expand Up @@ -74,4 +75,4 @@ function on_submit_form() {
var content = document.getElementById("content-textarea").value;
var expiry = document.getElementById("expiry-select").value;
ajax_submit_paste(content, expiry);
}
}
3 changes: 3 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<div class="header">
ElitePaste
</div>
<noscript>
<p class="container">You don't have javascript enabled, and this site requires Javascript to create and view pastes.</p>
</noscript>
<main>
<div class="container">
<div id="paste-form">
Expand Down
7 changes: 5 additions & 2 deletions templates/view_paste.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<script src="{{ url_for('static', filename='client.js') }}"></script>
<script>
document.addEventListener("DOMContentLoaded", (event) => {
var key = new URLSearchParams(window.location.search).get("secret"); // pull secret from URL params
var key = window.location.hash.split("#")[1];
console.log(key);
if (!key) {
document.getElementById("load-status").innerHTML = "No secret was supplied. No content will be displayed at this time.";
return;
}
var parts = window.location.href.split("/");
var paste_id = parts[parts.length-1].split("&")[0];
var paste_id = parts[parts.length-1].split("#")[0];
ajax_pull_paste(paste_id, key);
});
</script>
Expand All @@ -27,6 +27,9 @@
</style>
</head>
<body>
<noscript>
<p class="container">You don't have javascript enabled, and this site requires Javascript to create and view pastes.</p>
</noscript>
<main>
<div class="container">
<div id="load-status">
Expand Down