Launcher 0.1.2: Discord link, auto-install on by default, menu style setting, smoke tests

- links.json on main gives the Discord and sponsor links (built-in fallback offline,
  empty hides the button); 'links' command and MCP tool.
- Install new versions automatically is on unless explicitly turned off (new settings
  key, so 0.1.1's written default does not count as a choice).
- Settings: Horizon / Classic menu style, the horizon.txt menuStyle line the game reads;
  'menu-style' command and MCP tool.
- launcher workflow: install latest into a temp home, check imports (Windows, Linux client)
  and that the client starts, on all three platforms; also runs on launcher-* branches.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-13 17:27:31 +02:00
parent 87733155b3
commit 929fa4ec5a
11 changed files with 323 additions and 28 deletions
+32 -1
View File
@@ -6,7 +6,7 @@ name: launcher
on:
workflow_dispatch:
push:
branches: [launcher]
branches: [launcher, 'launcher-*']
tags: ['launcher-v*']
permissions:
@@ -56,6 +56,37 @@ jobs:
- name: Only system libraries
if: runner.os == 'Windows'
run: python ../tools/check_imports.py target/release/${{ matrix.binary }}
- name: Smoke test
env:
HORIZON_LAUNCHER_NO_SELF_UPDATE: '1'
run: |
set -euo pipefail
export HORIZON_LAUNCHER_HOME="${RUNNER_TEMP//\\//}/horizon-launcher-smoke"
export HORIZON_HOME="$HORIZON_LAUNCHER_HOME/game"
launcher="$PWD/target/release/${{ matrix.binary }}"
# GitHub's API rate-limits shared runner addresses now and then: try a few times.
retry() { for i in 1 2 3 4; do "$@" && return 0; sleep $((i * 15)); done; return 1; }
"$launcher" --version
retry "$launcher" versions
retry "$launcher" install latest
"$launcher" versions --installed
"$launcher" links --json
"$launcher" menu-style classic
grep -qx 'menuStyle:classic' "$HORIZON_HOME/horizon.txt"
"$launcher" menu-style horizon
clients=("$HORIZON_LAUNCHER_HOME"/versions/v*/horizon-client*)
client="${clients[0]}"
echo "installed client: $client"
if [[ "$RUNNER_OS" == "Windows" ]]; then
python ../tools/check_imports.py "$client"
python ../tools/check_imports.py "$launcher"
elif [[ "$RUNNER_OS" == "Linux" ]]; then
python3 ../tools/check_imports.py "$client"
fi
# The client starts: --help prints before any window or GPU is needed.
"$client" --help > "$RUNNER_TEMP/help.txt"
head -3 "$RUNNER_TEMP/help.txt"
grep -q -- '--resources' "$RUNNER_TEMP/help.txt"
- name: Package
run: |
mkdir -p dist
+1 -1
View File
@@ -2565,7 +2565,7 @@ dependencies = [
[[package]]
name = "horizon-launcher"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"clap",
"dirs 5.0.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "horizon-launcher"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
license = "MIT"
description = "Downloads, prepares and starts Horizon builds"
+20 -8
View File
@@ -17,16 +17,23 @@ The opening, then Play ([clip](docs/opening.webm)):
- **Play**: prepares resources as `PLAY.txt` describes (your launcher's 26.3 install, the
26.3 server jar from that version's own json, Python 3.10+ and Java 25), then starts the
client, or a server (`--dedicated --nogui`) in a folder you choose, with a live console.
- **Patch notes**: each release's notes, newest first, with a link to GitHub Sponsors.
- **Patch notes**: each release's notes, newest first, with a link to GitHub Sponsors. A quiet "Join Discord" link sits in the sidebar footer.
- **What's next**: the README's roadmap, from main.
Data lives in the platform's data directory (`~/.local/share/horizon-launcher` on Linux,
`~/Library/Application Support/horizon-launcher` on macOS, `%APPDATA%\horizon-launcher` on
Windows): `versions/<tag>/`, `server-jars/`, `server/` and `settings.json`.
- **Settings**: install new Horizon versions automatically (off by default; the selected
version only moves to the new one if you were on the newest), the opening animation, and the
launcher's own version and update state.
- **Settings**: install new Horizon versions automatically (on unless you turn it off; the
selected version only moves to the new one if you were on the newest), the opening animation,
the game's menu style, and the launcher's own version and update state.
- **Menu style**: Horizon's own menus or Classic (vanilla's screens). Classic has no way back
inside the game, so the launcher is where you return to Horizon's. It is the `menuStyle:` line
of `horizon.txt` in the game's home folder (`HORIZON_HOME`, else `horizon` in the data
directory), which the game reads when it starts.
- **Links**: the Discord invite and the Sponsors page come from `launcher/links.json` on main
(`{"discord": "...", "sponsor": "..."}`), so they change without a launcher release. Offline,
the launcher uses the same values built in; an empty address hides its button.
## Updates
@@ -56,10 +63,12 @@ The same binary is a command-line tool; without a subcommand it opens the window
horizon-launcher server [--dir <dir>] [--version <tag>] [--accept-eula]
horizon-launcher notes [<tag>] patch notes as plain text
horizon-launcher next the roadmap
horizon-launcher links the Discord and sponsor links
horizon-launcher menu-style [horizon|classic] show or set the game's menu style
horizon-launcher update [--check] Horizon and the launcher
`--json` prints JSON where there is something to report (`versions`, `install`, `notes`,
`next`, `update --check`). Errors go to stderr with exit code 1. `server` runs in the terminal,
`next`, `links`, `menu-style`, `update --check`). Errors go to stderr with exit code 1. `server` runs in the terminal,
so lines you type reach its console. `HORIZON_LAUNCHER_HOME` replaces the data folder (for
scripts and tests).
@@ -71,7 +80,7 @@ scripts and tests).
(with the full path to the binary if it is not on your `PATH`). Its tools: `list_versions`,
`install_version`, `remove_version`, `prepare_resources`, `launch_client`, `start_server`,
`server_command`, `server_log`, `stop_server`, `patch_notes`, `roadmap` and `check_updates`.
`server_command`, `server_log`, `stop_server`, `patch_notes`, `roadmap`, `links`, `menu_style` and `check_updates`.
A server started through MCP stops (cleanly, with `stop`) when the session ends. Starting one
needs `accept_eula`, which an agent should only pass with the player's consent.
@@ -83,9 +92,12 @@ The window, the command line and the MCP server all call the same core, `src/bac
On NixOS, `nix-shell` in this folder provides the libraries GPUI links to (Wayland, X11,
xkbcommon, Vulkan, fontconfig). macOS needs Xcode's command line tools. The `launcher`
workflow builds all three platforms on every push to the `launcher` branch.
workflow builds all three platforms on every push to the `launcher` branch (or a
`launcher-*` one), then installs the latest Horizon into a temporary folder and checks that the
client starts (`--help`) and that the binaries import only system libraries (Windows).
cargo test --lib # tag separation, version order, update selection, notes as text
cargo test --lib # tag separation, version order, update selection, notes as text,
# the auto-install default, the links fallback, the menu style file
Geist, Geist Mono and Instrument Serif (SIL Open Font License, `crates/horizon-theme/fonts/OFL-*.txt`, shared with the game's menus) are
bundled so the type is the same on every platform.
Binary file not shown.

After

Width:  |  Height:  |  Size: 498 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

+1
View File
@@ -0,0 +1 @@
{"discord": "https://discord.gg/HcTeMZxe5E", "sponsor": "https://github.com/sponsors/ludovic111"}
+151 -6
View File
@@ -9,7 +9,6 @@ use std::sync::mpsc::Sender;
use std::sync::{Arc, Mutex};
pub const REPO: &str = "ludovic111/horizon";
pub const SPONSOR_URL: &str = "https://github.com/sponsors/ludovic111";
pub const README_URL: &str = "https://github.com/ludovic111/horizon/blob/main/launcher/README.md";
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
/// Launcher releases are tagged `launcher-vX.Y.Z`; Horizon's own are `vYYYY.MM.DD`.
@@ -163,6 +162,43 @@ pub fn roadmap() -> Result<String, String> {
Err("The README has no roadmap section yet.".into())
}
/// The community and sponsor links, from `launcher/links.json` on main, so they can change
/// without a launcher release. An empty address hides its button.
#[derive(Clone, Debug, PartialEq, serde::Serialize)]
pub struct Links {
pub discord: String,
pub sponsor: String,
}
impl Default for Links {
/// What the launcher uses until (or unless) it can read links.json.
fn default() -> Self {
Self { discord: "https://discord.gg/HcTeMZxe5E".into(), sponsor: "https://github.com/sponsors/ludovic111".into() }
}
}
impl Links {
/// Reads links.json. A key that is missing keeps its default, an empty one hides the link,
/// and text that is not a JSON object gives the defaults.
pub fn parse(text: &str) -> Self {
let mut links = Self::default();
if let Ok(serde_json::Value::Object(map)) = serde_json::from_str(text) {
for (key, slot) in [("discord", &mut links.discord), ("sponsor", &mut links.sponsor)] {
if let Some(url) = map.get(key).and_then(|v| v.as_str()) {
*slot = url.trim().to_string();
}
}
}
links
}
}
/// The links from main, or the built-in ones when offline.
pub fn links() -> Links {
let url = format!("https://raw.githubusercontent.com/{REPO}/main/launcher/links.json");
get(&url).ok().and_then(|r| r.into_string().ok()).map_or_else(Links::default, |text| Links::parse(&text))
}
/// The launcher's data folder; `HORIZON_LAUNCHER_HOME` overrides it (for tests and scripts).
pub fn data_dir() -> PathBuf {
if let Some(home) = std::env::var_os("HORIZON_LAUNCHER_HOME").filter(|h| !h.is_empty()) {
@@ -346,6 +382,61 @@ pub fn game_home() -> PathBuf {
dirs::data_dir().unwrap_or_else(std::env::temp_dir).join("horizon")
}
/// Which drawing the game's menus use. Classic is vanilla's own screens, which have no way to
/// switch back, so the launcher is where the player returns to Horizon's.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MenuStyle {
Horizon,
Classic,
}
impl MenuStyle {
pub fn name(self) -> &'static str {
match self {
MenuStyle::Horizon => "horizon",
MenuStyle::Classic => "classic",
}
}
pub fn parse(name: &str) -> Option<Self> {
match name {
"horizon" => Some(MenuStyle::Horizon),
"classic" => Some(MenuStyle::Classic),
_ => None,
}
}
/// The style `horizon.txt` holds: Horizon unless it has the line `menuStyle:classic`, as the
/// game reads it (crates/horizon-client/src/ui_theme.rs).
fn from_file(text: &str) -> Self {
if text.lines().any(|l| l.trim() == "menuStyle:classic") {
MenuStyle::Classic
} else {
MenuStyle::Horizon
}
}
/// `text` with its `menuStyle:` line set to this style and every other line kept.
fn into_file(self, text: &str) -> String {
let mut out: Vec<String> = text.lines().filter(|l| !l.trim().starts_with("menuStyle:")).map(String::from).collect();
out.insert(0, format!("menuStyle:{}", self.name()));
out.join("\n") + "\n"
}
}
/// The menu style saved in the game home's `horizon.txt` (Horizon when there is none).
pub fn menu_style() -> MenuStyle {
MenuStyle::from_file(&fs::read_to_string(game_home().join("horizon.txt")).unwrap_or_default())
}
pub fn set_menu_style(style: MenuStyle) -> Result<(), String> {
let home = game_home();
fs::create_dir_all(&home).map_err(|e| e.to_string())?;
let file = home.join("horizon.txt");
let text = style.into_file(&fs::read_to_string(&file).unwrap_or_default());
fs::write(file, text).map_err(|e| e.to_string())
}
pub fn client_command(tag: &str) -> Command {
let home = game_home();
let _ = fs::create_dir_all(&home);
@@ -707,6 +798,7 @@ pub enum Job {
pub enum Msg {
Releases(Result<Vec<Release>, String>),
Roadmap(Result<String, String>),
Links(Links),
Progress(String, f32),
Installed(String, Result<(), String>),
Line(Job, String),
@@ -780,8 +872,10 @@ pub struct Settings {
pub selected: Option<String>,
pub minecraft_dir: Option<PathBuf>,
pub server_dir: Option<PathBuf>,
/// Unset means on: only a player who turned it off has `false` here. 0.1.1 wrote its
/// `auto_install` (off by default) for everyone, so this is a new key and that one is ignored.
#[serde(default)]
pub auto_install: bool,
pub install_new_versions: Option<bool>,
/// Off by default, so the opening animation shows unless the player turns it off.
#[serde(default)]
pub skip_opening: bool,
@@ -789,10 +883,14 @@ pub struct Settings {
impl Settings {
pub fn load() -> Self {
fs::read_to_string(data_dir().join("settings.json"))
.ok()
.and_then(|s| serde_json::from_str(&s).ok())
.unwrap_or_default()
Self::parse(&fs::read_to_string(data_dir().join("settings.json")).unwrap_or_default())
}
pub fn parse(text: &str) -> Self {
serde_json::from_str(text).unwrap_or_default()
}
/// Whether new Horizon versions are installed automatically.
pub fn auto_install(&self) -> bool {
self.install_new_versions.unwrap_or(true)
}
pub fn save(&self) {
let _ = fs::create_dir_all(data_dir());
@@ -859,6 +957,53 @@ mod tests {
assert!(select_after_update(None, &installed));
}
#[test]
fn new_versions_install_automatically_unless_turned_off() {
// No settings file, an old one that never mentioned it, and 0.1.1's default `false`.
assert!(Settings::parse("").auto_install());
assert!(Settings::parse("{}").auto_install());
assert!(Settings::parse(r#"{"selected": "v2026.10.13", "auto_install": false}"#).auto_install());
assert!(Settings::parse(r#"{"install_new_versions": true}"#).auto_install());
assert!(!Settings::parse(r#"{"install_new_versions": false}"#).auto_install());
// Saving after the player turned it off keeps it off.
let off = Settings { install_new_versions: Some(false), ..Settings::default() };
assert!(!Settings::parse(&serde_json::to_string(&off).unwrap()).auto_install());
// The selection rule is unchanged: the new version is selected only from the newest.
let installed = ["v2026.10.12".to_string(), "v2026.10.1".to_string()];
assert!(select_after_update(Some("v2026.10.12"), &installed));
assert!(!select_after_update(Some("v2026.10.1"), &installed));
}
#[test]
fn links_fall_back_to_the_built_in_ones() {
let defaults = Links::default();
assert_eq!(defaults.discord, "https://discord.gg/HcTeMZxe5E");
assert_eq!(defaults.sponsor, "https://github.com/sponsors/ludovic111");
// The file on main says the same thing as the defaults.
let file = Links::parse(r#"{"discord": "https://discord.gg/HcTeMZxe5E", "sponsor": "https://github.com/sponsors/ludovic111"}"#);
assert_eq!(file, defaults);
// Unreadable or missing, offline included: the defaults.
assert_eq!(Links::parse(""), defaults);
assert_eq!(Links::parse("<html>404</html>"), defaults);
assert_eq!(Links::parse("[1]"), defaults);
assert_eq!(Links::parse(r#"{"discord": 5}"#), defaults);
// A key that is missing keeps its default; a new address replaces it; empty hides it.
assert_eq!(Links::parse(r#"{"discord": "https://x.y/z"}"#), Links { discord: "https://x.y/z".into(), ..defaults.clone() });
assert_eq!(Links::parse(r#"{"discord": "", "sponsor": " "}"#), Links { discord: String::new(), sponsor: String::new() });
}
#[test]
fn menu_style_file_matches_the_games() {
assert_eq!(MenuStyle::from_file(""), MenuStyle::Horizon);
assert_eq!(MenuStyle::from_file("menuStyle:horizon\n"), MenuStyle::Horizon);
assert_eq!(MenuStyle::from_file("menuStyle:classic\n"), MenuStyle::Classic);
assert_eq!(MenuStyle::from_file("other:1\nmenuStyle:classic\n"), MenuStyle::Classic);
assert_eq!(MenuStyle::Classic.into_file(""), "menuStyle:classic\n");
assert_eq!(MenuStyle::Horizon.into_file("menuStyle:classic\nother:1\n"), "menuStyle:horizon\nother:1\n");
assert_eq!(MenuStyle::parse("classic"), Some(MenuStyle::Classic));
assert_eq!(MenuStyle::parse("vanilla"), None);
}
#[test]
fn plain_notes() {
let text = markdown_to_text("# Title\n\nSome *words* and [a link](https://x.y).\n\n- one\n- two\n");
+29
View File
@@ -57,6 +57,14 @@ enum Cmd {
Notes { tag: Option<String> },
/// Show the roadmap
Next,
/// Show the Discord and sponsor links
Links,
/// Show or set the game's menu style (classic is vanilla's own screens)
MenuStyle {
/// Omit to show the current style
#[arg(value_parser = ["horizon", "classic"])]
style: Option<String>,
},
/// Look for a newer Horizon release and launcher, and install them
Update {
/// Only report what is available
@@ -198,6 +206,27 @@ fn execute(command: Cmd, as_json: bool) -> Result<(), String> {
print!("{}", backend::markdown_to_text(&roadmap));
}
}
Cmd::Links => {
let links = backend::links();
if as_json {
json(serde_json::to_value(&links).unwrap());
} else {
for (name, url) in [("Discord", &links.discord), ("Sponsor", &links.sponsor)] {
println!("{name:<8} {}", if url.is_empty() { "(none)" } else { url });
}
}
}
Cmd::MenuStyle { style } => {
if let Some(style) = style.as_deref().and_then(backend::MenuStyle::parse) {
backend::set_menu_style(style)?;
}
let style = backend::menu_style().name();
if as_json {
json(serde_json::json!({ "menu_style": style }));
} else {
println!("Menu style: {style}");
}
}
Cmd::Update { check } => update(check, as_json)?,
Cmd::Mcp => unreachable!(),
}
+77 -11
View File
@@ -124,6 +124,9 @@ struct Launcher {
confirm_remove: Option<String>,
picker_open: bool,
settings: Settings,
/// The Discord and sponsor links: built in until links.json on main has been read.
links: backend::Links,
menu_style: backend::MenuStyle,
preparing: bool,
prepare_log: VecDeque<String>,
prepare_error: Option<String>,
@@ -192,6 +195,8 @@ impl Launcher {
confirm_remove: None,
picker_open: false,
settings,
links: backend::Links::default(),
menu_style: backend::menu_style(),
preparing: false,
prepare_log: VecDeque::new(),
prepare_error: None,
@@ -210,6 +215,7 @@ impl Launcher {
};
this.fetch_releases();
this.fetch_roadmap();
this.fetch_links();
this.check_updates();
this
}
@@ -262,6 +268,11 @@ impl Launcher {
std::thread::spawn(move || tx.send(Msg::Releases(backend::releases())));
}
fn fetch_links(&self) {
let tx = self.tx.clone();
std::thread::spawn(move || tx.send(Msg::Links(backend::links())));
}
fn fetch_roadmap(&mut self) {
self.roadmap = Load::Loading;
let tx = self.tx.clone();
@@ -275,6 +286,7 @@ impl Launcher {
match msg {
Msg::Releases(r) => self.releases = r.map_or_else(Load::Failed, Load::Ready),
Msg::Roadmap(r) => self.roadmap = r.map_or_else(Load::Failed, Load::Ready),
Msg::Links(links) => self.links = links,
Msg::Progress(tag, p) => {
self.bar = (self.bar.1, p);
self.installing = Some((tag, p));
@@ -300,7 +312,7 @@ impl Launcher {
Msg::Updates(Ok(updates)) => {
self.update_error = None;
self.updates = updates;
if self.settings.auto_install {
if self.settings.auto_install() {
self.install_update();
}
if let Some(release) = self.updates.launcher.clone() {
@@ -752,6 +764,17 @@ impl Launcher {
),
_ => div().child(format!("Launcher {}", backend::VERSION)),
};
let discord = (!self.links.discord.is_empty()).then(|| {
let url = self.links.discord.clone();
div()
.id("discord")
.mb(px(4.))
.text_color(t.muted)
.cursor_pointer()
.hover(move |s| s.text_color(t.text))
.child("Join Discord")
.on_click(move |_, _, cx| cx.open_url(&url))
});
div()
.flex()
.flex_col()
@@ -774,7 +797,7 @@ impl Launcher {
)
.child(nav)
.child(div().flex_1())
.child(div().px(px(10.)).text_size(px(theme::SMALL)).text_color(t.faint).child(footer))
.child(div().px(px(10.)).text_size(px(theme::SMALL)).text_color(t.faint).children(discord).child(footer))
}
fn segmented(&self, cx: &mut Context<Self>) -> Div {
@@ -1134,11 +1157,11 @@ impl Launcher {
fn settings_page(&mut self, cx: &mut Context<Self>) -> Div {
let t = self.theme;
let toggle = switch("auto-install", self.settings.auto_install, &t).on_click(cx.listener(
let toggle = switch("auto-install", self.settings.auto_install(), &t).on_click(cx.listener(
|this, _: &ClickEvent, _, cx| {
this.settings.auto_install = !this.settings.auto_install;
this.settings.install_new_versions = Some(!this.settings.auto_install());
this.settings.save();
if this.settings.auto_install {
if this.settings.auto_install() {
this.install_update();
}
cx.notify();
@@ -1151,6 +1174,46 @@ impl Launcher {
cx.notify();
},
));
let menus = div()
.id("menu-style")
.flex()
.flex_none()
.p(px(2.))
.gap(px(2.))
.rounded(px(theme::RADIUS_GROUP))
.bg(t.raised)
.border_1()
.border_color(t.border)
.children([(backend::MenuStyle::Horizon, "Horizon"), (backend::MenuStyle::Classic, "Classic")].map(
|(style, label)| {
let active = self.menu_style == style;
div()
.id(label)
.flex()
.items_center()
.h(px(theme::SEGMENT))
.px(px(14.))
.rounded(px(theme::RADIUS_SEGMENT))
.text_size(px(13.))
.cursor_pointer()
.when(active, |d| {
d.bg(t.bg).border_1().border_color(t.border).text_color(t.text).font_weight(FontWeight::MEDIUM)
})
.when(!active, |d| d.text_color(t.muted).hover(move |s| s.text_color(t.text)))
.child(label)
.on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
if backend::set_menu_style(style).is_ok() {
this.menu_style = style;
}
cx.notify();
}))
},
));
let menu_note = div().flex().flex_col().gap(px(2.)).child("Menu style").child(
div().text_size(px(theme::SMALL)).text_color(t.muted).child(
"Classic is vanilla's own screens, with no way back inside the game: switch back here. Applies the next time the game starts.",
),
);
let auto = div()
.flex()
.flex_col()
@@ -1225,7 +1288,7 @@ impl Launcher {
.flex()
.flex_col()
.gap(px(24.))
.child(page_header("Settings", "Updates, and the launcher itself.", &t))
.child(page_header("Settings", "Updates, menus, and the launcher itself.", &t))
.child(
div()
.flex()
@@ -1235,6 +1298,8 @@ impl Launcher {
.child(divider(&t))
.child(row("Opening", div().child("Show opening animation"), Some(opening), &t))
.child(divider(&t))
.child(row("Game menus", menu_note, Some(menus), &t))
.child(divider(&t))
.child(row("Horizon", horizon, horizon_action, &t))
.child(divider(&t))
.child(row("Launcher", div().child(launcher), launcher_action, &t))
@@ -1484,7 +1549,7 @@ impl Launcher {
fn notes_page(&mut self, cx: &mut Context<Self>) -> Div {
let t = self.theme;
let sponsor = div()
let sponsor = (!self.links.sponsor.is_empty()).then(|| div()
.flex()
.items_center()
.justify_between()
@@ -1506,15 +1571,16 @@ impl Launcher {
.child("Horizon is built in the open. Sponsors fund the next release."),
),
)
.child(button("sponsor", "Sponsor on GitHub", Kind::Secondary, &t).on_click(cx.listener(
|_, _: &ClickEvent, _, cx| cx.open_url(backend::SPONSOR_URL),
)));
.child(button("sponsor", "Sponsor on GitHub", Kind::Secondary, &t).on_click({
let url = self.links.sponsor.clone();
move |_: &ClickEvent, _, cx| cx.open_url(&url)
})));
let page = div()
.flex()
.flex_col()
.gap(px(24.))
.child(page_header("Patch notes", "What changed in each release, newest first.", &t))
.child(sponsor);
.children(sponsor);
let releases = match &self.releases {
Load::Loading => return page.child(centered("Loading patch notes…", &t)),
Load::Failed(e) => {
+11
View File
@@ -38,6 +38,9 @@ fn tools() -> Value {
{ "name": "patch_notes", "description": "A release's patch notes as markdown.",
"inputSchema": { "type": "object", "properties": { "tag": { "type": "string", "description": "Default: the newest release." } } } },
{ "name": "roadmap", "description": "What's planned next for Horizon, from the README's roadmap.", "inputSchema": none },
{ "name": "links", "description": "The Horizon community links: the Discord invite and the GitHub Sponsors page (an empty one is not offered).", "inputSchema": none },
{ "name": "menu_style", "description": "Show or set the game's menu style. \"horizon\" is Horizon's own menus, \"classic\" is vanilla's screens, which have no way back inside the game. The game reads it when it starts.",
"inputSchema": { "type": "object", "properties": { "style": { "type": "string", "enum": ["horizon", "classic"], "description": "Omit to show the current style." } } } },
{ "name": "check_updates", "description": "Check GitHub for a Horizon release newer than every installed version, and for a newer launcher.", "inputSchema": none },
])
}
@@ -136,6 +139,14 @@ impl Session {
Ok(format!("# {} ({}, {})\n\n{}", if r.name.is_empty() { &r.tag } else { &r.name }, r.tag, r.date, r.body))
}
"roadmap" => backend::roadmap(),
"links" => Ok(serde_json::to_string_pretty(&backend::links()).unwrap()),
"menu_style" => {
if let Some(name) = arg_str(args, "style") {
let style = backend::MenuStyle::parse(name).ok_or("style is \"horizon\" or \"classic\"")?;
backend::set_menu_style(style)?;
}
Ok(format!("Menu style: {}", backend::menu_style().name()))
}
"check_updates" => {
let u = backend::check_updates()?;
Ok(serde_json::to_string_pretty(&json!({