Skip to content

Commit

Permalink
Use the new simpler endpoint for avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
livid committed Sep 8, 2024
1 parent 56508fe commit b823769
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Sources/App/routes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,6 @@ func routes(_ app: Application) throws {
address = "0x" + resolvedAddress.lowercased()
displayName = name
}
if let avatar = try? await resolver.getAvatar(),
let avatarURL = try? await resolver.getAvatarImageURL(from: avatar) {
avatarURLString = avatarURL.absoluteString
}
if let contentHashURL = try? await resolver.contenthash() {
contentHash = contentHashURL.absoluteString
}
Expand All @@ -212,12 +208,9 @@ func routes(_ app: Application) throws {
address.count == 42
{
displayName = String(address.prefix(5)) + "" + String(address.suffix(4))
}
if avatarURLString != nil, let avatar = avatarURLString {
if avatar.hasPrefix("ipfs://ipfs/") {
avatarURLString =
"https://ipfs.io/ipfs/"
+ avatar.replacingOccurrences(of: "ipfs://ipfs/", with: "")
} else {
if let name = name {
avatarURLString = "https://metadata.ens.domains/mainnet/avatar/" + name
}
}
let result = Result(
Expand Down

0 comments on commit b823769

Please sign in to comment.