summary refs log tree commit diff
path: root/src/api/routes/downloads.ts
blob: bc0750f72d4973ffb710e9444bb8b8124ff32def (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { Router, Response, Request } from "express";
import { route } from "@fosscord/api";
import { Release, Config } from "@fosscord/util";

const router = Router();

router.get("/:branch", route({}), async (req: Request, res: Response) => {
	const { client } = Config.get();
	const { branch } = req.params;
	const { platform } = req.query;
	//TODO

	if (!platform || !["linux", "osx", "win"].includes(platform.toString()))
		return res.status(404);

	const release = await Release.findOneOrFail({
		where: { name: client.releases.upstreamVersion },
	});

	res.redirect(release[`win_url`]);
});

export default router;