add: user seller_data
This commit is contained in:
parent
fdaa81422a
commit
e4468e4768
14 changed files with 150 additions and 777 deletions
|
@ -8,6 +8,7 @@ mod routes;
|
|||
mod sanitize;
|
||||
|
||||
use assets::{init_dirs, write_assets};
|
||||
use stripe::Client as StripeClient;
|
||||
use tetratto_core::model::{permissions::FinePermission, uploads::CustomEmoji};
|
||||
pub use tetratto_core::*;
|
||||
|
||||
|
@ -27,7 +28,8 @@ use tracing::{Level, info};
|
|||
use std::{collections::HashMap, env::var, net::SocketAddr, process::exit, sync::Arc};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
pub(crate) type State = Arc<RwLock<(DataManager, Tera, Client)>>;
|
||||
pub(crate) type InnerState = (DataManager, Tera, Client, Option<StripeClient>);
|
||||
pub(crate) type State = Arc<RwLock<InnerState>>;
|
||||
|
||||
fn render_markdown(value: &Value, _: &HashMap<String, Value>) -> tera::Result<Value> {
|
||||
Ok(
|
||||
|
@ -115,6 +117,13 @@ async fn main() {
|
|||
let client = Client::new();
|
||||
let mut app = Router::new();
|
||||
|
||||
// cretae stripe client
|
||||
let stripe_client = if let Some(ref stripe) = config.stripe {
|
||||
Some(StripeClient::new(stripe.secret.clone()))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
// add correct routes
|
||||
if var("LITTLEWEB").is_ok() {
|
||||
app = app.merge(routes::lw_routes());
|
||||
|
@ -129,7 +138,12 @@ async fn main() {
|
|||
|
||||
// add junk
|
||||
app = app
|
||||
.layer(Extension(Arc::new(RwLock::new((database, tera, client)))))
|
||||
.layer(Extension(Arc::new(RwLock::new((
|
||||
database,
|
||||
tera,
|
||||
client,
|
||||
stripe_client,
|
||||
)))))
|
||||
.layer(axum::extract::DefaultBodyLimit::max(
|
||||
var("BODY_LIMIT")
|
||||
.unwrap_or("8388608".to_string())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue