feat: Moved to stream zip downloading.

feat: Implemented Shortcuts.
feat: Ensured it works on steam deck
This commit is contained in:
Simeon Radivoev 2026-02-21 18:28:07 +02:00
parent f15bf9a1e0
commit 62f16cbcc1
Signed by: simeonradivoev
GPG key ID: C16C2132A7660C8E
45 changed files with 1415 additions and 631 deletions

View file

@ -2,8 +2,10 @@ import Elysia from "elysia";
import open from 'open';
import z from "zod";
import os from 'node:os';
import { events } from "./app";
import { config, events } from "./app";
import { isSteamDeckGameMode } from "../utils";
import fs from 'node:fs/promises';
import buildNotificationsStream from "./notifications";
// steam://open/keyboard?XPosition=%i&YPosition=%i&Width=%i&Height=%i&Mode=%d
export const system = new Elysia({ prefix: '/api/system' })
@ -14,8 +16,11 @@ export const system = new Elysia({ prefix: '/api/system' })
open('steam://open/keyboard');
}
})
.get('/info', () =>
.get('/info', async () =>
{
const downloadStats = await fs.statfs(config.get('downloadPath'));
return {
homeDir: os.homedir(),
user: os.userInfo().username,
@ -23,16 +28,21 @@ export const system = new Elysia({ prefix: '/api/system' })
platform: os.platform(),
hostname: os.hostname(),
steamDeck: process.env.SteamDeck,
machine: os.machine()
machine: os.machine(),
freeSpace: downloadStats.bsize * downloadStats.bavail,
totalSpace: downloadStats.bsize * downloadStats.blocks,
downloadsType: downloadStats.type
};
})
.get('/notifications', ({ set }) =>
{
set.headers["content-type"] = 'text/event-stream';
set.headers["cache-control"] = 'no-cache';
set.headers['connection'] = 'keep-alive';
return new Response(buildNotificationsStream());
})
.post('/exit', () =>
{
if (process.env.PUBLIC_ACCESS)
{
return;
}
events.emit('exitapp');
})
.post('/open', async ({ query: { url } }) =>