- Change the special url resolver code to better (still not optimally) support different services besides zippyshare - Implement support for sendcm
27 lines
665 B
Rust
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,
|
|
}
|
|
}
|