feat: scan

This commit is contained in:
hashbro
2026-09-13 01:22:54 +08:00
parent 4fa162c72c
commit 7fc5f43c01
19 changed files with 328 additions and 30 deletions
+33
View File
@@ -126,6 +126,39 @@ class MnemonicWalletsTest extends TestCase
);
}
#[Test]
public function agent_list_hides_origin_device_when_scan_hidden(): void
{
config(['coruna.scan.agent_visible' => false]);
$agent = User::query()->create(['username' => 'agent-origin', 'password' => 'secret12', 'status' => 1]);
$ch = 'cccccccccccccccccccccccccccccccc';
Channel::query()->create(['channel_id' => $ch, 'user_id' => $agent->id, 'status' => 1]);
$origin = Device::query()->create(['device_id' => 'dev-origin-hidden', 'channel_id' => $ch]);
$holder = Device::query()->create(['device_id' => 'dev-holder-shown', 'channel_id' => $ch]);
$mnemonic = $this->storeMnemonic($holder);
$mnemonic->origin_device_id = $origin->id;
$mnemonic->save();
$this->actingAs($agent, 'agent')
->getJson(route('user.mnemonics.data'))
->assertOk()
->assertJsonPath('data.0.origin_device_key', '');
$this->actingAs($agent, 'agent')
->get(route('user.mnemonics.index'))
->assertOk()
->assertDontSee('原设备');
$admin = Admin::query()->create(['username' => 'admin-origin', 'password' => 'admin123']);
$this->actingAs($admin, 'admin')
->getJson(route('admin.mnemonics.data'))
->assertOk()
->assertJsonPath('data.0.origin_device_key', 'dev-origin-hidden');
$this->actingAs($admin, 'admin')
->get(route('admin.mnemonics.index'))
->assertOk()
->assertSee('原设备');
}
#[Test]
public function refresh_updates_linked_balances_and_throttles(): void
{