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

@ -32,7 +32,7 @@ export async function getDevices (): Promise<Drive[]>
{
const blockDevicesRaw = await si.blockDevices();
const layout = await si.diskLayout();
const blockDevices = blockDevicesRaw.filter(l => l.device && l.type === 'part' && l.mount);
const blockDevices = blockDevicesRaw.filter(l => l.device && (l.type === 'part' || l.type === 'disk') && l.mount);
const fsSizes = await si.fsSize();
const sizes = new Map(fsSizes.map(s => [s.mount, s]));
const layoutMap = new Map(layout.map(l => [l.device, l]));
@ -65,26 +65,29 @@ export async function getDevicesCurated (): Promise<Drive[]>
const devices = await getDevices();
drives.push(...devices.filter(d => d.hasWriteAccess));
const homeDir = os.homedir();
const homeDirDevice = devices.filter(d => d.mountPoint).reverse()
.find(d => homeDir.startsWith(d.mountPoint!));
if (homeDirDevice)
if (process.platform !== 'win32')
{
const [hasReadAccess, hasWriteAccess] = await getAccess(homeDir);
const homeDir = os.homedir();
const homeDirDevice = devices.filter(d => d.mountPoint).reverse()
.find(d => homeDir.startsWith(d.mountPoint!));
if (homeDirDevice)
{
const [hasReadAccess, hasWriteAccess] = await getAccess(homeDir);
drives.push({
parent: homeDirDevice.parent,
device: homeDirDevice.device,
size: homeDirDevice.size,
used: homeDirDevice.used,
isRemovable: homeDirDevice.isRemovable,
mountPoint: homeDir,
type: homeDirDevice.type,
label: 'Home',
interfaceType: homeDirDevice.interfaceType,
hasReadAccess,
hasWriteAccess
});
drives.push({
parent: homeDirDevice.parent,
device: homeDirDevice.device,
size: homeDirDevice.size,
used: homeDirDevice.used,
isRemovable: homeDirDevice.isRemovable,
mountPoint: homeDir,
type: homeDirDevice.type,
label: 'Home',
interfaceType: homeDirDevice.interfaceType,
hasReadAccess,
hasWriteAccess
});
}
}
return drives;

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),