Skip to content

Commit

Permalink
misc pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Dec 28, 2023
1 parent c26b9f7 commit 26511a7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 25 deletions.
11 changes: 2 additions & 9 deletions packages/bsky/src/api/blob-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import AppContext from '../context'
import { httpLogger as log } from '../logger'
import { retryHttp } from '../util/retry'
import { Database } from '../db'
import { sql } from 'kysely'

// Resolve and verify blob from its origin host

Expand Down Expand Up @@ -85,22 +84,16 @@ export async function resolveBlob(
) {
const cidStr = cid.toString()

const [{ pds }, takedownStatus, takedown] = await Promise.all([
const [{ pds }, takedown] = await Promise.all([
idResolver.did.resolveAtprotoData(did), // @TODO cache did info
db.db
.selectFrom('moderation_subject_status')
.select('id')
.where('blobCids', '@>', sql`CAST(${JSON.stringify([cidStr])} AS JSONB)`)
.where('takendown', 'is', true)
.executeTakeFirst(),
db.db
.selectFrom('blob_takedown')
.select('takedownRef')
.where('did', '=', did)
.where('cid', '=', cid.toString())
.executeTakeFirst(),
])
if (takedownStatus || takedown) {
if (takedown) {
throw createError(404, 'Blob not found')
}

Expand Down
2 changes: 1 addition & 1 deletion packages/dev-env/src/pds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class TestPds {
bskyAppViewUrl: 'https://appview.invalid',
bskyAppViewDid: 'did:example:invalid',
bskyAppViewCdnUrlPattern: 'http://cdn.appview.com/%s/%s/%s',
modServiceUrl: 'https:/moderator.invalid',
modServiceUrl: 'https://moderator.invalid',
modServiceDid: 'did:example:invalid',
plcRotationKeyK256PrivateKeyHex: plcRotationPriv,
inviteRequired: false,
Expand Down
1 change: 0 additions & 1 deletion packages/ozone/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require('esbuild').build({
external: [
// Referenced in pg driver, but optional and we don't use it
'pg-native',
'sharp',
],
plugins: buildShallow ? [nodeExternalsPlugin()] : [],
})
15 changes: 4 additions & 11 deletions packages/pds/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,23 +167,16 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
repoBackfillLimitMs: env.repoBackfillLimitMs ?? DAY,
}

if (!env.bskyAppViewUrl) {
throw new Error('Must configure PDS_BSKY_APP_VIEW_URL')
} else if (!env.bskyAppViewDid) {
throw new Error('Must configure PDS_BSKY_APP_VIEW_DID')
}
assert(env.bskyAppViewUrl)
assert(env.bskyAppViewDid)
const bskyAppViewCfg: ServerConfig['bskyAppView'] = {
url: env.bskyAppViewUrl,
did: env.bskyAppViewDid,
cdnUrlPattern: env.bskyAppViewCdnUrlPattern,
}

if (!env.modServiceUrl) {
throw new Error('Must configure PDS_MOD_SERVICE_URL')
} else if (!env.modServiceDid) {
throw new Error('Must configure PDS_MOD_SERVICE_DID')
}

assert(env.modServiceUrl)
assert(env.modServiceDid)
const modServiceCfg: ServerConfig['modService'] = {
url: env.modServiceUrl,
did: env.modServiceDid,
Expand Down
3 changes: 0 additions & 3 deletions packages/xrpc/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ export class ServiceClient {
this.baseClient.lex.assertValidXrpcOutput(methodNsid, res.body)
} catch (e: any) {
if (e instanceof ValidationError) {
console.log(methodNsid)
console.log(res.body)
console.log('E: ', e)
throw new XRPCInvalidResponseError(methodNsid, e, res.body)
} else {
throw e
Expand Down

0 comments on commit 26511a7

Please sign in to comment.