mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(flash board): add SWF posting support (#1145)
This commit is contained in:
@@ -14,7 +14,7 @@ import { MEDIA_UPLOAD_RECIPES } from './media-upload-recipes.js';
|
||||
const POLL_INTERVAL_MS = 500;
|
||||
|
||||
/** File extensions that denote direct media URLs (mirrors src/lib/media-hosting/direct-url.ts) */
|
||||
const DIRECT_MEDIA_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.webm', '.mp4', '.mov', '.avi', '.mkv', '.gifv'];
|
||||
const DIRECT_MEDIA_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.webm', '.mp4', '.mov', '.avi', '.mkv', '.gifv', '.swf'];
|
||||
|
||||
/** Returns true if the URL appears to point to a direct media file. Exported for tests. */
|
||||
export function isDirectMediaUrl(url) {
|
||||
|
||||
@@ -105,6 +105,11 @@ describe('media-upload-automation', () => {
|
||||
expect(isDirectMediaUrl('https://example.com/video.mp4')).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://i.imgur.com/abc.png?size=large')).toBe(true);
|
||||
expect(isDirectMediaUrl('https://imgur.com/page.html?img=photo.jpg')).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user