Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat-new-onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
yashdesu committed Aug 15, 2024
2 parents 501796d + 4e9eeec commit 49e941e
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 404 deletions.
1 change: 1 addition & 0 deletions built-in-api-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default [
'/api/cron',
'/api/config',
'/api/clubs',
'/api/authenticate',
'/api/assets',
'/api/addDaoToDraft',
]
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clubs",
"version": "0.24.0-beta.2",
"version": "0.24.0-beta.3",
"private": true,
"type": "module",
"scripts": {
Expand Down Expand Up @@ -47,9 +47,9 @@
"prettier": "3.3.3",
"prettier-plugin-astro": "0.14.1",
"prettier-plugin-svelte": "3.2.6",
"prettier-plugin-tailwindcss": "0.6.5",
"prettier-plugin-tailwindcss": "0.6.6",
"svelte-check": "^3.5.1",
"type-fest": "4.23.0",
"type-fest": "4.24.0",
"typescript": "5.5.4",
"vitest": "^1.0.0",
"vue-tsc": "^2.0.0"
Expand All @@ -58,7 +58,7 @@
"@astrojs/check": "0.8.1",
"@astrojs/lit": "4.3.0",
"@astrojs/prefetch": "0.4.1",
"@astrojs/react": "3.6.1",
"@astrojs/react": "3.6.2",
"@astrojs/svelte": "5.7.0",
"@astrojs/tailwind": "5.1.0",
"@astrojs/vercel": "7.7.2",
Expand All @@ -69,7 +69,7 @@
"@devprotocol/clubs-plugin-awesome-onboarding": "0.4.4",
"@devprotocol/clubs-plugin-posts": "0.20.17",
"@devprotocol/clubs-plugin-posts-voting": "0.8.8",
"@devprotocol/dev-kit": "8.6.2",
"@devprotocol/dev-kit": "8.7.0",
"@devprotocol/hashi": "2.3.1",
"@devprotocol/huddle01-clubs-plugin": "0.1.7",
"@devprotocol/khaos-core": "^1.6.0",
Expand All @@ -87,7 +87,7 @@
"@wagmi/core": "^1.4.1",
"@web3modal/wagmi": "3.5.7",
"@webcomponents/template-shadowroot": "^0.2.1",
"astro": "4.13.1",
"astro": "4.13.4",
"autoprefixer": "10.4.20",
"bad-words": "^3.0.4",
"bignumber.js": "9.1.2",
Expand Down Expand Up @@ -121,7 +121,7 @@
"truncate-eth-address": "1.0.2",
"uuid": "^10.0.0",
"viem": "1.21.4",
"vue": "3.4.36",
"vue": "3.4.37",
"web3modal": "1.9.12"
},
"repository": "https://github.com/dev-protocol/clubs.git",
Expand Down
43 changes: 43 additions & 0 deletions src/pages/api/authenticate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { getDefaultClient } from '@fixtures/api/club/redis'
import { authenticate, decode } from '@devprotocol/clubs-core'
import { isNotError, whenDefined, whenNotError } from '@devprotocol/util-ts'
import { json } from '@fixtures/api/json'
import { headers } from '@fixtures/api/headers'
import { getDefaultProvider } from 'ethers'

export const POST = async ({ request }: { request: Request }) => {
const { message, signature, site } = (await request.json()) as {
site: string
message: string
signature: string
}

const client = await getDefaultClient()

const config = await client.get(site)
const authenticated =
(await whenDefined(config, (previousConfiguration) =>
authenticate({
message,
signature,
previousConfiguration,
provider: getDefaultProvider(decode(previousConfiguration).rpcUrl),
}),
)) ?? new Error('Specified Club is not defined.')

const res = whenNotError(authenticated, (_auth) =>
_auth ? _auth : new Error('Unauthorized'),
)

return isNotError(res)
? new Response(
json({
authenticated: res,
}),
{ status: 200, headers },
)
: new Response(json({ error: res.message }), {
status: 401,
headers,
})
}
109 changes: 0 additions & 109 deletions src/pages/api/mock/achievement/[account].ts

This file was deleted.

78 changes: 0 additions & 78 deletions src/pages/demo/App.vue

This file was deleted.

13 changes: 0 additions & 13 deletions src/pages/demo/achievements.astro

This file was deleted.

Loading

0 comments on commit 49e941e

Please sign in to comment.