File tree Expand file tree Collapse file tree 5 files changed +19
-61
lines changed
Expand file tree Collapse file tree 5 files changed +19
-61
lines changed Original file line number Diff line number Diff line change 3636 muc_show_logs_before_join : true ,
3737 notify_all_room_messages : [ 'discuss@conference.conversejs.org' ] ,
3838 fetch_url_headers : true ,
39- whitelisted_plugins : [ 'converse-debug' , 'converse-protocol-handler' ] ,
39+ whitelisted_plugins : [ 'converse-debug' ] ,
4040 bosh_service_url : 'https://conversejs.org/http-bind/' , // Please use this connection manager only for testing purposes
4141 // view_mode: 'overlayed',
4242 show_controlbox_by_default : true ,
Original file line number Diff line number Diff line change @@ -22,7 +22,16 @@ export function routeToChat (event) {
2222 return ;
2323 }
2424 event ?. preventDefault ( ) ;
25- const jid = location . hash . split ( '=' ) . pop ( ) ;
25+ let jid = location . hash . split ( '=' ) . pop ( ) ;
26+ // decodeURIComponent is needed in case the JID contains special characters
27+ // that were URL-encoded, e.g. `user%40domain` instead of `user@domain`.
28+ jid = decodeURIComponent ( jid ) ;
29+
30+ // Remove xmpp: prefix if present
31+ if ( jid . startsWith ( 'xmpp:' ) ) {
32+ jid = jid . slice ( 5 ) ;
33+ }
34+
2635 if ( ! u . isValidJID ( jid ) ) {
2736 return log . warn ( `Invalid JID "${ jid } " provided in URL fragment` ) ;
2837 }
Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ import "./plugins/rosterview/index.js";
4242import "./plugins/singleton/index.js" ;
4343import "./plugins/dragresize/index.js" ; // Allows chat boxes to be resized by dragging them
4444import "./plugins/fullscreen/index.js" ;
45- import "./plugins/protocol-handler/index.js" ; // Handle xmpp: links
4645/* END: Removable components */
4746
4847_converse . exports . CustomElement = CustomElement ;
Original file line number Diff line number Diff line change @@ -65,6 +65,14 @@ converse.plugins.add('converse-chatview', {
6565 Object . assign ( _converse , exports ) ; // DEPRECATED
6666 Object . assign ( _converse . exports , exports ) ;
6767
68+ if ( 'registerProtocolHandler' in navigator ) {
69+ try {
70+ const handlerUrl = `${ window . location . origin } ${ window . location . pathname } #converse/chat?jid=%s` ;
71+ navigator . registerProtocolHandler ( 'xmpp' , handlerUrl ) ;
72+ } catch ( error ) {
73+ console . warn ( 'Failed to register protocol handler:' , error ) ;
74+ }
75+ }
6876 api . listen . on ( 'connected' , ( ) => api . disco . own . features . add ( Strophe . NS . SPOILER ) ) ;
6977 api . listen . on ( 'chatBoxClosed' , ( model ) => clearHistory ( model . get ( 'jid' ) ) ) ;
7078 }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments