feat: Moved to stream zip downloading.
feat: Implemented Shortcuts. feat: Ensured it works on steam deck
This commit is contained in:
parent
f15bf9a1e0
commit
62f16cbcc1
45 changed files with 1415 additions and 631 deletions
|
|
@ -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 } }) =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue