Skip to content

Commit 560059e

Browse files
committed
fix types and whatnot
1 parent 2181072 commit 560059e

File tree

9 files changed

+361
-171
lines changed

9 files changed

+361
-171
lines changed

epicshop/epic-me/app/routes/authorize.tsx

Lines changed: 164 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Form } from 'react-router'
2-
import { type EpicExecutionContext } from 'workers/app.ts'
1+
import { Form, useSearchParams } from 'react-router'
32
import { z } from 'zod'
3+
import { type EpicExecutionContext } from '#types/helpers'
44
import { type Route } from './+types/authorize'
55

66
export function meta({}: Route.MetaArgs) {
@@ -93,6 +93,7 @@ export default function Authorize({
9393
actionData,
9494
}: Route.ComponentProps) {
9595
const { users } = loaderData
96+
const [searchParams] = useSearchParams()
9697

9798
return (
9899
<div className="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 p-8 dark:from-gray-900 dark:to-gray-800">
@@ -384,6 +385,167 @@ export default function Authorize({
384385
</li>
385386
</ul>
386387
</div>
388+
389+
{/* Search Parameters Form */}
390+
<section className="mt-8 rounded-xl border border-gray-200 bg-white p-6 shadow-lg dark:border-gray-700 dark:bg-gray-800">
391+
<h2 className="mb-4 text-xl font-semibold text-gray-900 dark:text-white">
392+
Update Search Parameters
393+
</h2>
394+
<p className="mb-4 text-sm text-gray-600 dark:text-gray-300">
395+
Modify the OAuth request parameters below:
396+
</p>
397+
398+
<form method="get" className="space-y-4">
399+
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
400+
<div>
401+
<label
402+
htmlFor="response_type"
403+
className="block text-sm font-medium text-gray-700 dark:text-gray-300"
404+
>
405+
Response Type
406+
</label>
407+
<p className="mt-1 text-xs text-gray-500 dark:text-gray-400">
408+
The OAuth response type (e.g., "code" for authorization code
409+
flow)
410+
</p>
411+
<input
412+
type="text"
413+
id="response_type"
414+
name="response_type"
415+
defaultValue={searchParams.get('response_type') ?? undefined}
416+
className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"
417+
/>
418+
</div>
419+
420+
<div>
421+
<label
422+
htmlFor="client_id"
423+
className="block text-sm font-medium text-gray-700 dark:text-gray-300"
424+
>
425+
Client ID
426+
</label>
427+
<p className="mt-1 text-xs text-gray-500 dark:text-gray-400">
428+
The unique identifier for the OAuth client application
429+
</p>
430+
<input
431+
type="text"
432+
id="client_id"
433+
name="client_id"
434+
defaultValue={searchParams.get('client_id') ?? undefined}
435+
className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"
436+
/>
437+
</div>
438+
439+
<div>
440+
<label
441+
htmlFor="code_challenge"
442+
className="block text-sm font-medium text-gray-700 dark:text-gray-300"
443+
>
444+
Code Challenge
445+
</label>
446+
<p className="mt-1 text-xs text-gray-500 dark:text-gray-400">
447+
The PKCE code challenge for enhanced security
448+
</p>
449+
<input
450+
type="text"
451+
id="code_challenge"
452+
name="code_challenge"
453+
defaultValue={searchParams.get('code_challenge') ?? undefined}
454+
className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"
455+
/>
456+
</div>
457+
458+
<div>
459+
<label
460+
htmlFor="code_challenge_method"
461+
className="block text-sm font-medium text-gray-700 dark:text-gray-300"
462+
>
463+
Code Challenge Method
464+
</label>
465+
<p className="mt-1 text-xs text-gray-500 dark:text-gray-400">
466+
The method used for PKCE (e.g., "S256" for SHA256)
467+
</p>
468+
<input
469+
type="text"
470+
id="code_challenge_method"
471+
name="code_challenge_method"
472+
defaultValue={
473+
searchParams.get('code_challenge_method') ?? undefined
474+
}
475+
className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"
476+
/>
477+
</div>
478+
479+
<div className="md:col-span-2">
480+
<label
481+
htmlFor="redirect_uri"
482+
className="block text-sm font-medium text-gray-700 dark:text-gray-300"
483+
>
484+
Redirect URI
485+
</label>
486+
<p className="mt-1 text-xs text-gray-500 dark:text-gray-400">
487+
The URI where the user will be redirected after authorization
488+
</p>
489+
<input
490+
type="url"
491+
id="redirect_uri"
492+
name="redirect_uri"
493+
defaultValue={searchParams.get('redirect_uri') ?? undefined}
494+
className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"
495+
/>
496+
</div>
497+
498+
<div>
499+
<label
500+
htmlFor="scope"
501+
className="block text-sm font-medium text-gray-700 dark:text-gray-300"
502+
>
503+
Scope
504+
</label>
505+
<p className="mt-1 text-xs text-gray-500 dark:text-gray-400">
506+
Space-separated list of requested permissions
507+
</p>
508+
<input
509+
type="text"
510+
id="scope"
511+
name="scope"
512+
defaultValue={searchParams.get('scope') ?? undefined}
513+
placeholder="e.g., read write"
514+
className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"
515+
/>
516+
</div>
517+
518+
<div>
519+
<label
520+
htmlFor="state"
521+
className="block text-sm font-medium text-gray-700 dark:text-gray-300"
522+
>
523+
State
524+
</label>
525+
<p className="mt-1 text-xs text-gray-500 dark:text-gray-400">
526+
Optional parameter to maintain state between request and
527+
callback
528+
</p>
529+
<input
530+
type="text"
531+
id="state"
532+
name="state"
533+
defaultValue={searchParams.get('state') ?? undefined}
534+
className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:focus:border-blue-400 dark:focus:ring-blue-400"
535+
/>
536+
</div>
537+
</div>
538+
539+
<div className="flex gap-3">
540+
<button
541+
type="submit"
542+
className="rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none dark:bg-blue-500 dark:hover:bg-blue-600 dark:focus:ring-blue-400"
543+
>
544+
Update Parameters
545+
</button>
546+
</div>
547+
</form>
548+
</section>
387549
</div>
388550
</div>
389551
)

epicshop/epic-me/app/routes/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Form } from 'react-router'
2-
import { migrate } from '../../workers/db/migrations'
3-
import { sql } from '../../workers/db/utils'
2+
import { migrate } from '#workers/db/migrations'
3+
import { sql } from '#workers/db/utils'
44
import { type Route } from './+types/index'
55

66
export function meta({}: Route.MetaArgs) {

epicshop/epic-me/app/routes/introspect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type Token } from '@cloudflare/workers-oauth-provider'
1+
import { type Token } from '#types/helpers'
22
import { type Route } from './+types/introspect'
33

44
export async function loader({ request, context }: Route.LoaderArgs) {

0 commit comments

Comments
 (0)