Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Work on Downloader has been started. #2 #3
Browse files Browse the repository at this point in the history
Added the Downloader structure.
Now Downloader is a list for downloading, which can verify and download.
Errors have been moved to make them global.
Added comments in English for example configuration.
Direct Default specifications for structures have been removed, now using Derive.
A "framework" for checking for Downloader has been made.
The Model folder now belongs to Downloader.
Now models will provide links for downloading and file hashes for verification.
Lock added for future config.lock.

Начата работа над Downloader.
Добавил структуру Downloader.
Теперь Downloader это лист для скачивания, который может проверить и скачать.
Перенесены ошибки, чтобы сделать их глобальными.
Добавлены комментарии на английском для примера конфигурации.
Убраны прямые указания Default для структур, теперь используем Derive
Сделан каркас для проверки для Downloader.
Папка Model теперь относится к Downloader.
Теперь модели будут предоставлять ссылки для скачивания и хеш файла для проверки.
Добавлен Lock, для будущего config.lock.
  • Loading branch information
TOwInOK committed Mar 20, 2024
1 parent 495601f commit 309fc6a
Show file tree
Hide file tree
Showing 19 changed files with 314 additions and 302 deletions.
29 changes: 22 additions & 7 deletions Sample of config.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,48 @@
#Sample of config
# Пример конфигурации
# Sample of config

#freez - добавлять ли на проверку/скачивание если object присутствует.
# freez - добавлять ли на проверку/скачивание если object присутствует.
# freez - whether to add for checking/downloading if object is present.

# Секция ядра
# Секция ядра / Core section
[core]
# Выбери один из вариантов: vanila, spigot, bucket, paper, purpur
# Choose one of the options: vanilla, spigot, bucket, paper, purpur
provider = "paper"
# Версия сервера (например, "1.14.4" или специальный код)
# Server version (e.g., "1.14.4" or a special code)
version = "1.14.4"
# Замораживать ли объекты при наличии в системе
# Whether to freeze objects if present in the system
freeze = false
force_update = false

# Update - не требуется при загрузке, он нужен только когда freez = true, чтобы обновить на туже версию, либо принудительно обновить на самую последнюю, даже когда обновления нет.
# Секция плагинов
# Update - not required on load, only needed when freez = true, to update to the same version, or forcibly update to the latest, even when there are no updates.
# Секция плагинов / Plugins section
[plugins]
# Пример 1 - строчка
# Example 1 - single line
vc1 = {version = "ail5iPUK", chanel = "stable", freez = true, update = false}

# Пример 2 - строчка
# Example 2 - single line
cooler1 = {source = "Spigot", version = "ail5iPUK", chanel = "Beta", freez = false, update = false}

# Пример 3 - строчка
# Example 3 - single line
best_plugin_without_any_param1 = {}

# Пример 1 - секция
# Example 1 - section
[plugins.simple_voice_chat2]
version = "ail5iPUK"
chanel = "Stable"
freez = false
update = false

# Пример 2 - секция
# Example 2 - section
[plugins.cooler2]
source = "Spigot"
version = "ail5iPUK"
Expand All @@ -40,17 +51,21 @@
update = true

# Пример 3 - секция
# Example 3 - section
[plugins.best_plugin_without_any_param2]
#Дефолт:
#Дефолт: / Default:
#source = Modrith
#version = "Latest"
#chanel = "Stable"
#freez = false
#update = false

# Секция дополнений
# Additions section
[additions]
#Git link для конфига
# Git link для конфига
# Git link for the config
configPluguinsFrom = "[email protected]:TOwInOK/test.git"
#Ключ если в привате
# Ключ если в привате
# Key if in private
key = "SUPEREKLy"
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[core]
# Выбери один из вариантов: vanila, spigot, bucket, paper, purpur
# Выбери один из вариантов: Vanila, Spigot, Bucket, Paper, Purpur, Forge, NeoForge, Fabric
provider = "Paper"
version = "1.14.4"
# Замораживать ли объекты при наличии в системе
Expand Down
8 changes: 1 addition & 7 deletions src/config/additions.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Debug)]
#[derive(Deserialize, Serialize, Debug, Default)]
pub struct Additions {
// git link
#[serde(rename = "configPluguinsFrom")]
config_plugins_from: String,
// git key
key: String,
}

impl Default for Additions {
fn default() -> Self {
Self { config_plugins_from: Default::default(), key: Default::default() }
}
}
30 changes: 30 additions & 0 deletions src/config/core.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use crate::config::Versions;
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Debug, Default)]
pub struct Core {
// Ядро
#[serde(default)]
pub provider: Provider,
// Версия ядра
#[serde(default)]
pub version: Versions,
// Приостановить обновление
#[serde(default)]
pub freeze: bool,
// Нужно обновить
#[serde(default)]
pub force_update: bool,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub enum Provider {
#[default]
Vanilla,
Bucket,
Spigot,
Paper,
Purpur,
Fabric,
Forge,
NeoForge,
}
41 changes: 0 additions & 41 deletions src/config/core/mod.rs

This file was deleted.

138 changes: 0 additions & 138 deletions src/config/downloader.rs

This file was deleted.

Empty file added src/config/lock.rs
Empty file.
Loading

0 comments on commit 309fc6a

Please sign in to comment.