playttm 0.0.8 → 0.0.10
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/lib.d.ts +10 -3
- package/dist/lib.js +248 -77
- package/package.json +1 -1
- package/src/lib.ts +247 -5
package/dist/lib.d.ts
CHANGED
|
@@ -92,12 +92,19 @@ export declare class ThaiTicketMajor {
|
|
|
92
92
|
*/
|
|
93
93
|
static syncCookiesToChrome(cookieString: string, domainUrl?: string): Promise<void>;
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
95
|
+
* Clear any session and dynamic rules set by the extension so the browser is left 100% clean.
|
|
96
96
|
*/
|
|
97
|
+
static clearExtensionRules(): Promise<void>;
|
|
97
98
|
/**
|
|
98
|
-
* Setup declarativeNetRequest session rules
|
|
99
|
+
* Setup declarativeNetRequest session rules for Chrome Extension environment.
|
|
100
|
+
* Uses initiatorDomains=[chrome.runtime.id] so Chrome ONLY modifies requests
|
|
101
|
+
* originating from this extension popup, and NEVER touches normal browser tabs!
|
|
99
102
|
*/
|
|
100
|
-
static setupExtensionRules(
|
|
103
|
+
static setupExtensionRules(context?: {
|
|
104
|
+
k?: string;
|
|
105
|
+
zone?: string;
|
|
106
|
+
roundId?: string;
|
|
107
|
+
}): Promise<void>;
|
|
101
108
|
syncCookies(domainUrl?: string): Promise<void>;
|
|
102
109
|
private emitProgress;
|
|
103
110
|
/**
|
package/dist/lib.js
CHANGED
|
@@ -175,201 +175,358 @@ class ThaiTicketMajor {
|
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
|
-
*
|
|
178
|
+
* Clear any session and dynamic rules set by the extension so the browser is left 100% clean.
|
|
179
179
|
*/
|
|
180
|
+
static clearExtensionRules() {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
if (typeof chrome === "undefined" || !(chrome === null || chrome === void 0 ? void 0 : chrome.declarativeNetRequest)) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
// Clear all session rules
|
|
187
|
+
if (chrome.declarativeNetRequest.getSessionRules && chrome.declarativeNetRequest.updateSessionRules) {
|
|
188
|
+
const existing = yield chrome.declarativeNetRequest.getSessionRules();
|
|
189
|
+
const ids = existing.map((r) => r.id);
|
|
190
|
+
if (ids.length > 0) {
|
|
191
|
+
yield chrome.declarativeNetRequest.updateSessionRules({
|
|
192
|
+
removeRuleIds: ids,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// Clear any lingering dynamic rules
|
|
197
|
+
if (chrome.declarativeNetRequest.getDynamicRules && chrome.declarativeNetRequest.updateDynamicRules) {
|
|
198
|
+
const dynamicRules = yield chrome.declarativeNetRequest.getDynamicRules();
|
|
199
|
+
const dynamicIds = dynamicRules.map((r) => r.id);
|
|
200
|
+
if (dynamicIds.length > 0) {
|
|
201
|
+
yield chrome.declarativeNetRequest.updateDynamicRules({
|
|
202
|
+
removeRuleIds: dynamicIds,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch (err) {
|
|
208
|
+
console.warn("Could not clear declarativeNetRequest rules:", err);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
180
212
|
/**
|
|
181
|
-
* Setup declarativeNetRequest session rules
|
|
213
|
+
* Setup declarativeNetRequest session rules for Chrome Extension environment.
|
|
214
|
+
* Uses initiatorDomains=[chrome.runtime.id] so Chrome ONLY modifies requests
|
|
215
|
+
* originating from this extension popup, and NEVER touches normal browser tabs!
|
|
182
216
|
*/
|
|
183
|
-
static setupExtensionRules() {
|
|
217
|
+
static setupExtensionRules(context) {
|
|
184
218
|
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
219
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29;
|
|
186
220
|
if (typeof chrome === "undefined" || !((_a = chrome === null || chrome === void 0 ? void 0 : chrome.declarativeNetRequest) === null || _a === void 0 ? void 0 : _a.updateSessionRules)) {
|
|
187
221
|
return;
|
|
188
222
|
}
|
|
223
|
+
const extensionId = (_b = chrome.runtime) === null || _b === void 0 ? void 0 : _b.id;
|
|
224
|
+
// IMPORTANT: By specifying initiatorDomains with the extension ID, Chrome will ONLY
|
|
225
|
+
// modify requests sent by this extension, and will NEVER touch normal browser tabs!
|
|
226
|
+
const initiatorDomains = extensionId ? [extensionId] : undefined;
|
|
227
|
+
const fixedReferer = ((context === null || context === void 0 ? void 0 : context.k) && (context === null || context === void 0 ? void 0 : context.zone) && (context === null || context === void 0 ? void 0 : context.roundId))
|
|
228
|
+
? `https://booking.thaiticketmajor.com/booking/3m/fixed.php?k=${context.k}&zone=${context.zone}&round=${context.roundId}`
|
|
229
|
+
: "https://booking.thaiticketmajor.com/booking/3m/fixed.php";
|
|
230
|
+
const festivalReferer = ((context === null || context === void 0 ? void 0 : context.k) && (context === null || context === void 0 ? void 0 : context.zone) && (context === null || context === void 0 ? void 0 : context.roundId))
|
|
231
|
+
? `https://booking.thaiticketmajor.com/booking/3m/festival.php?k=${context.k}&zone=${context.zone}&round=${context.roundId}`
|
|
232
|
+
: "https://booking.thaiticketmajor.com/booking/3m/festival.php";
|
|
233
|
+
const enrollReferer = ((context === null || context === void 0 ? void 0 : context.k) && (context === null || context === void 0 ? void 0 : context.zone) && (context === null || context === void 0 ? void 0 : context.roundId))
|
|
234
|
+
? `https://booking.thaiticketmajor.com/booking/3m/enroll.php?k=${context.k}&zone=${context.zone}&round=${context.roundId}`
|
|
235
|
+
: "https://booking.thaiticketmajor.com/booking/3m/enroll.php";
|
|
236
|
+
const excludedDomains = ["booking.thaiticketmajor.com", "www.thaiticketmajor.com", "thaiticketmajor.com"];
|
|
189
237
|
try {
|
|
190
|
-
const ruleIdsToRemove = [
|
|
238
|
+
const ruleIdsToRemove = [
|
|
239
|
+
1001, 1002, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019,
|
|
240
|
+
1020, 1021, 1022, 1023
|
|
241
|
+
];
|
|
191
242
|
yield chrome.declarativeNetRequest.updateSessionRules({
|
|
192
243
|
removeRuleIds: ruleIdsToRemove,
|
|
193
244
|
addRules: [
|
|
194
245
|
{
|
|
195
|
-
id:
|
|
196
|
-
priority:
|
|
246
|
+
id: 1020,
|
|
247
|
+
priority: 25,
|
|
197
248
|
action: {
|
|
198
|
-
type: ((
|
|
249
|
+
type: ((_c = chrome.declarativeNetRequest.RuleActionType) === null || _c === void 0 ? void 0 : _c.MODIFY_HEADERS) || "modifyHeaders",
|
|
199
250
|
requestHeaders: [
|
|
200
251
|
{
|
|
201
252
|
header: "Referer",
|
|
202
|
-
operation: ((
|
|
203
|
-
value:
|
|
253
|
+
operation: ((_d = chrome.declarativeNetRequest.HeaderOperation) === null || _d === void 0 ? void 0 : _d.SET) || "set",
|
|
254
|
+
value: fixedReferer,
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
header: "Origin",
|
|
258
|
+
operation: ((_e = chrome.declarativeNetRequest.HeaderOperation) === null || _e === void 0 ? void 0 : _e.SET) || "set",
|
|
259
|
+
value: "https://booking.thaiticketmajor.com",
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
condition: Object.assign(Object.assign({ urlFilter: "bookingseats.php", resourceTypes: [
|
|
264
|
+
((_f = chrome.declarativeNetRequest.ResourceType) === null || _f === void 0 ? void 0 : _f.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
265
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: 1021,
|
|
269
|
+
priority: 25,
|
|
270
|
+
action: {
|
|
271
|
+
type: ((_g = chrome.declarativeNetRequest.RuleActionType) === null || _g === void 0 ? void 0 : _g.MODIFY_HEADERS) || "modifyHeaders",
|
|
272
|
+
requestHeaders: [
|
|
273
|
+
{
|
|
274
|
+
header: "Referer",
|
|
275
|
+
operation: ((_h = chrome.declarativeNetRequest.HeaderOperation) === null || _h === void 0 ? void 0 : _h.SET) || "set",
|
|
276
|
+
value: fixedReferer,
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
header: "Origin",
|
|
280
|
+
operation: ((_j = chrome.declarativeNetRequest.HeaderOperation) === null || _j === void 0 ? void 0 : _j.SET) || "set",
|
|
281
|
+
value: "https://booking.thaiticketmajor.com",
|
|
204
282
|
},
|
|
205
283
|
],
|
|
206
284
|
},
|
|
207
|
-
condition: {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
285
|
+
condition: Object.assign(Object.assign({ urlFilter: "validateseat.php", resourceTypes: [
|
|
286
|
+
((_k = chrome.declarativeNetRequest.ResourceType) === null || _k === void 0 ? void 0 : _k.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
287
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
id: 1022,
|
|
291
|
+
priority: 25,
|
|
292
|
+
action: {
|
|
293
|
+
type: ((_l = chrome.declarativeNetRequest.RuleActionType) === null || _l === void 0 ? void 0 : _l.MODIFY_HEADERS) || "modifyHeaders",
|
|
294
|
+
requestHeaders: [
|
|
295
|
+
{
|
|
296
|
+
header: "Referer",
|
|
297
|
+
operation: ((_m = chrome.declarativeNetRequest.HeaderOperation) === null || _m === void 0 ? void 0 : _m.SET) || "set",
|
|
298
|
+
value: festivalReferer,
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
header: "Origin",
|
|
302
|
+
operation: ((_o = chrome.declarativeNetRequest.HeaderOperation) === null || _o === void 0 ? void 0 : _o.SET) || "set",
|
|
303
|
+
value: "https://booking.thaiticketmajor.com",
|
|
304
|
+
},
|
|
211
305
|
],
|
|
212
306
|
},
|
|
307
|
+
condition: Object.assign(Object.assign({ urlFilter: "bookingfestival.php", resourceTypes: [
|
|
308
|
+
((_p = chrome.declarativeNetRequest.ResourceType) === null || _p === void 0 ? void 0 : _p.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
309
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
213
310
|
},
|
|
214
311
|
{
|
|
215
|
-
id:
|
|
312
|
+
id: 1023,
|
|
313
|
+
priority: 25,
|
|
314
|
+
action: {
|
|
315
|
+
type: ((_q = chrome.declarativeNetRequest.RuleActionType) === null || _q === void 0 ? void 0 : _q.MODIFY_HEADERS) || "modifyHeaders",
|
|
316
|
+
requestHeaders: [
|
|
317
|
+
{
|
|
318
|
+
header: "Referer",
|
|
319
|
+
operation: ((_r = chrome.declarativeNetRequest.HeaderOperation) === null || _r === void 0 ? void 0 : _r.SET) || "set",
|
|
320
|
+
value: enrollReferer,
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
header: "Origin",
|
|
324
|
+
operation: ((_s = chrome.declarativeNetRequest.HeaderOperation) === null || _s === void 0 ? void 0 : _s.SET) || "set",
|
|
325
|
+
value: "https://booking.thaiticketmajor.com",
|
|
326
|
+
},
|
|
327
|
+
],
|
|
328
|
+
},
|
|
329
|
+
condition: Object.assign(Object.assign({ urlFilter: "enroll_process.php", resourceTypes: [
|
|
330
|
+
((_t = chrome.declarativeNetRequest.ResourceType) === null || _t === void 0 ? void 0 : _t.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
331
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
id: 1010,
|
|
216
335
|
priority: 20,
|
|
217
336
|
action: {
|
|
218
|
-
type: ((
|
|
337
|
+
type: ((_u = chrome.declarativeNetRequest.RuleActionType) === null || _u === void 0 ? void 0 : _u.MODIFY_HEADERS) || "modifyHeaders",
|
|
219
338
|
requestHeaders: [
|
|
220
339
|
{
|
|
221
340
|
header: "Referer",
|
|
222
|
-
operation: ((
|
|
341
|
+
operation: ((_v = chrome.declarativeNetRequest.HeaderOperation) === null || _v === void 0 ? void 0 : _v.SET) || "set",
|
|
223
342
|
value: "https://booking.thaiticketmajor.com/booking/3m/orderenc_kbankqr.php",
|
|
224
343
|
},
|
|
344
|
+
{
|
|
345
|
+
header: "Origin",
|
|
346
|
+
operation: ((_w = chrome.declarativeNetRequest.HeaderOperation) === null || _w === void 0 ? void 0 : _w.SET) || "set",
|
|
347
|
+
value: "https://booking.thaiticketmajor.com",
|
|
348
|
+
},
|
|
225
349
|
],
|
|
226
350
|
},
|
|
227
|
-
condition: {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
351
|
+
condition: Object.assign(Object.assign({ urlFilter: "getkbankqr.php", resourceTypes: [
|
|
352
|
+
((_x = chrome.declarativeNetRequest.ResourceType) === null || _x === void 0 ? void 0 : _x.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
353
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
id: 1011,
|
|
357
|
+
priority: 20,
|
|
358
|
+
action: {
|
|
359
|
+
type: ((_y = chrome.declarativeNetRequest.RuleActionType) === null || _y === void 0 ? void 0 : _y.MODIFY_HEADERS) || "modifyHeaders",
|
|
360
|
+
requestHeaders: [
|
|
361
|
+
{
|
|
362
|
+
header: "Referer",
|
|
363
|
+
operation: ((_z = chrome.declarativeNetRequest.HeaderOperation) === null || _z === void 0 ? void 0 : _z.SET) || "set",
|
|
364
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/orderenc_kbankqr.php",
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
header: "Origin",
|
|
368
|
+
operation: ((_0 = chrome.declarativeNetRequest.HeaderOperation) === null || _0 === void 0 ? void 0 : _0.SET) || "set",
|
|
369
|
+
value: "https://booking.thaiticketmajor.com",
|
|
370
|
+
},
|
|
231
371
|
],
|
|
232
372
|
},
|
|
373
|
+
condition: Object.assign(Object.assign({ urlFilter: "payment_kbankqr.php", resourceTypes: [
|
|
374
|
+
((_1 = chrome.declarativeNetRequest.ResourceType) === null || _1 === void 0 ? void 0 : _1.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
375
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
233
376
|
},
|
|
234
377
|
{
|
|
235
378
|
id: 1012,
|
|
236
379
|
priority: 20,
|
|
237
380
|
action: {
|
|
238
|
-
type: ((
|
|
381
|
+
type: ((_2 = chrome.declarativeNetRequest.RuleActionType) === null || _2 === void 0 ? void 0 : _2.MODIFY_HEADERS) || "modifyHeaders",
|
|
239
382
|
requestHeaders: [
|
|
240
383
|
{
|
|
241
384
|
header: "Referer",
|
|
242
|
-
operation: ((
|
|
385
|
+
operation: ((_3 = chrome.declarativeNetRequest.HeaderOperation) === null || _3 === void 0 ? void 0 : _3.SET) || "set",
|
|
243
386
|
value: "https://booking.thaiticketmajor.com/booking/3m/paycfmall.php",
|
|
244
387
|
},
|
|
388
|
+
{
|
|
389
|
+
header: "Origin",
|
|
390
|
+
operation: ((_4 = chrome.declarativeNetRequest.HeaderOperation) === null || _4 === void 0 ? void 0 : _4.SET) || "set",
|
|
391
|
+
value: "https://booking.thaiticketmajor.com",
|
|
392
|
+
},
|
|
245
393
|
],
|
|
246
394
|
},
|
|
247
|
-
condition: {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
((_k = chrome.declarativeNetRequest.ResourceType) === null || _k === void 0 ? void 0 : _k.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
251
|
-
],
|
|
252
|
-
},
|
|
395
|
+
condition: Object.assign(Object.assign({ urlFilter: "orderenc_kbankqr.php", resourceTypes: [
|
|
396
|
+
((_5 = chrome.declarativeNetRequest.ResourceType) === null || _5 === void 0 ? void 0 : _5.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
397
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
253
398
|
},
|
|
254
399
|
{
|
|
255
400
|
id: 1013,
|
|
256
401
|
priority: 20,
|
|
257
402
|
action: {
|
|
258
|
-
type: ((
|
|
403
|
+
type: ((_6 = chrome.declarativeNetRequest.RuleActionType) === null || _6 === void 0 ? void 0 : _6.MODIFY_HEADERS) || "modifyHeaders",
|
|
259
404
|
requestHeaders: [
|
|
260
405
|
{
|
|
261
406
|
header: "Referer",
|
|
262
|
-
operation: ((
|
|
407
|
+
operation: ((_7 = chrome.declarativeNetRequest.HeaderOperation) === null || _7 === void 0 ? void 0 : _7.SET) || "set",
|
|
263
408
|
value: "https://booking.thaiticketmajor.com/booking/3m/paymentall.php",
|
|
264
409
|
},
|
|
410
|
+
{
|
|
411
|
+
header: "Origin",
|
|
412
|
+
operation: ((_8 = chrome.declarativeNetRequest.HeaderOperation) === null || _8 === void 0 ? void 0 : _8.SET) || "set",
|
|
413
|
+
value: "https://booking.thaiticketmajor.com",
|
|
414
|
+
},
|
|
265
415
|
],
|
|
266
416
|
},
|
|
267
|
-
condition: {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
((_o = chrome.declarativeNetRequest.ResourceType) === null || _o === void 0 ? void 0 : _o.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
271
|
-
],
|
|
272
|
-
},
|
|
417
|
+
condition: Object.assign(Object.assign({ urlFilter: "paycfmall.php", resourceTypes: [
|
|
418
|
+
((_9 = chrome.declarativeNetRequest.ResourceType) === null || _9 === void 0 ? void 0 : _9.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
419
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
273
420
|
},
|
|
274
421
|
{
|
|
275
422
|
id: 1014,
|
|
276
423
|
priority: 20,
|
|
277
424
|
action: {
|
|
278
|
-
type: ((
|
|
425
|
+
type: ((_10 = chrome.declarativeNetRequest.RuleActionType) === null || _10 === void 0 ? void 0 : _10.MODIFY_HEADERS) || "modifyHeaders",
|
|
279
426
|
requestHeaders: [
|
|
280
427
|
{
|
|
281
428
|
header: "Referer",
|
|
282
|
-
operation: ((
|
|
429
|
+
operation: ((_11 = chrome.declarativeNetRequest.HeaderOperation) === null || _11 === void 0 ? void 0 : _11.SET) || "set",
|
|
283
430
|
value: "https://booking.thaiticketmajor.com/booking/3m/fixed.php",
|
|
284
431
|
},
|
|
432
|
+
{
|
|
433
|
+
header: "Origin",
|
|
434
|
+
operation: ((_12 = chrome.declarativeNetRequest.HeaderOperation) === null || _12 === void 0 ? void 0 : _12.SET) || "set",
|
|
435
|
+
value: "https://booking.thaiticketmajor.com",
|
|
436
|
+
},
|
|
285
437
|
],
|
|
286
438
|
},
|
|
287
|
-
condition: {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
((_r = chrome.declarativeNetRequest.ResourceType) === null || _r === void 0 ? void 0 : _r.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
291
|
-
],
|
|
292
|
-
},
|
|
439
|
+
condition: Object.assign(Object.assign({ urlFilter: "paymentall.php", resourceTypes: [
|
|
440
|
+
((_13 = chrome.declarativeNetRequest.ResourceType) === null || _13 === void 0 ? void 0 : _13.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
441
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
293
442
|
},
|
|
294
443
|
{
|
|
295
444
|
id: 1015,
|
|
296
445
|
priority: 20,
|
|
297
446
|
action: {
|
|
298
|
-
type: ((
|
|
447
|
+
type: ((_14 = chrome.declarativeNetRequest.RuleActionType) === null || _14 === void 0 ? void 0 : _14.MODIFY_HEADERS) || "modifyHeaders",
|
|
299
448
|
requestHeaders: [
|
|
300
449
|
{
|
|
301
450
|
header: "Referer",
|
|
302
|
-
operation: ((
|
|
451
|
+
operation: ((_15 = chrome.declarativeNetRequest.HeaderOperation) === null || _15 === void 0 ? void 0 : _15.SET) || "set",
|
|
303
452
|
value: "https://booking.thaiticketmajor.com/booking/3m/fixed.php",
|
|
304
453
|
},
|
|
454
|
+
{
|
|
455
|
+
header: "Origin",
|
|
456
|
+
operation: ((_16 = chrome.declarativeNetRequest.HeaderOperation) === null || _16 === void 0 ? void 0 : _16.SET) || "set",
|
|
457
|
+
value: "https://booking.thaiticketmajor.com",
|
|
458
|
+
},
|
|
305
459
|
],
|
|
306
460
|
},
|
|
307
|
-
condition: {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
((_u = chrome.declarativeNetRequest.ResourceType) === null || _u === void 0 ? void 0 : _u.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
311
|
-
],
|
|
312
|
-
},
|
|
461
|
+
condition: Object.assign(Object.assign({ urlFilter: "enroll.php", resourceTypes: [
|
|
462
|
+
((_17 = chrome.declarativeNetRequest.ResourceType) === null || _17 === void 0 ? void 0 : _17.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
463
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
313
464
|
},
|
|
314
465
|
{
|
|
315
466
|
id: 1018,
|
|
316
467
|
priority: 20,
|
|
317
468
|
action: {
|
|
318
|
-
type: ((
|
|
469
|
+
type: ((_18 = chrome.declarativeNetRequest.RuleActionType) === null || _18 === void 0 ? void 0 : _18.MODIFY_HEADERS) || "modifyHeaders",
|
|
319
470
|
requestHeaders: [
|
|
320
471
|
{
|
|
321
472
|
header: "Referer",
|
|
322
|
-
operation: ((
|
|
473
|
+
operation: ((_19 = chrome.declarativeNetRequest.HeaderOperation) === null || _19 === void 0 ? void 0 : _19.SET) || "set",
|
|
323
474
|
value: "https://booking.thaiticketmajor.com/booking/3m/zones.php",
|
|
324
475
|
},
|
|
476
|
+
{
|
|
477
|
+
header: "Origin",
|
|
478
|
+
operation: ((_20 = chrome.declarativeNetRequest.HeaderOperation) === null || _20 === void 0 ? void 0 : _20.SET) || "set",
|
|
479
|
+
value: "https://booking.thaiticketmajor.com",
|
|
480
|
+
},
|
|
325
481
|
],
|
|
326
482
|
},
|
|
327
|
-
condition: {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
((_x = chrome.declarativeNetRequest.ResourceType) === null || _x === void 0 ? void 0 : _x.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
331
|
-
],
|
|
332
|
-
},
|
|
483
|
+
condition: Object.assign(Object.assign({ urlFilter: "zonesavail.php", resourceTypes: [
|
|
484
|
+
((_21 = chrome.declarativeNetRequest.ResourceType) === null || _21 === void 0 ? void 0 : _21.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
485
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
333
486
|
},
|
|
334
487
|
{
|
|
335
488
|
id: 1002,
|
|
336
489
|
priority: 20,
|
|
337
490
|
action: {
|
|
338
|
-
type: ((
|
|
491
|
+
type: ((_22 = chrome.declarativeNetRequest.RuleActionType) === null || _22 === void 0 ? void 0 : _22.MODIFY_HEADERS) || "modifyHeaders",
|
|
339
492
|
requestHeaders: [
|
|
340
493
|
{
|
|
341
494
|
header: "Referer",
|
|
342
|
-
operation: ((
|
|
495
|
+
operation: ((_23 = chrome.declarativeNetRequest.HeaderOperation) === null || _23 === void 0 ? void 0 : _23.SET) || "set",
|
|
343
496
|
value: "https://kpaymentgateway.kasikornbank.com/",
|
|
344
497
|
},
|
|
498
|
+
{
|
|
499
|
+
header: "Origin",
|
|
500
|
+
operation: ((_24 = chrome.declarativeNetRequest.HeaderOperation) === null || _24 === void 0 ? void 0 : _24.SET) || "set",
|
|
501
|
+
value: "https://kpaymentgateway.kasikornbank.com",
|
|
502
|
+
},
|
|
345
503
|
],
|
|
346
504
|
},
|
|
347
|
-
condition: {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
((_0 = chrome.declarativeNetRequest.ResourceType) === null || _0 === void 0 ? void 0 : _0.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
351
|
-
],
|
|
352
|
-
},
|
|
505
|
+
condition: Object.assign(Object.assign({ urlFilter: "kasikornbank.com", resourceTypes: [
|
|
506
|
+
((_25 = chrome.declarativeNetRequest.ResourceType) === null || _25 === void 0 ? void 0 : _25.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
507
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
353
508
|
},
|
|
354
509
|
{
|
|
355
510
|
id: 1001,
|
|
356
511
|
priority: 1,
|
|
357
512
|
action: {
|
|
358
|
-
type: ((
|
|
513
|
+
type: ((_26 = chrome.declarativeNetRequest.RuleActionType) === null || _26 === void 0 ? void 0 : _26.MODIFY_HEADERS) || "modifyHeaders",
|
|
359
514
|
requestHeaders: [
|
|
360
515
|
{
|
|
361
516
|
header: "Referer",
|
|
362
|
-
operation: ((
|
|
517
|
+
operation: ((_27 = chrome.declarativeNetRequest.HeaderOperation) === null || _27 === void 0 ? void 0 : _27.SET) || "set",
|
|
363
518
|
value: "https://booking.thaiticketmajor.com/booking/3m/",
|
|
364
519
|
},
|
|
520
|
+
{
|
|
521
|
+
header: "Origin",
|
|
522
|
+
operation: ((_28 = chrome.declarativeNetRequest.HeaderOperation) === null || _28 === void 0 ? void 0 : _28.SET) || "set",
|
|
523
|
+
value: "https://booking.thaiticketmajor.com",
|
|
524
|
+
},
|
|
365
525
|
],
|
|
366
526
|
},
|
|
367
|
-
condition: {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
((_3 = chrome.declarativeNetRequest.ResourceType) === null || _3 === void 0 ? void 0 : _3.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
371
|
-
],
|
|
372
|
-
},
|
|
527
|
+
condition: Object.assign(Object.assign({ urlFilter: "thaiticketmajor.com", resourceTypes: [
|
|
528
|
+
((_29 = chrome.declarativeNetRequest.ResourceType) === null || _29 === void 0 ? void 0 : _29.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
529
|
+
] }, (initiatorDomains ? { initiatorDomains } : {})), { excludedInitiatorDomains: excludedDomains }),
|
|
373
530
|
},
|
|
374
531
|
],
|
|
375
532
|
});
|
|
@@ -1419,6 +1576,13 @@ class ThaiTicketMajor {
|
|
|
1419
1576
|
let paymentAllData;
|
|
1420
1577
|
// 5. ดำเนินการตามประเภทโซน (Fixed vs Festival)
|
|
1421
1578
|
if (targetZone.page === "fixed.php") {
|
|
1579
|
+
if (this.inBrowser) {
|
|
1580
|
+
yield ThaiTicketMajor.setupExtensionRules({
|
|
1581
|
+
k: zoneData.k,
|
|
1582
|
+
zone: targetZone.value,
|
|
1583
|
+
roundId: targetPerformRound.id,
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1422
1586
|
const fixedData = yield this.getFixedSeats(zoneData.k, targetZone.value, targetPerformRound.id);
|
|
1423
1587
|
const availableSeats = fixedData.seats;
|
|
1424
1588
|
if (availableSeats.length < ticketCount) {
|
|
@@ -1461,6 +1625,13 @@ class ThaiTicketMajor {
|
|
|
1461
1625
|
}
|
|
1462
1626
|
else {
|
|
1463
1627
|
// Festival Flow
|
|
1628
|
+
if (this.inBrowser) {
|
|
1629
|
+
yield ThaiTicketMajor.setupExtensionRules({
|
|
1630
|
+
k: zoneData.k,
|
|
1631
|
+
zone: targetZone.value,
|
|
1632
|
+
roundId: targetPerformRound.id,
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1464
1635
|
const festivalForm = yield this.getFestival(zoneData.k, zoneData.tk, selectedRound.query, targetZone.value, targetPerformRound.id);
|
|
1465
1636
|
yield this.validateFestivalSeats(zoneData.k, festivalForm, ticketCount);
|
|
1466
1637
|
const bookingFestivalRes = yield this.bookFestivalSeats(zoneData.k, festivalForm, ticketCount);
|
package/package.json
CHANGED
package/src/lib.ts
CHANGED
|
@@ -258,22 +258,185 @@ export class ThaiTicketMajor {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
|
|
261
262
|
/**
|
|
262
|
-
*
|
|
263
|
+
* Clear any session and dynamic rules set by the extension so the browser is left 100% clean.
|
|
263
264
|
*/
|
|
265
|
+
public static async clearExtensionRules(): Promise<void> {
|
|
266
|
+
if (typeof chrome === "undefined" || !chrome?.declarativeNetRequest) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
try {
|
|
270
|
+
// Clear all session rules
|
|
271
|
+
if (chrome.declarativeNetRequest.getSessionRules && chrome.declarativeNetRequest.updateSessionRules) {
|
|
272
|
+
const existing = await chrome.declarativeNetRequest.getSessionRules();
|
|
273
|
+
const ids = existing.map((r: any) => r.id);
|
|
274
|
+
if (ids.length > 0) {
|
|
275
|
+
await chrome.declarativeNetRequest.updateSessionRules({
|
|
276
|
+
removeRuleIds: ids,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
// Clear any lingering dynamic rules
|
|
281
|
+
if (chrome.declarativeNetRequest.getDynamicRules && chrome.declarativeNetRequest.updateDynamicRules) {
|
|
282
|
+
const dynamicRules = await chrome.declarativeNetRequest.getDynamicRules();
|
|
283
|
+
const dynamicIds = dynamicRules.map((r: any) => r.id);
|
|
284
|
+
if (dynamicIds.length > 0) {
|
|
285
|
+
await chrome.declarativeNetRequest.updateDynamicRules({
|
|
286
|
+
removeRuleIds: dynamicIds,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
} catch (err) {
|
|
291
|
+
console.warn("Could not clear declarativeNetRequest rules:", err);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
264
295
|
/**
|
|
265
|
-
* Setup declarativeNetRequest session rules
|
|
296
|
+
* Setup declarativeNetRequest session rules for Chrome Extension environment.
|
|
297
|
+
* Uses initiatorDomains=[chrome.runtime.id] so Chrome ONLY modifies requests
|
|
298
|
+
* originating from this extension popup, and NEVER touches normal browser tabs!
|
|
266
299
|
*/
|
|
267
|
-
public static async setupExtensionRules(): Promise<void> {
|
|
300
|
+
public static async setupExtensionRules(context?: { k?: string; zone?: string; roundId?: string }): Promise<void> {
|
|
268
301
|
if (typeof chrome === "undefined" || !chrome?.declarativeNetRequest?.updateSessionRules) {
|
|
269
302
|
return;
|
|
270
303
|
}
|
|
271
304
|
|
|
305
|
+
const extensionId = chrome.runtime?.id;
|
|
306
|
+
// IMPORTANT: By specifying initiatorDomains with the extension ID, Chrome will ONLY
|
|
307
|
+
// modify requests sent by this extension, and will NEVER touch normal browser tabs!
|
|
308
|
+
const initiatorDomains = extensionId ? [extensionId] : undefined;
|
|
309
|
+
|
|
310
|
+
const fixedReferer = (context?.k && context?.zone && context?.roundId)
|
|
311
|
+
? `https://booking.thaiticketmajor.com/booking/3m/fixed.php?k=${context.k}&zone=${context.zone}&round=${context.roundId}`
|
|
312
|
+
: "https://booking.thaiticketmajor.com/booking/3m/fixed.php";
|
|
313
|
+
|
|
314
|
+
const festivalReferer = (context?.k && context?.zone && context?.roundId)
|
|
315
|
+
? `https://booking.thaiticketmajor.com/booking/3m/festival.php?k=${context.k}&zone=${context.zone}&round=${context.roundId}`
|
|
316
|
+
: "https://booking.thaiticketmajor.com/booking/3m/festival.php";
|
|
317
|
+
|
|
318
|
+
const enrollReferer = (context?.k && context?.zone && context?.roundId)
|
|
319
|
+
? `https://booking.thaiticketmajor.com/booking/3m/enroll.php?k=${context.k}&zone=${context.zone}&round=${context.roundId}`
|
|
320
|
+
: "https://booking.thaiticketmajor.com/booking/3m/enroll.php";
|
|
321
|
+
|
|
322
|
+
const excludedDomains = ["booking.thaiticketmajor.com", "www.thaiticketmajor.com", "thaiticketmajor.com"];
|
|
323
|
+
|
|
272
324
|
try {
|
|
273
|
-
const ruleIdsToRemove = [
|
|
325
|
+
const ruleIdsToRemove = [
|
|
326
|
+
1001, 1002, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019,
|
|
327
|
+
1020, 1021, 1022, 1023
|
|
328
|
+
];
|
|
274
329
|
await chrome.declarativeNetRequest.updateSessionRules({
|
|
275
330
|
removeRuleIds: ruleIdsToRemove,
|
|
276
331
|
addRules: [
|
|
332
|
+
{
|
|
333
|
+
id: 1020,
|
|
334
|
+
priority: 25,
|
|
335
|
+
action: {
|
|
336
|
+
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
337
|
+
requestHeaders: [
|
|
338
|
+
{
|
|
339
|
+
header: "Referer",
|
|
340
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
341
|
+
value: fixedReferer,
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
header: "Origin",
|
|
345
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
346
|
+
value: "https://booking.thaiticketmajor.com",
|
|
347
|
+
},
|
|
348
|
+
],
|
|
349
|
+
},
|
|
350
|
+
condition: {
|
|
351
|
+
urlFilter: "bookingseats.php",
|
|
352
|
+
resourceTypes: [
|
|
353
|
+
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
354
|
+
],
|
|
355
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
356
|
+
excludedInitiatorDomains: excludedDomains,
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
id: 1021,
|
|
361
|
+
priority: 25,
|
|
362
|
+
action: {
|
|
363
|
+
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
364
|
+
requestHeaders: [
|
|
365
|
+
{
|
|
366
|
+
header: "Referer",
|
|
367
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
368
|
+
value: fixedReferer,
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
header: "Origin",
|
|
372
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
373
|
+
value: "https://booking.thaiticketmajor.com",
|
|
374
|
+
},
|
|
375
|
+
],
|
|
376
|
+
},
|
|
377
|
+
condition: {
|
|
378
|
+
urlFilter: "validateseat.php",
|
|
379
|
+
resourceTypes: [
|
|
380
|
+
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
381
|
+
],
|
|
382
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
383
|
+
excludedInitiatorDomains: excludedDomains,
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
id: 1022,
|
|
388
|
+
priority: 25,
|
|
389
|
+
action: {
|
|
390
|
+
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
391
|
+
requestHeaders: [
|
|
392
|
+
{
|
|
393
|
+
header: "Referer",
|
|
394
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
395
|
+
value: festivalReferer,
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
header: "Origin",
|
|
399
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
400
|
+
value: "https://booking.thaiticketmajor.com",
|
|
401
|
+
},
|
|
402
|
+
],
|
|
403
|
+
},
|
|
404
|
+
condition: {
|
|
405
|
+
urlFilter: "bookingfestival.php",
|
|
406
|
+
resourceTypes: [
|
|
407
|
+
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
408
|
+
],
|
|
409
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
410
|
+
excludedInitiatorDomains: excludedDomains,
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
id: 1023,
|
|
415
|
+
priority: 25,
|
|
416
|
+
action: {
|
|
417
|
+
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
418
|
+
requestHeaders: [
|
|
419
|
+
{
|
|
420
|
+
header: "Referer",
|
|
421
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
422
|
+
value: enrollReferer,
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
header: "Origin",
|
|
426
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
427
|
+
value: "https://booking.thaiticketmajor.com",
|
|
428
|
+
},
|
|
429
|
+
],
|
|
430
|
+
},
|
|
431
|
+
condition: {
|
|
432
|
+
urlFilter: "enroll_process.php",
|
|
433
|
+
resourceTypes: [
|
|
434
|
+
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
435
|
+
],
|
|
436
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
437
|
+
excludedInitiatorDomains: excludedDomains,
|
|
438
|
+
},
|
|
439
|
+
},
|
|
277
440
|
{
|
|
278
441
|
id: 1010,
|
|
279
442
|
priority: 20,
|
|
@@ -285,6 +448,11 @@ export class ThaiTicketMajor {
|
|
|
285
448
|
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
286
449
|
value: "https://booking.thaiticketmajor.com/booking/3m/orderenc_kbankqr.php",
|
|
287
450
|
},
|
|
451
|
+
{
|
|
452
|
+
header: "Origin",
|
|
453
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
454
|
+
value: "https://booking.thaiticketmajor.com",
|
|
455
|
+
},
|
|
288
456
|
],
|
|
289
457
|
},
|
|
290
458
|
condition: {
|
|
@@ -292,6 +460,8 @@ export class ThaiTicketMajor {
|
|
|
292
460
|
resourceTypes: [
|
|
293
461
|
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
294
462
|
],
|
|
463
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
464
|
+
excludedInitiatorDomains: excludedDomains,
|
|
295
465
|
},
|
|
296
466
|
},
|
|
297
467
|
{
|
|
@@ -305,6 +475,11 @@ export class ThaiTicketMajor {
|
|
|
305
475
|
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
306
476
|
value: "https://booking.thaiticketmajor.com/booking/3m/orderenc_kbankqr.php",
|
|
307
477
|
},
|
|
478
|
+
{
|
|
479
|
+
header: "Origin",
|
|
480
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
481
|
+
value: "https://booking.thaiticketmajor.com",
|
|
482
|
+
},
|
|
308
483
|
],
|
|
309
484
|
},
|
|
310
485
|
condition: {
|
|
@@ -312,6 +487,8 @@ export class ThaiTicketMajor {
|
|
|
312
487
|
resourceTypes: [
|
|
313
488
|
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
314
489
|
],
|
|
490
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
491
|
+
excludedInitiatorDomains: excludedDomains,
|
|
315
492
|
},
|
|
316
493
|
},
|
|
317
494
|
{
|
|
@@ -325,6 +502,11 @@ export class ThaiTicketMajor {
|
|
|
325
502
|
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
326
503
|
value: "https://booking.thaiticketmajor.com/booking/3m/paycfmall.php",
|
|
327
504
|
},
|
|
505
|
+
{
|
|
506
|
+
header: "Origin",
|
|
507
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
508
|
+
value: "https://booking.thaiticketmajor.com",
|
|
509
|
+
},
|
|
328
510
|
],
|
|
329
511
|
},
|
|
330
512
|
condition: {
|
|
@@ -332,6 +514,8 @@ export class ThaiTicketMajor {
|
|
|
332
514
|
resourceTypes: [
|
|
333
515
|
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
334
516
|
],
|
|
517
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
518
|
+
excludedInitiatorDomains: excludedDomains,
|
|
335
519
|
},
|
|
336
520
|
},
|
|
337
521
|
{
|
|
@@ -345,6 +529,11 @@ export class ThaiTicketMajor {
|
|
|
345
529
|
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
346
530
|
value: "https://booking.thaiticketmajor.com/booking/3m/paymentall.php",
|
|
347
531
|
},
|
|
532
|
+
{
|
|
533
|
+
header: "Origin",
|
|
534
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
535
|
+
value: "https://booking.thaiticketmajor.com",
|
|
536
|
+
},
|
|
348
537
|
],
|
|
349
538
|
},
|
|
350
539
|
condition: {
|
|
@@ -352,6 +541,8 @@ export class ThaiTicketMajor {
|
|
|
352
541
|
resourceTypes: [
|
|
353
542
|
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
354
543
|
],
|
|
544
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
545
|
+
excludedInitiatorDomains: excludedDomains,
|
|
355
546
|
},
|
|
356
547
|
},
|
|
357
548
|
{
|
|
@@ -365,6 +556,11 @@ export class ThaiTicketMajor {
|
|
|
365
556
|
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
366
557
|
value: "https://booking.thaiticketmajor.com/booking/3m/fixed.php",
|
|
367
558
|
},
|
|
559
|
+
{
|
|
560
|
+
header: "Origin",
|
|
561
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
562
|
+
value: "https://booking.thaiticketmajor.com",
|
|
563
|
+
},
|
|
368
564
|
],
|
|
369
565
|
},
|
|
370
566
|
condition: {
|
|
@@ -372,6 +568,8 @@ export class ThaiTicketMajor {
|
|
|
372
568
|
resourceTypes: [
|
|
373
569
|
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
374
570
|
],
|
|
571
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
572
|
+
excludedInitiatorDomains: excludedDomains,
|
|
375
573
|
},
|
|
376
574
|
},
|
|
377
575
|
{
|
|
@@ -385,13 +583,20 @@ export class ThaiTicketMajor {
|
|
|
385
583
|
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
386
584
|
value: "https://booking.thaiticketmajor.com/booking/3m/fixed.php",
|
|
387
585
|
},
|
|
586
|
+
{
|
|
587
|
+
header: "Origin",
|
|
588
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
589
|
+
value: "https://booking.thaiticketmajor.com",
|
|
590
|
+
},
|
|
388
591
|
],
|
|
389
592
|
},
|
|
390
593
|
condition: {
|
|
391
|
-
urlFilter: "enroll",
|
|
594
|
+
urlFilter: "enroll.php",
|
|
392
595
|
resourceTypes: [
|
|
393
596
|
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
394
597
|
],
|
|
598
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
599
|
+
excludedInitiatorDomains: excludedDomains,
|
|
395
600
|
},
|
|
396
601
|
},
|
|
397
602
|
{
|
|
@@ -405,6 +610,11 @@ export class ThaiTicketMajor {
|
|
|
405
610
|
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
406
611
|
value: "https://booking.thaiticketmajor.com/booking/3m/zones.php",
|
|
407
612
|
},
|
|
613
|
+
{
|
|
614
|
+
header: "Origin",
|
|
615
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
616
|
+
value: "https://booking.thaiticketmajor.com",
|
|
617
|
+
},
|
|
408
618
|
],
|
|
409
619
|
},
|
|
410
620
|
condition: {
|
|
@@ -412,6 +622,8 @@ export class ThaiTicketMajor {
|
|
|
412
622
|
resourceTypes: [
|
|
413
623
|
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
414
624
|
],
|
|
625
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
626
|
+
excludedInitiatorDomains: excludedDomains,
|
|
415
627
|
},
|
|
416
628
|
},
|
|
417
629
|
{
|
|
@@ -425,6 +637,11 @@ export class ThaiTicketMajor {
|
|
|
425
637
|
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
426
638
|
value: "https://kpaymentgateway.kasikornbank.com/",
|
|
427
639
|
},
|
|
640
|
+
{
|
|
641
|
+
header: "Origin",
|
|
642
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
643
|
+
value: "https://kpaymentgateway.kasikornbank.com",
|
|
644
|
+
},
|
|
428
645
|
],
|
|
429
646
|
},
|
|
430
647
|
condition: {
|
|
@@ -432,6 +649,8 @@ export class ThaiTicketMajor {
|
|
|
432
649
|
resourceTypes: [
|
|
433
650
|
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
434
651
|
],
|
|
652
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
653
|
+
excludedInitiatorDomains: excludedDomains,
|
|
435
654
|
},
|
|
436
655
|
},
|
|
437
656
|
{
|
|
@@ -445,6 +664,11 @@ export class ThaiTicketMajor {
|
|
|
445
664
|
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
446
665
|
value: "https://booking.thaiticketmajor.com/booking/3m/",
|
|
447
666
|
},
|
|
667
|
+
{
|
|
668
|
+
header: "Origin",
|
|
669
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
670
|
+
value: "https://booking.thaiticketmajor.com",
|
|
671
|
+
},
|
|
448
672
|
],
|
|
449
673
|
},
|
|
450
674
|
condition: {
|
|
@@ -452,6 +676,8 @@ export class ThaiTicketMajor {
|
|
|
452
676
|
resourceTypes: [
|
|
453
677
|
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
454
678
|
],
|
|
679
|
+
...(initiatorDomains ? { initiatorDomains } : {}),
|
|
680
|
+
excludedInitiatorDomains: excludedDomains,
|
|
455
681
|
},
|
|
456
682
|
},
|
|
457
683
|
],
|
|
@@ -1726,6 +1952,14 @@ export class ThaiTicketMajor {
|
|
|
1726
1952
|
|
|
1727
1953
|
// 5. ดำเนินการตามประเภทโซน (Fixed vs Festival)
|
|
1728
1954
|
if (targetZone.page === "fixed.php") {
|
|
1955
|
+
if (this.inBrowser) {
|
|
1956
|
+
await ThaiTicketMajor.setupExtensionRules({
|
|
1957
|
+
k: zoneData.k,
|
|
1958
|
+
zone: targetZone.value,
|
|
1959
|
+
roundId: targetPerformRound.id,
|
|
1960
|
+
});
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1729
1963
|
const fixedData = await this.getFixedSeats(zoneData.k, targetZone.value, targetPerformRound.id);
|
|
1730
1964
|
const availableSeats = fixedData.seats;
|
|
1731
1965
|
|
|
@@ -1771,6 +2005,14 @@ export class ThaiTicketMajor {
|
|
|
1771
2005
|
}
|
|
1772
2006
|
} else {
|
|
1773
2007
|
// Festival Flow
|
|
2008
|
+
if (this.inBrowser) {
|
|
2009
|
+
await ThaiTicketMajor.setupExtensionRules({
|
|
2010
|
+
k: zoneData.k,
|
|
2011
|
+
zone: targetZone.value,
|
|
2012
|
+
roundId: targetPerformRound.id,
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
|
|
1774
2016
|
const festivalForm = await this.getFestival(zoneData.k, zoneData.tk, selectedRound.query, targetZone.value, targetPerformRound.id);
|
|
1775
2017
|
|
|
1776
2018
|
await this.validateFestivalSeats(zoneData.k, festivalForm, ticketCount);
|