1
0
This commit is contained in:
Half-Shot
2025-08-28 18:19:57 +01:00
parent c213505b8c
commit 5abb4cf7a6
4 changed files with 11 additions and 6 deletions

View File

@@ -88,6 +88,7 @@ class ApplicationService:
supports_ephemeral: bool = False,
msc3202_transaction_extensions: bool = False,
msc4190_device_management: bool = False,
supports_profile_lookup: bool = False,
):
self.token = token
self.url = (
@@ -100,6 +101,7 @@ class ApplicationService:
self.id = id
self.ip_range_whitelist = ip_range_whitelist
self.supports_ephemeral = supports_ephemeral
self.supports_profile_lookup = supports_profile_lookup
self.msc3202_transaction_extensions = msc3202_transaction_extensions
self.msc4190_device_management = msc4190_device_management

View File

@@ -278,7 +278,7 @@ class ApplicationServiceApi(SimpleHttpClient):
url = f"{service.url}{APP_SERVICE_PREFIX}/profile/{urllib.parse.quote(user_id)}"
if key:
url += f"/{key}"
url += f"/{urllib.parse.quote(key)}"
response = await self.get_json(
url,

View File

@@ -171,6 +171,7 @@ def _load_appservice(
ip_range_whitelist = IPSet(as_info.get("ip_range_whitelist"))
supports_ephemeral = as_info.get("de.sorunome.msc2409.push_ephemeral", False)
lookup_profiles = as_info.get("uk.half-shot.lookup_profile", False)
# Opt-in flag for the MSC3202-specific transactional behaviour.
# When enabled, appservice transactions contain the following information:
@@ -206,6 +207,7 @@ def _load_appservice(
rate_limited=rate_limited,
ip_range_whitelist=ip_range_whitelist,
supports_ephemeral=supports_ephemeral,
supports_profile_lookup=lookup_profiles,
msc3202_transaction_extensions=msc3202_transaction_extensions,
msc4190_device_management=msc4190_enabled,
)

View File

@@ -724,11 +724,12 @@ class ApplicationServicesHandler:
user_query_services = self._get_services_for_user(user_id=user_id)
accumulated_profile = {}
for user_service in user_query_services:
profile = await self.appservice_api.query_profile(
user_service, user_id, from_user_id, key
)
if profile:
accumulated_profile.update(profile)
if user_service.supports_profile_lookup:
profile = await self.appservice_api.query_profile(
user_service, user_id, from_user_id, key
)
if profile:
accumulated_profile.update(profile)
return accumulated_profile
async def query_room_alias_exists(