mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Add support for specifying Matrix homeserver URL (#1065)
This commit is contained in:
@@ -15,5 +15,11 @@ export class MatrixApi implements ICredentialType {
|
|||||||
type: 'string' as NodePropertyTypes,
|
type: 'string' as NodePropertyTypes,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Homeserver URL',
|
||||||
|
name: 'homeserverUrl',
|
||||||
|
type: 'string' as NodePropertyTypes,
|
||||||
|
default: 'https://matrix-client.matrix.org',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,7 @@ export async function matrixApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
|||||||
},
|
},
|
||||||
body,
|
body,
|
||||||
qs: query,
|
qs: query,
|
||||||
// Override URL when working with media only. All other endpoints use client.
|
uri: '',
|
||||||
//@ts-ignore
|
|
||||||
uri: option.hasOwnProperty('overridePrefix') ? `https://matrix.org/_matrix/${option.overridePrefix}/r0${resource}` : `https://matrix.org/_matrix/client/r0${resource}`,
|
|
||||||
json: true,
|
json: true,
|
||||||
};
|
};
|
||||||
options = Object.assign({}, options, option);
|
options = Object.assign({}, options, option);
|
||||||
@@ -56,6 +54,8 @@ export async function matrixApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
|||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
throw new Error('No credentials got returned!');
|
throw new Error('No credentials got returned!');
|
||||||
}
|
}
|
||||||
|
//@ts-ignore
|
||||||
|
options.uri = `${credentials.homeserverUrl}/_matrix/${option.overridePrefix || 'client'}/r0${resource}`;
|
||||||
options.headers!.Authorization = `Bearer ${credentials.accessToken}`;
|
options.headers!.Authorization = `Bearer ${credentials.accessToken}`;
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
response = await this.helpers.request(options);
|
response = await this.helpers.request(options);
|
||||||
|
|||||||
Reference in New Issue
Block a user