Add sizes to launcher manifest

This commit is contained in:
2025-11-05 10:36:40 -07:00
parent 1c1a963363
commit c3090b260a
4 changed files with 14 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/ -- https://www.phpmyadmin.net/
-- --
-- Host: localhost -- Host: localhost
-- Generation Time: Nov 05, 2025 at 01:16 AM -- Generation Time: Nov 05, 2025 at 05:35 PM
-- Server version: 12.0.2-MariaDB -- Server version: 12.0.2-MariaDB
-- PHP Version: 8.4.14 -- PHP Version: 8.4.14
@@ -68,7 +68,8 @@ CREATE TABLE `launcherversions` (
`hidden` tinyint(1) NOT NULL DEFAULT 1, `hidden` tinyint(1) NOT NULL DEFAULT 1,
`game` int(11) NOT NULL DEFAULT 0, `game` int(11) NOT NULL DEFAULT 0,
`place` int(11) NOT NULL DEFAULT 0, `place` int(11) NOT NULL DEFAULT 0,
`sha512sums` text NOT NULL DEFAULT '[]' `sha512sums` text NOT NULL DEFAULT '[]',
`sizes` text NOT NULL DEFAULT '\'[]\''
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
-- --

View File

@@ -19,7 +19,8 @@ export const launcherVersions = mysqlTable('launcherversions', {
hidden: int('hidden').notNull().default(1), hidden: int('hidden').notNull().default(1),
game: int('game').notNull().default(0).references(() => launcherGames.id), game: int('game').notNull().default(0).references(() => launcherGames.id),
place: int('place').notNull().default(0), place: int('place').notNull().default(0),
sha512sums: text('sha512sums').notNull().default("[]") sha512sums: text('sha512sums').notNull().default("[]"),
sizes: text('sizes').notNull().default("[]")
}) })
export const launcherUpdates = mysqlTable('launcherupdates', { export const launcherUpdates = mysqlTable('launcherupdates', {

View File

@@ -45,7 +45,7 @@ export async function handler(context: Context, db: MySql2Database) {
sha512sums: launcherUpdates.sha512sums sha512sums: launcherUpdates.sha512sums
}) })
.from(launcherUpdates) .from(launcherUpdates)
.where(eq(launcherUpdates.hidden, false)) .where(eq(launcherUpdates.hidden, 0))
.orderBy(desc(launcherUpdates.place)) .orderBy(desc(launcherUpdates.place))
.limit(1) .limit(1)
.execute() .execute()

View File

@@ -46,7 +46,8 @@ export async function handler(context: Context, db: MySql2Database) {
downloadUrls: launcherVersions.downloadUrls, downloadUrls: launcherVersions.downloadUrls,
platforms: launcherVersions.platforms, platforms: launcherVersions.platforms,
executables: launcherVersions.executables, executables: launcherVersions.executables,
sha512sums: launcherVersions.sha512sums sha512sums: launcherVersions.sha512sums,
sizes: launcherVersions.sizes
}).from(launcherVersions) }).from(launcherVersions)
.where(eq(launcherVersions.hidden, 0)) .where(eq(launcherVersions.hidden, 0))
.orderBy( .orderBy(
@@ -61,15 +62,18 @@ export async function handler(context: Context, db: MySql2Database) {
platforms: JSON.parse(v.platforms), platforms: JSON.parse(v.platforms),
executables: JSON.parse(v.executables), executables: JSON.parse(v.executables),
sha512sums: JSON.parse(v.sha512sums), sha512sums: JSON.parse(v.sha512sums),
sizes: JSON.parse(v.sizes),
downloadUrl: undefined as string | undefined, downloadUrl: undefined as string | undefined,
executable: undefined as string | undefined, executable: undefined as string | undefined,
sha512sum: undefined as string | undefined sha512sum: undefined as string | undefined,
size: undefined as number | undefined
})) }))
.filter(v => { .filter(v => {
if (showAll || !platString) { if (showAll || !platString) {
delete v.downloadUrl delete v.downloadUrl
delete v.executable delete v.executable
delete v.sha512sum delete v.sha512sum
delete v.size
return true return true
} }
const i = v.platforms.indexOf(platString) const i = v.platforms.indexOf(platString)
@@ -77,10 +81,12 @@ export async function handler(context: Context, db: MySql2Database) {
v.downloadUrl = v.downloadUrls[i] v.downloadUrl = v.downloadUrls[i]
v.executable = v.executables[i] v.executable = v.executables[i]
v.sha512sum = v.sha512sums[i] v.sha512sum = v.sha512sums[i]
v.size = v.sizes[i]
delete v.downloadUrls delete v.downloadUrls
delete v.platforms delete v.platforms
delete v.executables delete v.executables
delete v.sha512sums delete v.sha512sums
delete v.sizes
return true return true
} }
return false return false