Update: 2026-07-05 23:31:51

This commit is contained in:
Hamza-Ayed
2026-07-05 23:31:51 +03:00
parent 36761dce91
commit 4a6ca417ad
3 changed files with 37 additions and 1 deletions
@@ -24,6 +24,8 @@ import requests
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
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
headers = {
@@ -105,7 +107,13 @@ def report_status(action, params):
def process_task():
print("[*] Checking for pending tasks...")
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()
except Exception as e:
print(f"[-] Connection failed: {e}")
@@ -27,6 +27,33 @@ try {
// The bot asks for a task to do
$platform = $_GET['platform'] ?? 'facebook';
$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
if ($requestedAccountId) {
+1
View File
@@ -2087,6 +2087,7 @@ CREATE TABLE IF NOT EXISTS `social_accounts` (
`proxy_port` INT NULL,
`proxy_username` VARCHAR(100) NULL,
`proxy_password` VARCHAR(100) NULL,
`device_id` VARCHAR(255) NULL UNIQUE,
`last_active` DATETIME NULL,
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP,
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP