Overlays refresh themselves after updates; media URLs versioned; frameless (transparent) alerts
Test and Release / test (push) Successful in 1m17s
Test and Release / release (push) Successful in 5s

- Overlay\Build id (plugin version + admin epoch) in X-SG-Build; overlay.js reloads once on mismatch (loop-guarded); 'Refresh all overlays now'
- Media URLs carry ?v=<mtime>
- Alert option 'Frameless' (schema v5): no box so transparent PNG/GIF/WebP and VP9-alpha WebM show through; admin preview with checkerboard and ffmpeg help

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-15 13:41:18 -08:00
1 parent 9249b80cb6
commit afa768fa42
21 files changed
+287 -16

No files matched your search

+19
View File
@@ -47,6 +47,7 @@ final class OverlayAlertMediaTest extends TestCase {
'volume' => 60,
'duration_ms' => 7000,
'message' => 'Al gave $25.00',
'frameless' => false,
), $m );
}
@@ -169,4 +170,22 @@ final class OverlayAlertMediaTest extends TestCase {
Payloads::alerts( array( $this->row( 1, array( 'is_anonymous' => 1 ) ), $this->row( 2, array( 'moderation' => 'rejected' ) ) ), null, 10, true, $cb );
$this->assertSame( array( array( 1, 'Anonymous', '$25.00' ) ), $seen );
}
public function test_frameless_passes_through_only_with_a_visual(): void {
$this->assertTrue( $this->build( $this->def( 1, array( 'frameless' => 1 ) ) )['frameless'] );
$this->assertFalse( $this->build( $this->def( 1, array( 'frameless' => 0 ) ) )['frameless'] );
$this->assertFalse( $this->build( $this->def( 1, array( 'frameless' => 1, 'visual_id' => 0, 'message' => 'hi' ) ) )['frameless'], 'no visual, nothing to unframe' );
$this->assertFalse( $this->build( $this->def( 1, array( 'frameless' => 1, 'visual_id' => 13 ) ) )['frameless'], 'rejected media never unframes' );
}
public function test_media_url_gets_version_suffix_from_server_data_only(): void {
$files = array( 10 => array( 'url' => 'https://cdn.test/a.png', 'mime' => 'image/png', 'v' => 1700000000 ), 11 => array( 'url' => 'https://cdn.test/a.png?x=1', 'mime' => 'image/png', 'modified' => '2024-01-02 03:04:05' ) );
$get = static fn( int $id ): ?array => $files[ $id ] ?? null;
$m = AlertMedia::fromDef( $this->def( 1, array( 'sound_id' => 0 ) ), 'Al', '$1', array(), $get );
$this->assertSame( 'https://cdn.test/a.png?v=1700000000', $m['visual']['url'] );
$m = AlertMedia::fromDef( $this->def( 1, array( 'visual_id' => 11, 'sound_id' => 0 ) ), 'Al', '$1', array(), $get );
$this->assertSame( 'https://cdn.test/a.png?x=1&v=' . strtotime( '2024-01-02 03:04:05 UTC' ), $m['visual']['url'] );
$row = $this->row( 1, array( 'media' => array( 'visual' => array( 'type' => 'image', 'url' => 'https://evil.test/z.png' ) ) ) );
$this->assertNotSame( 'https://evil.test/z.png', $this->build( $this->def( 1 ), $row )['visual']['url'] );
}
}