mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-08 14:41:28 -07:00
add playersettings, img, more match endpoints
This commit is contained in:
+6
-6
@@ -6,12 +6,12 @@ stubbed for now — no real KV/D1/DO bindings yet.
|
||||
|
||||
## Routes
|
||||
|
||||
| Method | Path | Description |
|
||||
| ------ | --------------------------------------------- | -------------------------------------------- |
|
||||
| GET | `/eac/challenge` | EAC challenge, served as text |
|
||||
| GET | `/cachedlogin/forplatformid/:platform/:id` | Cached logins (stubbed → `[]`) |
|
||||
| POST | `/connect/token` | OAuth token endpoint, issues a JWT |
|
||||
| GET | `/role/developer/:id` | Developer role lookup (TODO) |
|
||||
| Method | Path | Description |
|
||||
| ------ | ------------------------------------------ | ---------------------------------- |
|
||||
| GET | `/eac/challenge` | EAC challenge, served as text |
|
||||
| GET | `/cachedlogin/forplatformid/:platform/:id` | Cached logins (stubbed → `[]`) |
|
||||
| POST | `/connect/token` | OAuth token endpoint, issues a JWT |
|
||||
| GET | `/role/developer/:id` | Developer role lookup (TODO) |
|
||||
|
||||
## Notes / TODO
|
||||
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
import { Hono } from 'hono';
|
||||
import { useWorkersLogger } from 'workers-tagged-logger';
|
||||
import { Hono } from 'hono'
|
||||
import { useWorkersLogger } from 'workers-tagged-logger'
|
||||
|
||||
import { logger, withNotFound, withOnError } from '@repo/hono-helpers'
|
||||
|
||||
import { generateToken, TOKEN_TTL_SECONDS } from './jwt'
|
||||
|
||||
import { logger, withNotFound, withOnError } from '@repo/hono-helpers';
|
||||
|
||||
|
||||
|
||||
import { generateToken, TOKEN_TTL_SECONDS } from './jwt';
|
||||
|
||||
|
||||
|
||||
import type { App } from './context';
|
||||
|
||||
import type { App } from './context'
|
||||
|
||||
/** OAuth scopes granted by `/connect/token`. */
|
||||
const TOKEN_SCOPE =
|
||||
@@ -44,9 +37,9 @@ const app = new Hono<App>()
|
||||
{
|
||||
accountId: 1,
|
||||
platform: '0',
|
||||
'platformId': '0',
|
||||
'lastLoginTime': '2026-06-10T00:00:00Z',
|
||||
'requirePassword': false
|
||||
platformId: '0',
|
||||
lastLoginTime: '2026-06-10T00:00:00Z',
|
||||
requirePassword: false,
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
@@ -10,8 +10,7 @@ const DEV_SECRET = 'dev-insecure-signing-key-change-me'
|
||||
export const TOKEN_TTL_SECONDS = 3600
|
||||
|
||||
function base64url(input: ArrayBuffer | string): string {
|
||||
const bytes =
|
||||
typeof input === 'string' ? new TextEncoder().encode(input) : new Uint8Array(input)
|
||||
const bytes = typeof input === 'string' ? new TextEncoder().encode(input) : new Uint8Array(input)
|
||||
let binary = ''
|
||||
for (const byte of bytes) {
|
||||
binary += String.fromCharCode(byte)
|
||||
|
||||
@@ -26,7 +26,11 @@ describe('auth worker routes', () => {
|
||||
body: 'account_id=42&platform_id=steam-123',
|
||||
})
|
||||
expect(res.status).toBe(200)
|
||||
const json = (await res.json()) as { access_token: string; token_type: string; expires_in: number }
|
||||
const json = (await res.json()) as {
|
||||
access_token: string
|
||||
token_type: string
|
||||
expires_in: number
|
||||
}
|
||||
expect(json.token_type).toBe('Bearer')
|
||||
expect(json.expires_in).toBe(3600)
|
||||
// header.payload.signature
|
||||
|
||||
Reference in New Issue
Block a user