mirror of
https://github.com/tiennm99/store-scraper-bot.git
synced 2026-10-19 18:16:10 +00:00
fix: gate /rawappleapp + /rawgoogleapp on authorizeGroup
Match the auth check used by every other command. Without it, any chat that knows the bot username could dump arbitrary App Store / Play Store JSON.
This commit is contained in:
1 parent
0f0f9b93f3
commit
4fe4a781e0
3 files changed
+8
-4
No files matched your search
+2
-2
@@ -67,8 +67,8 @@ export function createBot(config, store, appleScraper, googleScraper) {
|
|||||||
listapp: createListAppCommand(store),
|
listapp: createListAppCommand(store),
|
||||||
checkapp: createCheckAppCommand(config, store, appleScraper, googleScraper),
|
checkapp: createCheckAppCommand(config, store, appleScraper, googleScraper),
|
||||||
checkappscore: createCheckAppScoresCommand(store, appleScraper, googleScraper),
|
checkappscore: createCheckAppScoresCommand(store, appleScraper, googleScraper),
|
||||||
rawappleapp: createRawAppleAppCommand(appleScraper),
|
rawappleapp: createRawAppleAppCommand(store, appleScraper),
|
||||||
rawgoogleapp: createRawGoogleAppCommand(googleScraper),
|
rawgoogleapp: createRawGoogleAppCommand(store, googleScraper),
|
||||||
};
|
};
|
||||||
|
|
||||||
return { sender, commands, api };
|
return { sender, commands, api };
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { buildAppleRequestByBundleId, buildAppleRequestByTrackId } from '../../api/apple-scraper.js';
|
import { buildAppleRequestByBundleId, buildAppleRequestByTrackId } from '../../api/apple-scraper.js';
|
||||||
|
import { authorizeGroup } from './command-utils.js';
|
||||||
|
|
||||||
// /rawappleapp <id|appId> [country=vn] — sends raw upstream JSON as a document.
|
// /rawappleapp <id|appId> [country=vn] — sends raw upstream JSON as a document.
|
||||||
export function createRawAppleAppCommand(appleScraper) {
|
export function createRawAppleAppCommand(store, appleScraper) {
|
||||||
return async (msg, sender, args) => {
|
return async (msg, sender, args) => {
|
||||||
|
if (!(await authorizeGroup(msg.chat.id, store, sender))) return;
|
||||||
if (args.length < 1 || args.length > 2) {
|
if (args.length < 1 || args.length > 2) {
|
||||||
await sender.sendMessage(msg.chat.id, 'Invalid arguments');
|
await sender.sendMessage(msg.chat.id, 'Invalid arguments');
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { buildGoogleRequest } from '../../api/google-scraper.js';
|
import { buildGoogleRequest } from '../../api/google-scraper.js';
|
||||||
|
import { authorizeGroup } from './command-utils.js';
|
||||||
|
|
||||||
// /rawgoogleapp <appId> [country=vn]
|
// /rawgoogleapp <appId> [country=vn]
|
||||||
export function createRawGoogleAppCommand(googleScraper) {
|
export function createRawGoogleAppCommand(store, googleScraper) {
|
||||||
return async (msg, sender, args) => {
|
return async (msg, sender, args) => {
|
||||||
|
if (!(await authorizeGroup(msg.chat.id, store, sender))) return;
|
||||||
if (args.length < 1 || args.length > 2) {
|
if (args.length < 1 || args.length > 2) {
|
||||||
await sender.sendMessage(msg.chat.id, 'Invalid arguments');
|
await sender.sendMessage(msg.chat.id, 'Invalid arguments');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in new issue
Block a user