• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

decentraland / realm-provider / 18787135118

24 Oct 2025 05:20PM UTC coverage: 16.438% (-22.7%) from 39.12%
18787135118

Pull #75

github

kevinszuchet
chore: Remove output-directory from docs workflow
Pull Request #75: docs: Add API spec

13 of 50 branches covered (26.0%)

Branch coverage included in aggregate %.

35 of 242 relevant lines covered (14.46%)

0.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.67
/src/controllers/handlers/about-main-handler.ts
1
import { HandlerContextWithPath, ServiceUnavailableError } from '../../types'
1✔
2
import { About } from '@dcl/catalyst-api-specs/lib/client'
3
import { randomInt } from 'crypto'
1✔
4

5
export async function aboutMainHandler(
1✔
6
  context: Pick<
7
    HandlerContextWithPath<'catalystsProvider' | 'mainRealmProvider' | 'config', '/main/about'>,
8
    'components' | 'url'
9
  >
10
): Promise<{ status: 200; body: About }> {
11
  const {
12
    components: { catalystsProvider, mainRealmProvider, config }
13
  } = context
6✔
14
  const blacklistedCatalyst = ((await config.getString('BLACKLISTED_CATALYST')) || '').split(';').filter(Boolean)
6✔
15
  const catalysts = await catalystsProvider.getHealhtyCatalysts()
6✔
16

17
  if (catalysts.length === 0) {
6!
18
    throw new ServiceUnavailableError('No content catalysts available')
×
19
  }
20

21
  const filteredCatalysts = blacklistedCatalyst.length
6✔
22
    ? catalysts.filter(
23
        (catalyst: any) =>
24
          !blacklistedCatalyst.some((blackListedCatalyst) => catalyst.url.toLowerCase().includes(blackListedCatalyst))
2✔
25
      )
26
    : catalysts
27

28
  let index = randomInt(filteredCatalysts.length)
6✔
29

30
  const preferredCatalyst = context.url.searchParams.get('catalyst')
6✔
31
  if (preferredCatalyst) {
6✔
32
    const preferredCatalystIndex = filteredCatalysts.findIndex((catalyst: any) => catalyst.url === preferredCatalyst)
9✔
33
    if (preferredCatalystIndex >= 0) {
5✔
34
      index = preferredCatalystIndex
3✔
35
    }
36
  }
37

38
  const catalystAbout = filteredCatalysts[index].about
6✔
39

40
  const mainRealmStatus = await mainRealmProvider.getStatus()
6✔
41

42
  const about: About = {
6✔
43
    ...catalystAbout,
44
    configurations: {
45
      ...catalystAbout.configurations,
46
      realmName: mainRealmStatus.realmName
47
    },
48
    healthy: mainRealmStatus.healthy,
49
    acceptingUsers: mainRealmStatus.healthy,
50
    comms: {
51
      version: mainRealmStatus.version,
52
      commitHash: mainRealmStatus.commitHash,
53
      healthy: mainRealmStatus.healthy,
54
      protocol: 'v3',
55
      usersCount: mainRealmStatus.userCount,
56
      adapter: mainRealmStatus.adapter
57
    }
58
  }
59

60
  if (about.bff) {
6!
61
    about.bff.userCount = mainRealmStatus.userCount
×
62
  }
63

64
  return {
6✔
65
    status: 200,
66
    body: about
67
  }
68
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc