Skip to content

Steam controller support and easier setup for worker - #22

Merged
AntonUden merged 10 commits into
mainfrom
steam-controller
Jun 29, 2026
Merged

Steam controller support and easier setup for worker#22
AntonUden merged 10 commits into
mainfrom
steam-controller

Conversation

@AntonUden

Copy link
Copy Markdown
Contributor

No description provided.

Comment on lines +131 to +175
], async (req: Request, res: Response) => {
/*
#swagger.path = '/images/icon'
#swagger.tags = ['Images'],
#swagger.description = "Upload a custom application icon (png, jpg, webp, gif, avif, bmp, tiff, heic, etc.). Transparency is preserved where supported. Image is scaled to 256x256."
#swagger.responses[200] = { description: "Ok" }
#swagger.responses[400] = { description: "Bad request. See console for more info" }
#swagger.security = [
{"apiKeyAuth": []},
{"tokenAuth": []}
]
*/
try {
if (!req.files?.file) {
res.status(400).send({ message: "No file named \"file\" was uploaded" });
return;
}
const file = req.files.file as fileUpload.UploadedFile;

const allowedMimeTypes = [
"image/png", "image/jpeg", "image/webp", "image/gif",
"image/bmp", "image/tiff", "image/avif", "image/svg+xml",
"image/heic", "image/heif",
];

if (!allowedMimeTypes.includes(file.mimetype)) {
res.status(400).send({ message: "Unsupported image format" });
return;
}

const dataBuffer = readFileSync(file.tempFilePath);
const outputBuffer = await sharp(dataBuffer)
.resize(256, 256)
.png()
.toBuffer();

const iconPath = resolve(this.protogen.imageDirectory + "/custom_icon.png");
writeFileSync(iconPath, outputBuffer);

this.faviconCache = null;
res.send({ message: "Icon updated" });
} catch (err) {
this.handleError(err, req, res);
}
});
return;
}

const dataBuffer = readFileSync(file.tempFilePath);
Comment on lines +177 to +201
this.router.delete("/icon", this.authMiddleware, async (req: Request, res: Response) => {
/*
#swagger.path = '/images/icon'
#swagger.tags = ['Images'],
#swagger.description = "Clear the custom application icon, reverting to the default"
#swagger.responses[200] = { description: "Ok" }
#swagger.responses[404] = { description: "No custom icon set" }
#swagger.security = [
{"apiKeyAuth": []},
{"tokenAuth": []}
]
*/
try {
const iconPath = resolve(this.protogen.imageDirectory + "/custom_icon.png");
if (!existsSync(iconPath)) {
res.status(404).send({ message: "No custom icon is set" });
return;
}
unlinkSync(iconPath);
this.faviconCache = null;
res.send({ message: "Icon cleared" });
} catch (err) {
this.handleError(err, req, res);
}
});
Comment thread backend/src/webserver/routes/images/ImageRouter.ts Dismissed
@AntonUden AntonUden changed the title Steam controller support Steam controller support and easier setup for worker Jun 29, 2026
@AntonUden
AntonUden merged commit b18127f into main Jun 29, 2026
7 of 11 checks passed
@AntonUden
AntonUden deleted the steam-controller branch June 29, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants