use serde::{Deserialize, Serialize};
use std::fmt::{Display, Formatter};
#[derive(Debug, Serialize, Eq, PartialEq, Deserialize)]
pub struct Plugin {
pub name: String,
pub url: String,
pub version: String,
}
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
pub struct ConfiguredPlugin {
pub name: String,
pub config: serde_json::Value,
}
impl Plugin {
#[inline]
pub fn build_url_with_console(&self, console_addr: &str) -> String {
format!("http://{}{}", console_addr, self.url)
}
#[inline]
pub fn is_relative_download_url(&self) -> bool {
!self.url.starts_with("http://") && !self.url.starts_with("https://")
}
}