@@ -9,7 +9,7 @@ use std::sync::LazyLock;
99use futures_lite:: FutureExt ;
1010use hyper:: { header:: HeaderValue , Body , Request , Response } ;
1111use log:: { info, warn} ;
12- use redlib:: client:: { canonical_path, proxy, rate_limit_check, CLIENT } ;
12+ use redlib:: client:: { canonical_path, proxy, rate_limit_check, MEDIA_CLIENT } ;
1313use redlib:: server:: { self , RequestExt } ;
1414use redlib:: utils:: { error, redirect, ThemeAssets } ;
1515use redlib:: { config, duplicates, headers, instance_info, post, search, settings, subreddit, user} ;
@@ -435,9 +435,16 @@ pub async fn proxy_commit_info() -> Result<Response<Body>, String> {
435435
436436#[ cached( time = 600 ) ]
437437async fn fetch_commit_info ( ) -> String {
438- let url = "https://github.com/redlib-org/redlib/commits/main.atom" ;
439-
440- CLIENT . get ( url) . send ( ) . await . expect ( "Failed to request GitHub" ) . text ( ) . await . expect ( "Failed to read body" )
438+ // wreq uses http v1.x: pass URL as &str and call .send().await, then .bytes().await
439+ let bytes = MEDIA_CLIENT
440+ . get ( "https://github.com/redlib-org/redlib/commits/main.atom" )
441+ . send ( )
442+ . await
443+ . expect ( "Failed to request GitHub" )
444+ . bytes ( )
445+ . await
446+ . expect ( "Failed to read body" ) ;
447+ String :: from_utf8_lossy ( & bytes) . into_owned ( )
441448}
442449
443450pub async fn proxy_instances ( ) -> Result < Response < Body > , String > {
@@ -452,7 +459,14 @@ pub async fn proxy_instances() -> Result<Response<Body>, String> {
452459
453460#[ cached( time = 600 ) ]
454461async fn fetch_instances ( ) -> String {
455- let url = "https://raw.githubusercontent.com/redlib-org/redlib-instances/refs/heads/main/instances.json" ;
456-
457- CLIENT . get ( url) . send ( ) . await . expect ( "Failed to request GitHub" ) . text ( ) . await . expect ( "Failed to read body" )
462+ // wreq uses http v1.x: pass URL as &str and call .send().await, then .bytes().await
463+ let bytes = MEDIA_CLIENT
464+ . get ( "https://raw.githubusercontent.com/redlib-org/redlib-instances/refs/heads/main/instances.json" )
465+ . send ( )
466+ . await
467+ . expect ( "Failed to request GitHub" )
468+ . bytes ( )
469+ . await
470+ . expect ( "Failed to read body" ) ;
471+ String :: from_utf8_lossy ( & bytes) . into_owned ( )
458472}
0 commit comments