diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index a10e48ac1f..89f999de7d 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -10,10 +10,10 @@ "Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.", "Open user settings": "Open user settings", "Previous/next recently visited room or community": "Previous/next recently visited room or community", - "Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s", + "Riot Desktop (%(platformName)s)": "Riot Desktop (%(platformName)s)", "Go to your browser to complete Sign In": "Go to your browser to complete Sign In", "Unknown device": "Unknown device", - "%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s on %(osName)s", + "%(appName)s (%(browserName)s, %(osName)s)": "%(appName)s (%(browserName)s, %(osName)s)", "You need to be using HTTPS to place a screen-sharing call.": "You need to be using HTTPS to place a screen-sharing call.", "powered by Matrix": "powered by Matrix", "Custom Server Options": "Custom Server Options", diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index aee9ee4930..4a07e202f7 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -390,7 +390,7 @@ export default class ElectronPlatform extends VectorBasePlatform { } getDefaultDeviceDisplayName(): string { - return _t('Riot Desktop on %(platformName)s', { platformName: platformFriendlyName() }); + return _t('Riot Desktop (%(platformName)s)', { platformName: platformFriendlyName() }); } screenCaptureErrorString(): ?string { diff --git a/src/vector/platform/WebPlatform.js b/src/vector/platform/WebPlatform.js index ec70ee2646..b4a01f78c9 100644 --- a/src/vector/platform/WebPlatform.js +++ b/src/vector/platform/WebPlatform.js @@ -181,16 +181,27 @@ export default class WebPlatform extends VectorBasePlatform { getDefaultDeviceDisplayName(): string { // strip query-string and fragment from uri const u = url.parse(window.location.href); + u.protocol = ""; u.search = ""; u.hash = ""; - const appName = u.format(); + // Remove trailing slash if present + u.pathname = u.pathname.replace(/\/$/, ""); + + let appName = u.format(); + // Remove leading slashes if present + appName = appName.replace(/^\/\//, ""); + // `appName` is now in the format `riot.im/develop`. const ua = new UAParser(); const browserName = ua.getBrowser().name || "unknown browser"; let osName = ua.getOS().name || "unknown OS"; // Stylise the value from the parser to match Apple's current branding. if (osName === "Mac OS") osName = "macOS"; - return _t('%(appName)s via %(browserName)s on %(osName)s', {appName: appName, browserName: browserName, osName: osName}); + return _t('%(appName)s (%(browserName)s, %(osName)s)', { + appName, + browserName, + osName, + }); } screenCaptureErrorString(): ?string {