You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-31 09:24:31 +03:00
Mount the static assets on /assets
This commit is contained in:
@ -522,3 +522,26 @@ impl Route for CompatLoginSsoComplete {
|
||||
format!("/complete-compat-sso/{}", self.id).into()
|
||||
}
|
||||
}
|
||||
|
||||
/// `GET /assets`
|
||||
pub struct StaticAsset {
|
||||
path: String,
|
||||
}
|
||||
|
||||
impl StaticAsset {
|
||||
#[must_use]
|
||||
pub fn new(path: String) -> Self {
|
||||
Self { path }
|
||||
}
|
||||
}
|
||||
|
||||
impl Route for StaticAsset {
|
||||
type Query = ();
|
||||
fn route() -> &'static str {
|
||||
"/assets"
|
||||
}
|
||||
|
||||
fn path(&self) -> std::borrow::Cow<'static, str> {
|
||||
format!("/assets/{}", self.path).into()
|
||||
}
|
||||
}
|
||||
|
@ -91,4 +91,10 @@ impl UrlBuilder {
|
||||
pub fn jwks_uri(&self) -> Url {
|
||||
self.url_for(&crate::endpoints::OAuth2Keys)
|
||||
}
|
||||
|
||||
/// Static asset
|
||||
#[must_use]
|
||||
pub fn static_asset(&self, path: String) -> Url {
|
||||
self.url_for(&crate::endpoints::StaticAsset::new(path))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user