mirror of
https://github.com/an-anime-team/sleepy-launcher.git
synced 2025-03-15 14:38:29 +03:00
feat: added telemetry disabling state support
This commit is contained in:
parent
2dea43fbda
commit
07fbb13b42
16 changed files with 129 additions and 5 deletions
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Added telemetry disabling state support
|
||||
|
||||
### Changed
|
||||
|
||||
- Replaced xlua patch by "disable mhypbase" option
|
||||
|
|
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -48,8 +48,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anime-game-core"
|
||||
version = "1.13.0"
|
||||
source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.13.0#440dca2cca2e5109468751033c566ab0777324e2"
|
||||
version = "1.13.1"
|
||||
source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.13.1#e8b99564f4ea12a331aa276ea91fe65c0ead465e"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bzip2",
|
||||
|
@ -96,8 +96,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anime-launcher-sdk"
|
||||
version = "1.8.0"
|
||||
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.8.0#01486e00a49c1ee7c78eaf81290136ae3ba69520"
|
||||
version = "1.8.1"
|
||||
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.8.1#6f6343df58a7801311c1fc9203172278901e8baf"
|
||||
dependencies = [
|
||||
"anime-game-core",
|
||||
"anyhow",
|
||||
|
|
|
@ -17,7 +17,7 @@ glib-build-tools = "0.17"
|
|||
|
||||
[dependencies.anime-launcher-sdk]
|
||||
git = "https://github.com/an-anime-team/anime-launcher-sdk"
|
||||
tag = "1.8.0"
|
||||
tag = "1.8.1"
|
||||
features = ["all", "genshin", "genshin-patch"]
|
||||
|
||||
# path = "../anime-launcher-sdk" # ! for dev purposes only
|
||||
|
|
|
@ -42,6 +42,10 @@ patch-sync-failed = Synchronisierung des Patch-Ordners fehlgeschlagen
|
|||
patch-state-check-failed = Status des Patchordners konnte nicht überprüft werden
|
||||
game-patching-error = Spiel konnte nicht gepatcht werden
|
||||
|
||||
# Disable telemetry
|
||||
|
||||
telemetry-servers-disabling-error = Failed to disable telemetry servers
|
||||
|
||||
# Sandbox
|
||||
|
||||
documentation-url-open-failed = Dokumentations-URL kann nicht geöffnet werden
|
||||
|
|
|
@ -42,6 +42,10 @@ patch-sync-failed = Failed to sync patch folder
|
|||
patch-state-check-failed = Failed to check patch folder state
|
||||
game-patching-error = Failed to patch game
|
||||
|
||||
# Disable telemetry
|
||||
|
||||
telemetry-servers-disabling-error = Failed to disable telemetry servers
|
||||
|
||||
# Sandbox
|
||||
|
||||
documentation-url-open-failed = Failed to open documentation URL
|
||||
|
|
|
@ -42,6 +42,10 @@ patch-sync-failed = Fallo al sincronizar carpeta del parche
|
|||
patch-state-check-failed = Fallo al comprobar estado de carpeta del parche
|
||||
game-patching-error = Fallo al parchear el juego
|
||||
|
||||
# Disable telemetry
|
||||
|
||||
telemetry-servers-disabling-error = Failed to disable telemetry servers
|
||||
|
||||
# Sandbox
|
||||
|
||||
documentation-url-open-failed = Failed to open documentation URL
|
||||
|
|
|
@ -42,6 +42,10 @@ patch-sync-failed = Impossible de synchroniser le patch
|
|||
patch-state-check-failed = Impossible de déterminer l'état du patch
|
||||
game-patching-error = Le patch du jeu a échoué
|
||||
|
||||
# Disable telemetry
|
||||
|
||||
telemetry-servers-disabling-error = Failed to disable telemetry servers
|
||||
|
||||
# Sandbox
|
||||
|
||||
documentation-url-open-failed = Failed to open documentation URL
|
||||
|
|
|
@ -42,6 +42,10 @@ patch-sync-failed = Patch mappa szinkronizálása sikertelen
|
|||
patch-state-check-failed = Patch mappa állapota ellenőrzése sikertelen
|
||||
game-patching-error = Sikertelen játék patchelés
|
||||
|
||||
# Disable telemetry
|
||||
|
||||
telemetry-servers-disabling-error = Failed to disable telemetry servers
|
||||
|
||||
# Sandbox
|
||||
|
||||
documentation-url-open-failed = Failed to open documentation URL
|
||||
|
|
|
@ -42,6 +42,10 @@ patch-sync-failed = Gagal mensinkronisasi folder patch
|
|||
patch-state-check-failed = Gagal mengecek kondisi folder patch
|
||||
game-patching-error = Gagal melakukan patch pada game
|
||||
|
||||
# Disable telemetry
|
||||
|
||||
telemetry-servers-disabling-error = Failed to disable telemetry servers
|
||||
|
||||
# Sandbox
|
||||
|
||||
documentation-url-open-failed = Gagal membuka tautan dokumentasi
|
||||
|
|
|
@ -42,6 +42,10 @@ patch-sync-failed = Sincronizzazione della cartella della patch non riuscita
|
|||
patch-state-check-failed = Controllo dello stato della cartella della patch non riuscito
|
||||
game-patching-error = Patching del gioco non riuscito
|
||||
|
||||
# Disable telemetry
|
||||
|
||||
telemetry-servers-disabling-error = Failed to disable telemetry servers
|
||||
|
||||
# Sandbox
|
||||
|
||||
documentation-url-open-failed = Apertura dell'URL della documentazione non riuscita
|
||||
|
|
|
@ -42,6 +42,10 @@ patch-sync-failed = パッチフォルダの同期に失敗しました
|
|||
patch-state-check-failed = パッチフォルダの状態を確認するのに失敗しました
|
||||
game-patching-error = ゲームのパッチに失敗しました。
|
||||
|
||||
# Disable telemetry
|
||||
|
||||
telemetry-servers-disabling-error = Failed to disable telemetry servers
|
||||
|
||||
# Sandbox
|
||||
|
||||
documentation-url-open-failed = ドキュメントページを開けませんでした。
|
||||
|
|
|
@ -42,6 +42,10 @@ patch-sync-failed = Ошибка синхронизации папки патч
|
|||
patch-state-check-failed = Ошибка проверки статуса папки патча
|
||||
game-patching-error = Не удалось установить патч игры
|
||||
|
||||
# Disable telemetry
|
||||
|
||||
telemetry-servers-disabling-error = Failed to disable telemetry servers
|
||||
|
||||
# Sandbox
|
||||
|
||||
documentation-url-open-failed = Не удалось открыть ссылку с документацией
|
||||
|
|
|
@ -42,6 +42,10 @@ patch-sync-failed = Yama dosyalarını senkronize etme başarısız oldu
|
|||
patch-state-check-failed = Yama dosyalarının durumunu kontrol etme başarısız oldu
|
||||
game-patching-error = Yamayı uygulamada sorun çıktı
|
||||
|
||||
# Disable telemetry
|
||||
|
||||
telemetry-servers-disabling-error = Failed to disable telemetry servers
|
||||
|
||||
# Sandbox
|
||||
|
||||
documentation-url-open-failed = Belgelemenin URL'si açılamadı
|
||||
|
|
|
@ -42,6 +42,10 @@ patch-sync-failed = 同步补丁文件夹失败
|
|||
patch-state-check-failed = 检查补丁文件夹失败
|
||||
game-patching-error = 应用游戏补丁失败
|
||||
|
||||
# Disable telemetry
|
||||
|
||||
telemetry-servers-disabling-error = Failed to disable telemetry servers
|
||||
|
||||
# Sandbox
|
||||
|
||||
documentation-url-open-failed = Failed to open documentation URL
|
||||
|
|
68
src/ui/main/disable_telemetry.rs
Normal file
68
src/ui/main/disable_telemetry.rs
Normal file
|
@ -0,0 +1,68 @@
|
|||
use std::process::Command;
|
||||
|
||||
use relm4::prelude::*;
|
||||
|
||||
use crate::*;
|
||||
use crate::i18n::*;
|
||||
|
||||
use super::{App, AppMsg};
|
||||
|
||||
pub fn disable_telemetry(sender: ComponentSender<App>) {
|
||||
sender.input(AppMsg::DisableButtons(true));
|
||||
|
||||
let config = Config::get().unwrap();
|
||||
|
||||
std::thread::spawn(move || {
|
||||
let telemetry = config.launcher.edition
|
||||
.telemetry_servers()
|
||||
.iter()
|
||||
.map(|server| format!("0.0.0.0 {server}"))
|
||||
.collect::<Vec<String>>()
|
||||
.join("\\n");
|
||||
|
||||
let output = if config.patch.root {
|
||||
Command::new("pkexec")
|
||||
.arg("echo")
|
||||
.arg("-e")
|
||||
.arg(format!("\\n{telemetry}\\n"))
|
||||
.arg(">>")
|
||||
.arg("/etc/hosts")
|
||||
.spawn()
|
||||
}
|
||||
|
||||
else {
|
||||
Command::new("echo")
|
||||
.arg("-e")
|
||||
.arg(format!("\\n{telemetry}\\n"))
|
||||
.arg(">>")
|
||||
.arg("/etc/hosts")
|
||||
.spawn()
|
||||
};
|
||||
|
||||
match output.and_then(|child| child.wait_with_output()) {
|
||||
Ok(output) => if !output.status.success() {
|
||||
tracing::error!("Failed to update /etc/hosts file");
|
||||
|
||||
sender.input(AppMsg::Toast {
|
||||
title: tr("telemetry-servers-disabling-error"),
|
||||
description: Some(String::from_utf8(output.stderr).unwrap())
|
||||
});
|
||||
}
|
||||
|
||||
Err(err) => {
|
||||
tracing::error!("Failed to update /etc/hosts file");
|
||||
|
||||
sender.input(AppMsg::Toast {
|
||||
title: tr("telemetry-servers-disabling-error"),
|
||||
description: Some(err.to_string())
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
sender.input(AppMsg::DisableButtons(false));
|
||||
sender.input(AppMsg::UpdateLauncherState {
|
||||
perform_on_download_needed: false,
|
||||
show_status_page: true
|
||||
});
|
||||
});
|
||||
}
|
|
@ -16,6 +16,7 @@ mod download_wine;
|
|||
mod create_prefix;
|
||||
mod download_diff;
|
||||
mod migrate_folder;
|
||||
mod disable_telemetry;
|
||||
mod launch;
|
||||
|
||||
use anime_launcher_sdk::components::loader::ComponentsLoader;
|
||||
|
@ -394,6 +395,8 @@ impl SimpleComponent for App {
|
|||
PatchStatus::Available { .. } => "document-save-symbolic"
|
||||
}
|
||||
|
||||
Some(LauncherState::TelemetryNotDisabled) => "network-wired-symbolic",
|
||||
|
||||
Some(LauncherState::VoiceOutdated(_)) |
|
||||
Some(LauncherState::GameOutdated(_)) |
|
||||
None => "window-close-symbolic"
|
||||
|
@ -407,6 +410,9 @@ impl SimpleComponent for App {
|
|||
Some(LauncherState::FolderMigrationRequired { .. }) => tr("migrate-folders"),
|
||||
Some(LauncherState::PlayerPatchAvailable { .. }) => tr("apply-patch"),
|
||||
|
||||
// TODO: add localization
|
||||
Some(LauncherState::TelemetryNotDisabled) => String::from("Disable telemetry"),
|
||||
|
||||
Some(LauncherState::WineNotInstalled) => tr("download-wine"),
|
||||
Some(LauncherState::PrefixNotExists) => tr("create-prefix"),
|
||||
|
||||
|
@ -1033,6 +1039,8 @@ impl SimpleComponent for App {
|
|||
LauncherState::PlayerPatchAvailable { patch, disable_mhypbase } =>
|
||||
apply_patch::apply_patch(sender, patch.to_owned(), *disable_mhypbase),
|
||||
|
||||
LauncherState::TelemetryNotDisabled => disable_telemetry::disable_telemetry(sender),
|
||||
|
||||
LauncherState::WineNotInstalled => download_wine::download_wine(sender, self.progress_bar.sender().to_owned()),
|
||||
LauncherState::PrefixNotExists => create_prefix::create_prefix(sender),
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue