feat: implemented storage management

fix: Enabled fallback secrets
feat: Made header stats actually work
feat: Made steam deck keyboard auto open for some inputs
fix: Made keybaord also work with shortcuts (no tooltips yet)
This commit is contained in:
Simeon Radivoev 2026-02-24 00:30:16 +02:00
parent 62f16cbcc1
commit e4df8fb9fb
Signed by: simeonradivoev
GPG key ID: C16C2132A7660C8E
55 changed files with 1675 additions and 398 deletions

View file

@ -1,11 +1,13 @@
import { SERVER_URL } from "../../shared/constants";
import os from 'node:os';
import path, { dirname } from 'node:path';
import path from 'node:path';
import { getBrowserPath } from "./get-browser";
import { host, isSteamDeckGameMode } from "../utils";
import { isSteamDeckGameMode } from "../utils";
import { config } from "../api/app";
import { ensureDir } from 'fs-extra';
import { host } from "./host";
export async function BuildParams ()
export async function BuildParams (data: { configPath: string; })
{
const validBrowser = await getBrowserPath({
browserOrder: ['chrome', 'chromium']
@ -28,15 +30,19 @@ export async function BuildParams ()
const isEdge = validBrowser.path.toLowerCase().includes('edge') || validBrowser.path.toLowerCase().includes('msedge');
console.log(`[Browser] Detected: ${validBrowser.type} from ${validBrowser.source} - ${isEdge ? 'Edge' : 'Chrome/Chromium'}`);
const dataPath = path.join(data.configPath, 'browser-data');
await ensureDir(dataPath);
args.push(`--app=${SERVER_URL(host)}`);
args.push(`--app-id=gameflow`);
args.push(`--force-app-mode`);
args.push('--no-default-browser-check');
args.push('--new-instance');
args.push('--no-first-run');
args.push('--disable-infobars');
args.push("--disable-extensions");
args.push("--disable-plugins");
args.push(`--user-data-dir=${path.join(dirname(config.path), 'browser-data')}`);
args.push(`--user-data-dir=${dataPath}`);
args.push('--disable-sync'); //Disable syncing to a Google account
args.push('--disable-sync-preferences');
args.push('--disable-component-update');

View file

@ -1,7 +1,4 @@
import { $, type Subprocess } from "bun";
import path from 'node:path';
import { readFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
import os from 'node:os';
export type RunBrowserType = "chrome" | "chromium" | "firefox" | "edge";
@ -25,6 +22,7 @@ interface SpawnBrowserOptions
detached?: boolean;
execPath: string; // Required: browser executable path from get-browser.ts
source: RunBrowserSource; // How the browser was discovered (running, system, or flatpak)
configPath: string;
onExit?: () => void; // Called when the browser exists duh
ipc?: (message: string) => void;
}
@ -69,7 +67,8 @@ export async function spawnBrowser ({
execPath,
source,
onExit,
ipc
ipc,
configPath
}: SpawnBrowserOptions): Promise<Subprocess>
{
// Configuration for both Flatpak and Native
@ -117,6 +116,7 @@ export async function spawnBrowser ({
"--branch=stable",
`--arch=${process.arch === "x64" ? "x86_64" : process.arch}`, // map node arch to flatpak arch
`--command=${target.internalCmd}`,
`--filesystem=${configPath}`, // we must allw it to use our own config path to save profile data
"--file-forwarding",
...envFlags // Inject env vars here
];

7
src/bun/utils/host.ts Normal file
View file

@ -0,0 +1,7 @@
import { networkInterfaces } from "node:os";
const localIp = Object.values(networkInterfaces())
.flat()
.find((iface) => iface?.family === 'IPv4' && !iface.internal)?.address || 'localhost';
export const host = process.env.PUBLIC_ACCESS ? localIp : 'localhost';