This repository was archived by the owner on Apr 12, 2025. It is now read-only.
File tree 4 files changed +38
-5
lines changed
4 files changed +38
-5
lines changed Original file line number Diff line number Diff line change 33
33
REPLEX_ENABLE_CONSOLE=0 \
34
34
REPLEX_CACHE_TTL=0 \
35
35
REPLEX_HUB_RESTRICTIONS=1 \
36
- RUST_LOG="info ,replex=info " \
36
+ RUST_LOG="debug ,replex=debug " \
37
37
REPLEX_NTF_WATCHLIST_FORCE=0 \
38
38
RUSTFLAGS=-Awarnings \
39
39
cargo watch -w src -x run
Original file line number Diff line number Diff line change @@ -274,12 +274,14 @@ impl PlexClient {
274
274
self ,
275
275
uuid : String ,
276
276
) -> Option < String > {
277
+ //tracing::debug!(uuid = uuid, "Loading hero art from plex");
277
278
let cache_key = format ! ( "{}:hero_art" , uuid) ;
278
279
279
280
let cached_result: Option < Option < String > > =
280
281
GLOBAL_CACHE . get ( cache_key. as_str ( ) ) . await ;
281
282
282
283
if cached_result. is_some ( ) {
284
+ //tracing::debug!("Returning cached version");
283
285
return cached_result. unwrap ( ) ;
284
286
}
285
287
@@ -307,8 +309,14 @@ impl PlexClient {
307
309
}
308
310
}
309
311
312
+ if image. is_none ( ) {
313
+ tracing:: warn!( uuid = uuid, "No hero image found on plex" ) ;
314
+ }
315
+
310
316
image. as_ref ( ) ?; // dont return and dont cache, let us just retry next time.
311
317
318
+ //tracing::debug!("Hero image found");
319
+
312
320
let cache_expiry = crate :: cache:: Expiration :: Month ;
313
321
let _ = GLOBAL_CACHE
314
322
. insert ( cache_key, image. clone ( ) , cache_expiry)
Original file line number Diff line number Diff line change @@ -133,6 +133,11 @@ pub fn route() -> Router {
133
133
. hoop ( proxy_for_transform)
134
134
. get ( transform_hubs_response) ,
135
135
)
136
+ . push (
137
+ Router :: new ( )
138
+ . path ( "/replex/test_proxy/<**rest>" )
139
+ . goal ( test_proxy_request) ,
140
+ )
136
141
. push (
137
142
Router :: new ( )
138
143
. path ( "/replex/image/hero/<type>/<uuid>" )
@@ -184,11 +189,22 @@ async fn proxy_request(
184
189
depot : & mut Depot ,
185
190
ctrl : & mut FlowCtrl ,
186
191
) {
187
- let config: Config = Config :: dynamic ( req) . extract ( ) . unwrap ( ) ;
188
192
let proxy = default_proxy ( ) ;
189
193
proxy. handle ( req, depot, res, ctrl) . await ;
190
194
}
191
195
196
+ #[ handler]
197
+ async fn test_proxy_request (
198
+ req : & mut Request ,
199
+ res : & mut Response ,
200
+ depot : & mut Depot ,
201
+ ctrl : & mut FlowCtrl ,
202
+ ) {
203
+ dbg ! ( "yo" ) ;
204
+ let proxy = test_proxy ( "https://webhook.site" . to_string ( ) ) ;
205
+ proxy. handle ( req, depot, res, ctrl) . await ;
206
+ }
207
+
192
208
#[ handler]
193
209
async fn proxy_for_transform (
194
210
req : & mut Request ,
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ pub fn default_url_query_getter(
49
49
}
50
50
}
51
51
52
-
52
+ // Proxy to plex instance
53
53
pub fn default_proxy ( ) -> Proxy < String , ReqwestClient > {
54
54
let config: Config = Config :: figment ( ) . extract ( ) . unwrap ( ) ;
55
55
let mut proxy = Proxy :: new (
@@ -64,8 +64,6 @@ pub fn default_proxy() -> Proxy<String, ReqwestClient> {
64
64
proxy
65
65
}
66
66
67
-
68
-
69
67
pub fn proxy ( upstream : String ) -> Proxy < String , ReqwestClient > {
70
68
let mut proxy = Proxy :: new (
71
69
upstream,
@@ -79,6 +77,17 @@ pub fn proxy(upstream: String) -> Proxy<String, ReqwestClient> {
79
77
proxy
80
78
}
81
79
80
+ pub fn test_proxy ( upstream : String ) -> Proxy < String , ReqwestClient > {
81
+ let mut proxy = Proxy :: new (
82
+ upstream,
83
+ ReqwestClient :: new ( reqwest:: Client :: builder ( )
84
+ . build ( )
85
+ . unwrap ( ) )
86
+ ) ;
87
+
88
+ proxy
89
+ }
90
+
82
91
pub fn get_collection_id_from_child_path ( path : String ) -> i32 {
83
92
let mut path = path. replace ( "/library/collections/" , "" ) ;
84
93
path = path. replace ( "/children" , "" ) ;
You can’t perform that action at this time.
0 commit comments