Skip to content

Commit

Permalink
[C-2812] Use storageNodeSelector in libs, fix mobile images (#3667)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers authored Jun 28, 2023
1 parent 5daea08 commit e26986f
Show file tree
Hide file tree
Showing 28 changed files with 359 additions and 528 deletions.
6 changes: 3 additions & 3 deletions packages/common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"url": "https://github.com/AudiusProject/audius-client/issues"
},
"dependencies": {
"@audius/sdk": "3.0.3-beta.56",
"@audius/sdk": "3.0.3-beta.60",
"@fingerprintjs/fingerprintjs-pro": "3.5.6",
"@metaplex-foundation/mpl-token-metadata": "2.5.2",
"@optimizely/optimizely-sdk": "4.0.0",
Expand Down
36 changes: 22 additions & 14 deletions packages/common/src/services/audius-backend/AudiusBackend.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {
AudiusLibs as AudiusLibsType,
DiscoveryNodeSelector
import {
type AudiusLibs as AudiusLibsType,
type DiscoveryNodeSelector,
type StorageNodeSelectorService
} from '@audius/sdk'
import { DiscoveryAPI } from '@audius/sdk/dist/core'
import type { HedgehogConfig } from '@audius/sdk/dist/services/hedgehog'
Expand Down Expand Up @@ -78,7 +79,7 @@ import {
Nullable,
removeNullable
} from '../../utils'
import type { DiscoveryNodeSelectorService } from '../discovery-node-selector'
import type { DiscoveryNodeSelectorService } from '../sdk/discovery-node-selector'

import { MonitoringCallbacks } from './types'

Expand Down Expand Up @@ -232,6 +233,7 @@ type AudiusBackendParams = {
) => Promise<boolean | null> | null | boolean
getHostUrl: () => Nullable<string>
getLibs: () => Promise<any>
getStorageNodeSelector: () => Promise<StorageNodeSelectorService>
getWeb3Config: (
libs: any,
registryAddress: Maybe<string>,
Expand Down Expand Up @@ -286,6 +288,7 @@ export const audiusBackend = ({
getFeatureEnabled,
getHostUrl,
getLibs,
getStorageNodeSelector,
getWeb3Config,
hedgehogConfig,
identityServiceUrl,
Expand Down Expand Up @@ -700,6 +703,17 @@ export const audiusBackend = ({
})
}

const baseCreatorNodeConfig = AudiusLibs.configCreatorNode(
userNodeUrl,
/* lazyConnect */ true,
/* passList */ null,
contentNodeBlockList,
monitoringCallbacks.contentNode,
/* writeQuorumEnabled */ await getFeatureEnabled(
FeatureFlags.WRITE_QUORUM_ENABLED
)
)

try {
audiusLibs = new AudiusLibs({
localStorage,
Expand Down Expand Up @@ -732,16 +746,10 @@ export const audiusBackend = ({
},
identityServiceConfig:
AudiusLibs.configIdentityService(identityServiceUrl),
creatorNodeConfig: AudiusLibs.configCreatorNode(
userNodeUrl,
/* lazyConnect */ true,
/* passList */ null,
contentNodeBlockList,
monitoringCallbacks.contentNode,
/* writeQuorumEnabled */ await getFeatureEnabled(
FeatureFlags.WRITE_QUORUM_ENABLED
)
),
creatorNodeConfig: {
...baseCreatorNodeConfig,
storageNodeSelector: await getStorageNodeSelector()
},
// Electron cannot use captcha until it serves its assets from
// a "domain" (e.g. localhost) rather than the file system itself.
// i.e. there is no way to instruct captcha that the domain is "file://"
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export * from './solana-client'
export * from './track-download'
export * from './oauth'
export * from './location'
export * from './discovery-node-selector'
export * from './sdk/discovery-node-selector'
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {
stagingConfig
} from '@audius/sdk'

import { Env } from '../env'
import { Env } from '../../env'
import {
BooleanKeys,
IntKeys,
RemoteConfigInstance,
StringKeys
} from '../remote-config'
} from '../../remote-config'

type DiscoveryNodeSelectorConfig = {
env: Env
Expand Down
121 changes: 23 additions & 98 deletions packages/embed/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"webpack-cli": "4.5.0"
},
"dependencies": {
"@audius/sdk": "3.0.3-beta.56",
"@audius/sdk": "3.0.3-beta.60",
"@audius/stems": "1.5.30",
"amplitude-js": "8.11.1",
"axios": "0.19.2",
Expand Down
Loading

0 comments on commit e26986f

Please sign in to comment.