blob: ca513e3dda7b08b869b88a4fcf60d049bbe1619e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/*
This file is part of jellything (https://codeberg.org/metamuffin/jellything)
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2025 metamuffin <metamuffin.org>
*/
use rocket::{
http::Header,
response::{self, Responder},
Request,
};
pub struct Cors<T>(pub T);
impl<'r, T: Responder<'r, 'static>> Responder<'r, 'static> for Cors<T> {
fn respond_to(self, request: &'r Request<'_>) -> response::Result<'static> {
let mut r = self.0.respond_to(request)?;
r.adjoin_header(Header::new("access-controll-allow-origin", "*"));
Ok(r)
}
}
|