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:
@ -27,7 +27,7 @@ use mas_email::Mailer;
|
||||
use mas_handlers::{AppState, MatrixHomeserver};
|
||||
use mas_http::ServerLayer;
|
||||
use mas_policy::PolicyFactory;
|
||||
use mas_router::UrlBuilder;
|
||||
use mas_router::{Route, UrlBuilder};
|
||||
use mas_storage::MIGRATOR;
|
||||
use mas_tasks::TaskQueue;
|
||||
use mas_templates::Templates;
|
||||
@ -201,10 +201,16 @@ impl Options {
|
||||
.context("failed to load the policy")?;
|
||||
let policy_factory = Arc::new(policy_factory);
|
||||
|
||||
let url_builder = UrlBuilder::new(config.http.public_base.clone());
|
||||
|
||||
// Load and compile the templates
|
||||
let templates = Templates::load(config.templates.path.clone(), config.templates.builtin)
|
||||
.await
|
||||
.context("could not load templates")?;
|
||||
let templates = Templates::load(
|
||||
config.templates.path.clone(),
|
||||
config.templates.builtin,
|
||||
url_builder.clone(),
|
||||
)
|
||||
.await
|
||||
.context("could not load templates")?;
|
||||
|
||||
let mailer = Mailer::new(
|
||||
&templates,
|
||||
@ -213,8 +219,6 @@ impl Options {
|
||||
&config.email.reply_to,
|
||||
);
|
||||
|
||||
let url_builder = UrlBuilder::new(config.http.public_base.clone());
|
||||
|
||||
let static_files = mas_static_files::service(&config.http.web_root);
|
||||
|
||||
let homeserver = MatrixHomeserver::new(config.matrix.homeserver.clone());
|
||||
@ -246,7 +250,7 @@ impl Options {
|
||||
};
|
||||
|
||||
let router = mas_handlers::router(state)
|
||||
.fallback_service(static_files)
|
||||
.nest(mas_router::StaticAsset::route(), static_files)
|
||||
.layer(ServerLayer::default());
|
||||
|
||||
info!("Listening on http://{}", listener.local_addr().unwrap());
|
||||
|
@ -15,7 +15,6 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use clap::Parser;
|
||||
use mas_config::TemplatesConfig;
|
||||
use mas_templates::Templates;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
@ -58,11 +57,9 @@ impl Options {
|
||||
}
|
||||
|
||||
SC::Check { path, skip_builtin } => {
|
||||
let config = TemplatesConfig {
|
||||
path: Some(path.to_string()),
|
||||
builtin: !skip_builtin,
|
||||
};
|
||||
let templates = Templates::load(config.path.clone(), config.builtin).await?;
|
||||
let url_builder = mas_router::UrlBuilder::new("https://example.com/".parse()?);
|
||||
let templates =
|
||||
Templates::load(Some(path.into()), !skip_builtin, url_builder).await?;
|
||||
templates.check_render().await?;
|
||||
|
||||
Ok(())
|
||||
|
Reference in New Issue
Block a user