mirror of https://github.com/vector-im/riot-web
Make up a device display name
Pass a default device name into react-sdkpull/1959/head
parent
bb1854814c
commit
3a819a29b7
|
@ -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 getDefaultDeviceName() {
|
||||
// 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}
|
||||
default_device_name={getDefaultDeviceName()}
|
||||
/>,
|
||||
document.getElementById('matrixchat')
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue