add missing corp/cache-control headers to client authenticated media
Signed-off-by: Jason Volk <jason@zemos.net> Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
69b2bc4b8c
commit
e312768a66
@ -9,13 +9,15 @@ pub mod v1 {
|
|||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use http::header::{CONTENT_DISPOSITION, CONTENT_TYPE};
|
use http::header::{CACHE_CONTROL, CONTENT_DISPOSITION, CONTENT_TYPE};
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::{request, response, Metadata},
|
api::{request, response, Metadata},
|
||||||
http_headers::ContentDisposition,
|
http_headers::ContentDisposition,
|
||||||
metadata, IdParseError, MxcUri, OwnedServerName,
|
metadata, IdParseError, MxcUri, OwnedServerName,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::http_headers::CROSS_ORIGIN_RESOURCE_POLICY;
|
||||||
|
|
||||||
const METADATA: Metadata = metadata! {
|
const METADATA: Metadata = metadata! {
|
||||||
method: GET,
|
method: GET,
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
@ -65,6 +67,26 @@ pub mod v1 {
|
|||||||
/// file that was previously uploaded.
|
/// file that was previously uploaded.
|
||||||
#[ruma_api(header = CONTENT_DISPOSITION)]
|
#[ruma_api(header = CONTENT_DISPOSITION)]
|
||||||
pub content_disposition: Option<ContentDisposition>,
|
pub content_disposition: Option<ContentDisposition>,
|
||||||
|
|
||||||
|
/// The value of the `Cross-Origin-Resource-Policy` HTTP header.
|
||||||
|
///
|
||||||
|
/// See [MDN] for the syntax.
|
||||||
|
///
|
||||||
|
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
|
||||||
|
///
|
||||||
|
/// TODO: make this use Cow static str's
|
||||||
|
#[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)]
|
||||||
|
pub cross_origin_resource_policy: Option<String>,
|
||||||
|
|
||||||
|
/// The value of the `Cache-Control` HTTP header.
|
||||||
|
///
|
||||||
|
/// See [MDN] for the syntax.
|
||||||
|
///
|
||||||
|
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#syntax
|
||||||
|
///
|
||||||
|
/// TODO: make this use Cow static str's
|
||||||
|
#[ruma_api(header = CACHE_CONTROL)]
|
||||||
|
pub cache_control: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
@ -88,7 +110,13 @@ pub mod v1 {
|
|||||||
impl Response {
|
impl Response {
|
||||||
/// Creates a new `Response` with the given file contents.
|
/// Creates a new `Response` with the given file contents.
|
||||||
pub fn new(file: Vec<u8>) -> Self {
|
pub fn new(file: Vec<u8>) -> Self {
|
||||||
Self { file, content_type: None, content_disposition: None }
|
Self {
|
||||||
|
file,
|
||||||
|
content_type: None,
|
||||||
|
content_disposition: None,
|
||||||
|
cross_origin_resource_policy: None,
|
||||||
|
cache_control: None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,15 @@ pub mod v1 {
|
|||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use http::header::{CONTENT_DISPOSITION, CONTENT_TYPE};
|
use http::header::{CACHE_CONTROL, CONTENT_DISPOSITION, CONTENT_TYPE};
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::{request, response, Metadata},
|
api::{request, response, Metadata},
|
||||||
http_headers::ContentDisposition,
|
http_headers::ContentDisposition,
|
||||||
metadata, IdParseError, MxcUri, OwnedServerName,
|
metadata, IdParseError, MxcUri, OwnedServerName,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::http_headers::CROSS_ORIGIN_RESOURCE_POLICY;
|
||||||
|
|
||||||
const METADATA: Metadata = metadata! {
|
const METADATA: Metadata = metadata! {
|
||||||
method: GET,
|
method: GET,
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
@ -69,6 +71,26 @@ pub mod v1 {
|
|||||||
/// file that was previously uploaded.
|
/// file that was previously uploaded.
|
||||||
#[ruma_api(header = CONTENT_DISPOSITION)]
|
#[ruma_api(header = CONTENT_DISPOSITION)]
|
||||||
pub content_disposition: Option<ContentDisposition>,
|
pub content_disposition: Option<ContentDisposition>,
|
||||||
|
|
||||||
|
/// The value of the `Cross-Origin-Resource-Policy` HTTP header.
|
||||||
|
///
|
||||||
|
/// See [MDN] for the syntax.
|
||||||
|
///
|
||||||
|
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
|
||||||
|
///
|
||||||
|
/// TODO: make this use Cow static str's
|
||||||
|
#[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)]
|
||||||
|
pub cross_origin_resource_policy: Option<String>,
|
||||||
|
|
||||||
|
/// The value of the `Cache-Control` HTTP header.
|
||||||
|
///
|
||||||
|
/// See [MDN] for the syntax.
|
||||||
|
///
|
||||||
|
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#syntax
|
||||||
|
///
|
||||||
|
/// TODO: make this use Cow static str's
|
||||||
|
#[ruma_api(header = CACHE_CONTROL)]
|
||||||
|
pub cache_control: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
@ -93,7 +115,13 @@ pub mod v1 {
|
|||||||
impl Response {
|
impl Response {
|
||||||
/// Creates a new `Response` with the given file.
|
/// Creates a new `Response` with the given file.
|
||||||
pub fn new(file: Vec<u8>) -> Self {
|
pub fn new(file: Vec<u8>) -> Self {
|
||||||
Self { file, content_type: None, content_disposition: None }
|
Self {
|
||||||
|
file,
|
||||||
|
content_type: None,
|
||||||
|
content_disposition: None,
|
||||||
|
cross_origin_resource_policy: None,
|
||||||
|
cache_control: None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ pub mod v1 {
|
|||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use http::header::CONTENT_TYPE;
|
use http::header::{CACHE_CONTROL, CONTENT_TYPE};
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::{request, response, Metadata},
|
api::{request, response, Metadata},
|
||||||
@ -17,6 +17,8 @@ pub mod v1 {
|
|||||||
metadata, IdParseError, MxcUri, OwnedServerName,
|
metadata, IdParseError, MxcUri, OwnedServerName,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::http_headers::CROSS_ORIGIN_RESOURCE_POLICY;
|
||||||
|
|
||||||
const METADATA: Metadata = metadata! {
|
const METADATA: Metadata = metadata! {
|
||||||
method: GET,
|
method: GET,
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
@ -87,6 +89,26 @@ pub mod v1 {
|
|||||||
/// The content type of the thumbnail.
|
/// The content type of the thumbnail.
|
||||||
#[ruma_api(header = CONTENT_TYPE)]
|
#[ruma_api(header = CONTENT_TYPE)]
|
||||||
pub content_type: Option<String>,
|
pub content_type: Option<String>,
|
||||||
|
|
||||||
|
/// The value of the `Cross-Origin-Resource-Policy` HTTP header.
|
||||||
|
///
|
||||||
|
/// See [MDN] for the syntax.
|
||||||
|
///
|
||||||
|
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
|
||||||
|
///
|
||||||
|
/// TODO: make this use Cow static str's
|
||||||
|
#[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)]
|
||||||
|
pub cross_origin_resource_policy: Option<String>,
|
||||||
|
|
||||||
|
/// The value of the `Cache-Control` HTTP header.
|
||||||
|
///
|
||||||
|
/// See [MDN] for the syntax.
|
||||||
|
///
|
||||||
|
/// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#syntax
|
||||||
|
///
|
||||||
|
/// TODO: make this use Cow static str's
|
||||||
|
#[ruma_api(header = CACHE_CONTROL)]
|
||||||
|
pub cache_control: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
@ -121,7 +143,12 @@ pub mod v1 {
|
|||||||
impl Response {
|
impl Response {
|
||||||
/// Creates a new `Response` with the given thumbnail.
|
/// Creates a new `Response` with the given thumbnail.
|
||||||
pub fn new(file: Vec<u8>) -> Self {
|
pub fn new(file: Vec<u8>) -> Self {
|
||||||
Self { file, content_type: None }
|
Self {
|
||||||
|
file,
|
||||||
|
content_type: None,
|
||||||
|
cross_origin_resource_policy: None,
|
||||||
|
cache_control: None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user