mirror of
https://github.com/redstrate/Kawari.git
synced 2025-05-07 05:07:44 +00:00
Add setup page to download generated LauncherTweaks configs
This commit is contained in:
parent
def9b4ab48
commit
7d7776f16e
5 changed files with 73 additions and 0 deletions
7
resources/templates/launchertweaks.toml
Normal file
7
resources/templates/launchertweaks.toml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
launcher_url = "http://{{ launcher_url }}/v700/"
|
||||||
|
disable_webview2_install = {{ enable_webview2 }}
|
||||||
|
disable_boot_version_check = true
|
||||||
|
force_http = true
|
||||||
|
game_patch_server = "{{ game_patch_server }}"
|
||||||
|
boot_patch_server = "{{ boot_patch_server }}"
|
||||||
|
extra_game_arguments = " /DEV.LobbyHost04 =127.0.0.1 /DEV.LobbyPort04 ={{ lobby_port }}"
|
20
resources/templates/setup.html
Normal file
20
resources/templates/setup.html
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{% extends "web_base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Kawari - Setup{% endblock %}
|
||||||
|
|
||||||
|
{% block webbody %}
|
||||||
|
<section class="py-5 text-center container">
|
||||||
|
<h2>Official Launcher</h2>
|
||||||
|
|
||||||
|
<p>First, download <a href="https://github.com/redstrate/LauncherTweaks">LauncherTweaks</a> and place the <code>winmm.dll</code> next to <code>ffxivboot64.exe</code>. Download the config below, and place it in the same folder.</p>
|
||||||
|
|
||||||
|
<p><a href="/launcherconfig?type=webview2" download="launchertweaks.toml" class="btn btn-primary">Download Config (WebView2)</a></p>
|
||||||
|
<p><a href="/launcherconfig?type=ie11" download="launchertweaks.toml" class="btn btn-secondary">Download Config (IE)</a></p>
|
||||||
|
|
||||||
|
<p><small>If you're using Linux and have problems with WebView2, download the "IE" config. If you don't know what this means, then download the WebView2 config.</small></p>
|
||||||
|
|
||||||
|
<h2>Astra</h2>
|
||||||
|
|
||||||
|
<p>Instructions coming soon!</p>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
|
@ -15,6 +15,9 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/worldstatus">World Status</a>
|
<a class="nav-link" href="/worldstatus">World Status</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/setup">Setup</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use axum::extract::Query;
|
||||||
use axum::response::Html;
|
use axum::response::Html;
|
||||||
use axum::{Router, routing::get};
|
use axum::{Router, routing::get};
|
||||||
use kawari::config::get_config;
|
use kawari::config::get_config;
|
||||||
|
@ -37,6 +38,18 @@ fn setup_default_environment() -> Environment<'static> {
|
||||||
.expect("Failed to find template!"),
|
.expect("Failed to find template!"),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
env.add_template_owned(
|
||||||
|
"setup.html",
|
||||||
|
std::fs::read_to_string("resources/templates/setup.html")
|
||||||
|
.expect("Failed to find template!"),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
env.add_template_owned(
|
||||||
|
"launchertweaks.toml",
|
||||||
|
std::fs::read_to_string("resources/templates/launchertweaks.toml")
|
||||||
|
.expect("Failed to find template!"),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
env
|
env
|
||||||
}
|
}
|
||||||
|
@ -70,6 +83,28 @@ async fn world_status() -> Html<String> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn setup() -> Html<String> {
|
||||||
|
let environment = setup_default_environment();
|
||||||
|
let template = environment.get_template("setup.html").unwrap();
|
||||||
|
Html(template.render({}).unwrap())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
struct Params {
|
||||||
|
r#type: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn launcher_config(Query(params): Query<Params>) -> String {
|
||||||
|
let config = get_config();
|
||||||
|
|
||||||
|
let environment = setup_default_environment();
|
||||||
|
let template = environment.get_template("launchertweaks.toml").unwrap();
|
||||||
|
template
|
||||||
|
.render(context! { launcher_url => config.launcher.server_name, enable_webview2 => if params.r#type == "webview2" { false } else { true }, game_patch_server => config.patch.game_server_name, boot_patch_server => config.patch.boot_server_name, lobby_port => config.lobby.port })
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
@ -77,6 +112,8 @@ async fn main() {
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.route("/", get(root))
|
.route("/", get(root))
|
||||||
.route("/worldstatus", get(world_status))
|
.route("/worldstatus", get(world_status))
|
||||||
|
.route("/setup", get(setup))
|
||||||
|
.route("/launcherconfig", get(launcher_config))
|
||||||
.nest_service("/static", ServeDir::new("resources/static"));
|
.nest_service("/static", ServeDir::new("resources/static"));
|
||||||
|
|
||||||
let config = get_config();
|
let config = get_config();
|
||||||
|
|
|
@ -132,6 +132,8 @@ pub struct PatchConfig {
|
||||||
/// ...
|
/// ...
|
||||||
/// ```
|
/// ```
|
||||||
pub patches_location: String,
|
pub patches_location: String,
|
||||||
|
pub game_server_name: String,
|
||||||
|
pub boot_server_name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PatchConfig {
|
impl Default for PatchConfig {
|
||||||
|
@ -141,6 +143,8 @@ impl Default for PatchConfig {
|
||||||
listen_address: "127.0.0.1".to_string(),
|
listen_address: "127.0.0.1".to_string(),
|
||||||
patch_dl_url: "patch-dl.ffxiv.localhost".to_string(),
|
patch_dl_url: "patch-dl.ffxiv.localhost".to_string(),
|
||||||
patches_location: String::new(),
|
patches_location: String::new(),
|
||||||
|
boot_server_name: "patch-bootver.ffxiv.localhost".to_string(),
|
||||||
|
game_server_name: "patch-gamever.ffxiv.localhost".to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,6 +288,7 @@ impl WorldConfig {
|
||||||
pub struct LauncherConfig {
|
pub struct LauncherConfig {
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
pub listen_address: String,
|
pub listen_address: String,
|
||||||
|
pub server_name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for LauncherConfig {
|
impl Default for LauncherConfig {
|
||||||
|
@ -291,6 +296,7 @@ impl Default for LauncherConfig {
|
||||||
Self {
|
Self {
|
||||||
port: 5802,
|
port: 5802,
|
||||||
listen_address: "127.0.0.1".to_string(),
|
listen_address: "127.0.0.1".to_string(),
|
||||||
|
server_name: "launcher.ffxiv.localhost".to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue