feat(flash board): add SWF posting support (#1145)

This commit is contained in:
Tommaso Casaburi
2026-05-30 16:07:41 +07:00
committed by GitHub
parent 56894700c1
commit 9b3a95dd95
69 changed files with 1372 additions and 63 deletions
@@ -21,6 +21,11 @@ describe('direct-url', () => {
expect(isDirectMediaUrl('https://example.com/video.gifv')).toBe(true);
});
it('returns true for Flash movie extensions', () => {
expect(isDirectMediaUrl('https://example.com/movie.swf')).toBe(true);
expect(isDirectMediaUrl('https://example.com/movie.SWF?download=1')).toBe(true);
});
it('strips query strings and fragments before checking', () => {
expect(isDirectMediaUrl('https://example.com/photo.jpg?size=large')).toBe(true);
expect(isDirectMediaUrl('https://example.com/page.html?img=photo.jpg')).toBe(false);
+3 -3
View File
@@ -1,7 +1,7 @@
/** File extensions that denote direct media URLs (images + videos) */
const DIRECT_MEDIA_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.webm', '.mp4', '.mov', '.avi', '.mkv', '.gifv'] as const;
/** File extensions that denote direct media URLs (images, videos, and Flash movies) */
const DIRECT_MEDIA_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.webm', '.mp4', '.mov', '.avi', '.mkv', '.gifv', '.swf'] as const;
/** Returns true if the URL appears to point to a direct media file (image or video) */
/** Returns true if the URL appears to point to a direct media file */
export function isDirectMediaUrl(url: string): boolean {
try {
const normalized = url.split('?')[0].split('#')[0].toLowerCase();