Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
2238a157e4 |
15
migrations/20250115200151_report.sql
Normal file
15
migrations/20250115200151_report.sql
Normal file
@ -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);
|
@ -5,7 +5,7 @@ use crate::routes::{delete_file, Nip94Event};
|
|||||||
use crate::settings::Settings;
|
use crate::settings::Settings;
|
||||||
use log::error;
|
use log::error;
|
||||||
use nostr::prelude::hex;
|
use nostr::prelude::hex;
|
||||||
use nostr::{Alphabet, SingleLetterTag, TagKind};
|
use nostr::{Alphabet, Event, SingleLetterTag, TagKind};
|
||||||
use rocket::data::ByteUnit;
|
use rocket::data::ByteUnit;
|
||||||
use rocket::futures::StreamExt;
|
use rocket::futures::StreamExt;
|
||||||
use rocket::http::{Header, Status};
|
use rocket::http::{Header, Status};
|
||||||
@ -281,6 +281,15 @@ async fn upload_media(
|
|||||||
process_upload("media", true, auth, fs, db, settings, data).await
|
process_upload("media", true, auth, fs, db, settings, data).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rocket::put("/report", data = "<data>", format = "json")]
|
||||||
|
async fn report(
|
||||||
|
auth: BlossomAuth,
|
||||||
|
db: &State<Database>,
|
||||||
|
data: Json<Event>,
|
||||||
|
) -> Status {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
fn check_head(auth: BlossomAuth, settings: &State<Settings>) -> BlossomHead {
|
fn check_head(auth: BlossomAuth, settings: &State<Settings>) -> BlossomHead {
|
||||||
if !check_method(&auth.event, "upload") {
|
if !check_method(&auth.event, "upload") {
|
||||||
return BlossomHead {
|
return BlossomHead {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user