mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 11:15:53 +03:00
Merge pull request #1959 from vector-im/rav/device_display_name
Make up a device display name
This commit is contained in:
commit
0afdf5d8e4
2 changed files with 19 additions and 1 deletions
|
@ -55,7 +55,9 @@
|
|||
"react-dnd-html5-backend": "^2.1.2",
|
||||
"react-dom": "^15.2.1",
|
||||
"react-gemini-scrollbar": "matrix-org/react-gemini-scrollbar#5e97aef",
|
||||
"sanitize-html": "^1.11.1"
|
||||
"sanitize-html": "^1.11.1",
|
||||
"ua-parser-js": "^0.7.10",
|
||||
"url": "^0.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel": "^5.8.23",
|
||||
|
|
|
@ -44,6 +44,8 @@ var VectorConferenceHandler = require('../VectorConferenceHandler');
|
|||
var UpdateChecker = require("./updater");
|
||||
var q = require('q');
|
||||
var request = require('browser-request');
|
||||
|
||||
import UAParser from 'ua-parser-js';
|
||||
import url from 'url';
|
||||
|
||||
import {parseQs, parseQsFromFragment} from './url_utils';
|
||||
|
@ -134,6 +136,19 @@ var makeRegistrationUrl = function() {
|
|||
'#/register';
|
||||
}
|
||||
|
||||
|
||||
function getDefaultDeviceDisplayName() {
|
||||
// strip query-string and fragment from uri
|
||||
let u = url.parse(window.location.href);
|
||||
u.search = "";
|
||||
u.hash = "";
|
||||
let app_name = u.format();
|
||||
|
||||
let ua = new UAParser();
|
||||
return app_name + " via " + ua.getBrowser().name +
|
||||
" on " + ua.getOS().name;
|
||||
}
|
||||
|
||||
window.addEventListener('hashchange', onHashChange);
|
||||
window.onload = function() {
|
||||
console.log("window.onload");
|
||||
|
@ -238,6 +253,7 @@ async function loadApp() {
|
|||
startingFragmentQueryParams={fragparts.params}
|
||||
enableGuest={true}
|
||||
onLoadCompleted={onLoadCompleted}
|
||||
defaultDeviceDisplayName={getDefaultDeviceDisplayName()}
|
||||
/>,
|
||||
document.getElementById('matrixchat')
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue