ffdl/src/integrations.rs
Daniel M a46bc063ff Add support for sendcm
- Change the special url resolver code to better (still not optimally)
  support different services besides zippyshare
- Implement support for sendcm
2022-04-01 00:40:42 +02:00

27 lines
665 B
Rust

mod zippy;
mod sendcm;
use anyhow::Result;
pub enum IntegratedService {
ZippyShare,
SendCm,
}
pub fn is_integrated_url(url: &str) -> Option<IntegratedService> {
if zippy::is_zippyshare_url(url) {
Some(IntegratedService::ZippyShare)
} else if sendcm::is_sendcm_url(url) {
Some(IntegratedService::SendCm)
} else {
None
}
}
pub async fn resolve_integrated_url(url: &str, service: IntegratedService) -> Result<String> {
match service {
IntegratedService::ZippyShare => zippy::resolve_link(url).await,
IntegratedService::SendCm => sendcm::resolve_link(url).await,
}
}