Allow custom push gateway to use non-default port (#8376)

This commit is contained in:
jonnyandrew 2023-05-02 10:05:15 +00:00 committed by GitHub
parent 3c2c6ef136
commit e37fe1f8f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

1
changelog.d/8376.bugfix Normal file
View File

@ -0,0 +1 @@
Allow custom push gateway to use non-default port

View File

@ -104,7 +104,8 @@ class UnifiedPushHelper @Inject constructor(
// else, unifiedpush, and pushkey is an endpoint
val gateway = stringProvider.getString(R.string.default_push_gateway_http_url)
val parsed = URL(endpoint)
val custom = "${parsed.protocol}://${parsed.host}/_matrix/push/v1/notify"
val port = if (parsed.port != -1) { ":${parsed.port}" } else { "" }
val custom = "${parsed.protocol}://${parsed.host}${port}/_matrix/push/v1/notify"
Timber.i("Testing $custom")
try {
val response = matrix.rawService().getUrl(custom, CacheStrategy.NoCache)