Compare commits

..

71 Commits

Author SHA1 Message Date
Alphonse Paix
ab650fdd35 Removed secrets
Some checks failed
Rust / Test (push) Has been cancelled
Rust / Rustfmt (push) Has been cancelled
Rust / Clippy (push) Has been cancelled
Rust / Code coverage (push) Has been cancelled
2025-09-22 16:22:46 +02:00
Alphonse Paix
4e18476f5e css corrections 2025-09-22 15:50:32 +02:00
Alphonse Paix
e90235a515 update main.css 2025-09-22 15:44:59 +02:00
Alphonse Paix
6f9d33953c Unsubscribe option available on website 2025-09-22 15:44:02 +02:00
Alphonse Paix
4b5fbc2eb3 Tests update 2025-09-22 12:40:17 +02:00
Alphonse Paix
05ac172907 Templates refactoring
Inject HTML directly and fix footer out of main content <div>
2025-09-22 01:43:36 +02:00
Alphonse Paix
98611f18e3 Unsubscribe link in emails sent 2025-09-22 01:25:36 +02:00
Alphonse Paix
829f3e4e4f Basic unsubscribe endpoint 2025-09-21 17:49:31 +02:00
Alphonse Paix
0725b87bf2 HTML and plain text for new post mail notifications 2025-09-21 03:45:29 +02:00
Alphonse Paix
56b25515f9 Dashboard template revision 2025-09-21 02:01:42 +02:00
Alphonse Paix
9dae7ff75d table wrapping 2025-09-20 19:19:57 +02:00
Alphonse Paix
53af71a9a1 responsive tables and post page redesign for narrow viewport 2025-09-20 17:39:25 +02:00
Alphonse Paix
9922a62691 remove unused use statement 2025-09-20 16:46:21 +02:00
Alphonse Paix
eb55fdb29f markdown with GFM extension 2025-09-20 16:45:16 +02:00
Alphonse Paix
e017a4ed3f fix mobile menu margins 2025-09-20 16:25:47 +02:00
Alphonse Paix
0bd10b201d <pre> element overflow 2025-09-20 16:05:20 +02:00
Alphonse Paix
bef658b940 Markdown rendering 2025-09-20 16:01:51 +02:00
Alphonse Paix
bf2ec15e71 Basic markdown with Tailwind CSS Typography 2025-09-20 14:03:13 +02:00
Alphonse Paix
38cb594882 Responsive navbar 2025-09-20 05:05:49 +02:00
Alphonse Paix
f7ebf73fbc Templates refactoring 2025-09-20 04:43:55 +02:00
Alphonse Paix
d85879a004 Error handling refactor and 500 page/message templates 2025-09-20 04:06:48 +02:00
Alphonse Paix
7971095227 Refactor admin routes to use new AppError struct in responses 2025-09-20 01:08:05 +02:00
Alphonse Paix
2b9cf979e8 Askama message template 2025-09-20 00:51:46 +02:00
Alphonse Paix
6ad207d0a4 Logo in the navbar 2025-09-20 00:20:58 +02:00
Alphonse Paix
44b2ce677a Templates adjustments 2025-09-19 20:07:38 +02:00
Alphonse Paix
bb27ad024d 404 page 2025-09-19 19:34:06 +02:00
Alphonse Paix
7578097754 Posts dedicated page with cards linking to specific post 2025-09-19 01:04:10 +02:00
Alphonse Paix
13cb477598 Refactor test suite to handle 303 See Other 2025-09-18 21:00:01 +02:00
Alphonse Paix
384d88eee8 query metadata 2025-09-18 20:09:03 +02:00
Alphonse Paix
ebae511a12 Brought back newsletter form on admin page 2025-09-18 18:40:03 +02:00
Alphonse Paix
066c2b8252 Admin can now write posts
Posts can be displayed on the website. Subscribers are automatically
notified by email. This gives the opportunity to track explicitly how
many people followed the link provided in the emails sent without being
intrusive (no invisible image).
2025-09-18 17:22:33 +02:00
Alphonse Paix
848fd621b7 Fix redirect issues
Dashboard button now correctly redirects to login page if user is not
logged in while login page redirects to dashboard the other way around.
2025-09-17 23:57:45 +02:00
Alphonse Paix
eec6e5f566 Update README 2025-09-17 14:35:39 +02:00
Alphonse Paix
a3ef312a6a Formatting 2025-09-17 14:24:45 +02:00
Alphonse Paix
bdddf0fe4a Test suite refactoring to match new htmx HTML swapping in pages 2025-09-17 14:16:27 +02:00
Alphonse Paix
7364e2a23c HX-Redirect to handle redirections with htmx 2025-09-17 13:16:56 +02:00
Alphonse Paix
7689628ffb Use HTML swap to display success and error messages 2025-09-17 03:40:23 +02:00
Alphonse Paix
a3533bfde7 Basic dashboard for newsletter issue and password systems 2025-09-17 01:47:03 +02:00
Alphonse Paix
626726d206 htmx and Tailwind CSS production setup 2025-09-16 20:30:34 +02:00
Alphonse Paix
ee72073ff5 Run on port 8080 for local env + minor fix for subscription confirm page 2025-09-16 19:09:11 +02:00
Alphonse Paix
d23d9a4e6e Update README 2025-09-16 16:53:45 +02:00
Alphonse Paix
8e1d68d948 Confirmation page and minor improvements to homepage and form messages
Basic redirect with flash messages for success and error messages
2025-09-16 16:47:28 +02:00
Alphonse Paix
612a221907 Merge remote-tracking branch 'origin/main' into askama 2025-09-16 15:25:28 +02:00
Alphonse Paix
01b08bdc0d Remove name from subscriptions table 2025-09-16 15:24:08 +02:00
Alphonse Paix
8a977df948 Askama + htmx for frontend
Server-side rendering with htmx and Tailwind CSS for the styling
2025-09-16 01:47:18 +02:00
Alphonse Paix
bcce04756c Update config to use self-hosted email server 2025-09-14 19:29:02 +00:00
Alphonse Paix
7c8ac0361e Better datastores security
Localhost only exposed ports and stronger password for Postgres local
environment instance
2025-09-07 12:46:27 +02:00
Alphonse Paix
bda940bb2d Update workflow to include redis 2025-09-05 19:23:11 +02:00
Alphonse Paix
c727b5032c Use env vars for TLS files 2025-09-05 18:27:46 +02:00
Alphonse Paix
a7d22e6634 Support for TLS encryption 2025-09-05 18:13:35 +02:00
Alphonse Paix
767fc571b6 Register form and confirmation messages 2025-09-04 23:39:53 +02:00
Alphonse Paix
3057fdc927 Fault-tolerant delivery system 2025-09-04 02:54:49 +02:00
Alphonse Paix
d47fba5cc9 Authentication and form for newsletter publishing 2025-09-01 15:47:27 +02:00
Alphonse Paix
6f6e6ab017 Admin dashboard and sessions 2025-09-01 03:08:43 +02:00
Alphonse Paix
de1fc4a825 Flash messages using axum-messages 2025-08-30 01:39:12 +02:00
Alphonse Paix
3ae50830f4 Handler to send emails to confirmed subscribers 2025-08-27 12:14:11 +02:00
Alphonse Paix
684519f689 Error handling with thiserror and anyhow 2025-08-26 12:47:22 +02:00
Alphonse Paix
fccb79c57f Fix send email request body 2025-08-25 18:51:37 +02:00
Alphonse Paix
5a86d7a35f Query metadata 2025-08-25 17:52:44 +02:00
Alphonse Paix
415d787260 Confirm subscription endpoint 2025-08-25 17:46:03 +02:00
Alphonse Paix
310a202ca3 Query metadata, migrations and formatting 2025-08-24 12:45:32 +02:00
Alphonse Paix
394799f4e0 Set status to 'confirmed' for new subscribers 2025-08-24 11:43:08 +02:00
Alphonse Paix
637a9e39d4 Email client, application startup logic and tests 2025-08-24 11:31:03 +02:00
Alphonse Paix
6a25c43ce4 Parse data from incoming request 2025-08-23 11:13:57 +02:00
Alphonse Paix
d0c146328a Fix bug when reading environment variables 2025-08-22 16:29:11 +02:00
Alphonse Paix
19ddc8958d Environment variables at runtime to connect to database 2025-08-22 16:01:20 +02:00
Alphonse Paix
80b8029844 Docker for deployment 2025-08-22 14:25:34 +02:00
Alphonse Paix
6dd44522b0 Update GitHub workflow 2025-08-22 08:44:02 +02:00
Alphonse Paix
f3e76acc00 Fix incorrect database query in test suite 2025-08-22 08:28:22 +02:00
Alphonse Paix
f1290d0bc5 Telemetry 2025-08-22 08:14:59 +02:00
Alphonse Paix
709bd28a8c Database connection and user registration 2025-08-21 15:38:12 +02:00
8 changed files with 16 additions and 8 deletions

