From eb556c8cabd73d8af4088741a8171549d036c31e Mon Sep 17 00:00:00 2001 From: James Rowe Date: Mon, 2 Dec 2019 09:37:53 -0700 Subject: [PATCH 01/10] Force disable exp and nbf validation. Some clients had the wrong time information so it would fail to validate their token when installing. Remove these checks since they'll be checked on the server side anyway --- src/frontend/rest/services/authentication.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/frontend/rest/services/authentication.rs b/src/frontend/rest/services/authentication.rs index 4364640..46e0efd 100644 --- a/src/frontend/rest/services/authentication.rs +++ b/src/frontend/rest/services/authentication.rs @@ -138,7 +138,7 @@ pub fn validate_token( }; // Configure validation for audience and issuer if the configuration provides it - let validation = match validation { + let mut validation = match validation { Some(v) => { let mut valid = Validation::new(Algorithm::RS256); valid.iss = v.iss; @@ -149,7 +149,8 @@ pub fn validate_token( } None => Validation::default(), }; - + validation.validate_exp = false; + validation.validate_nbf = false; // Verify the JWT token decode::(&body, pub_key.as_slice(), &validation) .map(|tok| tok.claims) From 37d27a82baafd112b243e7e5094f6a38e71ec865 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Thu, 5 Dec 2019 09:49:03 -0700 Subject: [PATCH 02/10] Move to installer v1.8 --- bootstrap.windows.toml | 2 +- config.windows.v10.toml | 52 +++++++++++++++++++++++++++++++++++++++++ config.windows.v9.toml | 1 + 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 config.windows.v10.toml diff --git a/bootstrap.windows.toml b/bootstrap.windows.toml index 6f30831..0b37c15 100644 --- a/bootstrap.windows.toml +++ b/bootstrap.windows.toml @@ -1,2 +1,2 @@ name = "yuzu" -target_url = "https://raw.githubusercontent.com/yuzu-emu/liftinstall/master/config.windows.v9.toml" +target_url = "https://raw.githubusercontent.com/yuzu-emu/liftinstall/master/config.windows.v10.toml" diff --git a/config.windows.v10.toml b/config.windows.v10.toml new file mode 100644 index 0000000..1db13a8 --- /dev/null +++ b/config.windows.v10.toml @@ -0,0 +1,52 @@ +installing_message = "Reminder: yuzu is an experimental emulator. Stuff will break!" +hide_advanced = true + +[authentication] +# Base64 encoded version of the public key for validating the JWT token. Must be in DER format +pub_key_base64 = "MIIBCgKCAQEAs5K6s49JVV9LBMzDrkORsoPSYsv1sCXDtxjp4pn8p0uPSvJAsbNNmdIgCjfSULzbHLM28MblnI4zYP8ZgKtkjdg+Ic5WQbS5iBAkf18zMafpOrotTArLsgZSmUfNYt0SOiN17D+sq/Ov/CKXRM9CttKkEbanBTVqkx7sxsHVbkI6tDvkboSaNeVPHzHlfAbvGrUo5cbAFCB/KnRsoxr+g7jLKTxU1w4xb/pIs91h80AXV/yZPXL6ItPM3/0noIRXjmoeYWf2sFQaFALNB2Kef0p6/hoHYUQP04ZSIL3Q+v13z5X2YJIlI4eLg+iD25QYm9V8oP3+Xro4vd47a0/maQIDAQAB" +# URL to authenticate against. This must return a JWT token with their permissions and a custom claim patreonInfo with the following structure +# "patreonInfo": { "linked": false, "activeSubscription": false } +# If successful, the frontend will use this JWT token as a Bearer Authentication when requesting the binaries to download +auth_url = "https://api.yuzu-emu.org/jwt/installer/" + [authentication.validation] + iss = "citra-core" + aud = "installer" + +[[packages]] +name = "yuzu" +description = "Includes frequent updates to yuzu with all the latest reviewed and tested features." +default = true + [packages.source] + name = "github" + match = "^yuzu-windows-msvc-[0-9]*-[0-9a-f]*.tar.xz$" + [packages.source.config] + repo = "yuzu-emu/yuzu-mainline" + [[packages.shortcuts]] + name = "yuzu" + relative_path = "yuzu-windows-msvc/yuzu.exe" + description = "Launch yuzu" + +[[packages]] +name = "yuzu Early Access" +description = "Bonus preview release for project supporters. Thanks for your support!" +# Displayed when the package has no authentication for the user +need_authentication_description = "Click here to sign in with your yuzu account for Early Access" +# Displayed when the package has an authentication, but the user has not linked their account +need_link_description = "You are signed in, but you need to link your Patreon account! Click here for more details" +# Displayed when the package has an authentication, but the user has not linked their account +need_subscription_description = "You are signed in, but you need to link your Patreon account! Click here for more details" +# Displayed when the package has an authentication, but the user has not linked their account +need_reward_tier_description = "You are signed in, but are not backing an eligible reward tier! Click here for more details" +requires_authorization = true +# puts a "new" ribbon the package select +is_new = true + [packages.source] + name = "patreon" + match = "^yuzu-windows-msvc-[0-9]*-[0-9a-f]*.tar.xz$" + [packages.source.config] + repo = "earlyaccess" + [[packages.shortcuts]] + name = "yuzu Early Access" + relative_path = "yuzu-windows-msvc-early-access/yuzu.exe" + description = "Launch yuzu Early Access" + diff --git a/config.windows.v9.toml b/config.windows.v9.toml index 1db13a8..518261a 100644 --- a/config.windows.v9.toml +++ b/config.windows.v9.toml @@ -1,5 +1,6 @@ installing_message = "Reminder: yuzu is an experimental emulator. Stuff will break!" hide_advanced = true +new_tool = "https://github.com/yuzu-emu/liftinstall/releases/download/1.8/yuzu_install.exe" [authentication] # Base64 encoded version of the public key for validating the JWT token. Must be in DER format From 128c1b1f418a6e1e38844a26547c27e46048e52d Mon Sep 17 00:00:00 2001 From: James Rowe Date: Thu, 5 Dec 2019 23:36:53 -0700 Subject: [PATCH 03/10] Add paste button --- ui/src/App.vue | 2 +- ui/src/views/AuthenticationView.vue | 36 +++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/ui/src/App.vue b/ui/src/App.vue index 60e865c..a265872 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -124,7 +124,7 @@ pre { } /* Dark mode */ -body.has-background-black-ter .subtitle, body.has-background-black-ter .column > div { +body.has-background-black-ter .subtitle, body.has-background-black-ter .column > div, body.has-background-black-ter section { color: hsl(0, 0%, 96%); } diff --git a/ui/src/views/AuthenticationView.vue b/ui/src/views/AuthenticationView.vue index 4ce7600..125c5e0 100644 --- a/ui/src/views/AuthenticationView.vue +++ b/ui/src/views/AuthenticationView.vue @@ -1,5 +1,6 @@ From 6cae7461929428804c870961c74705e8b96febfa Mon Sep 17 00:00:00 2001 From: James Rowe Date: Fri, 6 Dec 2019 22:31:37 -0700 Subject: [PATCH 07/10] Launch existing maintenance tool if it exists in the default install folder --- src/main.rs | 31 ++++++++++++++++++++++++++- src/native/mod.rs | 6 +++--- src/tasks/launch_installed_on_exit.rs | 6 ++---- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2643c3c..b0956a0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,11 +65,13 @@ mod tasks; use installer::InstallerFramework; use logging::LoggingErrors; +use std::path::PathBuf; use clap::App; use clap::Arg; use config::BaseAttributes; +use std::process::{Command, Stdio, exit}; static RAW_CONFIG: &'static str = include_str!(concat!(env!("OUT_DIR"), "/bootstrap.toml")); @@ -106,12 +108,12 @@ fn main() { info!("{} installer", app_name); - // Handle self-updating if needed let current_exe = std::env::current_exe().log_expect("Current executable could not be found"); let current_path = current_exe .parent() .log_expect("Parent directory of executable could not be found"); + // Handle self-updating if needed self_update::perform_swap(¤t_exe, matches.value_of("swap")); if let Some(new_matches) = self_update::check_args(reinterpret_app, current_path) { matches = new_matches; @@ -119,15 +121,42 @@ fn main() { self_update::cleanup(current_path); // Load in metadata + setup the installer framework + let mut fresh_install = false; let metadata_file = current_path.join("metadata.json"); let mut framework = if metadata_file.exists() { info!("Using pre-existing metadata file: {:?}", metadata_file); InstallerFramework::new_with_db(config, current_path).log_expect("Unable to parse metadata") } else { info!("Starting fresh install"); + fresh_install = true; InstallerFramework::new(config) }; + // check for existing installs if we are running as a fresh install + let installed_path = PathBuf::from(framework.get_default_path().unwrap()); + if fresh_install && installed_path.join("metadata.json").exists() { + info!("Existing install detected! Trying to launch this install instead"); + // Generate installer path + let platform_extension = if cfg!(windows) { + "maintenancetool.exe" + } else { + "maintenancetool" + }; + let existing = installed_path.join(platform_extension).into_os_string().into_string(); + if existing.is_ok() { + info!("Launching {:?}", existing); + let success = Command::new(existing.unwrap()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .spawn(); + if success.is_ok() { + exit(0); + } else { + error!("Unable to start existing yuzu maintenance tool. Launching old one instead"); + } + } + } + let is_launcher = if let Some(string) = matches.value_of("launcher") { framework.is_launcher = true; framework.launcher_path = Some(string.to_string()); diff --git a/src/native/mod.rs b/src/native/mod.rs index 193f8c5..967b7a9 100644 --- a/src/native/mod.rs +++ b/src/native/mod.rs @@ -30,7 +30,7 @@ mod natives { HANDLE, PROCESS_QUERY_INFORMATION, PROCESS_TERMINATE, PROCESS_VM_READ, }; - use widestring::{U16CString, U16CStr}; + use widestring::{U16CString}; extern "C" { pub fn saveShortcut( @@ -65,7 +65,7 @@ mod natives { exe_path: &str, ) -> Result { let mut cmd_path = [0u16; MAX_PATH + 1]; - let result = unsafe { getDesktopFolder(cmd_path.as_mut_ptr()) }; + let _result = unsafe { getDesktopFolder(cmd_path.as_mut_ptr()) }; let source_path = format!( "{}\\{}.lnk", String::from_utf16_lossy(&cmd_path[..count_u16(&cmd_path)]).as_str(), @@ -96,7 +96,7 @@ mod natives { #[allow(unsafe_code)] fn create_shortcut_inner( source_file: String, - name: &str, + _name: &str, description: &str, target: &str, args: &str, diff --git a/src/tasks/launch_installed_on_exit.rs b/src/tasks/launch_installed_on_exit.rs index 5b7251f..5b67cf5 100644 --- a/src/tasks/launch_installed_on_exit.rs +++ b/src/tasks/launch_installed_on_exit.rs @@ -13,17 +13,15 @@ use config::PackageDescription; use logging::LoggingErrors; -use native::create_desktop_shortcut; - pub struct LaunchOnExitTask {} impl Task for LaunchOnExitTask { fn execute( &mut self, - mut input: Vec, + _: Vec, context: &mut InstallerFramework, - messenger: &dyn Fn(&TaskMessage), + _: &dyn Fn(&TaskMessage), ) -> Result { let pkg = &context.database.packages.first(); if pkg.is_none() { From 9999c52ea8b397c2a130a48e481ad67165405b91 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Fri, 6 Dec 2019 22:45:42 -0700 Subject: [PATCH 08/10] Add a little padding to select packages description --- ui/src/views/SelectPackages.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/views/SelectPackages.vue b/ui/src/views/SelectPackages.vue index 24ff657..d919454 100644 --- a/ui/src/views/SelectPackages.vue +++ b/ui/src/views/SelectPackages.vue @@ -13,7 +13,7 @@
-

+

{{ Lpackage.description }}

From 6210a2668fdca2b43693164a9051306aba3a7be4 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Sun, 8 Dec 2019 17:26:18 -0700 Subject: [PATCH 09/10] Attempt to refresh shortcuts on create --- src/native/interop.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/native/interop.cpp b/src/native/interop.cpp index 97f5b83..37b49c5 100644 --- a/src/native/interop.cpp +++ b/src/native/interop.cpp @@ -99,6 +99,10 @@ extern "C" int saveShortcut( goto err; } + // Notify that a new shortcut was created using the shell api + SHChangeNotify(SHCNE_CREATE, SHCNF_PATH, shortcutPath, NULL); + SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH, shortcutPath, NULL); + persistFile->Release(); shellLink->Release(); CoUninitialize(); From d9e4e5ecc26ac16101497fbf6b602c06ed5d71d5 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Sun, 8 Dec 2019 17:26:42 -0700 Subject: [PATCH 10/10] Prevent fresh install with no packages selected --- ui/src/views/SelectPackages.vue | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/ui/src/views/SelectPackages.vue b/ui/src/views/SelectPackages.vue index d919454..9c376fc 100644 --- a/ui/src/views/SelectPackages.vue +++ b/ui/src/views/SelectPackages.vue @@ -30,11 +30,6 @@

-
- -
- -
Install Location
@@ -55,12 +50,13 @@ v-on:click="advanced = true">Advanced...

- Install -

-

- Modify + + +

@@ -94,6 +90,17 @@ installDesktopShortcut: true } }, + computed: { + has_package_selected: function() { + for (let i=0; i < this.$root.config.packages.length; ++i) { + let pkg = this.$root.config.packages[i]; + if (pkg.default) { + return true; + } + } + return false; + } + }, methods: { select_file: function () { window.external.invoke(JSON.stringify({