mirror of
				https://github.com/TeamPiped/piped-proxy.git
				synced 2024-08-14 23:50:45 +00:00 
			
		
		
		
	Fix for proxying LBRY HLS.
This commit is contained in:
		
							parent
							
								
									dafafaf418
								
							
						
					
					
						commit
						fa345b493b
					
				
					 1 changed files with 2 additions and 4 deletions
				
			
		| 
						 | 
					@ -188,10 +188,8 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
 | 
				
			||||||
                    if url.starts_with("https://") {
 | 
					                    if url.starts_with("https://") {
 | 
				
			||||||
                        return line.replace(url, localize_url(url, host).as_str());
 | 
					                        return line.replace(url, localize_url(url, host).as_str());
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } else if line.starts_with("https://") {
 | 
					 | 
				
			||||||
                    return localize_url(line, host);
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                line.to_string()
 | 
					                localize_url(line, host)
 | 
				
			||||||
            }).collect::<Vec<String>>().join("\n");
 | 
					            }).collect::<Vec<String>>().join("\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return Ok(response.body(modified));
 | 
					            return Ok(response.body(modified));
 | 
				
			||||||
| 
						 | 
					@ -212,7 +210,7 @@ fn localize_url(url: &str, host: &str) -> String {
 | 
				
			||||||
            .append_pair("host", &host);
 | 
					            .append_pair("host", &host);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return format!("{}?{}", url.path(), url.query().unwrap());
 | 
					        return format!("{}?{}", url.path(), url.query().unwrap());
 | 
				
			||||||
    } else if url.starts_with('/') {
 | 
					    } else if url.ends_with(".m3u8") || url.ends_with(".ts") {
 | 
				
			||||||
        return if url.contains('?') {
 | 
					        return if url.contains('?') {
 | 
				
			||||||
            format!("{}&host={}", url, host)
 | 
					            format!("{}&host={}", url, host)
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue