2018-01-27 03:27:41 +00:00
|
|
|
#![windows_subsystem = "windows"]
|
2018-01-26 12:29:28 +00:00
|
|
|
|
|
|
|
extern crate web_view;
|
2018-01-27 11:56:36 +00:00
|
|
|
|
2018-01-26 12:29:28 +00:00
|
|
|
extern crate includedir;
|
|
|
|
extern crate phf;
|
|
|
|
|
2018-01-27 03:27:41 +00:00
|
|
|
extern crate serde;
|
|
|
|
#[macro_use]
|
|
|
|
extern crate serde_derive;
|
|
|
|
extern crate serde_json;
|
|
|
|
extern crate toml;
|
|
|
|
|
2018-01-29 07:21:37 +00:00
|
|
|
extern crate semver;
|
|
|
|
|
2018-01-26 12:29:28 +00:00
|
|
|
mod assets;
|
2018-01-27 03:27:41 +00:00
|
|
|
mod rest;
|
|
|
|
mod config;
|
|
|
|
mod installer;
|
2018-01-29 07:21:37 +00:00
|
|
|
mod sources;
|
2018-01-26 12:29:28 +00:00
|
|
|
|
|
|
|
use web_view::*;
|
|
|
|
|
2018-01-27 03:27:41 +00:00
|
|
|
use config::Config;
|
|
|
|
|
|
|
|
use installer::InstallerFramework;
|
2018-01-26 12:29:28 +00:00
|
|
|
|
2018-01-27 03:27:41 +00:00
|
|
|
use rest::WebServer;
|
|
|
|
|
|
|
|
// TODO: Fetch this over a HTTP request?
|
2018-01-27 11:58:56 +00:00
|
|
|
static RAW_CONFIG: &'static str = include_str!("../config.toml");
|
2018-01-26 12:29:28 +00:00
|
|
|
|
|
|
|
fn main() {
|
2018-01-27 03:27:41 +00:00
|
|
|
let config = Config::from_toml_str(RAW_CONFIG).unwrap();
|
|
|
|
|
2018-01-27 04:33:15 +00:00
|
|
|
let app_name = config.general.name.clone();
|
|
|
|
|
2018-01-27 03:27:41 +00:00
|
|
|
let framework = InstallerFramework::new(config);
|
|
|
|
|
|
|
|
let server = WebServer::new(framework).unwrap();
|
|
|
|
|
2018-01-26 12:29:28 +00:00
|
|
|
// Startup HTTP server for handling the web view
|
2018-01-27 03:27:41 +00:00
|
|
|
let http_address = format!("http://{}", server.get_addr());
|
|
|
|
println!("{}", http_address);
|
|
|
|
|
2018-01-26 12:29:28 +00:00
|
|
|
// Init the web view
|
|
|
|
let size = (1024, 550);
|
|
|
|
let resizable = false;
|
|
|
|
let debug = true;
|
|
|
|
|
|
|
|
run(
|
2018-01-27 04:33:15 +00:00
|
|
|
&format!("{} Installer", app_name),
|
2018-01-26 12:29:28 +00:00
|
|
|
&http_address,
|
|
|
|
Some(size),
|
|
|
|
resizable,
|
|
|
|
debug,
|
2018-01-29 07:21:37 +00:00
|
|
|
|_| {},
|
|
|
|
|_, _, _| {},
|
|
|
|
(),
|
2018-01-26 12:29:28 +00:00
|
|
|
);
|
|
|
|
}
|