mirror of
https://github.com/yuzu-emu/liftinstall.git
synced 2024-11-22 03:25:39 +01:00
Use nicer macro-based system for pulling assets
This commit is contained in:
parent
e7175ae880
commit
79fa12043d
75
Cargo.lock
generated
75
Cargo.lock
generated
@ -107,15 +107,6 @@ name = "dtoa"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "0.2.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.1"
|
||||
@ -228,25 +219,6 @@ dependencies = [
|
||||
"unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "includedir"
|
||||
version = "0.2.2"
|
||||
source = "git+https://github.com/j-selby/includedir.git?rev=4e25ad8#4e25ad85d43d6fd6a22194edc48190d6529fbfcf"
|
||||
dependencies = [
|
||||
"flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "includedir_codegen"
|
||||
version = "0.2.2"
|
||||
source = "git+https://github.com/j-selby/includedir.git?rev=e6db212#e6db21299b76a8e9539378eec36421cbc3af980b"
|
||||
dependencies = [
|
||||
"flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iovec"
|
||||
version = "0.1.2"
|
||||
@ -312,14 +284,13 @@ dependencies = [
|
||||
"futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.11.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"includedir 0.2.2 (git+https://github.com/j-selby/includedir.git?rev=4e25ad8)",
|
||||
"includedir_codegen 0.2.2 (git+https://github.com/j-selby/includedir.git?rev=e6db212)",
|
||||
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime_guess 1.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nfd 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"number_prefix 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"reqwest 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rust-embed 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -398,15 +369,6 @@ dependencies = [
|
||||
"unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz-sys"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.1.2"
|
||||
@ -661,11 +623,30 @@ dependencies = [
|
||||
"uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-embed"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "safemem"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
version = "0.1.10"
|
||||
@ -981,11 +962,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "0.1.8"
|
||||
version = "2.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1065,7 +1046,6 @@ dependencies = [
|
||||
"checksum core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "065a5d7ffdcbc8fa145d6f0746f3555025b9097a9e9cda59f7467abae670c78d"
|
||||
"checksum crc 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd5d02c0aac6bd68393ed69e00bbc2457f3e89075c6349db7189618dc4ddc1d7"
|
||||
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
|
||||
"checksum flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "e6234dd4468ae5d1e2dbb06fe2b058696fdc50a339c68a393aefbf00bc81e423"
|
||||
"checksum flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fac2277e84e5e858483756647a9d0aa8d9a2b7cba517fd84325a0aaa69a0909"
|
||||
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
|
||||
"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||
@ -1079,8 +1059,6 @@ dependencies = [
|
||||
"checksum hyper 0.11.15 (registry+https://github.com/rust-lang/crates.io-index)" = "4d6105c5eeb03068b10ff34475a0d166964f98e7b9777cc34b342a225af9b87c"
|
||||
"checksum hyper-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c81fa95203e2a6087242c38691a0210f23e9f3f8f944350bd676522132e2985"
|
||||
"checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d"
|
||||
"checksum includedir 0.2.2 (git+https://github.com/j-selby/includedir.git?rev=4e25ad8)" = "<none>"
|
||||
"checksum includedir_codegen 0.2.2 (git+https://github.com/j-selby/includedir.git?rev=e6db212)" = "<none>"
|
||||
"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
|
||||
"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
@ -1098,7 +1076,6 @@ dependencies = [
|
||||
"checksum mime 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e00e17be181010a91dbfefb01660b17311059dc8c7f48b9017677721e732bd"
|
||||
"checksum mime_guess 1.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dc7e82a15629bb4ecd9e72365bf33d1382be91e030f820edb8e2a21c02430da8"
|
||||
"checksum mime_guess 2.0.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)" = "013572795763289e14710c7b279461295f2673b2b338200c235082cd7ca9e495"
|
||||
"checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4"
|
||||
"checksum miniz_oxide 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aaa2d3ad070f428fffbd7d3ca2ea20bb0d8cffe9024405c44e1840bc1418b398"
|
||||
"checksum miniz_oxide_c_api 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "92d98fdbd6145645828069b37ea92ca3de225e000d80702da25c20d3584b38a5"
|
||||
"checksum mio 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "75f72a93f046f1517e3cfddc0a096eb756a2ba727d36edc8227dee769a50a9b0"
|
||||
@ -1126,7 +1103,9 @@ dependencies = [
|
||||
"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e"
|
||||
"checksum relay 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f301bafeb60867c85170031bdb2fcf24c8041f33aee09e7b116a58d4e9f781c5"
|
||||
"checksum reqwest 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "449c45f593ce9af9417c91e22f274fb8cea013bcf3d37ec1b5fb534b623bc708"
|
||||
"checksum rust-embed 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "399b86082734a2ce9f80a58377431da7f4f57712d9947cf9036d93c8098d2b79"
|
||||
"checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f"
|
||||
"checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637"
|
||||
"checksum schannel 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "acece75e0f987c48863a6c792ec8b7d6c4177d4a027f8ccc72f849794f437016"
|
||||
"checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d"
|
||||
"checksum security-framework 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "dfa44ee9c54ce5eecc9de7d5acbad112ee58755239381f687e564004ba4a2332"
|
||||
@ -1166,7 +1145,7 @@ dependencies = [
|
||||
"checksum vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0a7d8bed3178a8fb112199d466eeca9ed09a14ba8ad67718179b4fd5487d0b"
|
||||
"checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
"checksum walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c66c0b9792f0a765345452775f3adbd28dde9d33f30d13e5dcc5ae17cf6f3780"
|
||||
"checksum walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "63636bd0eb3d00ccb8b9036381b526efac53caf112b7783b730ab3f8e44da369"
|
||||
"checksum web-view 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "92f76092d2f039a4989ea946e195366dae806bdeb9be01779af2b96c3cffb90d"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
|
||||
|
@ -19,8 +19,8 @@ url = "*"
|
||||
reqwest = "0.8.4"
|
||||
number_prefix = "0.2.7"
|
||||
|
||||
includedir = {git = "https://github.com/j-selby/includedir.git", rev="4e25ad8"}
|
||||
phf = "0.7.21"
|
||||
rust-embed = "1.1.1"
|
||||
log = "*" # Used by rust-embed's macros
|
||||
|
||||
serde = "1.0.27"
|
||||
serde_derive = "1.0.27"
|
||||
@ -34,6 +34,3 @@ semver = {version = "0.9.0", features = ["serde"]}
|
||||
regex = "0.2"
|
||||
|
||||
zip = "0.2.8"
|
||||
|
||||
[build-dependencies]
|
||||
includedir_codegen = {git = "https://github.com/j-selby/includedir.git", rev="e6db212"}
|
||||
|
10
build.rs
10
build.rs
@ -1,10 +0,0 @@
|
||||
extern crate includedir_codegen;
|
||||
|
||||
use includedir_codegen::Compression;
|
||||
|
||||
fn main() {
|
||||
includedir_codegen::start("FILES")
|
||||
.dir("static", Compression::Gzip)
|
||||
.build("data.rs")
|
||||
.unwrap();
|
||||
}
|
@ -1,17 +1,16 @@
|
||||
/// Serves static files from a asset directory.
|
||||
extern crate mime_guess;
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
use assets::mime_guess::{get_mime_type, octet_stream};
|
||||
|
||||
// Include built-in files
|
||||
include!(concat!(env!("OUT_DIR"), "/data.rs"));
|
||||
#[derive(RustEmbed)]
|
||||
#[folder("static/")]
|
||||
struct Assets;
|
||||
|
||||
/// Returns a static file based upon a given String as a Path.
|
||||
///
|
||||
/// file_path: String path, beginning with a /
|
||||
pub fn file_from_string(file_path: &str) -> Option<(String, Cow<'static, [u8]>)> {
|
||||
pub fn file_from_string(file_path: &str) -> Option<(String, Vec<u8>)> {
|
||||
let guessed_mime = match file_path.rfind(".") {
|
||||
Some(ext_ptr) => {
|
||||
let ext = &file_path[ext_ptr + 1..];
|
||||
@ -23,10 +22,5 @@ pub fn file_from_string(file_path: &str) -> Option<(String, Cow<'static, [u8]>)>
|
||||
|
||||
let string_mime = guessed_mime.to_string();
|
||||
|
||||
// We already get the / from the HTTP request.
|
||||
match FILES.get(&format!("static{}", file_path)) {
|
||||
Ok(val) => Some((string_mime, val)),
|
||||
// Only error is a not found one
|
||||
Err(_) => None,
|
||||
}
|
||||
Some((string_mime, Assets::get(file_path)?))
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ pub struct InstallerFramework {
|
||||
preexisting_install: bool
|
||||
}
|
||||
|
||||
// Contains basic properties on the status of the session. Subset of InstallationFramework.
|
||||
/// Contains basic properties on the status of the session. Subset of InstallationFramework.
|
||||
#[derive(Serialize)]
|
||||
pub struct InstallationStatus {
|
||||
database: Vec<LocalInstallation>,
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![windows_subsystem = "windows"]
|
||||
#![feature(attr_literals)]
|
||||
|
||||
extern crate web_view;
|
||||
|
||||
@ -10,8 +11,10 @@ extern crate tokio_core;
|
||||
extern crate number_prefix;
|
||||
extern crate reqwest;
|
||||
|
||||
extern crate includedir;
|
||||
extern crate phf;
|
||||
#[macro_use]
|
||||
extern crate rust_embed;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
@ -38,7 +41,6 @@ use config::Config;
|
||||
use installer::InstallerFramework;
|
||||
|
||||
use rest::WebServer;
|
||||
use std::path::Path;
|
||||
|
||||
// TODO: Fetch this over a HTTP request?
|
||||
static RAW_CONFIG: &'static str = include_str!("../config.toml");
|
||||
|
@ -32,7 +32,6 @@ use assets;
|
||||
|
||||
use installer::InstallerFramework;
|
||||
use installer::InstallMessage;
|
||||
use installer::LocalInstallation;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct FileSelection {
|
||||
|
@ -45,9 +45,23 @@
|
||||
<div class="column" v-else-if="modify_install">
|
||||
<h4 class="subtitle">Choose an option:</h4>
|
||||
|
||||
<a class="button is-primary is-pulled-right" v-on:click="exit">Update</a>
|
||||
<a class="button is-primary is-pulled-right" v-on:click="exit">Modify</a>
|
||||
<a class="button is-primary is-pulled-right" v-on:click="exit">Uninstall</a>
|
||||
<div class="field is-grouped">
|
||||
<p class="control">
|
||||
<a class="button is-link" v-on:click="exit">
|
||||
Update
|
||||
</a>
|
||||
</p>
|
||||
<p class="control">
|
||||
<a class="button" v-on:click="exit">
|
||||
Modify
|
||||
</a>
|
||||
</p>
|
||||
<p class="control">
|
||||
<a class="button is-danger" v-on:click="confirm_uninstall">
|
||||
Uninstall
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="column" v-else-if="select_packages">
|
||||
@ -110,6 +124,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="modal is-active" v-if="confirm_uninstall">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Are you sure you want to uninstall {{ config.general.name }}?</p>
|
||||
</header>
|
||||
<footer class="modal-card-foot">
|
||||
<button class="button is-danger">Yes</button>
|
||||
<button class="button" v-on:click="cancel_uninstall">No</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/api/config"></script>
|
||||
@ -125,6 +152,7 @@
|
||||
select_packages : true,
|
||||
is_installing : false,
|
||||
is_finished : false,
|
||||
confirm_uninstall : false,
|
||||
progress : 0,
|
||||
progress_message : "",
|
||||
has_error : false,
|
||||
@ -183,6 +211,12 @@
|
||||
app.is_installing = false;
|
||||
app.is_finished = false;
|
||||
},
|
||||
"confirm_uninstall": function() {
|
||||
app.confirm_uninstall = true;
|
||||
},
|
||||
"cancel_uninstall": function() {
|
||||
app.confirm_uninstall = false;
|
||||
},
|
||||
"exit": function() {
|
||||
ajax("/api/exit", function() {});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user