Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 5 additions & 29 deletions packages/common/src/services/audius-backend/AudiusBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ import { userMetadataToSdk } from '~/adapters/user'
import { Env } from '~/services/env'
import dayjs from '~/utils/dayjs'

import {
ID,
InstagramUser,
TikTokUser,
ComputedUserProperties,
WriteableUserMetadata
} from '../../models'
import { ID, ComputedUserProperties, WriteableUserMetadata } from '../../models'
import { AnalyticsEvent } from '../../models/Analytics'
import { ReportToSentryArgs } from '../../models/ErrorReporting'
import * as schemas from '../../schemas'
Expand Down Expand Up @@ -120,7 +114,6 @@ type AudiusBackendParams = {
) => Promise<boolean | null> | null | boolean
getHostUrl: () => Nullable<string>
identityServiceUrl: Maybe<string>
generalAdmissionUrl: Maybe<string>
isElectron: Maybe<boolean>
localStorage?: LocalStorage
nativeMobile: Maybe<boolean>
Expand All @@ -141,7 +134,6 @@ type AudiusBackendParams = {

export const audiusBackend = ({
identityServiceUrl,
generalAdmissionUrl,
nativeMobile,
reportError,
env
Expand Down Expand Up @@ -216,28 +208,12 @@ export const audiusBackend = ({
}
}

async function instagramHandle(handle: string) {
try {
const res = await fetch(
`${generalAdmissionUrl}/social/instagram/${handle}`
)
const json: InstagramUser = await res.json()
return json
} catch (error) {
console.error(error)
return null
}
async function instagramHandle(_: string) {
return null
}

async function tiktokHandle(handle: string) {
try {
const res = await fetch(`${generalAdmissionUrl}/social/tiktok/${handle}`)
const json: TikTokUser = await res.json()
return json
} catch (error) {
console.error(error)
return null
}
async function tiktokHandle(_: string) {
return null
}

async function clearNotificationBadges({ sdk }: { sdk: AudiusSdk }) {
Expand Down
1 change: 0 additions & 1 deletion packages/common/src/services/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export type Env = {
FINGERPRINT_PUBLIC_API_KEY: Nullable<string>
GA_HOSTNAME: string
GA_MEASUREMENT_ID: string
GENERAL_ADMISSION: string
HCAPTCHA_BASE_URL: string
HCAPTCHA_SITE_KEY: string
IDENTITY_SERVICE: string
Expand Down
69 changes: 1 addition & 68 deletions packages/common/src/services/oauth/formatSocialProfile.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
InstagramProfile,
TikTokProfile,
TwitterProfile
} from '~/store/account/types'
import { TikTokProfile, TwitterProfile } from '~/store/account/types'

export const MAX_HANDLE_LENGTH = 30
export const MAX_DISPLAY_NAME_LENGTH = 32
Expand Down Expand Up @@ -68,69 +64,6 @@ export const formatTwitterProfile = async (
}
}

export const formatInstagramProfile = async (
instagramProfile: InstagramProfile,
generalAdmission: string,
resizeImage: (
image: File,
maxWidth?: number,
square?: boolean,
key?: string
) => Promise<File>
) => {
let profileImage
if (instagramProfile.profile_pic_url_hd) {
try {
const profileUrl = `${generalAdmission}/proxy/simple?url=${encodeURIComponent(
instagramProfile.profile_pic_url_hd
)}`
const imageBlob = await fetch(profileUrl).then((r) => r.blob())
const artworkFile = new File([imageBlob], 'Artwork', {
type: 'image/jpeg'
})
const file = await resizeImage(artworkFile)
const url = URL.createObjectURL(file)
profileImage = { url, file }
} catch (e) {
console.error('Failed to fetch profile_pic_url_hd', e)
}
}
// Truncate to MAX_HANDLE_LENGTH characters because we don't support longer handles.
// If the user is verifed, they won't be able to claim the status if
// the handle doesn't match, so just pass through.
let requiresUserReview = false
let handleTooLong = false
if (instagramProfile.username.length > MAX_HANDLE_LENGTH) {
requiresUserReview = true
handleTooLong = true
if (!instagramProfile.is_verified) {
instagramProfile.username = instagramProfile.username.slice(
0,
MAX_HANDLE_LENGTH
)
}
}
if (
!instagramProfile.full_name ||
instagramProfile.full_name.length > MAX_DISPLAY_NAME_LENGTH
) {
requiresUserReview = true
if (instagramProfile.full_name) {
instagramProfile.full_name = instagramProfile.full_name.slice(
0,
MAX_DISPLAY_NAME_LENGTH
)
}
}

return {
profile: instagramProfile,
profileImage,
requiresUserReview,
handleTooLong
}
}

export const formatTikTokProfile = async (
tikTokProfile: TikTokProfile,
resizeImage: (
Expand Down
7 changes: 0 additions & 7 deletions packages/embed/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,9 @@ Like you've seen on [twitter](https://twitter.com/audius/status/1293624808459010

## Running
```
# Run against a local [General Admission](https://github.com/AudiusProject/general-admission) server
npm run start:dev

# Run against staging Audius services
npm run start:stage

# Run against production Audius services
npm run start:prod


## Deploying

Deployed via CI
Expand Down
10 changes: 0 additions & 10 deletions packages/embed/workers-site/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ addEventListener('fetch', (event) => {
})

async function handleEvent(event) {
const url = new URL(event.request.url)
const { pathname, search, hash } = url

if (pathname.startsWith('/embed/api')) {
const destinationURL = GA + pathname + search + hash
const newRequest = new Request(destinationURL, event.request)

return await fetch(newRequest)
}

const options = {}
// Always map requests to `/` since this is an SPA
options.mapRequestToAsset = (request) => {
Expand Down
4 changes: 1 addition & 3 deletions packages/embed/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ entry-point = "workers-site"
[env.test]
name = "test"
route = "test.audius.co/*"
vars = { GA = "https://general-admission.audius.co" }

[env.production]
name = "embed"
route = "embed.audius.co/*"
vars = { GA = "https://general-admission.audius.co" }
route = "embed.audius.co/*"
6 changes: 0 additions & 6 deletions packages/identity-service/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,12 +731,6 @@ const config = convict({
default: '',
env: 'aaoAddress'
},
generalAdmissionAddress: {
doc: 'General admission server address',
format: String,
default: '',
env: 'generalAdmissionAddress'
},
sentryDSN: {
doc: 'Sentry DSN key',
format: String,
Expand Down
Loading