fix: custom_css setting
This commit is contained in:
parent
d128b2c438
commit
2a99d49c8a
4 changed files with 26 additions and 3 deletions
|
@ -66,7 +66,7 @@ pub async fn stripe_webhook(
|
|||
}
|
||||
EventType::InvoicePaymentSucceeded => {
|
||||
// payment finished and subscription created
|
||||
// we're doing this *instead* of CustomerSubscriptionDeleted because
|
||||
// we're doing this *instead* of CustomerSubscriptionCreated because
|
||||
// the invoice happens *after* the checkout session ends... which is what we need
|
||||
let invoice = match req.data.object {
|
||||
EventObject::Invoice(c) => c,
|
||||
|
|
|
@ -71,6 +71,27 @@ pub async fn redirect_from_ip(
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn redirect_from_stripe_id(
|
||||
jar: CookieJar,
|
||||
Extension(data): Extension<State>,
|
||||
Path(id): Path<String>,
|
||||
) -> impl IntoResponse {
|
||||
let data = &(data.read().await).0;
|
||||
let user = match get_user_from_token!(jar, data) {
|
||||
Some(ua) => ua,
|
||||
None => return Redirect::to("/"),
|
||||
};
|
||||
|
||||
if !user.permissions.check(FinePermission::MANAGE_USERS) {
|
||||
return Redirect::to("/");
|
||||
}
|
||||
|
||||
match data.get_user_by_stripe_id(&id).await {
|
||||
Ok(u) => Redirect::to(&format!("/@{}", u.username)),
|
||||
Err(_) => Redirect::to("/"),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn me_request(jar: CookieJar, Extension(data): Extension<State>) -> impl IntoResponse {
|
||||
let data = &(data.read().await).0;
|
||||
let user = match get_user_from_token!(jar, data, oauth::AppScope::UserReadProfile) {
|
||||
|
|
|
@ -10,6 +10,8 @@ use axum::{
|
|||
use pathbufd::PathBufD;
|
||||
use serde::Deserialize;
|
||||
|
||||
pub const MAXIMUM_PROXY_FILE_SIZE: u64 = 4194304; // 4 MiB
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct ProxyQuery {
|
||||
pub url: String,
|
||||
|
@ -58,7 +60,7 @@ pub async fn proxy_request(
|
|||
match http.get(image_url).send().await {
|
||||
Ok(stream) => {
|
||||
let size = stream.content_length();
|
||||
if size.unwrap_or_default() > 10485760 {
|
||||
if size.unwrap_or_default() > MAXIMUM_PROXY_FILE_SIZE {
|
||||
// return defualt image (content too big)
|
||||
return (
|
||||
[("Content-Type", "image/svg+xml")],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue