Skip to content

Commit

Permalink
feat: about endpoint (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
meelrossi committed Aug 9, 2023
1 parent 8121fe8 commit 55233a7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
38 changes: 37 additions & 1 deletion src/Project/Project.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import { Ownable } from '../Ownable'
import { Project } from './Project.model'
import { ProjectAttributes, projectSchema } from './Project.types'
import { SearchableProject } from './SearchableProject'
import { PREVIEW_HASH } from '../Scene/utils'

const BUILDER_SERVER_URL = process.env.BUILDER_SERVER_URL
const PEER_URL = process.env.PEER_URL

export const THUMBNAIL_FILE_NAME = 'thumbnail'
const FILE_NAMES = [
Expand All @@ -30,7 +34,6 @@ const FILE_NAMES = [
const MIME_TYPES = ['image/png', 'image/jpeg']

const validator = getValidator()

export class ProjectRouter extends Router {
mount() {
const withProjectExists = withModelExists(Project, 'id', {
Expand Down Expand Up @@ -138,6 +141,12 @@ export class ProjectRouter extends Router {
server.handleRequest(this.uploadFiles)
)

this.router.get(
'/projects/:id/about',
withProjectExists,
this.getPreviewAbout
)

this.router.put(
'/projects/:id/crdt',
withAuthentication,
Expand Down Expand Up @@ -281,6 +290,33 @@ export class ProjectRouter extends Router {
return true
}

async getPreviewAbout(req: Request, res: Response) {
const projectId = server.extractFromReq(req, 'id')
return res.json({
healthy: true,
acceptingUsers: true,
configurations: {
globalScenesUrn: [],
scenesUrn: [
`urn:decentraland:entity:${PREVIEW_HASH}?=&baseUrl=${BUILDER_SERVER_URL}v1/projects/${projectId}/contents/`
]
},
content: {
healthy: true,
publicUrl: `${PEER_URL}/content`
},
lambdas: {
healthy: true,
publicUrl: `${PEER_URL}/lambdas`
},
comms: {
healthy: true,
protocol: "v3",
fixedAdapter: "offline:offline"
}
})
}

async upsertCrdt(_req: AuthRequest) {
return true
}
Expand Down
1 change: 1 addition & 0 deletions src/Scene/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const PREVIEW_HASH = 'bafkreiczoxhrxosdeoi4srth6wegejpwsn34bkult6rb7xp3ehejxt4qsi'

0 comments on commit 55233a7

Please sign in to comment.