@@ -2,15 +2,15 @@ use actix_web::{get, post, put, web, HttpResponse, Responder};
2
2
use serde:: Deserialize ;
3
3
use sqlx:: Acquire ;
4
4
5
- use crate :: webhook:: send_webhook;
6
5
use crate :: extractors:: auth:: Auth ;
7
6
use crate :: types:: api:: { create_download_link, ApiError , ApiResponse } ;
8
7
use crate :: types:: mod_json:: ModJson ;
8
+ use crate :: types:: models:: developer:: Developer ;
9
9
use crate :: types:: models:: incompatibility:: Incompatibility ;
10
10
use crate :: types:: models:: mod_entity:: { download_geode_file, Mod , ModUpdate } ;
11
11
use crate :: types:: models:: mod_gd_version:: { GDVersionEnum , VerPlatform } ;
12
12
use crate :: types:: models:: mod_version_status:: ModVersionStatusEnum ;
13
- use crate :: types :: models :: developer :: Developer ;
13
+ use crate :: webhook :: send_webhook ;
14
14
use crate :: AppData ;
15
15
16
16
#[ derive( Deserialize , Default ) ]
@@ -85,9 +85,8 @@ pub async fn get(
85
85
let mut pool = data. db . acquire ( ) . await . or ( Err ( ApiError :: DbAcquireError ) ) ?;
86
86
87
87
let has_extended_permissions = match auth. developer ( ) {
88
- Ok ( dev) => dev. admin ||
89
- Developer :: has_access_to_mod ( dev. id , & id, & mut pool) . await ?,
90
- _ => false
88
+ Ok ( dev) => dev. admin || Developer :: has_access_to_mod ( dev. id , & id, & mut pool) . await ?,
89
+ _ => false ,
91
90
} ;
92
91
93
92
let found = Mod :: get_one ( & id, false , & mut pool) . await ?;
@@ -113,8 +112,13 @@ pub async fn create(
113
112
) -> Result < impl Responder , ApiError > {
114
113
let dev = auth. developer ( ) ?;
115
114
let mut pool = data. db . acquire ( ) . await . or ( Err ( ApiError :: DbAcquireError ) ) ?;
116
- let mut file_path = download_geode_file ( & payload. download_link ) . await ?;
117
- let json = ModJson :: from_zip ( & mut file_path, & payload. download_link , false ) ?;
115
+ let mut file_path = download_geode_file ( & payload. download_link , data. max_download_mb ) . await ?;
116
+ let json = ModJson :: from_zip (
117
+ & mut file_path,
118
+ & payload. download_link ,
119
+ false ,
120
+ data. max_download_mb ,
121
+ ) ?;
118
122
json. validate ( ) ?;
119
123
let mut transaction = pool. begin ( ) . await . or ( Err ( ApiError :: TransactionError ) ) ?;
120
124
let result = Mod :: from_json ( & json, dev. clone ( ) , & mut transaction) . await ;
0 commit comments