mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-08 14:41:28 -07:00
enforce steam ticket validation
This commit is contained in:
@@ -179,7 +179,7 @@ async function getUsernames(db: D1Database, ids: number[]): Promise<Map<number,
|
||||
const { results } = await db
|
||||
.prepare(
|
||||
`SELECT account_id AS id, json_extract(data, '$.username') AS username
|
||||
FROM accounts WHERE account_id IN (${placeholders(ids.length)})`
|
||||
FROM account WHERE account_id IN (${placeholders(ids.length)})`
|
||||
)
|
||||
.bind(...ids)
|
||||
.all<{ id: number; username: string }>()
|
||||
|
||||
@@ -73,7 +73,7 @@ export const imageRoutes = new Hono<App>({ strict: false })
|
||||
// account row (a JSON blob in the shared accounts table) so it sticks.
|
||||
if (savedImageType === SavedImageType.ProfileThumbnail) {
|
||||
await c.env.DB.prepare(
|
||||
"UPDATE accounts SET data = json_set(data, '$.profileImage', ?2) WHERE account_id = ?1"
|
||||
"UPDATE account SET data = json_set(data, '$.profileImage', ?2) WHERE account_id = ?1"
|
||||
)
|
||||
.bind(id, name)
|
||||
.run()
|
||||
|
||||
@@ -55,13 +55,13 @@ beforeAll(async () => {
|
||||
// profile thumbnails on the account row. Seed the account the test token (sub
|
||||
// 42) authenticates as.
|
||||
await env.DB.prepare(
|
||||
`CREATE TABLE IF NOT EXISTS accounts (
|
||||
`CREATE TABLE IF NOT EXISTS account (
|
||||
data TEXT NOT NULL,
|
||||
account_id INTEGER GENERATED ALWAYS AS (json_extract(data, '$.accountId')) VIRTUAL,
|
||||
username_lower TEXT GENERATED ALWAYS AS (lower(json_extract(data, '$.username'))) VIRTUAL
|
||||
)`
|
||||
).run()
|
||||
await env.DB.prepare('INSERT OR IGNORE INTO accounts (data) VALUES (?1)')
|
||||
await env.DB.prepare('INSERT OR IGNORE INTO account (data) VALUES (?1)')
|
||||
.bind(
|
||||
JSON.stringify({ accountId: 42, username: 'Tester', profileImage: 'DefaultProfileImage.jpg' })
|
||||
)
|
||||
@@ -477,7 +477,7 @@ describe('images', () => {
|
||||
)
|
||||
|
||||
// The account row now points its profileImage at the uploaded key.
|
||||
const row = await env.DB.prepare('SELECT data FROM accounts WHERE account_id = 42').first<{
|
||||
const row = await env.DB.prepare('SELECT data FROM account WHERE account_id = 42').first<{
|
||||
data: string
|
||||
}>()
|
||||
expect(JSON.parse(row!.data).profileImage).toBe(ImageName)
|
||||
|
||||
Reference in New Issue
Block a user