Add support for github host

This commit is contained in:
Lncvrt committed 2026-03-28 17:57:11 -07:00
1 parent 1b78f36a8a
commit d7da88fc90
3 files changed
+18 -13

No files matched your search

+8 -5
View File
@@ -1,5 +1,5 @@
import { Context } from 'elysia'
import { cdnFiles, launcherVersionManifest, mods } from '../../../lib/tables'
import { files, launcherVersionManifest, mods } from '../../../lib/tables'
import { getDatabaseConnection, jsonResponse } from '../../../lib/util'
import { eq, sql } from 'drizzle-orm'
@@ -13,9 +13,9 @@ export const handler = async (context: Context) => {
const downloadId = Number(context.query.downloadId)
const result = await db
.select({ path: cdnFiles.path, hash: cdnFiles.hash })
.from(cdnFiles)
.where(eq(cdnFiles.id, downloadId))
.select({ path: files.path, hash: files.hash, host: files.host })
.from(files)
.where(eq(files.id, downloadId))
.execute()
if (result.length != 1)
@@ -38,7 +38,10 @@ export const handler = async (context: Context) => {
return jsonResponse({
success: true,
data: {
url: 'https://games-r2.lncvrt.xyz/' + result[0].path,
url:
result[0].host == 1
? `https://github.com/${result[0].path[0]}/${result[0].path[1]}/releases/download/${result[0].path[2]}/${result[0].path[3]}`
: 'https://games-r2.lncvrt.xyz/' + result[0].path,
hash: result[0].hash
}
})