From 8ce3f87dc02555ea29982b4366c897d4e7c8fd7a Mon Sep 17 00:00:00 2001 From: kieran Date: Tue, 15 Oct 2024 12:29:43 +0100 Subject: [PATCH] fix: build all features for docker --- .drone.yml | 2 +- Dockerfile | 2 +- config.toml | 5 ++++- src/bin/void_cat_migrate.rs | 10 ++-------- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.drone.yml b/.drone.yml index 6c97ce9..518191e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,5 +18,5 @@ steps: - dockerd & - docker login -u kieran -p $TOKEN git.v0l.io - docker login -u voidic -p $TOKEN_DOCKER - - docker buildx build --push -t git.v0l.io/kieran/route96:latest -t voidic/route96:latest --build-arg FEATURES="labels,void-cat-redirects" . + - docker buildx build --push -t git.v0l.io/kieran/route96:latest -t voidic/route96:latest . - kill $(cat /var/run/docker.pid) diff --git a/Dockerfile b/Dockerfile index 5cd3449..4839349 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,7 @@ RUN git clone --depth=1 https://git.v0l.io/Kieran/FFmpeg.git && \ --disable-static \ --enable-shared && \ make -j8 && make install -RUN cargo install --path . --root /app/build --features "${FEATURES}" +RUN cargo install --path . --root /app/build --all-features FROM node:bookworm as ui_builder WORKDIR /app/src diff --git a/config.toml b/config.toml index cef8089..d6ae75d 100644 --- a/config.toml +++ b/config.toml @@ -23,4 +23,7 @@ public_url = "http://localhost:8000" # webhook_url = "https://api.snort.social/api/v1/media/webhook" # Analytics support -# plausible_url = "https://plausible.com/" \ No newline at end of file +# plausible_url = "https://plausible.com/" + +# Support legacy void +# void_cat_database = "postgres://postgres:postgres@localhost:41911/void" \ No newline at end of file diff --git a/src/bin/void_cat_migrate.rs b/src/bin/void_cat_migrate.rs index 9b56c1f..3668f87 100644 --- a/src/bin/void_cat_migrate.rs +++ b/src/bin/void_cat_migrate.rs @@ -1,5 +1,4 @@ use anyhow::Error; -use chrono::{DateTime, Utc}; use clap::Parser; use config::Config; use log::{info, warn}; @@ -8,11 +7,8 @@ use route96::db::{Database, FileUpload}; use route96::filesystem::FileStore; use route96::settings::Settings; use route96::void_db::{VoidCatDb, VoidFile}; -use sqlx::FromRow; -use sqlx_postgres::{PgPool, PgPoolOptions}; use std::path::PathBuf; use tokio::io::{AsyncWriteExt, BufWriter}; -use uuid::Uuid; #[derive(Debug, Clone, clap::ValueEnum)] enum ArgOperation { @@ -123,10 +119,7 @@ async fn migrate_file( let uid = db.upsert_user(&pubkey_vec).await?; info!("Mapped user {} => {}", &f.email, uid); - let md: Option> = match &f.media_dimensions { - Some(s) => Some(s.split("x").collect()), - _ => None, - }; + let md: Option> = f.media_dimensions.as_ref().map(|s| s.split("x").collect()); let fu = FileUpload { id: id_vec, name: match &f.name { @@ -146,6 +139,7 @@ async fn migrate_file( }, blur_hash: None, alt: f.description.clone(), + ..Default::default() }; db.add_file(&fu, uid).await?; Ok(())