From 2238a157e4f0ab721ed82b2db71af3e30cb39b86 Mon Sep 17 00:00:00 2001 From: kieran Date: Mon, 20 Jan 2025 11:16:48 +0000 Subject: [PATCH] wip --- migrations/20250115200151_report.sql | 15 +++++++++++++++ src/routes/blossom.rs | 11 ++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 migrations/20250115200151_report.sql diff --git a/migrations/20250115200151_report.sql b/migrations/20250115200151_report.sql new file mode 100644 index 0000000..a972a78 --- /dev/null +++ b/migrations/20250115200151_report.sql @@ -0,0 +1,15 @@ +-- Add migration script here +create table reports +( + file_id binary(32) not null, + report_id binary(32) not null, + reporter_pubkey binary(32) not null, + event varchar(8192) not null, + received timestamp default current_timestamp, + + constraint fk_reports_file_id + foreign key (file_id) references uploads (id) + on delete cascade + on update restrict +); +create unique index ix_reports_file_report_id on reports (file_id, report_id); \ No newline at end of file diff --git a/src/routes/blossom.rs b/src/routes/blossom.rs index 1a9795f..0cadb9d 100644 --- a/src/routes/blossom.rs +++ b/src/routes/blossom.rs @@ -5,7 +5,7 @@ use crate::routes::{delete_file, Nip94Event}; use crate::settings::Settings; use log::error; use nostr::prelude::hex; -use nostr::{Alphabet, SingleLetterTag, TagKind}; +use nostr::{Alphabet, Event, SingleLetterTag, TagKind}; use rocket::data::ByteUnit; use rocket::futures::StreamExt; use rocket::http::{Header, Status}; @@ -281,6 +281,15 @@ async fn upload_media( process_upload("media", true, auth, fs, db, settings, data).await } +#[rocket::put("/report", data = "", format = "json")] +async fn report( + auth: BlossomAuth, + db: &State, + data: Json, +) -> Status { + +} + fn check_head(auth: BlossomAuth, settings: &State) -> BlossomHead { if !check_method(&auth.event, "upload") { return BlossomHead {