mirror of
https://github.com/yuzu-emu/liftinstall.git
synced 2025-11-04 22:24:57 +00:00
* platform: fix build on Linux and update web-view * deps: replace xz-decom with xz2 and update deps * platform: fix regression... ... that prevents the build on Windows * linux: implement platform-dependent functions * travis: add macos and windows CI * travis: use official Rust Docker image * Update Cargo.lock for new version * Break apart REST into separate services This cleans up locking, ensures consistent futures for all endpoints and enhances code re-use. * Clean up codebase, fixing minor errors * Update packages, use async client for downloading config While this has a hell of a lot more boilerplate, this is quite a bit cleaner. * Add explicit 'dyn's as per Rust nightly requirements * Migrate self updating functions to own module * Migrate assets to server module * Use patched web-view to fix dialogs, remove nfd * Implement basic dark mode * Revert window.close usage * ui: split files and use Webpack * frontend: ui: include prebuilt assets... ... and update rust side stuff * build: integrate webpack building into build.rs * Polish Vue UI split * Add instructions for node + yarn * native: fix uninstall self-destruction behavior...... by not showing the command prompt window and fork-spawning the cmd * native: deal with Unicode issues in native APIs * native: further improve Unicode support on Windows * travis: add cache and fix issues * ui: use Buefy components to... ... beautify the UI * ui: makes error message selectable * Make launcher mode behaviour more robust * Fix error display on launcher pages * Correctly handle exit on error * Bump installer version
43 lines
1.3 KiB
Rust
43 lines
1.3 KiB
Rust
//! frontend/rest/services/static_files.rs
|
|
//!
|
|
//! The static files call returns static files embedded within the executable.
|
|
//!
|
|
//! e.g. index.html, main.js, ...
|
|
|
|
use frontend::rest::assets;
|
|
|
|
use frontend::rest::services::default_future;
|
|
use frontend::rest::services::Future;
|
|
use frontend::rest::services::Request;
|
|
use frontend::rest::services::Response;
|
|
use frontend::rest::services::WebService;
|
|
|
|
use hyper::header::{ContentLength, ContentType};
|
|
use hyper::StatusCode;
|
|
|
|
use logging::LoggingErrors;
|
|
|
|
pub fn handle(_service: &WebService, req: Request) -> Future {
|
|
// At this point, we have a web browser client. Search for a index page
|
|
// if needed
|
|
let mut path: String = req.path().to_owned();
|
|
if path.ends_with('/') {
|
|
path += "index.html";
|
|
}
|
|
|
|
default_future(match assets::file_from_string(&path) {
|
|
Some((content_type, file)) => {
|
|
let content_type = ContentType(
|
|
content_type
|
|
.parse()
|
|
.log_expect("Failed to parse content type into correct representation"),
|
|
);
|
|
Response::new()
|
|
.with_header(ContentLength(file.len() as u64))
|
|
.with_header(content_type)
|
|
.with_body(file)
|
|
}
|
|
None => Response::new().with_status(StatusCode::NotFound),
|
|
})
|
|
}
|