fix: Fixed issues on windows

feat: Implemented mouse and gamepad automatic switching
fix: Made touch screen work better on the steam deck
This commit is contained in:
Simeon Radivoev 2026-02-24 18:58:48 +02:00
parent e4df8fb9fb
commit b4a89385d0
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
24 changed files with 334 additions and 137 deletions

View file

@ -12,7 +12,6 @@ import { getDevices, getDevicesCurated } from "./drives";
import getFolderSize from "get-folder-size";
import si from 'systeminformation';
// steam://open/keyboard?XPosition=%i&YPosition=%i&Width=%i&Height=%i&Mode=%d
export const system = new Elysia({ prefix: '/api/system' })
.post('/show_keyboard', async ({ body: { XPosition, YPosition, Width, Height } }) =>
{
@ -67,12 +66,23 @@ export const system = new Elysia({ prefix: '/api/system' })
.get('/drives', async () =>
{
const drives = await getDevices();
if (process.platform === 'win32')
return drives.map(d =>
{
d.mountPoint += '/';
return d;
});
return drives;
})
// Drives that are vaiable for downloads
.get('/drives/download', async () =>
{
const drives = await getDevicesCurated();
const downloadsPath = config.get('downloadPath');
let downloadsPath = config.get('downloadPath');
if (!path.isAbsolute(downloadsPath))
{
downloadsPath = path.resolve(process.cwd(), downloadsPath);
}
const currentDownloadsSize = await getFolderSize(downloadsPath);
let used = false;
const drivesDownload: DownloadsDrive[] = drives
@ -115,6 +125,7 @@ export const system = new Elysia({ prefix: '/api/system' })
drives: drivesDownload,
};
})
// Create Folder
.put('/dirs', async ({ body: { dirname, name } }) =>
{
await fs.mkdir(path.join(dirname, name));
@ -123,7 +134,11 @@ export const system = new Elysia({ prefix: '/api/system' })
})
.get('/dirs', async ({ query: { path: startingPath } }) =>
{
const currentPath = startingPath ?? dirname(Bun.main);
let currentPath = startingPath ?? dirname(process.cwd());
if (!path.isAbsolute(currentPath))
{
currentPath = path.resolve(process.cwd(), currentPath);
}
const paths = await fs.readdir(currentPath, { withFileTypes: true });
return {
name: path.basename(currentPath),