Skip to content

Commit

Permalink
feat: inform user when the download has expired
Browse files Browse the repository at this point in the history
  • Loading branch information
aalemayhu committed Dec 23, 2023
1 parent 791166b commit 0e0b8aa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 29 deletions.
8 changes: 6 additions & 2 deletions src/controllers/DownloadController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DownloadController {
if (body) {
res.send(body);
} else {
res.status(404).send();
throw new Error('File not found');
}
} catch (error) {
console.error(error);
Expand All @@ -35,7 +35,11 @@ class DownloadController {
res.redirect('/uploads');
} else {
sendError(error);
res.status(404).send();
res
.status(404)
.send(
"Download link expire, try converting again <a href='/upload'>upload</a>"
);
}
}
}
Expand Down
55 changes: 28 additions & 27 deletions src/services/EmailService/templates/convert-link.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>2anki.net - Deck Ready</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css"
/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css" />
</head>

<body class="content">
<section class="section">
<div class="container">
<h1 class="title">Your converted deck is ready!</h1>
<p class="subtitle">
Download your converted deck here.
<section class="section">
<div class="container">
<h1 class="title">Your converted deck is ready!</h1>
<p class="subtitle">
Download your converted deck here.

<a href="{{link}}">{{link}}</a>

<a href="{{link}}">{{link}}</a>
<strong>This link will expire so make sure to download the file.</strong>

Happy learning.
</p>
<p>
If you are having any issues, don't hesitate to ask for help! Reply to
this email or join Discord https://alemayhu.com/discord
</p>
<p>Thank you!</p>
<p><strong>Alexander Alemayhu</strong> Developer of 2anki.net</p>
<hr />
<p class="has-text-grey-light">
If you did not request this deck conversion, please contact me via
email
<a href="mailto:alexander@alemayhu.com">alexander@alemayhu.com</a>.
</p>
</div>
</section>
Happy learning.
</p>
<p>
If you are having any issues, don't hesitate to ask for help! Reply to
this email.
</p>
<p>Thank you!</p>
<p><strong>Alexander Alemayhu</strong> Developer of 2anki.net</p>
<hr />
<p class="has-text-grey-light">
If you did not request this deck conversion, please contact me via
email
<a href="mailto:alexander@alemayhu.com">alexander@alemayhu.com</a>.
</p>
</div>
</section>
</body>
</html>

</html>

0 comments on commit 0e0b8aa

Please sign in to comment.