35 lines
750 B
Rust
35 lines
750 B
Rust
use ntex::web;
|
|
|
|
use crate::{proxies::sxyprn::SxyprnProxy, util::requester::Requester};
|
|
|
|
pub mod sxyprn;
|
|
pub mod hanimecdn;
|
|
pub mod javtiful;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub enum AnyProxy {
|
|
Sxyprn(SxyprnProxy),
|
|
Javtiful(javtiful::JavtifulProxy),
|
|
}
|
|
|
|
pub trait Proxy {
|
|
async fn get_video_url(
|
|
&self,
|
|
url: String,
|
|
requester: web::types::State<Requester>,
|
|
) -> String;
|
|
}
|
|
|
|
|
|
impl Proxy for AnyProxy {
|
|
async fn get_video_url(
|
|
&self,
|
|
url: String,
|
|
requester: web::types::State<Requester>,
|
|
) -> String {
|
|
match self {
|
|
AnyProxy::Sxyprn(p) => p.get_video_url(url, requester).await,
|
|
AnyProxy::Javtiful(p) => p.get_video_url(url, requester).await,
|
|
}
|
|
}
|
|
} |