mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-17 05:54:19 +01:00
feat: support cdn.nostr.build thumbnail
This commit is contained in:
@@ -28,4 +28,13 @@ describe('thumbnailUrl', () => {
|
||||
'https://nostr.build/responsive/240p/i/f56ee902307158c1ebbcb5ac00430dbf1425eac12d55e4277ebccbe54d09671b.jpg';
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
});
|
||||
|
||||
it('should return url for cdn.nostr.build', () => {
|
||||
const actual = thumbnailUrl(
|
||||
'https://cdn.nostr.build/i/6a2868ebb53da2c295e3a2a20a29fa009f230f721b71e88c7ffc3ec8eaae870f.png',
|
||||
);
|
||||
const expected =
|
||||
'https://nostr.build/responsive/240p/i/6a2868ebb53da2c295e3a2a20a29fa009f230f721b71e88c7ffc3ec8eaae870f.png';
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,7 +54,11 @@ export const thumbnailUrl = (urlString: string): string => {
|
||||
|
||||
// nostr.build
|
||||
// https://github.com/nostrbuild/nostr.build/blob/main/api/v2/routes_upload.php
|
||||
if (url.host === 'nostr.build' || url.host === 'image.nostr.build') {
|
||||
if (
|
||||
url.host === 'nostr.build' ||
|
||||
url.host === 'image.nostr.build' ||
|
||||
url.host === 'cdn.nostr.build'
|
||||
) {
|
||||
const result = new URL(url);
|
||||
result.host = 'nostr.build';
|
||||
// profile pic (PFP)
|
||||
|
||||
Reference in New Issue
Block a user