mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(directories): support multisub public keys
This commit is contained in:
@@ -18,6 +18,10 @@ let cachedAddressToDirectoryMap: Map<string, string> | null = null;
|
||||
|
||||
const getDirectoryCode = (community: DirectoryCommunity): string | null => community.directoryCode ?? extractDirectoryFromTitle(community.title ?? '');
|
||||
|
||||
const getCommunityLookupAddresses = (community: DirectoryCommunity): string[] => [
|
||||
...new Set([community.address, community.name, community.publicKey].filter((value): value is string => typeof value === 'string' && value.length > 0)),
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a map from directory codes to community addresses
|
||||
* Uses caching to avoid recreating the map when communities array hasn't changed
|
||||
@@ -58,7 +62,9 @@ const getAddressToDirectoryMap = (communities: DirectoryCommunity[]): Map<string
|
||||
if (!community.address) continue;
|
||||
const directory = getDirectoryCode(community);
|
||||
if (directory) {
|
||||
map.set(community.address, directory);
|
||||
for (const address of getCommunityLookupAddresses(community)) {
|
||||
map.set(address, directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user