mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2026-01-27 17:11:13 +00:00
First commit: /a/, /gallery/, images, gifv
This commit is contained in:
11
src/util.ts
Normal file
11
src/util.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export const proxyURL = (url: string): string =>
|
||||
url.replace(/^https?:\/\/[^.]*\.imgur.com\//, '/');
|
||||
|
||||
export const linkify = (content: string) =>
|
||||
content.replace(
|
||||
/https?:\/\/[^.]*\.imgur.com\/([\/_a-zA-Z0-9-]+)\.gifv/g,
|
||||
'<video src="/$1.mp4" class="commentVideo commentObject" loop="" autoplay=""></video>'
|
||||
).replace(
|
||||
/https?:\/\/[^.]*\.imgur.com\/([\/_a-zA-Z0-9-]+\.[a-z0-9A-Z]{2,6})/g,
|
||||
'<a href="/$1" target="_blank"><img class="commentImage commentObject" src="/$1" loading="lazy" /></a>'
|
||||
);
|
||||
Reference in New Issue
Block a user