Update: 2026-07-05 23:31:51
This commit is contained in:
@@ -24,6 +24,8 @@ import requests
|
|||||||
SERVER_URL = "http://jordan-siro.intaleqapp.com/backend/marketing_engine/social_worker.php"
|
SERVER_URL = "http://jordan-siro.intaleqapp.com/backend/marketing_engine/social_worker.php"
|
||||||
BOT_TOKEN = "YOUR_SECRET_BOT_TOKEN" # Must match headers in social_worker.php
|
BOT_TOKEN = "YOUR_SECRET_BOT_TOKEN" # Must match headers in social_worker.php
|
||||||
PLATFORM = "facebook" # 'facebook' or 'telegram'
|
PLATFORM = "facebook" # 'facebook' or 'telegram'
|
||||||
|
ACCOUNT_ID = None # Set to a specific integer if manual mapping is preferred
|
||||||
|
DEVICE_ID = None # e.g. "a1b2c3d4" - Recommended: The unique Android device ID for auto Plug & Play binding
|
||||||
CHECK_INTERVAL_SECONDS = 60 # Cooldown between checking for new tasks
|
CHECK_INTERVAL_SECONDS = 60 # Cooldown between checking for new tasks
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
@@ -105,7 +107,13 @@ def report_status(action, params):
|
|||||||
def process_task():
|
def process_task():
|
||||||
print("[*] Checking for pending tasks...")
|
print("[*] Checking for pending tasks...")
|
||||||
try:
|
try:
|
||||||
res = requests.get(f"{SERVER_URL}?action=get_task&platform={PLATFORM}", headers=headers, timeout=10)
|
url = f"{SERVER_URL}?action=get_task&platform={PLATFORM}"
|
||||||
|
if ACCOUNT_ID:
|
||||||
|
url += f"&account_id={ACCOUNT_ID}"
|
||||||
|
elif DEVICE_ID:
|
||||||
|
url += f"&device_id={DEVICE_ID}"
|
||||||
|
|
||||||
|
res = requests.get(url, headers=headers, timeout=10)
|
||||||
response_data = res.json()
|
response_data = res.json()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[-] Connection failed: {e}")
|
print(f"[-] Connection failed: {e}")
|
||||||
|
|||||||
@@ -27,6 +27,33 @@ try {
|
|||||||
// The bot asks for a task to do
|
// The bot asks for a task to do
|
||||||
$platform = $_GET['platform'] ?? 'facebook';
|
$platform = $_GET['platform'] ?? 'facebook';
|
||||||
$requestedAccountId = $_GET['account_id'] ?? null;
|
$requestedAccountId = $_GET['account_id'] ?? null;
|
||||||
|
$deviceId = $_GET['device_id'] ?? null;
|
||||||
|
|
||||||
|
// Automatic Plug & Play Device Binding
|
||||||
|
if ($deviceId) {
|
||||||
|
$stmtDev = $con->prepare("SELECT id FROM social_accounts WHERE device_id = ?");
|
||||||
|
$stmtDev->execute([$deviceId]);
|
||||||
|
$acc = $stmtDev->fetch(PDO::FETCH_ASSOC);
|
||||||
|
if ($acc) {
|
||||||
|
$requestedAccountId = $acc['id'];
|
||||||
|
} else {
|
||||||
|
require_once __DIR__ . '/account_manager.php';
|
||||||
|
$am = new AccountManager();
|
||||||
|
// Find an account that doesn't have a device_id yet
|
||||||
|
$stmtFind = $con->prepare("SELECT id FROM social_accounts WHERE platform = ? AND device_id IS NULL AND status = 'active' LIMIT 1");
|
||||||
|
$stmtFind->execute([$platform]);
|
||||||
|
$newAcc = $stmtFind->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($newAcc) {
|
||||||
|
$requestedAccountId = $newAcc['id'];
|
||||||
|
$updateDev = $con->prepare("UPDATE social_accounts SET device_id = ? WHERE id = ?");
|
||||||
|
$updateDev->execute([$deviceId, $requestedAccountId]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'No available unassigned accounts for this new device']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find a pending task that is scheduled for now or earlier
|
// Find a pending task that is scheduled for now or earlier
|
||||||
if ($requestedAccountId) {
|
if ($requestedAccountId) {
|
||||||
|
|||||||
@@ -2087,6 +2087,7 @@ CREATE TABLE IF NOT EXISTS `social_accounts` (
|
|||||||
`proxy_port` INT NULL,
|
`proxy_port` INT NULL,
|
||||||
`proxy_username` VARCHAR(100) NULL,
|
`proxy_username` VARCHAR(100) NULL,
|
||||||
`proxy_password` VARCHAR(100) NULL,
|
`proxy_password` VARCHAR(100) NULL,
|
||||||
|
`device_id` VARCHAR(255) NULL UNIQUE,
|
||||||
`last_active` DATETIME NULL,
|
`last_active` DATETIME NULL,
|
||||||
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
|
|||||||
Reference in New Issue
Block a user