1- import * as PusherTypes from 'pusher-js' ;
1+ import Pusher , { Channel } from 'pusher-js' ;
22import app from 'flarum/forum/app' ;
33import { extend } from 'flarum/common/extend' ;
44import DiscussionList from 'flarum/forum/components/DiscussionList' ;
@@ -11,26 +11,24 @@ import type Tag from 'ext:flarum/tags/common/models/Tag';
1111
1212export type PusherBinding = {
1313 channels : {
14- main : PusherTypes . Channel ;
15- user : PusherTypes . Channel | null ;
14+ main : Channel ;
15+ user : Channel | null ;
1616 } ;
17- pusher : PusherTypes . default ;
17+ pusher : Pusher ;
1818} ;
1919
2020app . initializers . add ( 'flarum-pusher' , ( ) => {
2121 app . pusher = ( async ( ) => {
22- // @ts -expect-error
23- await import ( '//cdn.jsdelivr.net/npm/[email protected] /dist/web/pusher.min.js' /* webpackIgnore: true, webpackPrefetch: true */ ) ; 24-
25- // @ts -expect-error Imported dynamically
26- const socket : PusherTypes . default = new Pusher ( app . forum . attribute ( 'pusherKey' ) , {
22+ const socket : Pusher = new Pusher ( app . forum . attribute ( 'pusherKey' ) , {
2723 authEndpoint : `${ app . forum . attribute ( 'apiUrl' ) } /pusher/auth` ,
2824 cluster : app . forum . attribute ( 'pusherCluster' ) ,
2925 auth : {
3026 headers : {
3127 'X-CSRF-Token' : app . session . csrfToken ,
3228 } ,
3329 } ,
30+ httpHost : app . forum . attribute ( 'pusherHostname' ) ,
31+ wsHost : app . forum . attribute ( 'pusherHostname' )
3432 } ) ;
3533
3634 return {
0 commit comments