From dd11f0a224d8aadb0882e8858ccf6c1cafaa815b Mon Sep 17 00:00:00 2001 From: Matthew Pomes Date: Sat, 4 Oct 2025 18:15:11 -0500 Subject: [PATCH] Finalize initial implementation --- .gitea/workflows/ci.yaml | 18 ++++++++++++++++-- src/devices.rs | 3 ++- src/main.rs | 7 ++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 544b81c..91659b7 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -15,11 +15,25 @@ jobs: matrix: toolchain: - stable - - beta - - nightly + # - beta + # - nightly steps: - uses: actions/checkout@v4 - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - run: cargo build --verbose - run: cargo test --verbose - run: cargo build --release --target=x86_64-unknown-linux-musl + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: gitea.loadingm.xyz + username: "the10thwiz" + password: ${{ secrets.PACKAGE_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + file: 'Dockerfile' + tags: gitea.loadingm.xyz/the10thwiz/gpodder:latest + + diff --git a/src/devices.rs b/src/devices.rs index fee8d8b..dc62585 100644 --- a/src/devices.rs +++ b/src/devices.rs @@ -8,7 +8,7 @@ use crate::{ use rocket::{ Route, TypedError, get, post, routes, serde::{Deserialize, Serialize, json::Json}, - trace::debug, + trace::{debug, info}, }; use rocket_db_pools::{ Connection, @@ -71,6 +71,7 @@ pub async fn update( .await?; // debug!("Users: {:?}", sqlx::query!("SELECT * FROM users").fetch_all(&mut **db).await); + debug!("INSERT INTO devices (id, user, caption, type) VALUES ({:?}, {:?}, {:?}, {:?})", device, username, dev.caption, dev.r#type); let res = sqlx::query("INSERT INTO devices (id, user, caption, type) VALUES (?, ?, ?, ?)") .bind(device) .bind(username) diff --git a/src/main.rs b/src/main.rs index 532f5d3..4e71030 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ #![allow(private_interfaces)] -use rocket::{catch, catchers, fairing::AdHoc, launch, TypedError}; +use rocket::{catch, catchers, fairing::AdHoc, launch, TypedError, trace::error}; mod auth; mod devices; @@ -31,6 +31,7 @@ impl From for SqlError { #[catch(default, error = "")] fn catch_sql(error: &SqlError) -> String { + error!("DB: {}", error.0); format!("Db Error: {}", error.0) } @@ -58,7 +59,7 @@ const SQL_INIT: &[&str] = &[ updated INTEGER NOT NULL, PRIMARY KEY(url, user, device) ON CONFLICT REPLACE, FOREIGN KEY(user) REFERENCES users(name), - FOREIGN KEY(device) REFERENCES devices(id) + FOREIGN KEY(device, user) REFERENCES devices(id, user) );", "CREATE TABLE IF NOT EXISTS episodes ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, @@ -74,7 +75,7 @@ const SQL_INIT: &[&str] = &[ total INTEGER, updated INTEGER NOT NULL, FOREIGN KEY(user) REFERENCES users(name), - FOREIGN KEY(device) REFERENCES devices(id) + FOREIGN KEY(device, user) REFERENCES devices(id, user) );", ];