This repository was archived by the owner on Apr 12, 2025. It is now read-only.
File tree 1 file changed +22
-1
lines changed
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ pub fn route() -> Router {
198
198
. push (
199
199
Router :: with_path ( "/photo/<colon:colon>/transcode" )
200
200
. hoop ( fix_photo_transcode_request)
201
- // .hoop(debug )
201
+ . hoop ( resolve_local_media_path )
202
202
. goal ( proxy_request) ,
203
203
)
204
204
. push ( Router :: with_path ( "<**rest>" ) . goal ( proxy_request) ) ;
@@ -305,6 +305,27 @@ async fn fix_photo_transcode_request(
305
305
}
306
306
}
307
307
308
+ // resolve a local media path to full url
309
+ #[ handler]
310
+ async fn resolve_local_media_path (
311
+ req : & mut Request ,
312
+ _depot : & mut Depot ,
313
+ res : & mut Response ,
314
+ ) {
315
+ let params: PlexContext = req. extract ( ) . await . unwrap ( ) ;
316
+ let url = req. query :: < String > ( "url" ) ;
317
+ if url. is_some ( ) && url. clone ( ) . unwrap ( ) . contains ( "/replex/image/hero" )
318
+ {
319
+ let parts: Vec < String > = url. unwrap ( ) . split ( "/" ) . map ( |x| x. to_string ( ) ) . collect ( ) ;
320
+ let plex_client = PlexClient :: from_request ( req, params. clone ( ) ) ;
321
+ let uuid = parts[ 7 ] . clone ( ) ;
322
+ let rurl = plex_client. get_hero_art ( uuid) . await ;
323
+ if rurl. is_some ( ) {
324
+ add_query_param_salvo ( req, "url" . to_string ( ) , rurl. unwrap ( ) ) ;
325
+ }
326
+ }
327
+ }
328
+
308
329
#[ handler]
309
330
async fn disable_related_query (
310
331
req : & mut Request ,
You can’t perform that action at this time.
0 commit comments