fix(vpn): pause polling while a private config is on screen
Every five-second poll re-rendered the page, putting the private key into another HTTP response — the handoff kept it out of the snapshot but not out of the responses. Traffic figures can wait the minute it takes to copy a key. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>feat/portal-design
parent
c2b18ecfbc
commit
3bd3e64a3d
|
|
@ -1,4 +1,7 @@
|
|||
<div class="space-y-5" wire:poll.5s="refreshPeers">
|
||||
{{-- Polling pauses while a config is on screen: every poll re-renders this
|
||||
page, and that would put the private key into an HTTP response every five
|
||||
seconds. Traffic figures can wait the minute someone needs to copy a key. --}}
|
||||
<div class="space-y-5" @if (! $newConfig) wire:poll.5s="refreshPeers" @endif>
|
||||
<div class="animate-rise">
|
||||
<h1 class="text-2xl font-semibold tracking-tight text-ink">{{ __('vpn.title') }}</h1>
|
||||
<p class="mt-1 text-sm text-muted">{{ __('vpn.subtitle') }}</p>
|
||||
|
|
|
|||
|
|
@ -714,3 +714,20 @@ it('never leaves the previous config on screen after another access is created',
|
|||
->and($component->get('newConfigName'))->toBeNull()
|
||||
->and(App\Services\Wireguard\ConfigHandoff::get($firstToken))->toBeNull();
|
||||
});
|
||||
|
||||
it('does not keep polling while a private config is on screen', function () {
|
||||
vpnHub();
|
||||
Queue::fake();
|
||||
$owner = operator('Owner');
|
||||
|
||||
$component = Livewire::actingAs($owner)->test(Vpn::class)->assertSee('wire:poll', false);
|
||||
|
||||
$component->set('name', 'Notebook')->set('ownerId', $owner->id)->call('create');
|
||||
|
||||
// Otherwise every poll would put the private key into another response.
|
||||
$component->assertDontSee('wire:poll', false)->assertSee('PrivateKey');
|
||||
|
||||
$component->call('dismissConfig')
|
||||
->assertSee('wire:poll', false)
|
||||
->assertDontSee('PrivateKey');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue