Use a safe but sane device name

jryans/device-name
J. Ryan Stinnett 2020-07-14 21:54:44 +01:00
parent f70f3c7796
commit 0fa2941188
1 changed files with 13 additions and 12 deletions

View File

@ -173,20 +173,21 @@ export default class WebPlatform extends VectorBasePlatform {
} }
getDefaultDeviceDisplayName(): string { getDefaultDeviceDisplayName(): string {
return "unknown browser " + Math.round(Number.MAX_SAFE_INTEGER * Math.random()); // TODO: Revert this after launch
// // strip query-string and fragment from uri
// const u = url.parse(window.location.href);
// u.protocol = "";
// u.search = "";
// u.hash = "";
// // Remove trailing slash if present
// u.pathname = u.pathname.replace(/\/$/, "");
// strip query-string and fragment from uri // let appName = u.format();
const u = url.parse(window.location.href); // // Remove leading slashes if present
u.protocol = ""; // appName = appName.replace(/^\/\//, "");
u.search = ""; // // `appName` is now in the format `develop.element.io`.
u.hash = "";
// Remove trailing slash if present
u.pathname = u.pathname.replace(/\/$/, "");
let appName = u.format(); const appName = "Riot Web";
// Remove leading slashes if present
appName = appName.replace(/^\/\//, "");
// `appName` is now in the format `develop.element.io`.
const ua = new UAParser(); const ua = new UAParser();
const browserName = ua.getBrowser().name || "unknown browser"; const browserName = ua.getBrowser().name || "unknown browser";