Scratch space for learning atproto app development

tidy

Changed files
+32 -21
src
auth
pages
public
+2 -2
.gitignore
···
dist-ssr
*.local
.env
+
*.sqlite
# Editor directories and files
!.vscode/extensions.json
···
*.ntvs*
*.njsproj
*.sln
-
*.sw?
-
*.sqlite
+
*.sw?
+3 -11
src/auth/storage.ts
···
NodeSavedState,
NodeSavedStateStore,
} from '@atproto/oauth-client-node'
-
import { Database } from '#/db'
+
import type { Database } from '#/db'
export class StateStore implements NodeSavedStateStore {
constructor(private db: Database) {}
async get(key: string): Promise<NodeSavedState | undefined> {
-
const result = await this.db
-
.selectFrom('auth_state')
-
.selectAll()
-
.where('key', '=', key)
-
.executeTakeFirst()
+
const result = await this.db.selectFrom('auth_state').selectAll().where('key', '=', key).executeTakeFirst()
if (!result) return
return JSON.parse(result.state) as NodeSavedState
}
···
export class SessionStore implements NodeSavedSessionStore {
constructor(private db: Database) {}
async get(key: string): Promise<NodeSavedSession | undefined> {
-
const result = await this.db
-
.selectFrom('auth_session')
-
.selectAll()
-
.where('key', '=', key)
-
.executeTakeFirst()
+
const result = await this.db.selectFrom('auth_session').selectAll().where('key', '=', key).executeTakeFirst()
if (!result) return
return JSON.parse(result.session) as NodeSavedSession
}
+26 -7
src/pages/public/styles.css
···
Josh's Custom CSS Reset
https://www.joshwcomeau.com/css/custom-css-reset/
*/
-
*, *::before, *::after {
+
*,
+
*::before,
+
*::after {
box-sizing: border-box;
}
* {
···
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
-
img, picture, video, canvas, svg {
+
img,
+
picture,
+
video,
+
canvas,
+
svg {
display: block;
max-width: 100%;
}
-
input, button, textarea, select {
+
input,
+
button,
+
textarea,
+
select {
font: inherit;
}
-
p, h1, h2, h3, h4, h5, h6 {
+
p,
+
h1,
+
h2,
+
h3,
+
h4,
+
h5,
+
h6 {
overflow-wrap: break-word;
}
-
#root, #__next {
+
#root,
+
#__next {
isolation: isolate;
}
/*
Common components
*/
-
button, .button {
+
button,
+
.button {
display: inline-block;
border: 0;
background-color: var(--primary-500);
···
cursor: pointer;
text-decoration: none;
}
-
button:hover, .button:hover {
+
button:hover,
+
.button:hover {
background: var(--primary-400);
}
···
.error.visible {
display: block;
}
+
#header {
background-color: #fff;
text-align: center;
+1 -1
src/routes.ts
···
import { page } from '#/lib/view'
import { home, STATUS_OPTIONS } from '#/pages/home'
import { login } from '#/pages/login'
-
import { ifString } from './lib/util'
+
import { ifString } from '#/lib/util'
type Session = { did?: string }