Skip to content

Commit

Permalink
fix small issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr1Furious committed Dec 23, 2024
1 parent ba0997d commit 545ba94
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 18 deletions.
4 changes: 2 additions & 2 deletions instance_builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The `spec.json` file is used to define the specifications for generating instanc
"include_no_overwrite": ["string"],
"include_from": "string",
"replace_download_urls": "boolean",
"auth_provider": {
"auth_backend": {
"type": "string",
"data_field1": "data_value1",
"other_data_fields": "other_data_values"
Expand Down Expand Up @@ -52,7 +52,7 @@ The `spec.json` file is used to define the specifications for generating instanc
- **include**: A list of additional files or directories to include in the instance (optional; e.g., mods).
- **include_no_overwrite**: A list of files or directories to include without overwriting existing files (optional; e.g., configs).
- **include_from**: A directory from which to include files (optional).
- **auth_provider**: Authentication data for accessing protected resources (optional).
- **auth_backend**: Authentication data for accessing protected resources (optional).
- **type**: The authentication provider name (e.g., "telegram" for [this telegram format](https://foxlab.dev/minecraft/tgauth-backend)).
- Any additional fields for the selected authentication provider.
- **exec_before**: A command to execute before processing this version (optional).
Expand Down
2 changes: 1 addition & 1 deletion instance_builder/spec.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"config"
],
"include_from": "<...>/PrismLauncher/instances/Monifactory/minecraft",
"auth_provider": {
"auth_backend": {
"type": "telegram",
"auth_base_url": "https://mc-auth.vanutp.dev"
}
Expand Down
4 changes: 2 additions & 2 deletions instance_builder/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct Version {

pub include_from: Option<String>,

pub auth_provider: Option<AuthBackend>,
pub auth_backend: Option<AuthBackend>,

pub exec_before: Option<String>,
pub exec_after: Option<String>,
Expand Down Expand Up @@ -208,7 +208,7 @@ impl VersionsSpec {
resources_url_base,
self.download_server_base.clone(),
result.extra_libs_paths,
version.auth_provider.clone(),
version.auth_backend.clone(),
);
let extra_generator_result = extra_generator.generate(work_dir).await?;
mapping.extend(extra_generator_result.include_mapping.into_iter().map(
Expand Down
11 changes: 7 additions & 4 deletions launcher/src/app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct LauncherApp {
pub fn run_gui(config: Config) {
let native_options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default()
.with_inner_size((650.0, 500.0))
.with_inner_size((650.0, 450.0))
.with_icon(utils::get_icon_data())
.with_resizable(false),
..Default::default()
Expand Down Expand Up @@ -295,9 +295,12 @@ impl LauncherApp {
let force_launch_result = self.launch_state.render_download_ui(
ui,
&mut self.config,
!self.java_state.checking_java()
&& some_version_selected
&& have_some_auth_data,
self.instance_sync_state.is_syncing()
|| self.manifest_state.is_fetching()
|| self.metadata_state.is_getting()
|| self.java_state.checking_java()
|| !some_version_selected
|| !have_some_auth_data,
);
match force_launch_result {
ForceLaunchResult::ForceLaunchSelected => {
Expand Down
6 changes: 3 additions & 3 deletions launcher/src/app/launch_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ impl LaunchState {
&mut self,
ui: &mut egui::Ui,
config: &mut Config,
enabled: bool,
disabled: bool,
) -> ForceLaunchResult {
let lang = config.lang;

if !self.force_launch {
let mut button_clicked = false;
ui.add_enabled_ui(enabled, |ui| {
ui.add_enabled_ui(!disabled, |ui| {
if LaunchState::big_button_clicked(
ui,
&LangMessage::DownloadAndLaunch.to_string(lang),
Expand All @@ -174,7 +174,7 @@ impl LaunchState {
}
} else {
let mut cancel_clicked = false;
ui.add_enabled_ui(enabled, |ui| {
ui.add_enabled_ui(!disabled, |ui| {
if LaunchState::big_button_clicked(ui, &LangMessage::CancelLaunch.to_string(lang)) {
self.force_launch = false;
cancel_clicked = true;
Expand Down
3 changes: 2 additions & 1 deletion launcher/src/app/metadata_state.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{path::Path, sync::Arc};

use log::error;
use log::{error, info};
use shared::version::version_manifest::VersionInfo;
use tokio::runtime::Runtime;

Expand Down Expand Up @@ -52,6 +52,7 @@ fn get_metadata(
CompleteVersionMetadata::read_local(&version_info, &data_dir).await;
MetadataFetchResult {
status: if connect_error {
info!("Metadata offline mode");
GetStatus::ReadLocalOffline
} else if let Some(local_error) = local_metadata.as_ref().err() {
error!(
Expand Down
12 changes: 7 additions & 5 deletions launcher/src/version/instance_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,17 @@ impl InstanceStorage {
status: InstanceStatus::Missing,
});

if let Some(mut instance) = local_instance {
if let Some(remote_instance) = remote_instance {
if let Some(mut remote_instance) = remote_instance {
if let Some(instance) = local_instance {
if remote_instance.version_info != instance.version_info {
instance.status = InstanceStatus::Outdated;
remote_instance.status = InstanceStatus::Outdated;
} else {
remote_instance.status = InstanceStatus::UpToDate;
}
}
Some(instance)
Some(remote_instance)
} else {
remote_instance
local_instance
}
}

Expand Down
1 change: 1 addition & 0 deletions shared/src/version/extra_version_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ impl AuthBackend {

#[derive(Deserialize, Serialize)]
pub struct ExtraVersionMetadata {
#[serde(default)]
pub auth_backend: Option<AuthBackend>,

#[serde(default)]
Expand Down

0 comments on commit 545ba94

Please sign in to comment.