-
Notifications
You must be signed in to change notification settings - Fork 26
feature parity with legacy ytproxy #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
b1658c9
1a3884c
f386d6a
84c790a
a83a14f
a9e34cb
67369a4
082d1ae
736f51e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,22 @@ | ||
| use lazy_static::lazy_static; | ||
| use qstring::QString; | ||
| use reqwest::Url; | ||
| use std::borrow::Cow; | ||
| use std::collections::BTreeMap; | ||
| use std::env; | ||
|
|
||
| #[cfg(not(feature = "prefix-path"))] | ||
| lazy_static! { | ||
| static ref PREFIX_PATH: Option<String> = Some(String::from("")); | ||
| } | ||
|
|
||
| #[cfg(feature = "prefix-path")] | ||
| lazy_static! { | ||
| static ref PREFIX_PATH: Option<String> = match env::var("PREFIX_PATH") { | ||
| Ok(v) => Some(String::from(v)), | ||
| Err(e) => panic!("$PREFIX_PATH is not set ({})", e) | ||
| }; | ||
| } | ||
paolafrancesca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| pub fn read_buf(buf: &[u8], pos: &mut usize) -> u8 { | ||
| let byte = buf[*pos]; | ||
|
|
@@ -13,7 +28,6 @@ fn finalize_url(path: &str, query: BTreeMap<String, String>) -> String { | |
| #[cfg(feature = "qhash")] | ||
| { | ||
| use std::collections::BTreeSet; | ||
| use std::env; | ||
|
|
||
| let qhash = { | ||
| let secret = env::var("HASH_SECRET"); | ||
|
|
@@ -46,12 +60,12 @@ fn finalize_url(path: &str, query: BTreeMap<String, String>) -> String { | |
| if qhash.is_some() { | ||
| let mut query = QString::new(query.into_iter().collect::<Vec<_>>()); | ||
| query.add_pair(("qhash", qhash.unwrap())); | ||
| return format!("{}?{}", path, query); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need feature specific code for when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hi @FireMasterK , please let me know if my solution is what you meant. thanks |
||
| return format!("{}{}?{}", PREFIX_PATH.as_ref().unwrap().to_string(), path, query); | ||
| } | ||
| } | ||
|
|
||
| let query = QString::new(query.into_iter().collect::<Vec<_>>()); | ||
| format!("{}?{}", path, query) | ||
| format!("{}{}?{}", PREFIX_PATH.as_ref().unwrap().to_string(), path, query) | ||
| } | ||
|
|
||
| pub fn localize_url(url: &str, host: &str) -> String { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.