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:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user