Rocket.Chat.ReactNative/patches/@rocket.chat+sdk+1.0.0-alph...

61 lines
3.2 KiB
Diff

diff --git a/node_modules/@rocket.chat/sdk/lib/api/api.js b/node_modules/@rocket.chat/sdk/lib/api/api.js
index 5b7dc21..49f1af5 100644
--- a/node_modules/@rocket.chat/sdk/lib/api/api.js
+++ b/node_modules/@rocket.chat/sdk/lib/api/api.js
@@ -62,6 +62,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var log_1 = require("../log");
var message_1 = require("../message");
var tiny_events_1 = require("tiny-events");
+var settings = require("../settings");
var Client = /** @class */ (function () {
function Client(_a) {
var _b = _a.host, host = _b === void 0 ? 'http://localhost:3000' : _b;
@@ -70,7 +71,7 @@ var Client = /** @class */ (function () {
}
Object.defineProperty(Client.prototype, "headers", {
get: function () {
- return __assign({ 'Content-Type': 'application/json' }, this._headers);
+ return __assign({ 'Content-Type': 'application/json', ...settings.customHeaders }, this._headers);
},
set: function (obj) {
this._headers = obj;
diff --git a/node_modules/@rocket.chat/sdk/lib/drivers/ddp.js b/node_modules/@rocket.chat/sdk/lib/drivers/ddp.js
index e3510c7..e951959 100644
--- a/node_modules/@rocket.chat/sdk/lib/drivers/ddp.js
+++ b/node_modules/@rocket.chat/sdk/lib/drivers/ddp.js
@@ -110,6 +110,7 @@ tiny_events_1.EventEmitter.prototype.removeAllListeners = function (event) {
var interfaces_1 = require("../../interfaces");
var util_1 = require("../util");
var js_sha256_1 = require("js-sha256");
+var settings = require("../settings");
/** Websocket handler class, manages connections and subscriptions by DDP */
var Socket = /** @class */ (function (_super) {
__extends(Socket, _super);
@@ -145,7 +146,7 @@ var Socket = /** @class */ (function (_super) {
return !_this.alive() && _this.reopen();
}, ms);
try {
- connection = new universal_websocket_client_1.default(this.host);
+ connection = new universal_websocket_client_1.default(this.host, null, { headers: settings.customHeaders });
connection.onerror = reject;
}
catch (err) {
diff --git a/node_modules/@rocket.chat/sdk/lib/settings.d.ts b/node_modules/@rocket.chat/sdk/lib/settings.d.ts
index 99eb828..8c99307 100644
--- a/node_modules/@rocket.chat/sdk/lib/settings.d.ts
+++ b/node_modules/@rocket.chat/sdk/lib/settings.d.ts
@@ -17,3 +17,4 @@ export declare let dmCacheMaxAge: number;
export declare let token: string;
export declare let rid: string;
export declare let department: string;
+export declare let customHeaders: object;
diff --git a/node_modules/@rocket.chat/sdk/lib/settings.js b/node_modules/@rocket.chat/sdk/lib/settings.js
index 822c286..15f2688 100644
--- a/node_modules/@rocket.chat/sdk/lib/settings.js
+++ b/node_modules/@rocket.chat/sdk/lib/settings.js
@@ -30,3 +30,4 @@ exports.token = process.env.LIVECHAT_TOKEN || '';
exports.rid = process.env.LIVECHAT_ROOM || '';
exports.department = process.env.LIVECHAT_DEPARTMENT || '';
//# sourceMappingURL=settings.js.map
+exports.customHeaders = {};