mirror of
https://github.com/tgeorgiadis/quiver-launcher.git
synced 2026-11-22 21:50:52 -05:00
Start games from desktop and Steam shortcuts through Quiver, so cloud saves sync (#522)
* Start games from desktop and Steam shortcuts through Quiver, so cloud saves sync A shortcut made in Quiver started the game directly, so its saves never synced before play or backed up after. It now runs `quiver --launch <app>`: a small helper with no window that finds the open Quiver, or starts one with none, waits while Quiver brings the saves in line as Play does, then starts the game itself and tells Quiver when it closed, for the backup and upload. Steam ties its overlay, controller settings, playing status and Stop to the program it started and what that starts, which is why the helper starts the game rather than Quiver (tested on Windows and a Steam Deck). Steam's Stop ends the shortcut at once on Windows, so a Quiver it starts there breaks away from Steam's job. On Linux it stays among Steam's processes, so Game Mode shows its window for the which-saves question; Exit Game gives two seconds after SIGTERM, in which it backs up and hands the upload to a Quiver started outside Steam (systemd-run, or flatpak run on the host) with --upload-saves. Usage data's app_launched and app_closed say whether Play or a shortcut started the app, and how a shortcut's game ended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Hand the saves on from the shortcut when Steam's Exit Game stops it On a Steam Deck, Exit Game's SIGTERM also ended the AppImage's mount under the Quiver the shortcut started, so it never got to back up or hand the upload on. The shortcut's helper, which is still waiting on the game, now starts the Quiver outside Steam's processes itself, and that Quiver backs up the saves once the game has closed before sending them. Each step of a shortcut's launch is noted in quiver.log ("shortcut: ..."), with the app and the program's name only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Return a Steam shortcut to the library as soon as the game closes The AppImage's runtime (uruntime) kept its mount for a while after Quiver closed, looking every five seconds whether it was still used, and Steam showed the game as running on a black screen for up to 25 seconds after it closed. The AppImage now holds REUSE_CHECK_DELAY=0, and the Quiver a shortcut starts gets it too. A shortcut that can't start its app shows Quiver's window with why before saying so, rather than quitting before the window opened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Leave the controllers to the game while a shortcut's Quiver has no window Quiver reads controllers itself, through SDL, and its hidden page still said it had the focus, so a Quiver a shortcut started moved through its library, opened search (and Steam's keyboard) and started games as the player played. With no window on screen it now leaves them alone, as behind a game; shown for a question, it has them again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Give the Quiver that sends the saves after Exit Game the session's display Started by systemd-run, outside Steam's processes, it had none of the session's environment and couldn't open even the window it keeps hidden (Runtime(CreateWindow)), so Exit Game's saves weren't sent. It now gets the display, the bus and what says it's Game Mode, and not what Steam set for the game. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep a shortcut's Quiver running through Steam's Stop on Windows Steam's Stop ends the program it started and every process whose parent leads back to it; it puts a shortcut in no job (tested), so breaking away from one did nothing and the Quiver the shortcut started was ended before it could back up and send the saves. It's now started through a middleman (--shortcut-hop) that exits at once, leaving it no living parent to be found by. quiver.log lines go out in one write, so a shortcut's helper and Quiver writing at once don't run into each other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Set up a game's copy from a shortcut, and start it through the shortcut A shortcut whose game needed the player's copy was turned away with a message, and Play without it in that Quiver's window started the game from Quiver, which Steam didn't show or track. The shortcut now waits while the window asks, as Play does: setting the copy up, Play without it and "I've already set it up, don't ask again" all start the game through the shortcut, and Cancel or closing the question tells it not to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * A shortcut that starts Quiver waits for the account, so cloud saves sync first A hidden Quiver started by a shortcut answered it before the account had loaded, so cloud saves were off for that start and the game began with the saves on this computer. The page now answers shortcuts once the account is ready. The web tests' stand-in answers shortcut_requests, which the page asks for on start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015HpW13PMkoWDb7bqcSp3cK --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
04db45f548
commit
18bd2ca15e
23 files changed
+1205
-203
No files matched your search
@@ -29,3 +29,14 @@ command=$1; shift
|
||||
# and aborts), and libxkbcommon-x11, which winit loads.
|
||||
${TAURI_CEF_CLI:-cargo tauri} "$command" --features cef --ignore-version-mismatches --config $tauri/tauri.cef.conf.json "$@" \
|
||||
-- --config "$PWD/$tauri/.cargo/cef.toml"
|
||||
# The AppImage's runtime (uruntime) keeps its mount for a while after Quiver closes, in case it's started again,
|
||||
# looking every REUSE_CHECK_DELAY (5s) to see if it's still used. Started from a Steam shortcut (shortcut_play.rs),
|
||||
# that kept Steam showing the game as running, on a black screen, for up to 25s after it closed: so it lets go as
|
||||
# soon as Quiver does. The setting lives in the AppImage, read before anything in it starts.
|
||||
if [ "$command" = build ]; then
|
||||
for image in $tauri/target/*/bundle/appimage/*.AppImage; do
|
||||
if [ -f "$image" ] && [ "$image" -nt $tauri/Cargo.lock.wry ]; then
|
||||
"$image" --appimage-addenvs 'REUSE_CHECK_DELAY=0'
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -55,6 +55,14 @@ pub fn page_focus(focused: bool) {
|
||||
let _ = focused;
|
||||
}
|
||||
|
||||
/// Quiver with no window on screen (started by a shortcut, shortcut_play.rs): it leaves the controllers alone, as
|
||||
/// behind a game, though its hidden page may still say it has the focus. Its window shown for a question, it has them.
|
||||
pub fn unseen(unseen: bool) {
|
||||
#[cfg(not(target_os = "android"))]
|
||||
sdl::UNSEEN.store(unseen, std::sync::atomic::Ordering::Relaxed);
|
||||
let _ = unseen;
|
||||
}
|
||||
|
||||
/// None on Android: SDL reads controllers there through its own Java
|
||||
/// activity, which Quiver's app doesn't have.
|
||||
#[cfg(target_os = "android")]
|
||||
@@ -87,6 +95,13 @@ mod sdl {
|
||||
/// Whether Quiver's window is in front. Until it says otherwise it is, so a
|
||||
/// window that never reports its focus still has controllers.
|
||||
pub(super) static FOCUSED: AtomicBool = AtomicBool::new(true);
|
||||
/// Quiver has no window on screen (super::unseen): it's behind whatever is, focused or not.
|
||||
pub(super) static UNSEEN: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
/// In front: focused, with its window on screen.
|
||||
fn in_front() -> bool {
|
||||
FOCUSED.load(Ordering::Relaxed) && !UNSEEN.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
/// How far a stick or trigger goes before it counts as pressed: half way.
|
||||
const HALF: i16 = i16::MAX / 2;
|
||||
@@ -102,7 +117,7 @@ mod sdl {
|
||||
});
|
||||
}
|
||||
std::thread::spawn(move || loop {
|
||||
let behind = !FOCUSED.load(Ordering::Relaxed);
|
||||
let behind = !in_front();
|
||||
if !behind || crate::session::watching() {
|
||||
if !read(&app, behind) {
|
||||
return;
|
||||
@@ -115,7 +130,7 @@ mod sdl {
|
||||
|
||||
/// Whether to go on reading: in front, or `behind` while a game wants watching.
|
||||
fn reading(behind: bool) -> bool {
|
||||
let focused = FOCUSED.load(Ordering::Relaxed);
|
||||
let focused = in_front();
|
||||
if behind {
|
||||
!focused && crate::session::watching()
|
||||
} else {
|
||||
|
||||
@@ -28,6 +28,7 @@ mod secrets;
|
||||
mod session;
|
||||
mod setup;
|
||||
mod shortcut;
|
||||
mod shortcut_play;
|
||||
mod snapshots;
|
||||
mod specs;
|
||||
mod steam;
|
||||
@@ -100,6 +101,8 @@ struct Config {
|
||||
steam_deck: bool,
|
||||
/// How this copy was installed, sent with usage data (update.rs).
|
||||
package: &'static str,
|
||||
/// Started by a shortcut, with no window (shortcut_play.rs): what for.
|
||||
shortcut: shortcut_play::Started,
|
||||
}
|
||||
|
||||
/// Steam is running Quiver as one of its games, so it would overwrite a new shortcut as it closes.
|
||||
@@ -145,6 +148,7 @@ fn config(app: tauri::AppHandle, data: State<Data>) -> Config {
|
||||
os_version: device::os_version(),
|
||||
steam_deck: device::steam_deck(|name| std::env::var(name).ok(), device::board_vendor()),
|
||||
package: update::package(),
|
||||
shortcut: shortcut_play::started(&std::env::args().collect::<Vec<_>>()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1261,8 +1265,11 @@ async fn shortcut_icon(data: &Data, request: &shortcut::ShortcutRequest) -> Opti
|
||||
#[tauri::command]
|
||||
async fn create_shortcut(app: tauri::AppHandle, request: shortcut::ShortcutRequest) -> Result<String, String> {
|
||||
let data = app.state::<Data>();
|
||||
let target = target(&data, &request.folder, request.dir.clone(), &request.preferred, request.wine, request.program.clone(), &request.launch)?;
|
||||
let icon = shortcut_icon(&data, &request).await;
|
||||
// Whether it can start now, said here rather than when the shortcut is used.
|
||||
let game = target(&data, &request.folder, request.dir.clone(), &request.preferred, request.wine, request.program.clone(), &request.launch)?;
|
||||
// Through Quiver, so its saves sync first and are backed up after (shortcut_play.rs).
|
||||
let target = shortcut_play::shortcut_target(&request.id);
|
||||
let icon = shortcut_icon(&data, &request).await.or_else(|| cfg!(windows).then(|| game.exe.clone()));
|
||||
let path = shortcut::desktop(&target, &request.name, icon.as_deref())?;
|
||||
Ok(format!("{} is on your desktop.", path.file_name().unwrap_or_default().to_string_lossy()))
|
||||
}
|
||||
@@ -1271,9 +1278,12 @@ async fn create_shortcut(app: tauri::AppHandle, request: shortcut::ShortcutReque
|
||||
#[tauri::command]
|
||||
async fn add_to_steam(app: tauri::AppHandle, request: shortcut::ShortcutRequest) -> Result<String, String> {
|
||||
let data = app.state::<Data>();
|
||||
let target = target(&data, &request.folder, request.dir.clone(), &request.preferred, request.wine, request.program.clone(), &request.launch)?;
|
||||
// Whether it can start now, said here rather than when Steam starts it.
|
||||
let game = target(&data, &request.folder, request.dir.clone(), &request.preferred, request.wine, request.program.clone(), &request.launch)?;
|
||||
// Through Quiver, so its saves sync first and are backed up after (shortcut_play.rs).
|
||||
let target = shortcut_play::shortcut_target(&request.id);
|
||||
steam::account()?;
|
||||
let icon = shortcut_icon(&data, &request).await;
|
||||
let icon = shortcut_icon(&data, &request).await.or_else(|| cfg!(windows).then(|| game.exe.clone()));
|
||||
let folder = install::plain_name(&request.folder)?;
|
||||
let mut art: Vec<(String, PathBuf)> = Vec::new();
|
||||
let pictures = [("", &request.art.header), ("p", &request.art.capsule), ("_hero", &request.art.hero), ("_logo", &request.art.logo), ("_icon", &request.art.icon)];
|
||||
@@ -1286,16 +1296,12 @@ async fn add_to_steam(app: tauri::AppHandle, request: shortcut::ShortcutRequest)
|
||||
}
|
||||
}
|
||||
}
|
||||
// On Linux a `.desktop` names the app's own program, so Steam stores it as
|
||||
// the shortcut's program and starts it in the game's folder (a game that
|
||||
// needs environment variables is named through a script instead). A Windows
|
||||
// game Steam itself runs with Proton is named the same way, so Steam keeps
|
||||
// its Proton and the player's launch options.
|
||||
// On Linux a `.desktop` names Quiver and its arguments, so Steam stores
|
||||
// Quiver as the shortcut's program and the arguments as its launch
|
||||
// options. Quiver runs a Windows game with Proton itself, as Play does.
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if target.steam_proton {
|
||||
return add_proton(&data, &request.name, folder, &target, icon.as_deref(), art);
|
||||
}
|
||||
let _ = game;
|
||||
return add_native(&data, &request.name, folder, &target, icon.as_deref(), art);
|
||||
}
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
@@ -1316,42 +1322,6 @@ async fn add_to_steam(app: tauri::AppHandle, request: shortcut::ShortcutRequest)
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds a Windows game Steam runs with its own Proton: a `.desktop` naming the
|
||||
/// game, so Steam stores the game as the program and applies a compat tool. It
|
||||
/// is added at once through the running Steam, or written directly once Steam
|
||||
/// closes. Linux only.
|
||||
#[cfg(target_os = "linux")]
|
||||
fn add_proton(data: &Data, name: &str, folder: &str, target: &shortcut::Target, icon: Option<&Path>, art: Vec<(String, PathBuf)>) -> Result<String, String> {
|
||||
let launcher = steam::Launcher::write_proton(&data.0, folder, name, target, icon)?;
|
||||
let mut shortcut = steam::Shortcut::new(name, target, icon);
|
||||
shortcut.shortcut_path = launcher.desktop().to_string_lossy().into_owned();
|
||||
shortcut.art = art;
|
||||
// Steam reads the grid folder as it loads, so artwork added now shows after a restart; the shortcut itself is already there.
|
||||
let art_note = if shortcut.art.is_empty() { "" } else { " Artwork will appear after restarting Steam." };
|
||||
if !steam::running() {
|
||||
steam::apply(&shortcut)?;
|
||||
return Ok(format!("{name} is in Steam. It's set to run with Proton. Start Steam to see it."));
|
||||
}
|
||||
// Steam is running: it adds the shortcut itself, at once, and its own write is what lasts.
|
||||
let ids = match steam::existing_id(&launcher) {
|
||||
Some(id) => vec![id],
|
||||
None => match steam::add_now(launcher.desktop()) {
|
||||
Ok(()) => steam_ids(&launcher, name),
|
||||
// Steam wouldn't take it now: a waiting copy adds it once Steam closes.
|
||||
Err(_) => {
|
||||
queue_steam(data, folder, &shortcut)?;
|
||||
return Ok(format!("{name} will be added to Steam when Steam closes. Restart Steam to see it."));
|
||||
}
|
||||
},
|
||||
};
|
||||
if let Ok((user, _)) = steam::account() {
|
||||
for id in ids {
|
||||
let _ = steam::place_art(&user, id, &shortcut.art);
|
||||
}
|
||||
}
|
||||
Ok(format!("{name} is in Steam. It's set to run with Proton.{art_note}"))
|
||||
}
|
||||
|
||||
/// Adds a native Linux shortcut: a `.desktop` naming the game's own program, so
|
||||
/// Steam stores the program and starts it in the game's folder. Added at once
|
||||
/// through the running Steam, which writes it itself, or written directly once
|
||||
@@ -2294,7 +2264,8 @@ fn append_log(path: &Path, line: &str) {
|
||||
use std::io::Write;
|
||||
let stamp = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0);
|
||||
if let Ok(mut file) = std::fs::OpenOptions::new().create(true).append(true).open(path) {
|
||||
let _ = writeln!(file, "{stamp} {line}");
|
||||
// In one write, so lines from Quiver and a shortcut's helper at once don't run into each other.
|
||||
let _ = file.write_all(format!("{stamp} {line}\n").as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2556,6 +2527,21 @@ pub fn run() {
|
||||
return steam::wait_and_apply(Path::new(file));
|
||||
}
|
||||
}
|
||||
// A data folder a shortcut was given, for the Quiver it was made by (shortcut_play.rs): as QUIVER_DATA, which the
|
||||
// Quivers it starts get too.
|
||||
if let Some(data) = shortcut_play::data_arg(&args) {
|
||||
std::env::set_var("QUIVER_DATA", data);
|
||||
}
|
||||
// The middleman a shortcut starts its Quiver through on Windows (shortcut_play.rs).
|
||||
#[cfg(desktop)]
|
||||
if args.iter().any(|a| a == shortcut_play::HOP) {
|
||||
std::process::exit(shortcut_play::hop());
|
||||
}
|
||||
// A shortcut starting a game through Quiver: no window, and none of the launcher (shortcut_play.rs).
|
||||
#[cfg(desktop)]
|
||||
if args.iter().any(|a| a == shortcut_play::LAUNCH) {
|
||||
std::process::exit(shortcut_play::helper(&args));
|
||||
}
|
||||
let builder = tauri::Builder::default();
|
||||
// Chromium without its sandbox, as WebKitGTK ran here: with it, CEF aborts at start where unprivileged user
|
||||
// namespaces are restricted (Ubuntu 24.04 on) unless a setuid chrome-sandbox is installed, which only a deb
|
||||
@@ -2581,7 +2567,9 @@ pub fn run() {
|
||||
#[cfg(windows)]
|
||||
let builder = if std::env::var_os("QUIVER_DATA").is_none() && portable_data().is_none() {
|
||||
builder.plugin(tauri_plugin_single_instance::init(|app, args, _| {
|
||||
if !args.iter().any(|a| a == tray::ARG) {
|
||||
// One a shortcut started with no window finds this one answering already.
|
||||
let unseen = [tray::ARG, shortcut_play::HOST, shortcut_play::UPLOAD];
|
||||
if !args.iter().any(|a| unseen.contains(&a.as_str())) {
|
||||
tray::open_window(app);
|
||||
}
|
||||
}))
|
||||
@@ -2635,9 +2623,11 @@ pub fn run() {
|
||||
let unseen = std::env::args().any(|a| a == tray::ARG);
|
||||
#[cfg(not(windows))]
|
||||
let unseen = false;
|
||||
// Started by a shortcut: no window, unless there's a question to ask (shortcut_play.rs).
|
||||
let for_shortcut = shortcut_play::started(&std::env::args().collect::<Vec<_>>()).host;
|
||||
#[cfg(windows)]
|
||||
app.manage(tray::Tray::new(settings["closeToTray"] == true, unseen));
|
||||
let maximize = main_window(app, &dir, theme_of(settings["theme"].as_str()), title_bar, !unseen)?;
|
||||
let maximize = main_window(app, &dir, theme_of(settings["theme"].as_str()), title_bar, !unseen && !for_shortcut)?;
|
||||
#[cfg(not(windows))]
|
||||
let _ = maximize;
|
||||
// Paint behind the page in the theme it will draw in.
|
||||
@@ -2654,7 +2644,7 @@ pub fn run() {
|
||||
if let Err(e) = tray::refresh(app.handle()) {
|
||||
append_log(&dir.join("quiver.log"), &format!("Couldn't show the tray icon: {e}"));
|
||||
}
|
||||
if full && !unseen {
|
||||
if full && !unseen && !for_shortcut {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = fullscreen(&window, true, title_bar);
|
||||
}
|
||||
@@ -2671,6 +2661,9 @@ pub fn run() {
|
||||
append_log(&dir.join("quiver.log"), &line);
|
||||
}
|
||||
delete_moved(None, &dir, old);
|
||||
app.manage(shortcut_play::Host::default());
|
||||
#[cfg(desktop)]
|
||||
shortcut_play::listen(app.handle(), &dir, for_shortcut);
|
||||
app.manage(Data(dir, std::sync::Mutex::new(apps)));
|
||||
app.manage(Snapshotted(Default::default()));
|
||||
app.manage(gamepad::Pads::default());
|
||||
@@ -2748,6 +2741,11 @@ pub fn run() {
|
||||
set_window_position,
|
||||
create_shortcut,
|
||||
add_to_steam,
|
||||
shortcut_play::shortcut_requests,
|
||||
shortcut_play::shortcut_start,
|
||||
shortcut_play::shortcut_refuse,
|
||||
shortcut_play::shortcut_done,
|
||||
shortcut_play::shortcut_window,
|
||||
open_url,
|
||||
to_background,
|
||||
set_tray,
|
||||
@@ -2828,6 +2826,9 @@ pub fn run() {
|
||||
if let tauri::RunEvent::Exit = _event {
|
||||
keyboard::kwin::unload_now();
|
||||
}
|
||||
if let tauri::RunEvent::Exit = _event {
|
||||
shortcut_play::stop_listening(_app);
|
||||
}
|
||||
// Back from an app started from Quiver: that's its play time.
|
||||
#[cfg(target_os = "android")]
|
||||
if let tauri::RunEvent::Resumed = _event {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! Desktop shortcuts and Steam shortcuts for an installed app. Both start the
|
||||
//! game directly, as Quiver Launcher 3 did, so they work without Quiver.
|
||||
//! game through Quiver (shortcut_play.rs), so its saves sync before it starts
|
||||
//! and are backed up after.
|
||||
use serde::Deserialize;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
@@ -58,6 +59,8 @@ pub struct Art {
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ShortcutRequest {
|
||||
/// The app, which the shortcut names to Quiver (shortcut_play.rs).
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub folder: String,
|
||||
pub dir: Option<String>,
|
||||
|
||||
@@ -0,0 +1,830 @@
|
||||
//! Shortcuts that start a game through Quiver, so its saves sync before it starts and are backed up and sent after
|
||||
//! (docs/cloud-saves.md, "From a shortcut"). A desktop or Steam shortcut runs `quiver --launch <app id>`, which is
|
||||
//! this file's helper: a small program with no window that
|
||||
//!
|
||||
//! 1. finds the Quiver that's open, or starts one with no window (`--shortcut-host`), and asks it for the app;
|
||||
//! 2. waits while Quiver brings the app's saves in line, as Play does (and asks, if both sides changed);
|
||||
//! 3. starts the game itself, with the command Quiver gives it, and waits for it;
|
||||
//! 4. tells Quiver when the game closed, and Quiver backs up and sends the saves.
|
||||
//!
|
||||
//! The helper starts the game rather than Quiver because Steam ties its overlay, its controller settings, its
|
||||
//! "playing" status and its Stop to the program it started and what that starts: a game Quiver started, outside
|
||||
//! that tree, has none of them, and in Game Mode isn't even shown (tested on Windows and a Steam Deck).
|
||||
//!
|
||||
//! Steam's Stop (Windows) and Exit Game (Linux) end the helper and the game without warning on Windows, and two
|
||||
//! seconds after a SIGTERM on Linux. So:
|
||||
//! - On Windows, Steam's Stop ends the program it started and every process whose parent leads back to it (no job:
|
||||
//! tested). So a Quiver the helper starts is started by a middleman (`--shortcut-hop`) that exits at once, leaving
|
||||
//! it no living parent to be found by; a dropped connection counts as the game closing.
|
||||
//! - On Linux, it runs inside them, where Game Mode shows its window for the question about which saves to keep. On
|
||||
//! SIGTERM the helper, which is already waiting on the game, starts a Quiver outside Steam's processes
|
||||
//! (`--upload-saves`, by systemd-run, or `flatpak run` on the host) that backs the saves up once the game has
|
||||
//! closed, sends them and quits. The Quiver inside can't do it: an AppImage's mount goes with the same SIGTERM.
|
||||
//!
|
||||
//! Each step is noted in quiver.log ("shortcut: …"), for bug reports.
|
||||
//!
|
||||
//! Quiver listens on 127.0.0.1 at a port it writes to `shortcuts.json` in its data folder, with a token only the
|
||||
//! player's own programs can read there.
|
||||
use crate::{Data, Running};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::io::{BufRead, BufReader, Write};
|
||||
use std::net::{TcpListener, TcpStream};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering};
|
||||
use std::sync::Mutex;
|
||||
use std::time::{Duration, Instant};
|
||||
use tauri::{AppHandle, Emitter, Manager};
|
||||
|
||||
/// The shortcut's argument: `--launch <app id> [-- arguments for the game]`.
|
||||
pub const LAUNCH: &str = "--launch";
|
||||
/// Quiver started by a shortcut: no window, and it quits once the game's saves are sent.
|
||||
pub const HOST: &str = "--shortcut-host";
|
||||
/// The middleman a shortcut starts its Quiver through on Windows, which starts it and exits at once (start_host).
|
||||
pub const HOP: &str = "--shortcut-hop";
|
||||
/// Quiver started to send an app's saves after Steam stopped the game: `--upload-saves <app id> [seconds played]`, the
|
||||
/// seconds when this session's play time is still to count.
|
||||
pub const UPLOAD: &str = "--upload-saves";
|
||||
/// The data folder a Quiver was given (`QUIVER_DATA`), which a shortcut, and the Quivers it starts, are given too.
|
||||
pub const DATA: &str = "--quiver-data";
|
||||
const FILE: &str = "shortcuts.json";
|
||||
/// How long a shortcut waits for a Quiver it started to answer: a first start reads the library and opens the page.
|
||||
const STARTING: Duration = Duration::from_secs(90);
|
||||
/// How long a Quiver with no window waits for its page to say the saves are sent before it quits anyway.
|
||||
const SENDING: Duration = Duration::from_secs(120);
|
||||
|
||||
/// Where Quiver listens, in its data folder.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct Listening {
|
||||
port: u16,
|
||||
token: String,
|
||||
}
|
||||
|
||||
/// What a shortcut asks Quiver for.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct Ask {
|
||||
token: String,
|
||||
app: String,
|
||||
/// Arguments the player gave the shortcut after Quiver's own, which go after the game's.
|
||||
#[serde(default)]
|
||||
args: Vec<String>,
|
||||
/// The helper started this Quiver to answer it.
|
||||
#[serde(default)]
|
||||
hidden: bool,
|
||||
}
|
||||
|
||||
/// The game's command, as Play would start it (lib.rs `target`).
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||
pub struct Run {
|
||||
pub program: PathBuf,
|
||||
pub args: Vec<String>,
|
||||
pub env: Vec<(String, String)>,
|
||||
pub dir: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
enum Reply {
|
||||
Start(Run),
|
||||
/// Not started: the player said no, or Quiver can't start it (and says why in its window).
|
||||
Refuse(String),
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
enum Report {
|
||||
Started,
|
||||
Failed(String),
|
||||
/// `stopped`: the helper was asked to stop before the game closed (Steam's Exit Game).
|
||||
Closed { code: Option<i32>, stopped: bool },
|
||||
}
|
||||
|
||||
/// A shortcut waiting for its page to answer, for `shortcut_requests` and the `shortcut-play` event.
|
||||
#[derive(Serialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Request {
|
||||
pub request: u64,
|
||||
pub app: String,
|
||||
pub hidden: bool,
|
||||
}
|
||||
|
||||
/// How this Quiver was started, for the page (lib.rs `config`).
|
||||
#[derive(Serialize, Clone, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Started {
|
||||
/// Started by a shortcut, with no window: it quits once the saves are sent.
|
||||
pub host: bool,
|
||||
/// Started to send this app's saves, after Steam stopped it: the app, and the seconds it was played when that's
|
||||
/// still to count.
|
||||
pub upload: Option<(String, Option<u64>)>,
|
||||
}
|
||||
|
||||
/// The data folder named after `--quiver-data`, if one is: Quiver uses it as it does `QUIVER_DATA` (lib.rs run).
|
||||
pub fn data_arg(args: &[String]) -> Option<PathBuf> {
|
||||
let at = args.iter().position(|a| a == DATA)?;
|
||||
args.get(at + 1).map(PathBuf::from)
|
||||
}
|
||||
|
||||
/// `--quiver-data` and the folder, when this Quiver was given one: for the shortcuts and Quivers it starts.
|
||||
fn data_args() -> Vec<String> {
|
||||
std::env::var("QUIVER_DATA").ok().filter(|d| !d.is_empty()).map(|d| vec![DATA.to_string(), d]).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// How this Quiver was started, from its arguments.
|
||||
pub fn started(args: &[String]) -> Started {
|
||||
let host = args.iter().any(|a| a == HOST);
|
||||
let upload = args.iter().position(|a| a == UPLOAD).and_then(|at| {
|
||||
let id = args.get(at + 1)?.clone();
|
||||
Some((id, args.get(at + 2).and_then(|s| s.parse().ok())))
|
||||
});
|
||||
Started { host: host || upload.is_some(), upload }
|
||||
}
|
||||
|
||||
struct Pending {
|
||||
app: String,
|
||||
hidden: bool,
|
||||
args: Vec<String>,
|
||||
stream: TcpStream,
|
||||
}
|
||||
|
||||
/// A game a shortcut started, until it closes.
|
||||
struct Session {
|
||||
started: Instant,
|
||||
}
|
||||
|
||||
/// Quiver's side: the shortcuts waiting, the games they started, and whether to quit when they're done.
|
||||
#[derive(Default)]
|
||||
pub struct Host {
|
||||
pending: Mutex<Vec<(u64, Pending)>>,
|
||||
sessions: Mutex<Vec<(u64, Session)>>,
|
||||
next: AtomicU64,
|
||||
/// Started by a shortcut with no window: quits when nothing's left to do, unless the player opened its window.
|
||||
quits: AtomicBool,
|
||||
/// Games closed whose saves the page is still sending.
|
||||
sending: AtomicUsize,
|
||||
token: Mutex<String>,
|
||||
}
|
||||
|
||||
/// A token for the port: 128 bits from the system's random keys, which std's hasher is seeded with.
|
||||
fn token() -> String {
|
||||
use std::hash::{BuildHasher, Hasher};
|
||||
let mut out = String::new();
|
||||
for _ in 0..2 {
|
||||
let mut hasher = std::collections::hash_map::RandomState::new().build_hasher();
|
||||
hasher.write_u128(std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap_or_default().as_nanos());
|
||||
hasher.write_u32(std::process::id());
|
||||
out.push_str(&format!("{:016x}", hasher.finish()));
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
fn send(stream: &mut TcpStream, what: &impl Serialize) -> std::io::Result<()> {
|
||||
let mut line = serde_json::to_vec(what).map_err(std::io::Error::other)?;
|
||||
line.push(b'\n');
|
||||
stream.write_all(&line)
|
||||
}
|
||||
|
||||
fn read<T: for<'a> Deserialize<'a>>(reader: &mut impl BufRead) -> std::io::Result<T> {
|
||||
let mut line = String::new();
|
||||
if reader.read_line(&mut line)? == 0 {
|
||||
return Err(std::io::ErrorKind::UnexpectedEof.into());
|
||||
}
|
||||
serde_json::from_str(&line).map_err(std::io::Error::other)
|
||||
}
|
||||
|
||||
/// Notes a step in quiver.log, for bug reports: which app, and no paths but the program's name.
|
||||
fn note(data: &Path, what: &str) {
|
||||
crate::append_log(&data.join("quiver.log"), &format!("shortcut: {what}"));
|
||||
}
|
||||
|
||||
/// A program and its folder for a note: only the program's own name.
|
||||
fn run_line(program: &Path, dir: &Path) -> String {
|
||||
let name = |p: &Path| p.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();
|
||||
format!("{} to start, in {}", name(program), name(dir))
|
||||
}
|
||||
|
||||
// ---- Quiver's side ----
|
||||
|
||||
/// Listens for shortcuts, from setup. `quits`: this Quiver was started by one, with no window.
|
||||
pub fn listen(app: &AppHandle, data: &Path, quits: bool) {
|
||||
let host = app.state::<Host>();
|
||||
host.quits.store(quits, Ordering::SeqCst);
|
||||
// No window on screen: the controllers are the game's, not this Quiver's hidden library's.
|
||||
crate::gamepad::unseen(quits);
|
||||
let Ok(listener) = TcpListener::bind(("127.0.0.1", 0)) else { return };
|
||||
let Ok(port) = listener.local_addr().map(|a| a.port()) else { return };
|
||||
let token = token();
|
||||
*host.token.lock().unwrap() = token.clone();
|
||||
let file = data.join(FILE);
|
||||
if std::fs::write(&file, serde_json::to_vec(&Listening { port, token }).unwrap_or_default()).is_err() {
|
||||
return;
|
||||
}
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let _ = std::fs::set_permissions(&file, std::fs::Permissions::from_mode(0o600));
|
||||
}
|
||||
let answers = app.clone();
|
||||
std::thread::Builder::new()
|
||||
.name("shortcuts".into())
|
||||
.spawn(move || {
|
||||
for stream in listener.incoming().flatten() {
|
||||
let app = answers.clone();
|
||||
std::thread::spawn(move || asked(&app, stream));
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
// One started to send saves is busy until its page says they're sent.
|
||||
let uploads = started(&std::env::args().collect::<Vec<_>>()).upload.is_some();
|
||||
if uploads {
|
||||
host.sending.store(1, Ordering::SeqCst);
|
||||
}
|
||||
// One started for a shortcut that never asks (it gave up waiting, say) doesn't stay; nor one sending saves whose
|
||||
// page never says it's done.
|
||||
if quits {
|
||||
let app = app.clone();
|
||||
std::thread::spawn(move || {
|
||||
std::thread::sleep(STARTING);
|
||||
quit_if_done(&app);
|
||||
if uploads {
|
||||
std::thread::sleep(SENDING);
|
||||
if !app.get_webview_window("main").is_some_and(|w| w.is_visible().unwrap_or(false)) {
|
||||
app.exit(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
note(data, &format!("listening on port {port}{}", if quits { ", with no window, for a shortcut" } else { "" }));
|
||||
}
|
||||
|
||||
/// Removes the port's file as Quiver closes, if it's still this one's.
|
||||
pub fn stop_listening(app: &AppHandle) {
|
||||
let (Some(host), Some(data)) = (app.try_state::<Host>(), app.try_state::<Data>()) else { return };
|
||||
let file = data.0.join(FILE);
|
||||
let ours = std::fs::read(&file).ok().and_then(|b| serde_json::from_slice::<Listening>(&b).ok()).is_some_and(|l| l.token == *host.token.lock().unwrap());
|
||||
if ours {
|
||||
let _ = std::fs::remove_file(file);
|
||||
}
|
||||
}
|
||||
|
||||
fn asked(app: &AppHandle, stream: TcpStream) {
|
||||
let host = app.state::<Host>();
|
||||
let Ok(clone) = stream.try_clone() else { return };
|
||||
let mut reader = BufReader::new(clone);
|
||||
let Ok(ask) = read::<Ask>(&mut reader) else { return };
|
||||
if ask.token != *host.token.lock().unwrap() || ask.token.is_empty() {
|
||||
return;
|
||||
}
|
||||
let request = host.next.fetch_add(1, Ordering::SeqCst) + 1;
|
||||
if let Some(data) = app.try_state::<Data>() {
|
||||
note(&data.0, &format!("{}: a shortcut asks to play it", ask.app));
|
||||
}
|
||||
let shown = Request { request, app: ask.app.clone(), hidden: ask.hidden };
|
||||
host.pending.lock().unwrap().push((request, Pending { app: ask.app, hidden: ask.hidden, args: ask.args, stream }));
|
||||
let _ = app.emit("shortcut-play", shown);
|
||||
}
|
||||
|
||||
/// The shortcuts waiting for an answer: for a page that's only now ready, which missed their events.
|
||||
#[tauri::command]
|
||||
pub fn shortcut_requests(host: tauri::State<'_, Host>) -> Vec<Request> {
|
||||
host.pending.lock().unwrap().iter().map(|(request, p)| Request { request: *request, app: p.app.clone(), hidden: p.hidden }).collect()
|
||||
}
|
||||
|
||||
fn take(host: &Host, request: u64) -> Option<Pending> {
|
||||
let mut pending = host.pending.lock().unwrap();
|
||||
let at = pending.iter().position(|(r, _)| *r == request)?;
|
||||
Some(pending.remove(at).1)
|
||||
}
|
||||
|
||||
/// Doesn't start the app a shortcut asked for: the player said no, or it can't (the page says why).
|
||||
#[tauri::command]
|
||||
pub fn shortcut_refuse(app: AppHandle, request: u64, why: String) {
|
||||
let host = app.state::<Host>();
|
||||
if let Some(mut pending) = take(&host, request) {
|
||||
note(&app.state::<Data>().0, &format!("{}: not started{}{why}", pending.app, if why.is_empty() { "" } else { ": " }));
|
||||
let _ = send(&mut pending.stream, &Reply::Refuse(why));
|
||||
}
|
||||
quit_if_done(&app);
|
||||
}
|
||||
|
||||
/// Hands a shortcut the app's command, as Play would start it, with the shortcut's own arguments after its own, and
|
||||
/// follows the game until it closes: its play time, Discord, and `app-closed` with how it ended.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn shortcut_start(
|
||||
app: AppHandle,
|
||||
data: tauri::State<'_, Data>,
|
||||
request: u64,
|
||||
id: String,
|
||||
folder: String,
|
||||
dir: Option<String>,
|
||||
preferred: Vec<String>,
|
||||
wine: bool,
|
||||
program: Option<String>,
|
||||
launch: Option<crate::launch::LaunchOptions>,
|
||||
presence: Option<crate::discord::Game>,
|
||||
) -> Result<(), String> {
|
||||
let host = app.state::<Host>();
|
||||
let Some(mut pending) = take(&host, request) else { return Err("The shortcut stopped waiting.".into()) };
|
||||
let target = match crate::target(&data, &folder, dir, &preferred, wine, program, &launch.unwrap_or_default()) {
|
||||
Ok(target) => target,
|
||||
Err(e) => {
|
||||
let _ = send(&mut pending.stream, &Reply::Refuse(e.clone()));
|
||||
return Err(e);
|
||||
}
|
||||
};
|
||||
let (program, mut args, env) = target.command();
|
||||
args.extend(pending.args.iter().cloned());
|
||||
send(&mut pending.stream, &Reply::Start(Run { program, args, env, dir: target.dir.clone() })).map_err(|e| e.to_string())?;
|
||||
let hidden = pending.hidden;
|
||||
note(&data.0, &format!("{id}: sent the shortcut {}", run_line(&target.program, &target.dir)));
|
||||
host.sessions.lock().unwrap().push((request, Session { started: Instant::now() }));
|
||||
let stream = pending.stream;
|
||||
std::thread::spawn(move || follow(app, request, id, hidden, stream, presence));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The payload of `app-closed` for a game a shortcut started.
|
||||
#[derive(Serialize, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct Closed {
|
||||
id: String,
|
||||
seconds: u64,
|
||||
/// "shortcut", or "shortcut_hidden" when the shortcut started this Quiver.
|
||||
via: &'static str,
|
||||
/// "closed" (it quit), or "stopped" (Steam's Stop or Exit Game ended it).
|
||||
ended: &'static str,
|
||||
}
|
||||
|
||||
fn follow(app: AppHandle, request: u64, id: String, hidden: bool, stream: TcpStream, presence: Option<crate::discord::Game>) {
|
||||
let mut reader = BufReader::new(stream);
|
||||
let mut playing = false;
|
||||
let ended = loop {
|
||||
match read::<Report>(&mut reader) {
|
||||
Ok(Report::Started) => {
|
||||
playing = true;
|
||||
app.state::<Running>().started(&id);
|
||||
if let Some(game) = presence.clone() {
|
||||
app.state::<crate::discord::Presence>().started(&id, game);
|
||||
}
|
||||
}
|
||||
Ok(Report::Failed(why)) => {
|
||||
crate::append_log(&app.state::<Data>().0.join("quiver.log"), &format!("A shortcut couldn't start {id}: {why}"));
|
||||
break None;
|
||||
}
|
||||
Ok(Report::Closed { stopped, .. }) => break Some(if stopped { "stopped" } else { "closed" }),
|
||||
// The helper ended without saying: Steam's Stop took it and the game with it.
|
||||
Err(_) => break Some("stopped"),
|
||||
}
|
||||
};
|
||||
let host = app.state::<Host>();
|
||||
let session = {
|
||||
let mut sessions = host.sessions.lock().unwrap();
|
||||
let Some(at) = sessions.iter().position(|(r, _)| *r == request) else { return };
|
||||
sessions.remove(at).1
|
||||
};
|
||||
let data = app.state::<Data>().0.clone();
|
||||
match (playing, ended) {
|
||||
(true, Some(ended)) => note(&data, &format!("{id}: the game {} after {}s", if ended == "closed" { "closed" } else { "was stopped" }, session.started.elapsed().as_secs())),
|
||||
(false, _) => note(&data, &format!("{id}: the game didn't start")),
|
||||
_ => {}
|
||||
}
|
||||
if playing {
|
||||
app.state::<Running>().closed(&id);
|
||||
app.state::<crate::discord::Presence>().closed(&id);
|
||||
}
|
||||
match (playing, ended) {
|
||||
(true, Some(ended)) => {
|
||||
let seconds = session.started.elapsed().as_secs();
|
||||
host.sending.fetch_add(1, Ordering::SeqCst);
|
||||
let _ = app.emit("app-closed", Closed { id, seconds, via: if hidden { "shortcut_hidden" } else { "shortcut" }, ended });
|
||||
// The page says when the saves are sent (shortcut_done); a page that never does doesn't keep it open.
|
||||
let app = app.clone();
|
||||
std::thread::spawn(move || {
|
||||
std::thread::sleep(SENDING);
|
||||
let host = app.state::<Host>();
|
||||
if host.sending.load(Ordering::SeqCst) > 0 {
|
||||
shortcut_done(app.clone());
|
||||
}
|
||||
});
|
||||
}
|
||||
_ => quit_if_done(&app),
|
||||
}
|
||||
}
|
||||
|
||||
/// The page sent the saves of a game a shortcut started: a Quiver with no window can quit.
|
||||
#[tauri::command]
|
||||
pub fn shortcut_done(app: AppHandle) {
|
||||
let host = app.state::<Host>();
|
||||
let mut n = host.sending.load(Ordering::SeqCst);
|
||||
while n > 0 {
|
||||
match host.sending.compare_exchange(n, n - 1, Ordering::SeqCst, Ordering::SeqCst) {
|
||||
Ok(_) => break,
|
||||
Err(now) => n = now,
|
||||
}
|
||||
}
|
||||
quit_if_done(&app);
|
||||
}
|
||||
|
||||
/// Shows the window of a Quiver a shortcut started, for a question (which saves to keep) or to say why the game
|
||||
/// didn't start; or hides it again once answered.
|
||||
#[tauri::command]
|
||||
pub fn shortcut_window(app: AppHandle, show: bool) {
|
||||
let Some(window) = app.get_webview_window("main") else { return };
|
||||
crate::gamepad::unseen(!show);
|
||||
if show {
|
||||
let _ = window.show();
|
||||
let _ = window.unminimize();
|
||||
let _ = window.set_focus();
|
||||
if crate::in_game_mode() {
|
||||
let _ = window.set_fullscreen(true);
|
||||
}
|
||||
} else {
|
||||
let _ = window.hide();
|
||||
}
|
||||
}
|
||||
|
||||
/// Quits a Quiver a shortcut started once it has nothing left to do: no shortcut waiting, no game running, no saves
|
||||
/// being sent, and its window not open.
|
||||
fn quit_if_done(app: &AppHandle) {
|
||||
let host = app.state::<Host>();
|
||||
if !host.quits.load(Ordering::SeqCst) {
|
||||
return;
|
||||
}
|
||||
let busy = !host.pending.lock().unwrap().is_empty() || !host.sessions.lock().unwrap().is_empty() || host.sending.load(Ordering::SeqCst) > 0;
|
||||
let shown = app.get_webview_window("main").is_some_and(|w| w.is_visible().unwrap_or(false));
|
||||
if !busy && !shown {
|
||||
if let Some(data) = app.try_state::<Data>() {
|
||||
note(&data.0, "nothing left to do: quitting");
|
||||
}
|
||||
app.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Shortcuts ----
|
||||
|
||||
/// What a desktop or Steam shortcut to an app starts: this Quiver with `--launch` and the app, from wherever the
|
||||
/// system starts it (the Flatpak through `flatpak run`, an AppImage as itself). Quiver works out the game's command
|
||||
/// each time, so a shortcut follows the player's launch options and the program they chose as those change.
|
||||
pub fn shortcut_target(id: &str) -> crate::shortcut::Target {
|
||||
let (program, mut args) = match (crate::sandbox::id(), crate::update::kind()) {
|
||||
(Some(flatpak), _) => (crate::flatpak::program(), vec!["run".to_string(), flatpak]),
|
||||
(None, crate::update::Kind::AppImage(image)) => (image, vec![]),
|
||||
_ => (std::env::current_exe().unwrap_or_else(|_| PathBuf::from("quiver-launcher")), vec![]),
|
||||
};
|
||||
args.extend(data_args());
|
||||
args.extend([LAUNCH.to_string(), id.to_string()]);
|
||||
let dir = if crate::sandbox::id().is_some() { dirs::home_dir().unwrap_or_default() } else { program.parent().map(Path::to_path_buf).unwrap_or_default() };
|
||||
crate::shortcut::Target { exe: program.clone(), program, args, env: vec![], dir, extract_appimage: false, steam_proton: false, options: Default::default() }
|
||||
}
|
||||
|
||||
// ---- Starting Quiver ----
|
||||
|
||||
/// This Quiver again, with these arguments: its own AppImage (not the copy mounted for this one, which goes when it
|
||||
/// does), or its own program.
|
||||
fn quiver(args: &[&str]) -> Command {
|
||||
let program = match crate::update::kind() {
|
||||
crate::update::Kind::AppImage(image) => image,
|
||||
_ => std::env::current_exe().unwrap_or_else(|_| PathBuf::from("quiver-launcher")),
|
||||
};
|
||||
let mut command = crate::host::command(program);
|
||||
command.args(args);
|
||||
command
|
||||
}
|
||||
|
||||
/// What a Quiver started outside Steam's processes needs of the session: its display, its bus, and what says it's
|
||||
/// Game Mode (keyboard::game_mode) and a Steam Deck.
|
||||
#[cfg(target_os = "linux")]
|
||||
const SESSION: &[&str] = &[
|
||||
"DISPLAY",
|
||||
"WAYLAND_DISPLAY",
|
||||
"XAUTHORITY",
|
||||
"XDG_RUNTIME_DIR",
|
||||
"DBUS_SESSION_BUS_ADDRESS",
|
||||
"XDG_SESSION_TYPE",
|
||||
"XDG_CURRENT_DESKTOP",
|
||||
"XDG_SESSION_DESKTOP",
|
||||
"GAMESCOPE_WAYLAND_DISPLAY",
|
||||
"SteamDeck",
|
||||
"LANG",
|
||||
"LC_ALL",
|
||||
];
|
||||
|
||||
/// Linux: this Quiver, started so it's no part of the processes Steam ends: by systemd for the player's session, or
|
||||
/// for the Flatpak, `flatpak run` on the host. None without either.
|
||||
#[cfg(target_os = "linux")]
|
||||
fn outside_steam(args: &[&str]) -> Option<Command> {
|
||||
// Started by systemd or on the host, it has none of this one's environment.
|
||||
let data = data_args();
|
||||
let args: Vec<&str> = data.iter().map(String::as_str).chain(args.iter().copied()).collect();
|
||||
let args = args.as_slice();
|
||||
// Nor the session's display: without it, it can't open even the window it keeps hidden. Nor what says it's Game
|
||||
// Mode. Not what Steam set for the game, though: it's no part of it.
|
||||
let session: Vec<&str> = SESSION.iter().copied().filter(|name| std::env::var_os(name).is_some()).collect();
|
||||
if let Some(flatpak) = crate::sandbox::id() {
|
||||
let mut command = Command::new("flatpak");
|
||||
command.arg("run").arg(flatpak).args(args);
|
||||
for name in &session {
|
||||
command.env(name, std::env::var_os(name).unwrap_or_default());
|
||||
}
|
||||
return Some(crate::sandbox::host(command));
|
||||
}
|
||||
let systemd = crate::sandbox::which("systemd-run")?;
|
||||
let inner = quiver(args);
|
||||
let mut command = crate::host::command(systemd);
|
||||
command.args(["--user", "--collect", "--quiet"]);
|
||||
// A name alone: systemd-run takes its value from here.
|
||||
command.args(session.iter().map(|name| format!("--setenv={name}")));
|
||||
command.arg(inner.get_program()).args(inner.get_args());
|
||||
Some(command)
|
||||
}
|
||||
|
||||
/// Starts this Quiver with `args` and no console, outside a job if it can be (none of Steam's is, tested, but a job
|
||||
/// that's there may refuse it).
|
||||
#[cfg(windows)]
|
||||
fn spawn_detached(args: &[&str]) -> std::io::Result<std::process::Child> {
|
||||
use std::os::windows::process::CommandExt;
|
||||
const BREAKAWAY: u32 = 0x0100_0000; // CREATE_BREAKAWAY_FROM_JOB
|
||||
const DETACHED: u32 = 0x0000_0008; // DETACHED_PROCESS
|
||||
let mut command = quiver(args);
|
||||
command.stdin(std::process::Stdio::null()).stdout(std::process::Stdio::null()).stderr(std::process::Stdio::null());
|
||||
command.creation_flags(BREAKAWAY | DETACHED);
|
||||
command.spawn().or_else(|_| {
|
||||
command.creation_flags(DETACHED);
|
||||
command.spawn()
|
||||
})
|
||||
}
|
||||
|
||||
/// The middleman (`--shortcut-hop`): starts the Quiver a shortcut needs and exits at once, so that Quiver's parent is
|
||||
/// gone and Steam's Stop, which ends what its program started, doesn't find it.
|
||||
pub fn hop() -> i32 {
|
||||
#[cfg(windows)]
|
||||
return spawn_detached(&[HOST]).map_or(1, |_| 0);
|
||||
#[allow(unreachable_code)]
|
||||
1
|
||||
}
|
||||
|
||||
/// Starts a Quiver with no window to answer a shortcut. On Windows through the middleman, so Steam's Stop doesn't end
|
||||
/// it before the saves are sent; on Linux it stays among Steam's processes (see the top of this file), and the returned
|
||||
/// process is waited for.
|
||||
fn start_host() -> std::io::Result<Option<std::process::Child>> {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let status = spawn_detached(&[HOP])?.wait()?;
|
||||
return if status.success() { Ok(None) } else { Err(std::io::Error::other("the middleman couldn't start it")) };
|
||||
}
|
||||
#[allow(unreachable_code)]
|
||||
let mut command = quiver(&[HOST]);
|
||||
command.stdin(std::process::Stdio::null()).stdout(std::process::Stdio::null()).stderr(std::process::Stdio::null());
|
||||
// An AppImage's runtime lets go of its mount as soon as Quiver closes, rather than keeping Steam's shortcut
|
||||
// "running" for seconds after (scripts/tauri-cef.sh puts this in the AppImage too).
|
||||
command.env("REUSE_CHECK_DELAY", "0");
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
return command.spawn().map(Some);
|
||||
}
|
||||
#[allow(unreachable_code)]
|
||||
{
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::process::CommandExt;
|
||||
command.process_group(0);
|
||||
}
|
||||
command.spawn().map(|_| None)
|
||||
}
|
||||
}
|
||||
|
||||
// ---- The shortcut's side ----
|
||||
|
||||
/// Quiver's data folder, found as Quiver finds it (lib.rs setup) without starting it.
|
||||
fn data_dir() -> Option<PathBuf> {
|
||||
let identifier = serde_json::from_str::<serde_json::Value>(include_str!("../tauri.conf.json")).ok()?["identifier"].as_str()?.to_string();
|
||||
std::env::var_os("QUIVER_DATA")
|
||||
.map(PathBuf::from)
|
||||
.or_else(crate::portable_data)
|
||||
.or_else(|| crate::sandbox::data_dir(&identifier))
|
||||
.or_else(|| Some(dirs::data_dir()?.join(identifier)))
|
||||
}
|
||||
|
||||
/// A connection to the Quiver that's listening, if one is.
|
||||
fn connect(data: &Path) -> Option<(TcpStream, String)> {
|
||||
let listening: Listening = serde_json::from_slice(&std::fs::read(data.join(FILE)).ok()?).ok()?;
|
||||
let stream = TcpStream::connect_timeout(&(std::net::Ipv4Addr::LOCALHOST, listening.port).into(), Duration::from_secs(2)).ok()?;
|
||||
Some((stream, listening.token))
|
||||
}
|
||||
|
||||
/// The shortcut's arguments: the app, and what follows `--` (or anything else after it) for the game.
|
||||
pub fn parse(args: &[String]) -> Option<(String, Vec<String>)> {
|
||||
let at = args.iter().position(|a| a == LAUNCH)?;
|
||||
let app = args.get(at + 1)?.clone();
|
||||
let rest = &args[at + 2..];
|
||||
let rest = if rest.first().is_some_and(|a| a == "--") { &rest[1..] } else { rest };
|
||||
Some((app, rest.to_vec()))
|
||||
}
|
||||
|
||||
/// The polite stop requests the helper has had (Steam's Exit Game on Linux): the game is asked too, and its closing
|
||||
/// is still reported.
|
||||
static ASKED_TO_STOP: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
fn ignore_polite_stops() {
|
||||
extern "C" fn asked(_: libc::c_int) {
|
||||
ASKED_TO_STOP.store(true, Ordering::SeqCst);
|
||||
}
|
||||
for signal in [libc::SIGTERM, libc::SIGINT, libc::SIGHUP] {
|
||||
unsafe { libc::signal(signal, asked as extern "C" fn(libc::c_int) as libc::sighandler_t) };
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
fn ignore_polite_stops() {}
|
||||
|
||||
/// The game this helper started: when, and whether it has closed. For a handoff as Steam stops it (hand_off_on_stop).
|
||||
#[derive(Default)]
|
||||
struct Game {
|
||||
started: Mutex<Option<Instant>>,
|
||||
closed: AtomicBool,
|
||||
}
|
||||
|
||||
static GAME: std::sync::OnceLock<Game> = std::sync::OnceLock::new();
|
||||
|
||||
/// Linux: when Steam's Exit Game asks the shortcut to stop, the Quiver this helper started goes with it (an AppImage's
|
||||
/// mount ends on the same signal). So the helper, which is still running, starts one outside Steam's processes that
|
||||
/// backs up the saves once the game has closed, sends them, and quits; with the play time when the game was still
|
||||
/// running, which no one else will count.
|
||||
#[cfg(target_os = "linux")]
|
||||
fn hand_off_on_stop(data: PathBuf, app: String) {
|
||||
std::thread::spawn(move || {
|
||||
while !ASKED_TO_STOP.load(Ordering::SeqCst) {
|
||||
std::thread::sleep(Duration::from_millis(20));
|
||||
}
|
||||
let game = GAME.get_or_init(Game::default);
|
||||
let playing = (!game.closed.load(Ordering::SeqCst)).then(|| *game.started.lock().unwrap()).flatten();
|
||||
let seconds = playing.map(|at| at.elapsed().as_secs().to_string());
|
||||
let mut args = vec![UPLOAD, app.as_str()];
|
||||
args.extend(seconds.as_deref());
|
||||
match outside_steam(&args).map(|mut c| c.stdin(std::process::Stdio::null()).stdout(std::process::Stdio::null()).stderr(std::process::Stdio::null()).spawn()) {
|
||||
Some(Ok(_)) => note(&data, &format!("{app}: Steam is stopping it; started a Quiver outside Steam to back up and send the saves")),
|
||||
Some(Err(e)) => note(&data, &format!("{app}: Steam is stopping it, and the saves couldn't be handed on: {e}")),
|
||||
None => note(&data, &format!("{app}: Steam is stopping it, and the saves couldn't be handed on: no systemd-run")),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// The helper a shortcut runs (`--launch`): the game's exit code, or 1 when it didn't start.
|
||||
pub fn helper(args: &[String]) -> i32 {
|
||||
let Some(data) = data_dir() else { return 1 };
|
||||
let fail = |why: String| {
|
||||
note(&data, &why);
|
||||
1
|
||||
};
|
||||
let Some((app, extra)) = parse(args) else { return fail("no app named after --launch".into()) };
|
||||
ignore_polite_stops();
|
||||
note(&data, &format!("{app}: started"));
|
||||
let mut host = None;
|
||||
let (mut stream, token, hidden) = match connect(&data) {
|
||||
Some((stream, token)) => (stream, token, false),
|
||||
None => {
|
||||
match start_host() {
|
||||
Ok(child) => host = child,
|
||||
Err(e) => return fail(format!("{app}: couldn't start Quiver: {e}")),
|
||||
}
|
||||
note(&data, &format!("{app}: started Quiver with no window to answer"));
|
||||
let since = Instant::now();
|
||||
loop {
|
||||
if let Some((stream, token)) = connect(&data) {
|
||||
break (stream, token, true);
|
||||
}
|
||||
if since.elapsed() > STARTING {
|
||||
return fail(format!("{app}: Quiver didn't answer"));
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(200));
|
||||
}
|
||||
}
|
||||
};
|
||||
// A Quiver that was open already isn't among Steam's processes: it hears the game closed, or the connection drop.
|
||||
#[cfg(target_os = "linux")]
|
||||
if hidden {
|
||||
hand_off_on_stop(data.clone(), app.clone());
|
||||
}
|
||||
let code = play(&mut stream, Ask { token, app: app.clone(), args: extra, hidden });
|
||||
// On Linux the Quiver it started runs among Steam's processes, and from its AppImage or Flatpak sandbox: it ends
|
||||
// when this does, so it's given the time to send the saves.
|
||||
if let Some(mut host) = host {
|
||||
drop(stream);
|
||||
note(&data, &format!("{app}: waiting for Quiver to send the saves"));
|
||||
let _ = host.wait();
|
||||
}
|
||||
match code {
|
||||
Ok(code) => {
|
||||
note(&data, &format!("{app}: done"));
|
||||
code
|
||||
}
|
||||
Err(why) => fail(format!("{app}: {why}")),
|
||||
}
|
||||
}
|
||||
|
||||
fn play(stream: &mut TcpStream, ask: Ask) -> Result<i32, String> {
|
||||
send(stream, &ask).map_err(|e| e.to_string())?;
|
||||
let mut reader = BufReader::new(stream.try_clone().map_err(|e| e.to_string())?);
|
||||
let run = match read::<Reply>(&mut reader) {
|
||||
Ok(Reply::Start(run)) => run,
|
||||
Ok(Reply::Refuse(why)) => return Err(format!("not started: {why}")),
|
||||
Err(e) => return Err(format!("Quiver didn't say how to start it: {e}")),
|
||||
};
|
||||
let mut command = crate::host::command(&run.program);
|
||||
command.args(&run.args).envs(run.env.iter().map(|(k, v)| (k, v))).current_dir(&run.dir);
|
||||
let spawned = crate::sandbox::check(&run.program).and_then(|_| crate::sandbox::game(command).spawn());
|
||||
let game = GAME.get_or_init(Game::default);
|
||||
let status: Option<i32> = match spawned {
|
||||
Ok(mut child) => {
|
||||
*game.started.lock().unwrap() = Some(Instant::now());
|
||||
let _ = send(stream, &Report::Started);
|
||||
child.wait().ok().and_then(|s| s.code())
|
||||
}
|
||||
// One that needs administrator rights: Windows asks the player, as a double click would.
|
||||
#[cfg(windows)]
|
||||
Err(e) if e.raw_os_error() == Some(crate::elevate::REQUIRED) => match crate::elevate::start(&run.program, &run.args, &run.dir) {
|
||||
Ok(process) => {
|
||||
*game.started.lock().unwrap() = Some(Instant::now());
|
||||
let _ = send(stream, &Report::Started);
|
||||
process.map(|p| p.wait());
|
||||
Some(0)
|
||||
}
|
||||
Err(e) => {
|
||||
let _ = send(stream, &Report::Failed(e.to_string()));
|
||||
return Err(format!("couldn't start {}: {e}", run.program.display()));
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
let _ = send(stream, &Report::Failed(e.to_string()));
|
||||
return Err(format!("couldn't start {}: {e}", run.program.display()));
|
||||
}
|
||||
};
|
||||
game.closed.store(true, Ordering::SeqCst);
|
||||
let _ = send(stream, &Report::Closed { code: status, stopped: ASKED_TO_STOP.load(Ordering::SeqCst) });
|
||||
Ok(status.unwrap_or(0))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn s(words: &[&str]) -> Vec<String> {
|
||||
words.iter().map(|w| w.to_string()).collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_shortcut_names_the_app_and_what_the_game_gets() {
|
||||
assert_eq!(parse(&s(&["quiver", "--launch", "abc"])), Some(("abc".into(), vec![])));
|
||||
assert_eq!(parse(&s(&["quiver", "--launch", "abc", "--", "-w", "2"])), Some(("abc".into(), s(&["-w", "2"]))));
|
||||
// Steam puts the player's own launch options after the shortcut's.
|
||||
assert_eq!(parse(&s(&["quiver", "--launch", "abc", "--fullscreen"])), Some(("abc".into(), s(&["--fullscreen"]))));
|
||||
assert_eq!(parse(&s(&["quiver", "--launch"])), None);
|
||||
assert_eq!(parse(&s(&["quiver"])), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_shortcut_carries_the_data_folder_quiver_was_given() {
|
||||
assert_eq!(data_arg(&s(&["quiver", "--quiver-data", "/home/deck/QuiverDev/data", "--launch", "abc"])), Some("/home/deck/QuiverDev/data".into()));
|
||||
assert_eq!(data_arg(&s(&["quiver", "--launch", "abc"])), None);
|
||||
// It comes before --launch, so it's never taken for the game's.
|
||||
assert_eq!(parse(&s(&["quiver", "--quiver-data", "/d", "--launch", "abc"])), Some(("abc".into(), vec![])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn how_quiver_was_started() {
|
||||
let plain = started(&s(&["quiver"]));
|
||||
assert!(!plain.host && plain.upload.is_none());
|
||||
assert!(started(&s(&["quiver", "--shortcut-host"])).host);
|
||||
let upload = started(&s(&["quiver", "--upload-saves", "abc", "42"]));
|
||||
assert!(upload.host);
|
||||
assert_eq!(upload.upload, Some(("abc".into(), Some(42))));
|
||||
// Its play time counted already: only the saves to send.
|
||||
assert_eq!(started(&s(&["quiver", "--upload-saves", "abc"])).upload, Some(("abc".into(), None)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn messages_go_both_ways_as_json_lines() {
|
||||
let listener = TcpListener::bind(("127.0.0.1", 0)).unwrap();
|
||||
let port = listener.local_addr().unwrap().port();
|
||||
let mut out = TcpStream::connect(("127.0.0.1", port)).unwrap();
|
||||
let (incoming, _) = listener.accept().unwrap();
|
||||
let mut reader = BufReader::new(incoming);
|
||||
let run = Run { program: "/games/g/game".into(), args: s(&["a b", "--x"]), env: vec![("K".into(), "v\nw".into())], dir: "/games/g".into() };
|
||||
send(&mut out, &Reply::Start(run)).unwrap();
|
||||
send(&mut out, &Report::Closed { code: Some(3), stopped: true }).unwrap();
|
||||
let Reply::Start(got) = read::<Reply>(&mut reader).unwrap() else { panic!() };
|
||||
assert_eq!(got.args, s(&["a b", "--x"]));
|
||||
assert_eq!(got.env, vec![("K".to_string(), "v\nw".to_string())]);
|
||||
assert_eq!(read::<Report>(&mut reader).unwrap(), Report::Closed { code: Some(3), stopped: true });
|
||||
drop(out);
|
||||
assert!(read::<Report>(&mut reader).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tokens_differ() {
|
||||
assert_ne!(token(), token());
|
||||
assert_eq!(token().len(), 32);
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,9 @@
|
||||
//! the one that wrote it. The desktop names the app's own program
|
||||
//! (Launcher::write), so Steam stores it as the shortcut's program and starts
|
||||
//! it in the game's folder; a game that needs environment variables is named
|
||||
//! through a script instead, since an `Exec` Steam reads can't carry them. A
|
||||
//! Windows game Steam itself runs with Proton is named the same way
|
||||
//! (Launcher::write_proton), so Steam stores the game and applies a compat tool
|
||||
//! to it. Where the live add
|
||||
//! through a script instead, since an `Exec` Steam reads can't carry them.
|
||||
//! Quiver's own shortcuts name Quiver (shortcut_play.rs), which runs a Windows
|
||||
//! game with Proton itself. Where the live add
|
||||
//! isn't available (Windows, or a Steam without the handler), the write still
|
||||
//! waits in a separate copy of the launcher (`--add-to-steam <file>`) until
|
||||
//! Steam closes.
|
||||
@@ -136,6 +135,8 @@ fn options_of(args: &[String]) -> String {
|
||||
}
|
||||
|
||||
impl Shortcut {
|
||||
/// Where Steam's live add isn't used: on Linux, shortcuts come from a `.desktop` (Launcher::shortcut).
|
||||
#[cfg_attr(target_os = "linux", allow(dead_code))]
|
||||
pub fn new(name: &str, target: &crate::shortcut::Target, icon: Option<&Path>) -> Shortcut {
|
||||
let proton = cfg!(target_os = "linux") && target.steam_proton;
|
||||
let program = if proton { &target.exe } else { &target.program };
|
||||
@@ -242,32 +243,6 @@ impl Launcher {
|
||||
Ok(Launcher { desktop, exe: quoted(&script), script: Some(script), launch_options: String::new() })
|
||||
}
|
||||
|
||||
/// Writes a `.desktop` naming the game itself, under `data/steam`: Steam
|
||||
/// stores the game as the program and runs it with its own Proton. The
|
||||
/// player's launch options follow the game in the `Exec`, as Steam reads
|
||||
/// them for its LaunchOptions.
|
||||
pub fn write_proton(data: &Path, folder: &str, name: &str, target: &crate::shortcut::Target, icon: Option<&Path>) -> Result<Launcher, String> {
|
||||
let dir = data.join("steam");
|
||||
std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;
|
||||
// Steam only keeps a shortcut's program when it can be executed, so a
|
||||
// game whose archive never marked it runnable is made so here, whether
|
||||
// it was installed before or after Quiver started doing it (install.rs).
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
if let Ok(meta) = std::fs::metadata(&target.exe) {
|
||||
let mode = meta.permissions().mode();
|
||||
if mode & 0o111 == 0 {
|
||||
let _ = std::fs::set_permissions(&target.exe, std::fs::Permissions::from_mode(mode | 0o755));
|
||||
}
|
||||
}
|
||||
}
|
||||
let shortcut = Shortcut::new(name, target, icon);
|
||||
let desktop = dir.join(format!("{folder}.desktop"));
|
||||
std::fs::write(&desktop, proton_desktop(&shortcut, &target.dir, icon)).map_err(|e| e.to_string())?;
|
||||
Ok(Launcher { desktop, exe: shortcut.exe, script: None, launch_options: shortcut.launch_options })
|
||||
}
|
||||
|
||||
pub fn desktop(&self) -> &Path {
|
||||
&self.desktop
|
||||
}
|
||||
@@ -324,23 +299,6 @@ impl Launcher {
|
||||
}
|
||||
}
|
||||
|
||||
/// A `.desktop` for Steam to run with its own Proton: the `Exec` is the game,
|
||||
/// so Steam stores it as the program and applies a compat tool; the player's
|
||||
/// launch options follow, as Steam reads them for its LaunchOptions.
|
||||
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
|
||||
fn proton_desktop(s: &Shortcut, dir: &Path, icon: Option<&Path>) -> String {
|
||||
let value = |x: &str| x.replace('\\', "\\\\").replace('\n', "\\n").replace('\r', "\\r").replace('\t', "\\t");
|
||||
let exec = if s.launch_options.is_empty() { s.exe.clone() } else { format!("{} {}", s.exe, s.launch_options) };
|
||||
format!(
|
||||
"[Desktop Entry]\nType=Application\nName={}\nExec={}\nPath={}\nIcon={}\nTerminal=false\nCategories=Game;\nComment=Play {}\n",
|
||||
value(&s.name),
|
||||
value(&exec),
|
||||
value(&dir.to_string_lossy()),
|
||||
value(&icon.map(|p| p.to_string_lossy().into_owned()).unwrap_or_default()),
|
||||
value(&s.name),
|
||||
)
|
||||
}
|
||||
|
||||
/// The shell script a Linux shortcut runs: its folder, environment and command.
|
||||
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
|
||||
pub fn script_text(target: &crate::shortcut::Target, name: &str) -> String {
|
||||
@@ -839,60 +797,6 @@ mod tests {
|
||||
assert_eq!((s.exe.as_str(), s.launch_options.as_str()), ("\"/games/G/Game\"", "\"--fullscreen\""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn a_steam_proton_shortcut_names_the_game_so_steam_runs_it() {
|
||||
let target = |options: &str| crate::shortcut::Target {
|
||||
exe: "/games/G/game.exe".into(),
|
||||
program: "/protons/GE/proton".into(),
|
||||
args: vec!["run".into(), "/games/G/game.exe".into()],
|
||||
env: vec![("STEAM_COMPAT_DATA_PATH".into(), "/data/proton/G".into())],
|
||||
dir: "/games/G".into(),
|
||||
extract_appimage: false,
|
||||
steam_proton: true,
|
||||
options: crate::launch::parse(options).unwrap(),
|
||||
};
|
||||
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let launcher = Launcher::write_proton(dir.path(), "G", "G", &target(""), None).unwrap();
|
||||
// Steam stores the game itself, so it applies its own Proton to it.
|
||||
assert_eq!(launcher.exe(), "\"/games/G/game.exe\"");
|
||||
assert!(launcher.app_ids("G").contains(&app_id("\"/games/G/game.exe\"", "G")));
|
||||
assert!(launcher.app_ids("G").contains(&app_id("/games/G/game.exe", "G")));
|
||||
let desktop = std::fs::read_to_string(launcher.desktop()).unwrap();
|
||||
assert!(desktop.contains("Name=G\n"), "{desktop}");
|
||||
assert!(desktop.contains("Exec=\"/games/G/game.exe\"\n"), "{desktop}");
|
||||
assert!(desktop.contains("Path=/games/G\n"), "{desktop}");
|
||||
|
||||
// The player's launch options follow the game, for Steam's LaunchOptions.
|
||||
let launcher = Launcher::write_proton(dir.path(), "G", "G", &target("DXVK_HUD=1 %command% -w"), None).unwrap();
|
||||
let desktop = std::fs::read_to_string(launcher.desktop()).unwrap();
|
||||
assert!(desktop.contains("Exec=\"/games/G/game.exe\" DXVK_HUD=1 %command% -w\n"), "{desktop}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn a_steam_proton_shortcut_makes_the_game_runnable_for_steam() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let exe = dir.path().join("Game.exe");
|
||||
std::fs::write(&exe, b"MZ").unwrap();
|
||||
std::fs::set_permissions(&exe, std::fs::Permissions::from_mode(0o644)).unwrap();
|
||||
let target = crate::shortcut::Target {
|
||||
exe: exe.clone(),
|
||||
program: "/protons/GE/proton".into(),
|
||||
args: vec![],
|
||||
env: vec![],
|
||||
dir: dir.path().to_path_buf(),
|
||||
extract_appimage: false,
|
||||
steam_proton: true,
|
||||
options: Default::default(),
|
||||
};
|
||||
// Steam stores the desktop's program as the shortcut only when it can run it.
|
||||
Launcher::write_proton(dir.path(), "G", "G", &target, None).unwrap();
|
||||
assert_eq!(std::fs::metadata(&exe).unwrap().permissions().mode() & 0o111, 0o111, "Steam can run it");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_path_is_percent_encoded_for_the_steam_url() {
|
||||
assert_eq!(percent_encode("/home/deck/Games/My Game/run.sh"), "%2Fhome%2Fdeck%2FGames%2FMy%20Game%2Frun.sh");
|
||||
|
||||
@@ -1125,6 +1125,7 @@ export const foldersOn = (os: string) => os !== "android" && os !== "ios";
|
||||
export function shortcutRequest(entry: Entry, install: Install, settings: Settings): ShortcutRequest {
|
||||
const art = entry.libraryArt ?? {};
|
||||
return {
|
||||
id: entry.id,
|
||||
name: entry.projectName,
|
||||
folder: install.folder,
|
||||
dir: install.dir,
|
||||
|
||||
@@ -83,7 +83,17 @@ export type Config = {
|
||||
steamDeck?: boolean;
|
||||
/** How this copy was installed, for usage data (update.rs). Missing from an older build. */
|
||||
package?: string;
|
||||
/**
|
||||
* Started by a desktop or Steam shortcut, with no window (shortcut_play.rs): it quits once the game's saves are sent.
|
||||
* `upload`: started to send this app's saves after Steam stopped it, and the seconds it was played when that's still
|
||||
* to count. Missing from an older build.
|
||||
*/
|
||||
shortcut?: { host: boolean; upload: [string, number | null] | null };
|
||||
};
|
||||
/** A desktop or Steam shortcut waiting to start an app through Quiver (shortcut_play.rs). `hidden`: it started this Quiver. */
|
||||
export type ShortcutPlay = { request: number; app: string; hidden: boolean };
|
||||
/** How a game ended, for usage data: it quit, or Steam's Stop or Exit Game ended it. */
|
||||
export type Closed = { id: string; seconds: number; via?: "shortcut" | "shortcut_hidden"; ended?: "closed" | "stopped" };
|
||||
/** The hardware specs.rs reads. */
|
||||
export type PcSpecs = { cpu: string | null; gpu: string | null; ramGb: number | null };
|
||||
/** A repository host's answer, fetched by the Rust side for hosts that don't send CORS headers. */
|
||||
@@ -188,6 +198,8 @@ export type WindowsRunner = { kind: "wine" } | { kind: "proton"; path: string };
|
||||
|
||||
/** An installed app, for a desktop or Steam shortcut. */
|
||||
export type ShortcutRequest = {
|
||||
/** The app, which the shortcut names to Quiver. */
|
||||
id: string;
|
||||
name: string;
|
||||
folder: string;
|
||||
dir?: string;
|
||||
@@ -352,8 +364,30 @@ export const native = {
|
||||
invoke<void>("launch", { id, folder, dir, preferred, wine, program, launch, presence }),
|
||||
/** Discord's Rich Presence on or off (discord.rs), with its words in the player's language. */
|
||||
setDiscordPresence: (enabled: boolean, texts: { idle: string; button: string }) => invoke<void>("set_discord_presence", { enabled, texts }),
|
||||
/** An app started with an id has closed, after running this long. */
|
||||
onAppClosed: (handler: (p: { id: string; seconds: number }) => void) => listen<{ id: string; seconds: number }>("app-closed", (e) => handler(e.payload)),
|
||||
/** An app started with an id has closed, after running this long; one a shortcut started says how it ended. */
|
||||
onAppClosed: (handler: (p: Closed) => void) => listen<Closed>("app-closed", (e) => handler(e.payload)),
|
||||
/** The shortcuts waiting for this Quiver to start their app: for a page that's only now ready. */
|
||||
shortcutRequests: () => invoke<ShortcutPlay[]>("shortcut_requests"),
|
||||
/** A shortcut asks this Quiver to start an app. */
|
||||
onShortcutPlay: (handler: (p: ShortcutPlay) => void) => listen<ShortcutPlay>("shortcut-play", (e) => handler(e.payload)),
|
||||
/** Hands a shortcut the app's command, as `launch` would start it, for the shortcut to start. */
|
||||
shortcutStart: (
|
||||
request: number,
|
||||
id: string,
|
||||
folder: string,
|
||||
dir: string | undefined,
|
||||
preferred: string[],
|
||||
wine: boolean,
|
||||
program?: string,
|
||||
launch?: LaunchOptions,
|
||||
presence?: DiscordGame,
|
||||
) => invoke<void>("shortcut_start", { request, id, folder, dir, preferred, wine, program, launch, presence }),
|
||||
/** Tells a shortcut its app won't start: the player said no, or the window says why. */
|
||||
shortcutRefuse: (request: number, why: string) => invoke<void>("shortcut_refuse", { request, why }),
|
||||
/** The saves of a game a shortcut started are sent: a Quiver it started can quit. */
|
||||
shortcutDone: () => invoke<void>("shortcut_done"),
|
||||
/** Shows the window of a Quiver a shortcut started, for a question, or hides it again. */
|
||||
shortcutWindow: (show: boolean) => invoke<void>("shortcut_window", { show }),
|
||||
/** Where an app's saves are and its backups (saves.rs). */
|
||||
savesInfo: (of: SavesOf) => invoke<SavesInfo | null>("saves_info", { of }),
|
||||
/** Backs up an app's saves if they changed; null when there was nothing new. Fails while the app runs. */
|
||||
|
||||
@@ -144,7 +144,7 @@ export function OwnCopyPrompt() {
|
||||
if (copiesNeeded(entry, install, config.os).length) return;
|
||||
setLaunching(false);
|
||||
setUpCopy(null);
|
||||
void play(asking.id);
|
||||
void play(asking.id, undefined, false, asking.shortcut);
|
||||
}, [launching, install?.copies]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
@@ -179,6 +179,15 @@ export function OwnCopyPrompt() {
|
||||
if (!open || !entry || !install || !file || !asking) return null;
|
||||
const name = entry.projectName;
|
||||
const close = () => setUpCopy(null);
|
||||
// Closed without playing: a shortcut waiting on it hears it won't start, and a Quiver it started goes once its
|
||||
// window does (shortcut_play.rs).
|
||||
const cancel = () => {
|
||||
const waiting = asking.shortcut;
|
||||
close();
|
||||
if (!waiting) return;
|
||||
const hidden = waiting.hidden ? native.shortcutWindow(false).catch(() => {}) : Promise.resolve();
|
||||
void hidden.then(() => native.shortcutRefuse(waiting.request, "")).catch(() => {});
|
||||
};
|
||||
const folder = file.kind === "folder";
|
||||
|
||||
const use = async (path: string, inPlace = false) => {
|
||||
@@ -224,7 +233,7 @@ export function OwnCopyPrompt() {
|
||||
if (asking.play) setLaunching(true);
|
||||
else close();
|
||||
};
|
||||
const askAgain = () => (setCopy(entry.id, file.id, undefined), close());
|
||||
const askAgain = () => (setCopy(entry.id, file.id, undefined), cancel());
|
||||
const choose = async () => {
|
||||
const path = await native.pickCopy(file).catch(() => null);
|
||||
if (path) void use(path);
|
||||
@@ -246,7 +255,7 @@ export function OwnCopyPrompt() {
|
||||
const pct = progress && progress.total > 0 ? Math.min(100, Math.round((progress.done / progress.total) * 100)) : null;
|
||||
|
||||
return (
|
||||
<Dialog label={t`Set up your copy for ${name}`} className="own-copy-prompt" onClose={busy ? () => {} : close}>
|
||||
<Dialog label={t`Set up your copy for ${name}`} className="own-copy-prompt" onClose={busy ? () => {} : cancel}>
|
||||
<div className="detail-body">
|
||||
{phase.kind === "done" ? (
|
||||
<>
|
||||
@@ -283,10 +292,10 @@ export function OwnCopyPrompt() {
|
||||
</p>
|
||||
) : (
|
||||
<div className="row">
|
||||
<button className="primary" autoFocus onClick={() => (close(), void play(entry.id))}>
|
||||
<button className="primary" autoFocus onClick={() => (close(), void play(entry.id, undefined, false, asking.shortcut))}>
|
||||
<Play size={16} aria-hidden="true" /> {t({ message: "Play", comment: "Button that starts an app" })}
|
||||
</button>
|
||||
<button onClick={close}>{t`Close`}</button>
|
||||
<button onClick={cancel}>{t`Close`}</button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
@@ -385,9 +394,9 @@ export function OwnCopyPrompt() {
|
||||
<FolderOpen size={16} aria-hidden="true" /> {folder ? t`Choose a folder…` : t`Choose a file…`}
|
||||
</button>
|
||||
{asking.play && !busy && (
|
||||
<button onClick={() => (close(), void play(entry.id, undefined, true))}>{t`Play without it`}</button>
|
||||
<button onClick={() => (close(), void play(entry.id, undefined, true, asking.shortcut))}>{t`Play without it`}</button>
|
||||
)}
|
||||
<button disabled={busy} onClick={close}>
|
||||
<button disabled={busy} onClick={cancel}>
|
||||
{t`Cancel`}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
+117
-37
@@ -10,7 +10,7 @@ import { msg, plural, t } from "@lingui/core/macro";
|
||||
import { ApiError, createClient, createGithub, createGitlab, createProviders, githubAsset, githubProvider, githubRepository, parseRepository, toRef, type Asset, type Client, type Console, type Entry, type Github, type Gitlab, type Os, type HistoryRelease, type Release, type ReleaseScan, type ReleaseStatus, type UnverifiedRelease, type Verified, type Withdrawn, type Providers, type RepositoryRef } from "@quiverlauncher/api";
|
||||
import type { HiddenApp } from "./browse-hidden";
|
||||
import { hideOnApp, shownTags, type HiddenTags } from "./catalog-tags";
|
||||
import { native, type Config, type Installed, type SaveBackup, type LaunchOptions, type MovingApp, type OldApp, type OldFilter, type Progress, type StateProblem, type V3Library, type WindowsRunner } from "./native";
|
||||
import { native, type Config, type Installed, type SaveBackup, type ShortcutPlay, type LaunchOptions, type MovingApp, type OldApp, type OldFilter, type Progress, type StateProblem, type V3Library, type WindowsRunner } from "./native";
|
||||
import { Recovery } from "./recovery";
|
||||
import { assetFilterFor, bestAssets, installable, installFormat, isMsi, pickedBefore, releaseFor, wantedFiles } from "./assets";
|
||||
import { cameAfter, fromSite, scanAsks, installedFile, insteadOf, newestUnblocked, sameChecksum, unverifiedFile, versionLabel, withdrawnAsBlocked } from "./versions";
|
||||
@@ -290,8 +290,9 @@ type Launcher = {
|
||||
choosingProgram: string | null;
|
||||
chooseProgram: (id: string | null) => void;
|
||||
/** The app whose page asks for the player's own copy of its game (own-copy-setup.tsx): `play` once it's set up, from Play. */
|
||||
settingUpCopy: { id: string; fileId?: string; play?: boolean } | null;
|
||||
setUpCopy: (asking: { id: string; fileId?: string; play?: boolean } | null) => void;
|
||||
/** `shortcut`: a desktop or Steam shortcut is waiting to start the game once it's set up (shortcut_play.rs). */
|
||||
settingUpCopy: { id: string; fileId?: string; play?: boolean; shortcut?: ShortcutPlay } | null;
|
||||
setUpCopy: (asking: { id: string; fileId?: string; play?: boolean; shortcut?: ShortcutPlay } | null) => void;
|
||||
/** The Quiver Launcher 3 library the launcher found by itself, until a library is brought over; undefined while it looks. */
|
||||
oldLibrary: V3Library | null | undefined;
|
||||
/**
|
||||
@@ -320,8 +321,12 @@ type Launcher = {
|
||||
*/
|
||||
get: (entry: Entry, release?: Release, options?: GetOptions) => Promise<void>;
|
||||
/** Starts an app: `executable`, else its one program the player picked, else asks which of them, else the launcher's own choice. */
|
||||
/** Starts an installed app. Without the player's copy of its game that it needs, asks for it first, unless `withoutCopy`. */
|
||||
play: (id: string, executable?: string, withoutCopy?: boolean) => Promise<void>;
|
||||
/**
|
||||
* Starts an installed app. Without the player's copy of its game that it needs, asks for it first, unless `withoutCopy`.
|
||||
* `shortcut`: for a desktop or Steam shortcut, which starts the game itself once its saves are in line
|
||||
* (shortcut_play.rs); what Play would ask the player about first, the shortcut says to do in Quiver instead.
|
||||
*/
|
||||
play: (id: string, executable?: string, withoutCopy?: boolean, shortcut?: ShortcutPlay) => Promise<void>;
|
||||
/** Runs a Windows installer's setup again, for the version installed. */
|
||||
reinstall: (id: string) => Promise<void>;
|
||||
/** Stops a download; whatever was installed before stays as it was. */
|
||||
@@ -1802,11 +1807,11 @@ function LauncherState({ saved, children }: { saved: Saved; children: ReactNode
|
||||
const syncFolder = savesOn(config.os) ? settings.syncFolder : undefined;
|
||||
/** Said once each time the launcher runs: a folder on a drive that's unplugged fails for every backup. */
|
||||
const folderFailed = useRef(false);
|
||||
/** Keeps a backup that was just made in the sync folder too; never waited for. */
|
||||
/** Keeps a backup that was just made in the sync folder too. Never waited for by Play; resolves once it's there, or failed. */
|
||||
const sendToFolder = (id: string, install: Install, made: SaveBackup) => {
|
||||
const folder = forUsage.current.settings.syncFolder;
|
||||
if (!folder || !savesOn(config.os)) return;
|
||||
native.savesFolderPut(savesOf(id, install, forUsage.current.catalog[id]), folder, made.name).then(
|
||||
if (!folder || !savesOn(config.os)) return Promise.resolve();
|
||||
return native.savesFolderPut(savesOf(id, install, forUsage.current.catalog[id]), folder, made.name).then(
|
||||
() => ((folderFailed.current = false), savesChanged(id)),
|
||||
(e) => {
|
||||
if (folderFailed.current) return;
|
||||
@@ -1815,16 +1820,17 @@ function LauncherState({ saved, children }: { saved: Saved; children: ReactNode
|
||||
},
|
||||
);
|
||||
};
|
||||
/** Sends a backup that was just made to the sync folder and to the account; never waited for. */
|
||||
const sendToCloud = (id: string, install: Install, made: SaveBackup | null | undefined) => {
|
||||
if (made) sendToFolder(id, install, made);
|
||||
/** Sends a backup that was just made to the sync folder and to the account. Never waited for by Play; resolves once both are done. */
|
||||
const sendToCloud = (id: string, install: Install, made: SaveBackup | null | undefined): Promise<unknown> => {
|
||||
const folder = made ? sendToFolder(id, install, made) : Promise.resolve();
|
||||
const api = made && cloudNow.current(id);
|
||||
if (!api || !made) return;
|
||||
void native
|
||||
if (!api || !made) return folder;
|
||||
const cloud = native
|
||||
.savesCloud(savesOf(id, install, forUsage.current.catalog[id]))
|
||||
.then((state) => (state.off ? null : sendBackup(savesOf(id, install, forUsage.current.catalog[id]), id, made, { api, native })))
|
||||
.then(() => savesChanged(id))
|
||||
.catch(() => {});
|
||||
return Promise.all([folder, cloud]);
|
||||
};
|
||||
// How each send to the account went (cloud-saves.ts). One that didn't get there is tried again after 1, 5, 15 and 60
|
||||
// minutes. One the account had no room for is said once, with ways to make room, and sent when there is some.
|
||||
@@ -1871,21 +1877,25 @@ function LauncherState({ saved, children }: { saved: Saved; children: ReactNode
|
||||
.catch(() => {});
|
||||
};
|
||||
useEffect(() => {
|
||||
const closed = native.onAppClosed(({ id, seconds }) => {
|
||||
const closed = native.onAppClosed(({ id, seconds, via, ended }) => {
|
||||
const { catalog, installs } = forUsage.current;
|
||||
track("app_closed", { ...playedRef(appRef(id, catalog[id]?.slug ?? ""), installs[id]?.version ?? ""), seconds });
|
||||
track("app_closed", { ...playedRef(appRef(id, catalog[id]?.slug ?? ""), installs[id]?.version ?? ""), seconds, via: via ?? "play", ...(ended ? { ended } : {}) });
|
||||
// Its saves, backed up if the session changed them.
|
||||
const install = installs[id];
|
||||
if (install && savesOn(config.os))
|
||||
void native.savesPlayed(savesOf(id, install, catalog[id])).then(
|
||||
(made) => {
|
||||
if (made) savesChanged(id);
|
||||
sendToCloud(id, install, made);
|
||||
tellCatalog(id, install, true);
|
||||
},
|
||||
// Refused as too big to be saves, say: the catalog hears of that too.
|
||||
() => tellCatalog(id, install, false),
|
||||
);
|
||||
const sent =
|
||||
install && savesOn(config.os)
|
||||
? native.savesPlayed(savesOf(id, install, catalog[id])).then(
|
||||
(made) => {
|
||||
if (made) savesChanged(id);
|
||||
tellCatalog(id, install, true);
|
||||
return sendToCloud(id, install, made);
|
||||
},
|
||||
// Refused as too big to be saves, say: the catalog hears of that too.
|
||||
() => tellCatalog(id, install, false),
|
||||
)
|
||||
: Promise.resolve();
|
||||
// A Quiver a shortcut started quits once they're sent (shortcut_play.rs).
|
||||
if (via) void sent.finally(() => native.shortcutDone().catch(() => {}));
|
||||
});
|
||||
// Once the catalog and the account have had time to come in, so its counts are of the library as it is.
|
||||
const counted = setTimeout(() => {
|
||||
@@ -2991,26 +3001,55 @@ function LauncherState({ saved, children }: { saved: Saved; children: ReactNode
|
||||
add(entry);
|
||||
await installEntry(entry, release, { pin: options?.pin, unverified: options?.unverified || Boolean(options?.blocked), blocked: options?.blocked, asset: options?.asset, platform: options?.platform, to: options?.to, early: options?.early });
|
||||
},
|
||||
async play(id, executable, withoutCopy) {
|
||||
async play(id, executable, withoutCopy, shortcut) {
|
||||
/**
|
||||
* A shortcut's app doesn't start: with what to say, which a Quiver the shortcut started shows its window for
|
||||
* first, so it stays open with it rather than quitting with nothing left to do.
|
||||
*/
|
||||
const refuse = (why?: string) => {
|
||||
if (why) setNotice(why, { stays: Boolean(shortcut) });
|
||||
if (!shortcut) return;
|
||||
const shown = why && shortcut.hidden ? native.shortcutWindow(true).catch(() => {}) : Promise.resolve();
|
||||
void shown.then(() => native.shortcutRefuse(shortcut.request, why ?? "")).catch(() => {});
|
||||
};
|
||||
const install = installs[id];
|
||||
if (!install) return;
|
||||
if (appMoves[id]) return setNotice(t`Wait for it to finish moving, then play it.`);
|
||||
if (!install) return refuse(shortcut ? t`That shortcut's app isn't installed any more.` : undefined);
|
||||
const name = catalog[id]?.projectName ?? install.folder;
|
||||
if (appMoves[id]) return refuse(t`Wait for it to finish moving, then play it.`);
|
||||
// The game needs the player's own copy, which Quiver gets to it: asked for first.
|
||||
if (!withoutCopy && copiesNeeded(catalog[id], install, config.os).length) return setUpCopy({ id, play: true });
|
||||
// The programs the player picked for Play: one starts; more, and they choose.
|
||||
// From a shortcut too, which waits meanwhile: a Quiver it started shows its window for the question, and
|
||||
// whatever the player chooses that plays (the copy, Play without it, already set up) starts it through the shortcut.
|
||||
if (!withoutCopy && copiesNeeded(catalog[id], install, config.os).length) {
|
||||
if (shortcut?.hidden) await native.shortcutWindow(true).catch(() => {});
|
||||
return setUpCopy({ id, play: true, ...(shortcut ? { shortcut } : {}) });
|
||||
}
|
||||
// The programs the player picked for Play: one starts; more, and they choose (a shortcut starts the first).
|
||||
const programs = install.launch?.programs ?? [];
|
||||
if (!executable && programs.length > 1) return chooseProgram(id);
|
||||
if (!executable && programs.length > 1 && !shortcut) return chooseProgram(id);
|
||||
const chosen = executable ?? programs[0];
|
||||
const launch = { ...install.launch, ...(chosen ? { executable: chosen } : {}), windowsRunner: settings.windowsRunner, copies: launchCopies(catalog[id], install) };
|
||||
let program = install.program;
|
||||
// A Windows installer's program the player didn't choose after its setup: they choose it now.
|
||||
if (install.installer && !program) {
|
||||
if (shortcut) return refuse(t`Play ${name} from Quiver once, to choose the program its setup installed.`);
|
||||
program = (await native.pickProgram().catch(() => null)) ?? undefined;
|
||||
if (!program) return;
|
||||
}
|
||||
setInstalls((i) => ({ ...i, [id]: { ...i[id], lastPlayed: Date.now(), ...(program ? { program } : {}) } }));
|
||||
const ref = appRef(id, catalog[id]?.slug ?? allItems.find((i) => i.id === id)?.slug ?? "");
|
||||
const played = { ...playedRef(ref, install.version), wine: Boolean(install.wine) };
|
||||
const played = { ...playedRef(ref, install.version), wine: Boolean(install.wine), via: shortcut ? (shortcut.hidden ? "shortcut_hidden" : "shortcut") : "play" };
|
||||
const asking = (conflict: Conflict) => new Promise<"cloud" | "here" | null>((resolve) => setSavesConflict({ ...conflict, answer: (keep) => (setSavesConflict(null), resolve(keep)) }));
|
||||
// A Quiver a shortcut started has no window: it shows one for the question, and hides it again once answered.
|
||||
const ask = !shortcut?.hidden
|
||||
? asking
|
||||
: async (conflict: Conflict) => {
|
||||
await native.shortcutWindow(true).catch(() => {});
|
||||
try {
|
||||
return await asking(conflict);
|
||||
} finally {
|
||||
void native.shortcutWindow(false).catch(() => {});
|
||||
}
|
||||
};
|
||||
// On the player's Discord profile while it runs: its square icon, else its box art.
|
||||
const entry = catalog[id];
|
||||
const presence = entry?.projectName ? { name: entry.projectName, image: entry.artwork || entry.libraryArt?.capsule || entry.libraryArt?.header || undefined } : undefined;
|
||||
@@ -3022,9 +3061,9 @@ function LauncherState({ saved, children }: { saved: Saved; children: ReactNode
|
||||
api: cloud,
|
||||
native,
|
||||
changed: savesChanged,
|
||||
ask: (conflict) => new Promise((resolve) => setSavesConflict({ ...conflict, answer: (keep) => (setSavesConflict(null), resolve(keep)) })),
|
||||
ask,
|
||||
}).catch(() => ({ go: true }) as Awaited<ReturnType<typeof beforePlay>>);
|
||||
if (!synced.go) return;
|
||||
if (!synced.go) return refuse();
|
||||
const device = synced.fetched?.device;
|
||||
if (device) setNotice(t`Your saves from ${device} were put in place. The saves that were here are backed up.`);
|
||||
else if (synced.problem !== undefined) setNotice(synced.problem || t`Couldn't get your cloud saves. The app starts with the saves on this computer.`, { stays: true });
|
||||
@@ -3035,9 +3074,9 @@ function LauncherState({ saved, children }: { saved: Saved; children: ReactNode
|
||||
const synced = await folderBeforePlay(savesOf(id, { ...install, program }, entry), named, syncFolder, {
|
||||
native,
|
||||
changed: savesChanged,
|
||||
ask: (conflict) => new Promise((resolve) => setSavesConflict({ ...conflict, answer: (keep) => (setSavesConflict(null), resolve(keep)) })),
|
||||
ask,
|
||||
}).catch(() => ({ go: true }) as Awaited<ReturnType<typeof folderBeforePlay>>);
|
||||
if (!synced.go) return;
|
||||
if (!synced.go) return refuse();
|
||||
const device = synced.fetched?.device;
|
||||
if (device) setNotice(t`Your saves from ${device} were put in place from your sync folder. The saves that were here are backed up.`);
|
||||
else if (synced.problem !== undefined) setNotice(synced.problem || t`Couldn't get the saves in your sync folder. The app starts with the saves on this computer.`, { stays: true });
|
||||
@@ -3046,7 +3085,13 @@ function LauncherState({ saved, children }: { saved: Saved; children: ReactNode
|
||||
if (savesOn(config.os)) await native.savesWatch(savesOf(id, { ...install, program }, catalog[id])).catch(() => {});
|
||||
// The catalog's programs as they are now: a fix to them reaches this app without an update.
|
||||
const patterns = program || launch?.executable ? install.executables : startPatterns(install, entry, config.os);
|
||||
await native.launch(id, install.folder, install.dir, patterns, Boolean(install.wine), program, launch, presence).then(
|
||||
// From a shortcut, the shortcut starts it, so Steam ties its overlay, controls and Stop to the game; a window a
|
||||
// shortcut's Quiver showed for a question goes, so the game is in front.
|
||||
if (shortcut?.hidden) await native.shortcutWindow(false).catch(() => {});
|
||||
const started = shortcut
|
||||
? native.shortcutStart(shortcut.request, id, install.folder, install.dir, patterns, Boolean(install.wine), program, launch, presence)
|
||||
: native.launch(id, install.folder, install.dir, patterns, Boolean(install.wine), program, launch, presence);
|
||||
await started.then(
|
||||
() => {
|
||||
musicForGame();
|
||||
track("app_launched", played);
|
||||
@@ -3059,6 +3104,8 @@ function LauncherState({ saved, children }: { saved: Saved; children: ReactNode
|
||||
// Windows asked for administrator rights and the player said no.
|
||||
if (e === "cancelled") return;
|
||||
fail(id, e);
|
||||
// What went wrong is on its card, in a window a shortcut's Quiver shows for it.
|
||||
if (shortcut?.hidden) void native.shortcutWindow(true).catch(() => {});
|
||||
track("app_launch_failed", { ...played, reason: reasonOf(e), error: failureKind(e) });
|
||||
// No program found: what is there says why, since it's different apps on every system.
|
||||
const kinds = e === NO_PROGRAM ? await native.fileKinds(install.folder, install.dir).catch(() => null) : null;
|
||||
@@ -3385,6 +3432,39 @@ function LauncherState({ saved, children }: { saved: Saved; children: ReactNode
|
||||
};
|
||||
const now = useRef(value);
|
||||
now.current = value;
|
||||
// Desktop and Steam shortcuts start their app through Quiver (shortcut_play.rs): Play's steps, then the shortcut
|
||||
// starts the game itself. Those that asked before this page was ready are answered now.
|
||||
// Not before the account has loaded: until then cloud saves are off, and the game would start without the account's.
|
||||
useEffect(() => {
|
||||
if (!account.ready) return;
|
||||
const answer = (asked: ShortcutPlay) => void now.current.play(asked.app, undefined, false, asked);
|
||||
const listening = native.onShortcutPlay(answer);
|
||||
void native.shortcutRequests().then((waiting) => waiting.forEach(answer), () => {});
|
||||
return () => void listening.then((stop) => stop());
|
||||
}, [account.ready]);
|
||||
// A Quiver started to send an app's saves after Steam's Exit Game stopped it: backs them up, now the game has
|
||||
// closed, sends them, counts the session if no one did, and quits.
|
||||
const uploading = useRef(false);
|
||||
const upload = config.shortcut?.upload;
|
||||
useEffect(() => {
|
||||
if (!upload || uploading.current || !account.ready) return;
|
||||
uploading.current = true;
|
||||
const [id, seconds] = upload;
|
||||
const install = installs[id];
|
||||
if (seconds !== null) track("app_closed", { ...playedRef(appRef(id, catalog[id]?.slug ?? ""), install?.version ?? ""), seconds, via: "shortcut_hidden", ended: "handed_off" });
|
||||
const send = async () => {
|
||||
if (!install || !savesOn(config.os)) return;
|
||||
const of = savesOf(id, install, catalog[id]);
|
||||
const made = await native.savesPlayed(of).catch(() => null);
|
||||
if (made) savesChanged(id);
|
||||
// Backed up already (the game closed before Steam stopped it): the newest backup, which the account may not have.
|
||||
const newest = made ?? (await native.savesInfo(of).catch(() => null))?.backups[0];
|
||||
await sendToCloud(id, install, newest);
|
||||
};
|
||||
void send()
|
||||
.catch(() => {})
|
||||
.finally(() => native.shortcutDone().catch(() => {}));
|
||||
}, [account.ready]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
return (
|
||||
<LauncherNow.Provider value={now}>
|
||||
<LauncherContext.Provider value={value}>{children}</LauncherContext.Provider>
|
||||
|
||||
@@ -49,6 +49,37 @@ app's saves load on any system. The player can still restore any copy from the S
|
||||
The check never holds an app back for long: when the account can't be reached within a few seconds, the app starts
|
||||
with the saves on the computer.
|
||||
|
||||
## From a shortcut
|
||||
|
||||
A desktop shortcut or a Steam shortcut made in Quiver starts the game through Quiver
|
||||
(`apps/launcher/src-tauri/src/shortcut_play.rs`), so the same happens as with Play: the saves are brought in line
|
||||
before the game starts, and backed up and sent after it closes. The shortcut runs `quiver --launch <app>`. That finds
|
||||
the Quiver that's open, or starts one with no window, which works out the game's command as Play would, with the
|
||||
player's launch options as they are now. Anything the player adds to the shortcut's own arguments goes after the
|
||||
game's.
|
||||
|
||||
The shortcut starts the game itself, not Quiver: Steam ties its overlay, the shortcut's controller settings, its
|
||||
"playing" status and its Stop to the program it started and what that starts. A game started by another program has
|
||||
none of them, and Game Mode doesn't show it at all.
|
||||
|
||||
- **A question to ask** (both sides changed): a Quiver the shortcut started shows its window for it, then hides it
|
||||
again. In Game Mode that works because that Quiver runs among the shortcut's processes, which Game Mode shows.
|
||||
- **What Play would ask first:** for the player's copy of the game, the window shows the same question, and setting it
|
||||
up, Play without it and "I've already set it up" all start the game through the shortcut; Cancel tells it not to.
|
||||
With several programs, the shortcut starts the first; for the program a Windows installer put somewhere, it says to
|
||||
play it from Quiver once.
|
||||
- **Steam's Stop (Windows)** ends the shortcut and the game at once. A Quiver the shortcut starts there runs outside
|
||||
Steam's processes, so it's still there to back up and send the saves.
|
||||
- **Steam's Exit Game (Linux)** asks the shortcut's processes to stop and ends them two seconds later. The shortcut
|
||||
starts a Quiver outside Steam's processes at once (`systemd-run --user`, or `flatpak run` on the host for the Flatpak)
|
||||
with `--upload-saves`, which backs up the saves once the game has closed, sends them and quits. Offline, the backup
|
||||
waits on the computer, and the next start of the app sends it.
|
||||
|
||||
A Quiver a shortcut started quits once the saves are sent, unless the player opened its window. Each step is noted in
|
||||
`quiver.log` ("shortcut: …"). Quiver listens for
|
||||
shortcuts on 127.0.0.1, at a port written to `shortcuts.json` in its data folder with a token only the player's own
|
||||
programs can read.
|
||||
|
||||
## Limits
|
||||
|
||||
The site sets them, and the launcher shows what the site says: by default 250 MB an account, the 5 newest copies of
|
||||
|
||||
+3
-1
@@ -18,7 +18,9 @@ The launcher sends named events only (`apps/launcher/src/telemetry.ts`):
|
||||
pinned and hidden (`library_loaded`, each launch), and once a day each catalog app installed, with its version, how
|
||||
it updates and whether an update is waiting (`app_on_computer`, at most 40).
|
||||
- **Apps:** catalog apps installed, updated, launched, closed (with the seconds played), uninstalled, added and removed,
|
||||
by slug, and when launched or closed, the version. Apps players add are named only by kind. Installs cancelled and
|
||||
by slug, and when launched or closed, the version, whether Play or a desktop or Steam shortcut started it (and
|
||||
whether that shortcut had to start Quiver), and how a shortcut's game ended: it quit, Steam's Stop or Exit Game ended
|
||||
it, or Exit Game's two seconds handed its saves to another Quiver to send. Apps players add are named only by kind. Installs cancelled and
|
||||
at what stage; failed installs and launches, why, and what kind of failure; an app's folder renamed and the apps
|
||||
folder moved; an app's menu opened and its videos played, and several apps changed at once from the library (what was changed and how many apps, not which).
|
||||
- **Mods:** the mods screen opened, and mods installed, updated, uninstalled or failing to install: the catalog app's
|
||||
|
||||
@@ -106,6 +106,7 @@ export function standInForRust({ api, state = {}, config: more = {}, maximized =
|
||||
},
|
||||
// An app's saves (saves-tab.tsx): none known and no backups; making and restoring them is the real app's to show.
|
||||
saves_info: () => ({ places: [], from: "none", backups: [] }),
|
||||
shortcut_requests: () => [],
|
||||
saves_choose: () => ({ places: [], from: "none", backups: [] }),
|
||||
saves_to_report: () => ({ os: "linux", places: [] }),
|
||||
saves_restore_plan: () => [],
|
||||
|
||||
@@ -5287,6 +5287,10 @@ msgstr "Spielen"
|
||||
msgid "Play {name}"
|
||||
msgstr "{name} spielen"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "Play {name} from Quiver once, to choose the program its setup installed."
|
||||
msgstr "Spiele {name} einmal in Quiver, um das Programm zu wählen, das sein Setup installiert hat."
|
||||
|
||||
#: ../../apps/launcher/src/settings-page.tsx
|
||||
msgid "Play a music file of your own while Quiver is open. It fades out while you play."
|
||||
msgstr "Spiele eine eigene Musikdatei, solange Quiver geöffnet ist. Beim Spielen wird sie ausgeblendet."
|
||||
@@ -7073,6 +7077,10 @@ msgstr "Dieses Bild wurde nicht geladen."
|
||||
msgid "That playlist isn't shared any more, or the link is wrong."
|
||||
msgstr "Diese Playlist wird nicht mehr geteilt, oder der Link ist falsch."
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "That shortcut's app isn't installed any more."
|
||||
msgstr "Die App dieser Verknüpfung ist nicht mehr installiert."
|
||||
|
||||
#: ../../apps/launcher/src/account.tsx
|
||||
msgid "That sign-in took too long. Try again."
|
||||
msgstr "Die Anmeldung hat zu lange gedauert. Versuche es erneut."
|
||||
|
||||
@@ -5286,6 +5286,10 @@ msgstr "Play"
|
||||
msgid "Play {name}"
|
||||
msgstr "Play {name}"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "Play {name} from Quiver once, to choose the program its setup installed."
|
||||
msgstr "Play {name} from Quiver once, to choose the program its setup installed."
|
||||
|
||||
#: ../../apps/launcher/src/settings-page.tsx
|
||||
msgid "Play a music file of your own while Quiver is open. It fades out while you play."
|
||||
msgstr "Play a music file of your own while Quiver is open. It fades out while you play."
|
||||
@@ -7072,6 +7076,10 @@ msgstr "That picture didn't load."
|
||||
msgid "That playlist isn't shared any more, or the link is wrong."
|
||||
msgstr "That playlist isn't shared any more, or the link is wrong."
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "That shortcut's app isn't installed any more."
|
||||
msgstr "That shortcut's app isn't installed any more."
|
||||
|
||||
#: ../../apps/launcher/src/account.tsx
|
||||
msgid "That sign-in took too long. Try again."
|
||||
msgstr "That sign-in took too long. Try again."
|
||||
|
||||
@@ -5287,6 +5287,10 @@ msgstr "Jugar"
|
||||
msgid "Play {name}"
|
||||
msgstr "Jugar {name}"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "Play {name} from Quiver once, to choose the program its setup installed."
|
||||
msgstr "Juega {name} una vez desde Quiver para elegir el programa que instaló su instalador."
|
||||
|
||||
#: ../../apps/launcher/src/settings-page.tsx
|
||||
msgid "Play a music file of your own while Quiver is open. It fades out while you play."
|
||||
msgstr "Reproduce un archivo de música propio mientras Quiver está abierto. Se desvanece mientras juegas."
|
||||
@@ -7073,6 +7077,10 @@ msgstr "Esa imagen no se cargó."
|
||||
msgid "That playlist isn't shared any more, or the link is wrong."
|
||||
msgstr "Esa playlist ya no se comparte o el enlace es incorrecto."
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "That shortcut's app isn't installed any more."
|
||||
msgstr "La app de ese acceso directo ya no está instalada."
|
||||
|
||||
#: ../../apps/launcher/src/account.tsx
|
||||
msgid "That sign-in took too long. Try again."
|
||||
msgstr "El inicio de sesión tardó demasiado. Inténtalo de nuevo."
|
||||
|
||||
@@ -5287,6 +5287,10 @@ msgstr "Jouer"
|
||||
msgid "Play {name}"
|
||||
msgstr "Jouer à {name}"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "Play {name} from Quiver once, to choose the program its setup installed."
|
||||
msgstr "Lance {name} une fois depuis Quiver pour choisir le programme que son installation a mis en place."
|
||||
|
||||
#: ../../apps/launcher/src/settings-page.tsx
|
||||
msgid "Play a music file of your own while Quiver is open. It fades out while you play."
|
||||
msgstr "Jouez votre propre fichier musical tant que Quiver est ouvert. Il s'estompe pendant que vous jouez."
|
||||
@@ -7073,6 +7077,10 @@ msgstr "Cette image ne s'est pas chargée."
|
||||
msgid "That playlist isn't shared any more, or the link is wrong."
|
||||
msgstr "Cette playlist n'est plus partagée, ou le lien est incorrect."
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "That shortcut's app isn't installed any more."
|
||||
msgstr "L'app de ce raccourci n'est plus installée."
|
||||
|
||||
#: ../../apps/launcher/src/account.tsx
|
||||
msgid "That sign-in took too long. Try again."
|
||||
msgstr "La connexion a pris trop de temps. Réessayez."
|
||||
|
||||
@@ -5287,6 +5287,10 @@ msgstr "Gioca"
|
||||
msgid "Play {name}"
|
||||
msgstr "Avvia {name}"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "Play {name} from Quiver once, to choose the program its setup installed."
|
||||
msgstr "Avvia {name} una volta da Quiver per scegliere il programma installato dalla sua installazione."
|
||||
|
||||
#: ../../apps/launcher/src/settings-page.tsx
|
||||
msgid "Play a music file of your own while Quiver is open. It fades out while you play."
|
||||
msgstr "Riproduci un tuo file musicale mentre Quiver è aperto. Si abbassa mentre giochi."
|
||||
@@ -7073,6 +7077,10 @@ msgstr "Quell'immagine non si è caricata."
|
||||
msgid "That playlist isn't shared any more, or the link is wrong."
|
||||
msgstr "Quella playlist non è più condivisa, o il link è sbagliato."
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "That shortcut's app isn't installed any more."
|
||||
msgstr "L'app di questo collegamento non è più installata."
|
||||
|
||||
#: ../../apps/launcher/src/account.tsx
|
||||
msgid "That sign-in took too long. Try again."
|
||||
msgstr "L'accesso ha richiesto troppo tempo. Riprova."
|
||||
|
||||
@@ -5287,6 +5287,10 @@ msgstr "플레이"
|
||||
msgid "Play {name}"
|
||||
msgstr "{name} 플레이"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "Play {name} from Quiver once, to choose the program its setup installed."
|
||||
msgstr "Quiver에서 {name}을(를) 한 번 실행해서 설치 프로그램이 설치한 프로그램을 골라 주세요."
|
||||
|
||||
#: ../../apps/launcher/src/settings-page.tsx
|
||||
msgid "Play a music file of your own while Quiver is open. It fades out while you play."
|
||||
msgstr "Quiver가 열려 있는 동안 내 음악 파일을 재생합니다. 게임 중에는 소리가 줄어듭니다."
|
||||
@@ -7073,6 +7077,10 @@ msgstr "이미지를 불러오지 못했습니다."
|
||||
msgid "That playlist isn't shared any more, or the link is wrong."
|
||||
msgstr "더 이상 공유되지 않는 재생 목록이거나 링크가 잘못됐어요."
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "That shortcut's app isn't installed any more."
|
||||
msgstr "이 바로 가기의 앱은 더 이상 설치되어 있지 않아요."
|
||||
|
||||
#: ../../apps/launcher/src/account.tsx
|
||||
msgid "That sign-in took too long. Try again."
|
||||
msgstr "로그인이 너무 오래 걸렸어요. 다시 시도해 주세요."
|
||||
|
||||
@@ -5287,6 +5287,10 @@ msgstr "Jogar"
|
||||
msgid "Play {name}"
|
||||
msgstr "Jogar {name}"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "Play {name} from Quiver once, to choose the program its setup installed."
|
||||
msgstr "Jogue {name} uma vez pelo Quiver para escolher o programa que o instalador dele instalou."
|
||||
|
||||
#: ../../apps/launcher/src/settings-page.tsx
|
||||
msgid "Play a music file of your own while Quiver is open. It fades out while you play."
|
||||
msgstr "Toque um arquivo de música seu enquanto o Quiver estiver aberto. Ele some enquanto você joga."
|
||||
@@ -7073,6 +7077,10 @@ msgstr "Essa imagem não carregou."
|
||||
msgid "That playlist isn't shared any more, or the link is wrong."
|
||||
msgstr "Essa playlist não é mais compartilhada, ou o link está errado."
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "That shortcut's app isn't installed any more."
|
||||
msgstr "O app desse atalho não está mais instalado."
|
||||
|
||||
#: ../../apps/launcher/src/account.tsx
|
||||
msgid "That sign-in took too long. Try again."
|
||||
msgstr "O login demorou demais. Tente de novo."
|
||||
|
||||
@@ -5287,6 +5287,10 @@ msgstr "Играть"
|
||||
msgid "Play {name}"
|
||||
msgstr "Запустить {name}"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "Play {name} from Quiver once, to choose the program its setup installed."
|
||||
msgstr "Запустите {name} один раз из Quiver, чтобы выбрать программу, которую установил его установщик."
|
||||
|
||||
#: ../../apps/launcher/src/settings-page.tsx
|
||||
msgid "Play a music file of your own while Quiver is open. It fades out while you play."
|
||||
msgstr "Воспроизводите свой музыкальный файл, пока Quiver открыт. Во время игры он затихает."
|
||||
@@ -7073,6 +7077,10 @@ msgstr "Это изображение не загрузилось."
|
||||
msgid "That playlist isn't shared any more, or the link is wrong."
|
||||
msgstr "Доступ к этому плейлисту закрыт, или ссылка неверна."
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "That shortcut's app isn't installed any more."
|
||||
msgstr "Приложение этого ярлыка больше не установлено."
|
||||
|
||||
#: ../../apps/launcher/src/account.tsx
|
||||
msgid "That sign-in took too long. Try again."
|
||||
msgstr "Вход занял слишком много времени. Попробуйте ещё раз."
|
||||
|
||||
@@ -5287,6 +5287,10 @@ msgstr "游玩"
|
||||
msgid "Play {name}"
|
||||
msgstr "游玩 {name}"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "Play {name} from Quiver once, to choose the program its setup installed."
|
||||
msgstr "请先在 Quiver 中运行一次 {name},选择它的安装程序安装的程序。"
|
||||
|
||||
#: ../../apps/launcher/src/settings-page.tsx
|
||||
msgid "Play a music file of your own while Quiver is open. It fades out while you play."
|
||||
msgstr "Quiver 打开时播放你自己的音乐文件。开始游玩时,音乐会渐弱。"
|
||||
@@ -7073,6 +7077,10 @@ msgstr "图片加载失败。"
|
||||
msgid "That playlist isn't shared any more, or the link is wrong."
|
||||
msgstr "该播放列表已停止共享,或链接有误。"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "That shortcut's app isn't installed any more."
|
||||
msgstr "这个快捷方式对应的应用已不再安装。"
|
||||
|
||||
#: ../../apps/launcher/src/account.tsx
|
||||
msgid "That sign-in took too long. Try again."
|
||||
msgstr "登录超时。请重试。"
|
||||
|
||||
@@ -5287,6 +5287,10 @@ msgstr "遊玩"
|
||||
msgid "Play {name}"
|
||||
msgstr "遊玩 {name}"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "Play {name} from Quiver once, to choose the program its setup installed."
|
||||
msgstr "請先在 Quiver 中執行一次 {name},選擇它的安裝程式安裝的程式。"
|
||||
|
||||
#: ../../apps/launcher/src/settings-page.tsx
|
||||
msgid "Play a music file of your own while Quiver is open. It fades out while you play."
|
||||
msgstr "Quiver 開啟時播放你自己的音樂檔案。開始遊玩時,音樂會漸弱。"
|
||||
@@ -7073,6 +7077,10 @@ msgstr "圖片載入失敗。"
|
||||
msgid "That playlist isn't shared any more, or the link is wrong."
|
||||
msgstr "該播放清單已停止共享,或連結有誤。"
|
||||
|
||||
#: ../../apps/launcher/src/store.tsx
|
||||
msgid "That shortcut's app isn't installed any more."
|
||||
msgstr "這個快捷方式對應的應用程式已不再安裝。"
|
||||
|
||||
#: ../../apps/launcher/src/account.tsx
|
||||
msgid "That sign-in took too long. Try again."
|
||||
msgstr "登入超時。請重試。"
|
||||
|
||||
Reference in new issue
Block a user