Update.
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@
|
||||
* @keywords api, client, devrant, http, fetch
|
||||
*/
|
||||
|
||||
const API_BASE_URL = window.location.hostname === 'localhost' ? '/api/' : 'https://dr.molodetz.nl/api/';
|
||||
const API_BASE_URL = '/api/';
|
||||
const APP_ID = 3;
|
||||
|
||||
class ApiClient {
|
||||
|
||||
+5
-4
@@ -24,7 +24,7 @@ function getYoutubeVideoId(url) {
|
||||
}
|
||||
|
||||
function getYoutubeThumbnail(videoId) {
|
||||
return `https://img.youtube.com/vi/${videoId}/hqdefault.jpg`;
|
||||
return `/api/proxy-image?url=${encodeURIComponent(`https://img.youtube.com/vi/${videoId}/hqdefault.jpg`)}`;
|
||||
}
|
||||
|
||||
function getYoutubeEmbedUrl(videoId) {
|
||||
@@ -86,17 +86,18 @@ function isDevrantImageUrl(url) {
|
||||
}
|
||||
|
||||
function buildDevrantImageUrl(imagePath) {
|
||||
if (!imagePath) return null;
|
||||
if (imagePath.startsWith('http')) {
|
||||
return imagePath;
|
||||
return `/api/proxy-image?url=${encodeURIComponent(imagePath)}`;
|
||||
}
|
||||
return `https://img.devrant.com/${imagePath}`;
|
||||
return `/api/proxy-image?url=${encodeURIComponent(`https://img.devrant.com/${imagePath}`)}`;
|
||||
}
|
||||
|
||||
function buildAvatarUrl(avatar) {
|
||||
if (!avatar || !avatar.i) {
|
||||
return null;
|
||||
}
|
||||
return `https://avatars.devrant.com/${avatar.i}`;
|
||||
return `/api/proxy-image?url=${encodeURIComponent(`https://avatars.devrant.com/${avatar.i}`)}`;
|
||||
}
|
||||
|
||||
export {
|
||||
|
||||
Reference in New Issue
Block a user