File tree Expand file tree Collapse file tree 3 files changed +5
-7
lines changed Expand file tree Collapse file tree 3 files changed +5
-7
lines changed Original file line number Diff line number Diff line change 1+ Fix provisioning API base URL in setup widget.
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import { SlackApp } from './SlackApp';
55
66const App = ( ) => {
77 return < ProvisioningApp
8- apiPrefix = '/_matrix/provision'
98 tokenName = 'slack-sessionToken'
109 >
1110 < SlackApp />
Original file line number Diff line number Diff line change @@ -25,16 +25,13 @@ export const useProvisioningContext = (): ProvisioningContext => {
2525} ;
2626
2727/**
28- * @param apiPrefix Base path for API requests.
2928 * @param tokenName Name to use for the session token in localstorage.
3029 * @param children
3130 * @constructor
3231 */
3332export const ProvisioningApp : React . FC < React . PropsWithChildren < {
34- apiPrefix : string ,
3533 tokenName : string ,
3634} > > = ( {
37- apiPrefix,
3835 tokenName,
3936 children,
4037} ) => {
@@ -97,8 +94,9 @@ export const ProvisioningApp: React.FC<React.PropsWithChildren<{
9794 return ;
9895 }
9996
100- // Assuming the widget is hosted on the same origin as the API
101- const apiBaseUrl = urlJoin ( window . location . origin , apiPrefix ) ;
97+ // Remove the widget path to get the provisioning API base URL
98+ // https://example.com/slack/_matrix/provision/v1/static -> https://example.com/slack/_matrix/provision
99+ const apiBaseUrl = window . location . origin + window . location . pathname . replace ( '/v1/static' , '' ) ;
102100
103101 const initClient = async ( ) => {
104102 try {
@@ -118,7 +116,7 @@ export const ProvisioningApp: React.FC<React.PropsWithChildren<{
118116 }
119117 } ;
120118 void initClient ( ) ;
121- } , [ apiPrefix , tokenName , widgetApi ] ) ;
119+ } , [ tokenName , widgetApi ] ) ;
122120
123121 const provisioningContext : ProvisioningContext | undefined = useMemo ( ( ) => {
124122 if ( ! client || ! roomId || ! widgetId ) {
You can’t perform that action at this time.
0 commit comments