Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place

remove app view scope

nekomimi.pet e064c292 b379b966

verified
Changed files
+27 -26
apps
main-app
+6 -5
apps/main-app/package.json
···
"screenshot": "bun run scripts/screenshot-sites.ts"
},
"dependencies": {
-
"@atproto/api": "^0.17.3",
-
"@atproto/common-web": "^0.4.5",
+
"@atproto-labs/did-resolver": "^0.2.4",
+
"@atproto/api": "^0.17.7",
+
"@atproto/common-web": "^0.4.6",
"@atproto/jwk-jose": "^0.1.11",
-
"@atproto/lex-cli": "^0.9.5",
-
"@atproto/oauth-client-node": "^0.3.9",
-
"@atproto/xrpc-server": "^0.9.5",
+
"@atproto/lex-cli": "^0.9.7",
+
"@atproto/oauth-client-node": "^0.3.12",
+
"@atproto/xrpc-server": "^0.9.6",
"@elysiajs/cors": "^1.4.0",
"@elysiajs/eden": "^1.4.3",
"@elysiajs/openapi": "^1.4.11",
+5 -4
apps/main-app/src/lib/oauth-client.ts
···
import { logger } from "./logger";
import { SlingshotHandleResolver } from "./slingshot-handle-resolver";
+
// OAuth scope for all client types
+
const OAUTH_SCOPE = 'atproto repo:place.wisp.fs repo:place.wisp.domain repo:place.wisp.subfs repo:place.wisp.settings blob:*/*';
// Session timeout configuration (30 days in seconds)
const SESSION_TIMEOUT = 30 * 24 * 60 * 60; // 2592000 seconds
// OAuth state timeout (1 hour in seconds)
···
// Loopback client for local development
// For loopback, scopes and redirect_uri must be in client_id query string
const redirectUri = 'http://127.0.0.1:8000/api/auth/callback';
-
const scope = 'atproto repo:place.wisp.fs repo:place.wisp.domain repo:place.wisp.subfs repo:place.wisp.settings blob:*/* rpc:app.bsky.actor.getProfile?aud=did:web:api.bsky.app#bsky_appview';
const params = new URLSearchParams();
params.append('redirect_uri', redirectUri);
-
params.append('scope', scope);
+
params.append('scope', OAUTH_SCOPE);
return {
client_id: `http://localhost?${params.toString()}`,
···
response_types: ['code'],
application_type: 'web',
token_endpoint_auth_method: 'none',
-
scope: scope,
+
scope: OAUTH_SCOPE,
dpop_bound_access_tokens: false,
subject_type: 'public',
authorization_signed_response_alg: 'ES256'
···
application_type: 'web',
token_endpoint_auth_method: 'private_key_jwt',
token_endpoint_auth_signing_alg: "ES256",
-
scope: "atproto repo:place.wisp.fs repo:place.wisp.domain repo:place.wisp.subfs repo:place.wisp.settings blob:*/* rpc:app.bsky.actor.getProfile?aud=did:web:api.bsky.app#bsky_appview",
+
scope: OAUTH_SCOPE,
dpop_bound_access_tokens: true,
jwks_uri: `${config.domain}/jwks.json`,
subject_type: 'public',
+10 -12
apps/main-app/src/routes/user.ts
···
import { Elysia, t } from 'elysia'
import { requireAuth } from '../lib/wisp-auth'
import { NodeOAuthClient } from '@atproto/oauth-client-node'
-
import { Agent } from '@atproto/api'
import { getSitesByDid, getDomainByDid, getCustomDomainsByDid, getWispDomainInfo, getDomainsBySite, getAllWispDomains } from '../lib/db'
import { syncSitesFromPDS } from '../lib/sync-sites'
import { createLogger } from '@wisp/observability'
+
import { createDidResolver, extractAtprotoData } from '@atproto-labs/did-resolver'
const logger = createLogger('main-app')
+
const didResolver = createDidResolver({})
export const userRoutes = (client: NodeOAuthClient, cookieSecret: string) =>
new Elysia({
···
})
.get('/info', async ({ auth }) => {
try {
-
// Get user's handle from AT Protocol
-
const agent = new Agent(auth.session)
-
let handle = 'unknown'
try {
-
console.log('[User] Attempting to fetch profile for DID:', auth.did)
-
const profile = await agent.getProfile({ actor: auth.did })
-
console.log('[User] Profile fetched successfully:', profile.data.handle)
-
handle = profile.data.handle
+
const didDoc = await didResolver.resolve(auth.did)
+
const atprotoData = extractAtprotoData(didDoc)
+
+
if (atprotoData.aka) {
+
handle = atprotoData.aka
+
}
} catch (err) {
-
console.error('[User] Failed to fetch profile - Full error:', err)
-
console.error('[User] Error message:', err instanceof Error ? err.message : String(err))
-
console.error('[User] Error stack:', err instanceof Error ? err.stack : 'No stack')
-
logger.error('[User] Failed to fetch profile', err)
+
+
logger.error('[User] Failed to resolve DID', err)
}
return {
+6 -5
bun.lock
···
"name": "@wisp/main-app",
"version": "1.0.50",
"dependencies": {
-
"@atproto/api": "^0.17.3",
-
"@atproto/common-web": "^0.4.5",
+
"@atproto-labs/did-resolver": "^0.2.4",
+
"@atproto/api": "^0.17.7",
+
"@atproto/common-web": "^0.4.6",
"@atproto/jwk-jose": "^0.1.11",
-
"@atproto/lex-cli": "^0.9.5",
-
"@atproto/oauth-client-node": "^0.3.9",
-
"@atproto/xrpc-server": "^0.9.5",
+
"@atproto/lex-cli": "^0.9.7",
+
"@atproto/oauth-client-node": "^0.3.12",
+
"@atproto/xrpc-server": "^0.9.6",
"@elysiajs/cors": "^1.4.0",
"@elysiajs/eden": "^1.4.3",
"@elysiajs/openapi": "^1.4.11",