Add subcategories and last revision date to launcher manifest

This commit is contained in:
2026-01-27 09:32:00 -07:00
parent 3bdc2e2360
commit 9acc71fa13
3 changed files with 21 additions and 8 deletions

View File

@@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/ -- https://www.phpmyadmin.net/
-- --
-- Host: localhost -- Host: localhost
-- Generation Time: Jan 24, 2026 at 03:57 AM -- Generation Time: Jan 27, 2026 at 04:31 PM
-- Server version: 12.1.2-MariaDB -- Server version: 12.1.2-MariaDB
-- PHP Version: 8.5.2 -- PHP Version: 8.5.2
@@ -32,7 +32,8 @@ CREATE TABLE `games` (
`name` text NOT NULL, `name` text NOT NULL,
`official` tinyint(1) NOT NULL DEFAULT 0, `official` tinyint(1) NOT NULL DEFAULT 0,
`verified` tinyint(1) NOT NULL DEFAULT 0, `verified` tinyint(1) NOT NULL DEFAULT 0,
`developer` varchar(32) DEFAULT NULL `developer` varchar(32) DEFAULT NULL,
`subcategoryNames` text NOT NULL DEFAULT '{}'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
-- -------------------------------------------------------- -- --------------------------------------------------------
@@ -69,7 +70,9 @@ CREATE TABLE `launcherversionmanifest` (
`place` bigint(20) NOT NULL DEFAULT 0, `place` bigint(20) NOT NULL DEFAULT 0,
`sha512sums` text NOT NULL DEFAULT '[]', `sha512sums` text NOT NULL DEFAULT '[]',
`sizes` text NOT NULL DEFAULT '\'[]\'', `sizes` text NOT NULL DEFAULT '\'[]\'',
`changelog` text DEFAULT NULL `changelog` text DEFAULT NULL,
`subcategory` int(11) NOT NULL DEFAULT -1,
`lastRevision` bigint(20) NOT NULL DEFAULT 0
) 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

@@ -44,7 +44,8 @@ export const games = mysqlTable('games', {
name: text('name').notNull(), name: text('name').notNull(),
official: boolean('official').default(false).notNull(), official: boolean('official').default(false).notNull(),
verified: boolean('verified').default(false).notNull(), verified: boolean('verified').default(false).notNull(),
developer: varchar('developer', { length: 32 }) developer: varchar('developer', { length: 32 }),
subcategoryNames: text('subcategoryNames').default('{}').notNull()
}) })
export const launcherVersionManifest = mysqlTable('launcherversionmanifest', { export const launcherVersionManifest = mysqlTable('launcherversionmanifest', {
@@ -62,7 +63,9 @@ export const launcherVersionManifest = mysqlTable('launcherversionmanifest', {
place: bigint('place', { mode: 'number' }).default(0).notNull(), place: bigint('place', { mode: 'number' }).default(0).notNull(),
sha512sums: text('sha512sums').default('[]').notNull(), sha512sums: text('sha512sums').default('[]').notNull(),
sizes: text('sizes').default('[]').notNull(), sizes: text('sizes').default('[]').notNull(),
changelog: text('changelog') changelog: text('changelog'),
subcategory: int('subcategory').notNull().default(-1),
lastRevision: bigint('lastRevision', { mode: 'number' }).notNull().default(0)
}) })
export const verifyCodes = mysqlTable('verifycodes', { export const verifyCodes = mysqlTable('verifycodes', {

View File

@@ -82,7 +82,9 @@ export async function handler (context: Context) {
sha512sums: launcherVersionManifest.sha512sums, sha512sums: launcherVersionManifest.sha512sums,
sizes: launcherVersionManifest.sizes, sizes: launcherVersionManifest.sizes,
place: launcherVersionManifest.place, place: launcherVersionManifest.place,
changelog: launcherVersionManifest.changelog changelog: launcherVersionManifest.changelog,
subcategory: launcherVersionManifest.subcategory,
lastRevision: launcherVersionManifest.lastRevision
}) })
.from(launcherVersionManifest) .from(launcherVersionManifest)
.where(eq(launcherVersionManifest.hidden, false)) .where(eq(launcherVersionManifest.hidden, false))
@@ -147,9 +149,14 @@ export async function handler (context: Context) {
return false return false
}) })
const gameList = await db.select().from(games).execute() const gamesListRaw = await db.select().from(games).execute()
const gamesList = gamesListRaw.map(v => ({
...v,
subcategoryNames: JSON.parse(v.subcategoryNames)
}))
connection.end() connection.end()
return jsonResponse({ versions, games: gameList }) return jsonResponse({ versions, games: gamesList })
} }