#![allow(deprecated, reason = "Internal implementation of deprecated shims")]
#[cfg(server)]
use std::path::Path;
#[cfg(server)]
#[deprecated(
since = "0.1.0-rc.27",
note = "Use reinhardt_utils::staticfiles::vendor::AppVendorAsset instead"
)]
pub struct VendorAsset {
pub url: &'static str,
pub target: &'static str,
pub sha256: &'static str,
}
#[cfg(server)]
#[deprecated(
since = "0.1.0-rc.27",
note = "Use reinhardt_utils::staticfiles::vendor::Verbosity instead"
)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Verbosity {
Silent,
Normal,
Verbose,
}
#[cfg(server)]
impl From<Verbosity> for reinhardt_utils::staticfiles::vendor::Verbosity {
fn from(v: Verbosity) -> Self {
match v {
Verbosity::Silent => Self::Silent,
Verbosity::Normal => Self::Normal,
Verbosity::Verbose => Self::Verbose,
}
}
}
#[cfg(server)]
#[deprecated(
since = "0.1.0-rc.27",
note = "Admin vendor assets are now registered via inventory; \
use reinhardt_utils::staticfiles::vendor::registered_assets_for_app(\"admin\") instead"
)]
pub fn admin_vendor_assets() -> &'static [VendorAsset] {
&[]
}
#[cfg(server)]
#[deprecated(
since = "0.1.0-rc.27",
note = "Use reinhardt_utils::staticfiles::vendor::verify_integrity instead"
)]
pub fn verify_integrity(path: &Path, expected_sha256: &str) -> Result<(), String> {
reinhardt_utils::staticfiles::vendor::verify_integrity(path, expected_sha256)
.map_err(|e| e.to_string())
}
#[cfg(server)]
#[deprecated(
since = "0.1.0-rc.27",
note = "Use reinhardt_utils::staticfiles::vendor::ensure_vendor_assets_for_app instead"
)]
pub async fn download_vendor_assets(
base_dir: &Path,
verbosity: Verbosity,
) -> Result<(), anyhow::Error> {
let assets = reinhardt_utils::staticfiles::vendor::registered_assets_for_app("admin");
reinhardt_utils::staticfiles::vendor::download_assets(base_dir, &assets, verbosity.into())
.await
.map_err(|e| anyhow::anyhow!("{}", e))
}
#[cfg(server)]
#[deprecated(
since = "0.1.0-rc.27",
note = "Use reinhardt_utils::staticfiles::vendor::ensure_vendor_assets_for_app instead"
)]
pub async fn ensure_vendor_assets(base_dir: &std::path::Path) {
let _ =
reinhardt_utils::staticfiles::vendor::ensure_vendor_assets_for_app("admin", base_dir).await;
}