1
.env
View File

@@ -1 +0,0 @@
DATABASE_URL="postgres://postgres:Jq09NF6Y8ZXJS4jd9c8U@localhost:5432/newsletter"

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/target
/node_modules
.env

View File

@@ -7,9 +7,9 @@ database:
port: 5432
database_name: "newsletter"
username: "postgres"
password: "Jq09NF6Y8ZXJS4jd9c8U"
password: "password"
require_ssl: false
timeout_millis: 1000
timeout_milliseconds: 1000
email_client:
authorization_token: "secret-token"
redis_uri: "redis://127.0.0.1:6379"

View File

@@ -1,4 +1,4 @@
application:
host: "0.0.0.0"
database:
timeout_millis: 500
timeout_milliseconds: 500

View File

@@ -14,7 +14,7 @@ if ! [ -x "$(command -v sqlx)" ]; then
fi
DB_USER="${POSTGRES_USER:=postgres}"
DB_PASSWORD="${POSTGRES_PASSWORD:=Jq09NF6Y8ZXJS4jd9c8U}"
DB_PASSWORD="${POSTGRES_PASSWORD:=password}"
DB_NAME="${POSTGRES_DB:=newsletter}"
DB_PORT="${POSTGRES_PORT:=5432}"
DB_HOST="${POSTGRES_HOST:=localhost}"

View File

@@ -110,7 +110,7 @@ pub struct DatabaseSettings {
pub host: String,
pub database_name: String,
pub require_ssl: bool,
pub timeout_millis: u64,
pub timeout_milliseconds: u64,
}
impl DatabaseSettings {

View File

@@ -38,7 +38,9 @@ impl Application {
configuration.application.host, configuration.application.port
);
let connection_pool = PgPoolOptions::new()
.acquire_timeout(Duration::from_millis(configuration.database.timeout_millis))
.acquire_timeout(Duration::from_millis(
configuration.database.timeout_milliseconds,
))
.connect_lazy_with(configuration.database.with_db());
let email_client = EmailClient::build(configuration.email_client).unwrap();
let pool = Pool::new(

View File

@@ -108,5 +108,11 @@ async fn subscribe_fails_if_there_is_a_fatal_database_error() {
let response = app.post_subscriptions(body).await;
assert_eq!(response.status().as_u16(), 500);
assert!(
response
.text()
.await
.unwrap()
.contains("An internal server error occured")
);
}