diff --git a/.github/actions/prepare-ios-build/action.yaml b/.github/actions/prepare-ios-build/action.yaml index a85e219a0..b772f16a4 100644 --- a/.github/actions/prepare-ios-build/action.yaml +++ b/.github/actions/prepare-ios-build/action.yaml @@ -4,16 +4,6 @@ description: Action to prepare environment for ios build runs: using: composite steps: - - name: ci/install-os-deps - env: - HOMEBREW_NO_AUTO_UPDATE: "1" - shell: bash - run: | - echo "::group::install-os-deps" - brew install --overwrite python@3.12 - brew install watchman - echo "::endgroup::" - - name: ci/prepare-mobile-build uses: ./.github/actions/prepare-mobile-build diff --git a/app/screens/server/index.tsx b/app/screens/server/index.tsx index 180ef54c6..c6700abd2 100644 --- a/app/screens/server/index.tsx +++ b/app/screens/server/index.tsx @@ -290,31 +290,34 @@ const Server = ({ cancelPing = undefined; }; - const serverUrl = await getServerUrlAfterRedirect(pingUrl, !retryWithHttp); - if (!serverUrl) { + const ping = await getServerUrlAfterRedirect(pingUrl, !retryWithHttp); + if (!ping.url) { cancelPing(); + if (retryWithHttp) { + const nurl = pingUrl.replace('https:', 'http:'); + pingServer(nurl, false); + } else { + setUrlError(getErrorMessage(ping.error, intl)); + setButtonDisabled(true); + setConnecting(false); + } return; } - const result = await doPing(serverUrl, true, managedConfig?.timeout ? parseInt(managedConfig?.timeout, 10) : undefined); + const result = await doPing(ping.url, true, managedConfig?.timeout ? parseInt(managedConfig?.timeout, 10) : undefined); if (canceled) { return; } if (result.error) { - if (retryWithHttp) { - const nurl = serverUrl.replace('https:', 'http:'); - pingServer(nurl, false); - } else { - setUrlError(getErrorMessage(result.error, intl)); - setButtonDisabled(true); - setConnecting(false); - } + setUrlError(getErrorMessage(result.error, intl)); + setButtonDisabled(true); + setConnecting(false); return; } - canReceiveNotifications(serverUrl, result.canReceiveNotifications as string, intl); - const data = await fetchConfigAndLicense(serverUrl, true); + canReceiveNotifications(ping.url, result.canReceiveNotifications as string, intl); + const data = await fetchConfigAndLicense(ping.url, true); if (data.error) { setButtonDisabled(true); setUrlError(getErrorMessage(data.error, intl)); @@ -332,7 +335,7 @@ const Server = ({ } const server = await getServerByIdentifier(data.config.DiagnosticId); - const credentials = await getServerCredentials(serverUrl); + const credentials = await getServerCredentials(ping.url); setConnecting(false); if (server && server.lastActiveAt > 0 && credentials?.token) { @@ -344,7 +347,7 @@ const Server = ({ return; } - displayLogin(serverUrl, data.config!, data.license!); + displayLogin(ping.url, data.config!, data.license!); }; const transform = useAnimatedStyle(() => { diff --git a/app/utils/url/index.ts b/app/utils/url/index.ts index e9c45a386..52d4086c7 100644 --- a/app/utils/url/index.ts +++ b/app/utils/url/index.ts @@ -7,6 +7,7 @@ import urlParse from 'url-parse'; import {Files} from '@constants'; import {emptyFunction} from '@utils/general'; +import {logDebug} from '@utils/log'; import {latinise} from './latinise'; @@ -25,8 +26,10 @@ export function sanitizeUrl(url: string, useHttp = false) { preUrl = urlParse('https://' + stripTrailingSlashes(url), true); } - if (!protocol || (preUrl.protocol === 'http:' && !useHttp)) { + if (preUrl.protocol === 'http:' && !useHttp) { protocol = 'https:'; + } else if (!protocol) { + protocol = useHttp ? 'http:' : 'https:'; } return stripTrailingSlashes( @@ -43,12 +46,11 @@ export async function getServerUrlAfterRedirect(serverUrl: string, useHttp = fal url = resp.redirectUrls[resp.redirectUrls.length - 1]; } } catch (error) { - if (useHttp) { - return undefined; - } + logDebug('getServerUrlAfterRedirect error', url, error); + return {error}; } - return sanitizeUrl(url, useHttp); + return {url: sanitizeUrl(url, useHttp)}; } export function stripTrailingSlashes(url = '') { diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist index b6753efcc..8a96b6ebf 100644 --- a/ios/Mattermost/Info.plist +++ b/ios/Mattermost/Info.plist @@ -46,8 +46,14 @@ NSAllowsArbitraryLoads - NSAllowsLocalNetworking - + NSExceptionDomains + + localhost + + NSExceptionAllowsInsecureHTTPLoads + + + NSAppleMusicUsageDescription Enabling access to your media library means you can attach files from your media library to your messages in $(PRODUCT_NAME). diff --git a/package-lock.json b/package-lock.json index ed0a835b6..550db4ab7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "mattermost-mobile", - "version": "2.14.0", + "version": "2.15.0", "hasInstallScript": true, "license": "Apache 2.0", "dependencies": {