Skip to content

Commit

Permalink
Add local memorization to the original url field.
Browse files Browse the repository at this point in the history
Here we only store the original token in the local browser so
there shouldn't be any issues but it makes it a lot easier to
copy it again if you need to copy it to a new client.
  • Loading branch information
flofriday committed Oct 26, 2024
1 parent 11db6ca commit 36f9d84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions app/static/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ let currentUrl = "";

window.onload = () => {
copyBtn.disabled = true;

if (!urlText.value && localStorage.getItem("originalUrl")) {
urlText.value = localStorage.getItem("originalUrl");
}
};

urlText.onchange = () => {
Expand Down Expand Up @@ -72,8 +76,10 @@ async function verify(url) {
try {
const response = await fetch(`/verify?url=${encodeURIComponent(url)}`);
if (response.ok) {
localStorage.setItem("originalUrl", url);
setBetterUrl(url);
} else {
localStorage.setItem("originalUrl", "");
let message = await response.text();
if (message.trim().length > 0) {
setErrorMessage(message);
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
blinker==1.8.2
certifi==2024.8.30
charset-normalizer==3.3.2
charset-normalizer==3.4.0
click==8.1.7
flake8==7.1.1
Flask==3.0.3
gunicorn==23.0.0
icalendar==5.0.13
icalendar==6.0.1
idna==3.10
iniconfig==2.0.0
itsdangerous==2.2.0
Jinja2==3.1.4
MarkupSafe==2.1.5
MarkupSafe==3.0.2
mccabe==0.7.0
packaging==24.1
pluggy==1.5.0
Expand All @@ -21,7 +21,7 @@ pytest-mock==3.14.0
python-dateutil==2.9.0.post0
pytz==2024.2
requests==2.32.3
ruff==0.6.5
ruff==0.7.1
six==1.16.0
urllib3==2.2.3
Werkzeug==3.0.6

0 comments on commit 36f9d84

Please sign in to comment.