mirror of
https://github.com/yuzu-emu/liftinstall.git
synced 2025-07-23 21:08:24 +00:00
Clean up codebase, fixing minor errors
This commit is contained in:
parent
9d1f4c2576
commit
a447ef25b6
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/mod.rs
|
||||||
|
//!
|
||||||
//! Provides the frontend interface, including HTTP server.
|
//! Provides the frontend interface, including HTTP server.
|
||||||
|
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/mod.rs
|
||||||
|
//!
|
||||||
//! Contains the main web server used within the application.
|
//! Contains the main web server used within the application.
|
||||||
|
|
||||||
pub mod server;
|
pub mod server;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/server.rs
|
||||||
|
//!
|
||||||
//! Contains the over-arching server object + methods to manipulate it.
|
//! Contains the over-arching server object + methods to manipulate it.
|
||||||
|
|
||||||
use frontend::rest::services::WebService;
|
use frontend::rest::services::WebService;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/services/attributes.rs
|
||||||
|
//!
|
||||||
//! The /api/attr call returns an executable script containing session variables.
|
//! The /api/attr call returns an executable script containing session variables.
|
||||||
|
|
||||||
use frontend::rest::services::default_future;
|
use frontend::rest::services::default_future;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/services/config.rs
|
||||||
|
//!
|
||||||
//! The /api/config call returns the current installer framework configuration.
|
//! The /api/config call returns the current installer framework configuration.
|
||||||
//!
|
//!
|
||||||
//! This endpoint should be usable directly from a <script> tag during loading.
|
//! This endpoint should be usable directly from a <script> tag during loading.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/services/default_path.rs
|
||||||
|
//!
|
||||||
//! The /api/default-path returns the default path for the application to install into.
|
//! The /api/default-path returns the default path for the application to install into.
|
||||||
|
|
||||||
use frontend::rest::services::default_future;
|
use frontend::rest::services::default_future;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/services/exit.rs
|
||||||
|
//!
|
||||||
//! The /api/exit closes down the application.
|
//! The /api/exit closes down the application.
|
||||||
|
|
||||||
use frontend::rest::services::default_future;
|
use frontend::rest::services::default_future;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/services/install.rs
|
||||||
|
//!
|
||||||
//! The /api/install call installs a set of packages dictated by a POST request.
|
//! The /api/install call installs a set of packages dictated by a POST request.
|
||||||
|
|
||||||
use frontend::rest::services::stream_progress;
|
use frontend::rest::services::stream_progress;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/services/installation_status.rs
|
||||||
|
//!
|
||||||
//! The /api/installation-status call returns metadata relating to the current status of
|
//! The /api/installation-status call returns metadata relating to the current status of
|
||||||
//! the installation.
|
//! the installation.
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/services/mod.rs
|
||||||
|
//!
|
||||||
//! Provides all services used by the REST server.
|
//! Provides all services used by the REST server.
|
||||||
|
|
||||||
use std::sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
use std::sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/services/packages.rs
|
||||||
|
//!
|
||||||
//! The /api/packages call returns all the currently installed packages.
|
//! The /api/packages call returns all the currently installed packages.
|
||||||
|
|
||||||
use frontend::rest::services::default_future;
|
use frontend::rest::services::default_future;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/services/static_files.rs
|
||||||
|
//!
|
||||||
//! The static files call returns static files embedded within the executable.
|
//! The static files call returns static files embedded within the executable.
|
||||||
//!
|
//!
|
||||||
//! e.g. index.html, main.js, ...
|
//! e.g. index.html, main.js, ...
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/services/uninstall.rs
|
||||||
|
//!
|
||||||
//! The /api/uninstall call uninstalls all packages.
|
//! The /api/uninstall call uninstalls all packages.
|
||||||
|
|
||||||
use frontend::rest::services::default_future;
|
use frontend::rest::services::default_future;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/rest/services/update_updater.rs
|
||||||
|
//!
|
||||||
//! The /api/update-updater call attempts to update the currently running updater.
|
//! The /api/update-updater call attempts to update the currently running updater.
|
||||||
|
|
||||||
use frontend::rest::services::default_future;
|
use frontend::rest::services::default_future;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! frontend/ui/mod.rs
|
||||||
|
//!
|
||||||
//! Provides a web-view UI.
|
//! Provides a web-view UI.
|
||||||
|
|
||||||
use web_view::Content;
|
use web_view::Content;
|
||||||
|
|
|
@ -14,7 +14,7 @@ pub fn assert_ssl(url: &str) -> Result<(), String> {
|
||||||
if url.starts_with("https://") {
|
if url.starts_with("https://") {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(format!("Specified URL was not https"))
|
Err("Specified URL was not https".to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,14 +109,14 @@ pub struct LocalInstallation {
|
||||||
|
|
||||||
macro_rules! declare_messenger_callback {
|
macro_rules! declare_messenger_callback {
|
||||||
($target:expr) => {
|
($target:expr) => {
|
||||||
&|msg: &TaskMessage| match msg {
|
&|msg: &TaskMessage| match *msg {
|
||||||
&TaskMessage::DisplayMessage(msg, progress) => {
|
TaskMessage::DisplayMessage(msg, progress) => {
|
||||||
if let Err(v) = $target.send(InstallMessage::Status(msg.to_string(), progress as _))
|
if let Err(v) = $target.send(InstallMessage::Status(msg.to_string(), progress as _))
|
||||||
{
|
{
|
||||||
error!("Failed to submit queue message: {:?}", v);
|
error!("Failed to submit queue message: {:?}", v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&TaskMessage::PackageInstalled => {
|
TaskMessage::PackageInstalled => {
|
||||||
if let Err(v) = $target.send(InstallMessage::PackageInstalled) {
|
if let Err(v) = $target.send(InstallMessage::PackageInstalled) {
|
||||||
error!("Failed to submit queue message: {:?}", v);
|
error!("Failed to submit queue message: {:?}", v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ fn main() {
|
||||||
info!("Copy attempt failed: {:?}, retrying in 3 seconds.", e);
|
info!("Copy attempt failed: {:?}, retrying in 3 seconds.", e);
|
||||||
thread::sleep(time::Duration::from_millis(3000));
|
thread::sleep(time::Duration::from_millis(3000));
|
||||||
} else {
|
} else {
|
||||||
let _: () = Err(e).log_expect("Copying new binary failed");
|
Err::<(), _>(e).log_expect("Copying new binary failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,10 +49,11 @@ impl ReleaseSource for GithubReleases {
|
||||||
match response.status() {
|
match response.status() {
|
||||||
StatusCode::OK => {}
|
StatusCode::OK => {}
|
||||||
StatusCode::FORBIDDEN => {
|
StatusCode::FORBIDDEN => {
|
||||||
return Err(format!(
|
return Err(
|
||||||
"GitHub is rate limiting you. Try moving to a internet connection \
|
"GitHub is rate limiting you. Try moving to a internet connection \
|
||||||
that isn't shared, and/or disabling VPNs."
|
that isn't shared, and/or disabling VPNs."
|
||||||
));
|
.to_string(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(format!("Bad status code: {:?}.", response.status()));
|
return Err(format!("Bad status code: {:?}.", response.status()));
|
||||||
|
|
|
@ -32,13 +32,13 @@ impl Task for EnsureOnlyInstanceTask {
|
||||||
let exe = name;
|
let exe = name;
|
||||||
|
|
||||||
if exe.ends_with("maintenancetool.exe") || exe.ends_with("maintenancetool") {
|
if exe.ends_with("maintenancetool.exe") || exe.ends_with("maintenancetool") {
|
||||||
return Err(format!("Maintenance tool is already running!"));
|
return Err("Maintenance tool is already running!".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
for package in &context.database.packages {
|
for package in &context.database.packages {
|
||||||
for file in &package.files {
|
for file in &package.files {
|
||||||
if exe.ends_with(file) {
|
if exe.ends_with(file) {
|
||||||
return Err(format!("The installed application is currently running!"));
|
return Err("The installed application is currently running!".to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,6 @@ impl Task for EnsureOnlyInstanceTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn name(&self) -> String {
|
fn name(&self) -> String {
|
||||||
format!("EnsureOnlyInstanceTask")
|
"EnsureOnlyInstanceTask".to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,8 +133,8 @@ impl DependencyTree {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = i.execute(context, &|msg: &TaskMessage| match msg {
|
let result = i.execute(context, &|msg: &TaskMessage| match *msg {
|
||||||
&TaskMessage::DisplayMessage(msg, progress) => {
|
TaskMessage::DisplayMessage(msg, progress) => {
|
||||||
messenger(&TaskMessage::DisplayMessage(
|
messenger(&TaskMessage::DisplayMessage(
|
||||||
msg,
|
msg,
|
||||||
progress / total_tasks + (1.0 / total_tasks) * f64::from(count),
|
progress / total_tasks + (1.0 / total_tasks) * f64::from(count),
|
||||||
|
@ -159,8 +159,8 @@ impl DependencyTree {
|
||||||
|
|
||||||
let task_result = self
|
let task_result = self
|
||||||
.task
|
.task
|
||||||
.execute(inputs, context, &|msg: &TaskMessage| match msg {
|
.execute(inputs, context, &|msg: &TaskMessage| match *msg {
|
||||||
&TaskMessage::DisplayMessage(msg, progress) => {
|
TaskMessage::DisplayMessage(msg, progress) => {
|
||||||
messenger(&TaskMessage::DisplayMessage(
|
messenger(&TaskMessage::DisplayMessage(
|
||||||
msg,
|
msg,
|
||||||
progress / total_tasks + (1.0 / total_tasks) * f64::from(count),
|
progress / total_tasks + (1.0 / total_tasks) * f64::from(count),
|
||||||
|
@ -179,8 +179,8 @@ impl DependencyTree {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = i.execute(context, &|msg: &TaskMessage| match msg {
|
let result = i.execute(context, &|msg: &TaskMessage| match *msg {
|
||||||
&TaskMessage::DisplayMessage(msg, progress) => {
|
TaskMessage::DisplayMessage(msg, progress) => {
|
||||||
messenger(&TaskMessage::DisplayMessage(
|
messenger(&TaskMessage::DisplayMessage(
|
||||||
msg,
|
msg,
|
||||||
progress / total_tasks + (1.0 / total_tasks) * f64::from(count),
|
progress / total_tasks + (1.0 / total_tasks) * f64::from(count),
|
||||||
|
|
Loading…
Reference in a new issue