mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-26 07:05:43 +02:00
🥅 Catch error if URL not specificed
This commit is contained in:
parent
8c15ab4c84
commit
c87e13cb70
@ -142,12 +142,13 @@ export default {
|
|||||||
},
|
},
|
||||||
/* Get favicon URL, for items which use the favicon as their icon */
|
/* Get favicon URL, for items which use the favicon as their icon */
|
||||||
getFavicon(fullUrl, specificApi) {
|
getFavicon(fullUrl, specificApi) {
|
||||||
|
const fullUrlTrue = fullUrl || '';
|
||||||
const faviconApi = specificApi || this.appConfig.faviconApi || defaultFaviconApi;
|
const faviconApi = specificApi || this.appConfig.faviconApi || defaultFaviconApi;
|
||||||
if (this.shouldUseDefaultFavicon(fullUrl) || faviconApi === 'local') { // Check if we should use local icon
|
if (this.shouldUseDefaultFavicon(fullUrlTrue) || faviconApi === 'local') { // Check if we should use local icon
|
||||||
const urlParts = fullUrl.split('/');
|
const urlParts = fullUrlTrue.split('/');
|
||||||
if (urlParts.length >= 2) return `${urlParts[0]}/${urlParts[1]}/${urlParts[2]}/${iconCdns.faviconName}`;
|
if (urlParts.length >= 2) return `${urlParts[0]}/${urlParts[1]}/${urlParts[2]}/${iconCdns.faviconName}`;
|
||||||
} else if (fullUrl.includes('http')) { // Service is running publicly
|
} else if (fullUrlTrue.includes('http')) { // Service is running publicly
|
||||||
const host = this.getHostName(fullUrl);
|
const host = this.getHostName(fullUrlTrue);
|
||||||
const endpoint = faviconApiEndpoints[faviconApi];
|
const endpoint = faviconApiEndpoints[faviconApi];
|
||||||
return endpoint.replace('$URL', host);
|
return endpoint.replace('$URL', host);
|
||||||
}
|
}
|
||||||
@ -223,7 +224,7 @@ export default {
|
|||||||
/* Called when initial icon has resulted in 404. Attempts to find new icon */
|
/* Called when initial icon has resulted in 404. Attempts to find new icon */
|
||||||
getFallbackIcon() {
|
getFallbackIcon() {
|
||||||
if (this.attemptedFallback) return undefined; // If this is second attempt, then give up
|
if (this.attemptedFallback) return undefined; // If this is second attempt, then give up
|
||||||
const { iconType } = this;
|
const iconType = this.iconType || '';
|
||||||
const markAsAttempted = () => { this.broken = false; this.attemptedFallback = true; };
|
const markAsAttempted = () => { this.broken = false; this.attemptedFallback = true; };
|
||||||
if (iconType.includes('favicon')) { // Specify fallback for favicon-based icons
|
if (iconType.includes('favicon')) { // Specify fallback for favicon-based icons
|
||||||
markAsAttempted();
|
markAsAttempted();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user