File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -11,3 +11,4 @@ shuttle-axum = "0.53.0"
11
11
shuttle-runtime = " 0.53.0"
12
12
shuttle-secrets = " 0.42.0"
13
13
tokio = " 1.28.2"
14
+ tower-http = {version = " 0.6.2" , features = [" cors" ]}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use libsql::{ Builder, Database };
3
3
use std:: sync:: { Arc } ;
4
4
use std:: vec:: { Vec } ;
5
5
use tokio:: sync:: { RwLock } ;
6
+ use tower_http:: cors:: { Any , CorsLayer } ;
6
7
7
8
#[ shuttle_runtime:: main]
8
9
async fn main (
@@ -36,6 +37,11 @@ async fn main(
36
37
sync_auth : sync_auth
37
38
} ) ;
38
39
40
+ let cors = CorsLayer :: new ( )
41
+ . allow_methods ( Any )
42
+ . allow_origin ( Any )
43
+ . allow_headers ( Any ) ;
44
+
39
45
let router = Router :: new ( )
40
46
. route ( "/api" , get ( homepage) )
41
47
. route ( "/api/mod-list" , get ( mod_list) )
@@ -45,7 +51,8 @@ async fn main(
45
51
. route ( "/api/run-sync" , get ( redirect_api) )
46
52
. route ( "/api/run-sync/" , get ( redirect_api) )
47
53
. route ( "/api/run-sync/{auth}" , get ( sync_local) )
48
- . with_state ( app_state) ;
54
+ . with_state ( app_state)
55
+ . layer ( cors) ;
49
56
50
57
Ok ( router. into ( ) )
51
58
}
You can’t perform that action at this time.
0 commit comments