@smartico/public-api 0.0.219 → 0.0.221
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/dist/SmarticoAPI.d.ts +1 -0
- package/dist/WSAPI/WSAPI.d.ts +1 -1
- package/dist/index.js +29 -2
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +27 -1
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/SmarticoAPI.ts +34 -1
- package/src/WSAPI/WSAPI.ts +1 -1
package/package.json
CHANGED
package/src/SmarticoAPI.ts
CHANGED
|
@@ -190,6 +190,30 @@ class SmarticoAPI {
|
|
|
190
190
|
return ENV_ID;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
private replaceDomains(obj: any) {
|
|
194
|
+
const domains = {
|
|
195
|
+
'static4.smr.vc': 'd146b4m7rkvjkw.cloudfront.net',
|
|
196
|
+
'img4.smr.vc': 'dvm0p9vsezqr2.cloudfront.net',
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
let newObject = obj;
|
|
200
|
+
|
|
201
|
+
const oldDomains = Object.keys(domains);
|
|
202
|
+
|
|
203
|
+
for (const oldDomain of oldDomains) {
|
|
204
|
+
const stringified = JSON.stringify(newObject);
|
|
205
|
+
|
|
206
|
+
try {
|
|
207
|
+
const replacedString = stringified.replace(new RegExp(oldDomain, 'g'), domains[oldDomain]);
|
|
208
|
+
newObject = JSON.parse(replacedString);
|
|
209
|
+
} catch (error) {
|
|
210
|
+
console.error(error)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return newObject
|
|
215
|
+
}
|
|
216
|
+
|
|
193
217
|
public static getEnvId(label_api_key: string): number {
|
|
194
218
|
return label_api_key.length === 38 ? parseInt(label_api_key.substring(37, 38), 10) : 2;
|
|
195
219
|
}
|
|
@@ -207,7 +231,12 @@ class SmarticoAPI {
|
|
|
207
231
|
}
|
|
208
232
|
|
|
209
233
|
public static getAvatarUrl(label_api_key: string): string {
|
|
210
|
-
|
|
234
|
+
const envId = SmarticoAPI.getEnvDnsSuffix(label_api_key);
|
|
235
|
+
if (envId === '4') {
|
|
236
|
+
return 'https://dvm0p9vsezqr2.cloudfront.net';
|
|
237
|
+
} else {
|
|
238
|
+
return AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
239
|
+
}
|
|
211
240
|
}
|
|
212
241
|
|
|
213
242
|
private async send<T>(message: any, expectCID?: ClassId, force_language?: string): Promise<T> {
|
|
@@ -226,6 +255,10 @@ class SmarticoAPI {
|
|
|
226
255
|
result = await this.messageSender(message, this.publicUrl, expectCID);
|
|
227
256
|
const timeEnd = new Date().getTime();
|
|
228
257
|
|
|
258
|
+
if (this.label_api_key === 'a6e7ac26-c368-4892-9380-96e7ff82cf3e-4' && result) {
|
|
259
|
+
result = this.replaceDomains(result);
|
|
260
|
+
}
|
|
261
|
+
|
|
229
262
|
if (this.logHTTPTiming) {
|
|
230
263
|
this.logger.always('HTTP time, ms:' + (timeEnd - timeStart));
|
|
231
264
|
}
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
} from '../Jackpots';
|
|
51
51
|
import { GetTournamentsResponse } from '../Tournaments';
|
|
52
52
|
import { GetAchievementMapResponse } from '../Missions';
|
|
53
|
-
import { GetRelatedAchTourResponse } from '
|
|
53
|
+
import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
|
|
54
54
|
import { GetRafflesResponse } from '../Raffle/GetRafflesResponse';
|
|
55
55
|
import { InboxCategories } from '../Inbox/InboxCategories';
|
|
56
56
|
|