-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34bcedb
commit a41a167
Showing
27 changed files
with
717 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use std::collections::HashMap; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)] | ||
pub struct Hook { | ||
pub when: HookEvent, | ||
#[serde(default)] | ||
pub onfail: HookFailBehavior, | ||
#[serde(default = "bool_true")] | ||
pub show_output: bool, | ||
#[serde(default)] | ||
pub description: String, | ||
#[serde(default)] | ||
pub disabled: bool, | ||
#[serde(default)] | ||
pub env: HashMap<String, String>, | ||
|
||
pub windows: Option<String>, | ||
pub linux: Option<String>, | ||
} | ||
|
||
fn bool_true() -> bool { | ||
true | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone, Hash, PartialEq, Default)] | ||
#[serde(rename_all = "lowercase")] | ||
pub enum HookEvent { | ||
#[default] | ||
None, | ||
PreBuild, | ||
PostBuild, | ||
PreInstall, | ||
PostInstall, | ||
PreWorldUnpack, | ||
PostWorldUnpack, | ||
PreWorldPack, | ||
PostWorldPack, | ||
DevSessionStart, | ||
DevSessionEnd, | ||
TestSuccess, | ||
TestFail, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone, Hash, PartialEq, Default)] | ||
pub enum HookFailBehavior { | ||
#[default] | ||
Error, | ||
Ignore, | ||
Warn, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::LegacyDownloadable; | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone, Hash, PartialEq, Eq)] | ||
pub struct LegacyClientSideMod { | ||
#[serde(flatten)] | ||
pub dl: LegacyDownloadable, | ||
|
||
pub optional: bool, | ||
pub desc: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Deserialize, Serialize, Clone, Hash, PartialEq, Eq)] | ||
#[serde(tag = "type", rename_all = "lowercase")] | ||
pub enum LegacyDownloadable { | ||
// sources | ||
Url { | ||
url: String, | ||
#[serde(default)] | ||
#[serde(skip_serializing_if = "crate::api::utils::serde::is_default")] | ||
filename: Option<String>, | ||
#[serde(default)] | ||
#[serde(skip_serializing_if = "crate::api::utils::serde::is_default")] | ||
desc: Option<String>, | ||
}, | ||
|
||
#[serde(alias = "mr")] | ||
Modrinth { | ||
id: String, | ||
#[serde(default = "latest")] | ||
version: String, | ||
}, | ||
|
||
#[serde(alias = "cr")] | ||
CurseRinth { | ||
id: String, | ||
#[serde(default = "latest")] | ||
version: String, | ||
}, | ||
|
||
Spigot { | ||
id: String, | ||
#[serde(default = "latest")] | ||
version: String, | ||
}, | ||
|
||
Hangar { | ||
id: String, | ||
version: String, | ||
}, | ||
|
||
#[serde(rename = "ghrel")] | ||
GithubRelease { | ||
repo: String, | ||
tag: String, | ||
asset: String, | ||
}, | ||
|
||
// pain in the a- | ||
Jenkins { | ||
url: String, | ||
job: String, | ||
#[serde(default = "latest")] | ||
build: String, | ||
#[serde(default = "first")] | ||
artifact: String, | ||
}, | ||
|
||
Maven { | ||
url: String, | ||
group: String, | ||
artifact: String, | ||
#[serde(default = "latest")] | ||
version: String, | ||
#[serde(default = "artifact")] | ||
filename: String, | ||
}, | ||
} | ||
|
||
pub fn latest() -> String { | ||
"latest".to_owned() | ||
} | ||
|
||
pub fn first() -> String { | ||
"first".to_owned() | ||
} | ||
|
||
pub fn artifact() -> String { | ||
"artifact".to_owned() | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)] | ||
#[serde(default)] | ||
pub struct LegacyMarkdownOptions { | ||
pub files: Vec<String>, | ||
pub auto_update: bool, | ||
} | ||
|
||
impl Default for LegacyMarkdownOptions { | ||
fn default() -> Self { | ||
Self { | ||
files: vec!["README.md".to_owned()], | ||
auto_update: false, | ||
} | ||
} | ||
} | ||
|
||
impl LegacyMarkdownOptions { | ||
pub fn is_empty(&self) -> bool { | ||
self.files.is_empty() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
mod downloadable; | ||
mod world; | ||
mod clientsidemod; | ||
mod markdown_options; | ||
mod server; | ||
mod server_options; | ||
mod server_type; | ||
mod server_launcher; | ||
mod network; | ||
mod hook; | ||
|
||
pub use downloadable::*; | ||
pub use world::*; | ||
pub use clientsidemod::*; | ||
pub use markdown_options::*; | ||
pub use server::*; | ||
pub use server_options::*; | ||
pub use server_type::*; | ||
pub use server_launcher::*; | ||
pub use network::*; | ||
pub use hook::*; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
use std::collections::HashMap; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::api::models::hooks::Hook; | ||
|
||
use super::{LegacyDownloadable, LegacyMarkdownOptions}; | ||
|
||
#[derive(Debug, Deserialize, Serialize, Clone)] | ||
#[serde(default)] | ||
pub struct LegacyNetwork { | ||
pub name: String, | ||
pub proxy: String, | ||
#[serde(default)] | ||
#[serde(skip_serializing_if = "Vec::is_empty")] | ||
pub proxy_groups: Vec<String>, | ||
pub port: u16, | ||
pub servers: HashMap<String, LegacyServerEntry>, | ||
pub variables: HashMap<String, String>, | ||
|
||
#[serde(default)] | ||
#[serde(skip_serializing_if = "LegacyMarkdownOptions::is_empty")] | ||
pub markdown: LegacyMarkdownOptions, | ||
|
||
#[serde(default)] | ||
#[serde(skip_serializing_if = "HashMap::is_empty")] | ||
pub hooks: HashMap<String, Hook>, | ||
|
||
#[serde(default)] | ||
#[serde(skip_serializing_if = "HashMap::is_empty")] | ||
pub groups: HashMap<String, LegacyGroup>, | ||
} | ||
|
||
#[derive(Debug, Deserialize, Serialize, Default, Clone)] | ||
#[serde(default)] | ||
pub struct LegacyServerEntry { | ||
pub port: u16, | ||
pub ip_address: Option<String>, | ||
#[serde(skip_serializing_if = "Vec::is_empty")] | ||
pub groups: Vec<String>, | ||
} | ||
|
||
#[derive(Debug, Default, Deserialize, Serialize, Clone)] | ||
#[serde(default)] | ||
pub struct LegacyGroup { | ||
#[serde(default)] | ||
pub variables: HashMap<String, String>, | ||
#[serde(skip_serializing_if = "Vec::is_empty")] | ||
pub plugins: Vec<LegacyDownloadable>, | ||
#[serde(skip_serializing_if = "Vec::is_empty")] | ||
pub mods: Vec<LegacyDownloadable>, | ||
} | ||
|
||
impl Default for LegacyNetwork { | ||
fn default() -> Self { | ||
Self { | ||
name: String::new(), | ||
proxy: "proxy".to_owned(), | ||
proxy_groups: vec![], | ||
port: 25565, | ||
servers: HashMap::new(), | ||
variables: HashMap::new(), | ||
markdown: LegacyMarkdownOptions::default(), | ||
hooks: HashMap::new(), | ||
groups: HashMap::new(), | ||
} | ||
} | ||
} |
Oops, something went wrong.