@@ -21,31 +21,30 @@ var sdk = require("matrix-react-sdk");
2121sdk . loadSkin ( require ( '../skins/vector/skindex' ) ) ;
2222sdk . loadModule ( require ( '../modules/VectorConferenceHandler' ) ) ;
2323
24+ var qs = require ( "querystring" ) ;
25+
2426var lastLocationHashSet = null ;
2527
2628
27- function parseQueryParams ( location ) {
29+ // We want to support some name / value pairs in the fragment
30+ // so we're re-using query string ike format
31+ function parseQsFromFragment ( location ) {
2832 var hashparts = location . hash . split ( '?' ) ;
29- var params = { } ;
30- if ( hashparts . length == 2 ) {
31- var pairs = hashparts [ 1 ] . split ( '&' ) ;
32- for ( var i = 0 ; i < pairs . length ; ++ i ) {
33- var parts = pairs [ i ] . split ( '=' ) ;
34- if ( parts . length != 2 ) continue ;
35- params [ decodeURIComponent ( parts [ 0 ] ) ] = decodeURIComponent ( parts [ 1 ] ) ;
36- }
33+ if ( hashparts . length > 1 ) {
34+ console . log ( qs . parse ( hashparts [ 1 ] ) ) ;
35+ return qs . parse ( hashparts [ 1 ] ) ;
3736 }
38- return params
37+ return { } ;
3938}
4039
4140// Here, we do some crude URL analysis to allow
4241// deep-linking. We only support registration
4342// deep-links in this example.
4443function routeUrl ( location ) {
4544 if ( location . hash . indexOf ( '#/register' ) == 0 ) {
46- window . matrixChat . showScreen ( 'register' , parseQueryParams ( location ) ) ;
45+ window . matrixChat . showScreen ( 'register' , parseQsFromFragment ( location ) ) ;
4746 } else if ( location . hash . indexOf ( '#/login/cas' ) == 0 ) {
48- window . matrixChat . showScreen ( 'cas_login' , parseQueryParams ( location ) ) ;
47+ window . matrixChat . showScreen ( 'cas_login' , parseQsFromFragment ( location ) ) ;
4948 } else {
5049 window . matrixChat . showScreen ( location . hash . substring ( 2 ) ) ;
5150 }
0 commit comments