mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-04-21 13:14:04 +02:00
fixed favicon wrongly displaying for files
This commit is contained in:
parent
14fb5c37a9
commit
a5102abe46
1 changed files with 4 additions and 9 deletions
13
app.vue
13
app.vue
|
@ -5,7 +5,7 @@
|
||||||
spellcheck="false" class="search" type="text" placeholder="Type to filter entries...">
|
spellcheck="false" class="search" type="text" placeholder="Type to filter entries...">
|
||||||
<div class="bottom-bar">
|
<div class="bottom-bar">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<img class="logo" width="18px" src="/Logo.svg" alt="">
|
<img class="logo" width="18px" src="/logo.png" alt="">
|
||||||
<p>Qopy</p>
|
<p>Qopy</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
@click="selectItem(groupIndex, index)"
|
@click="selectItem(groupIndex, index)"
|
||||||
:ref="el => { if (isSelected(groupIndex, index)) selectedElement = el as HTMLElement }">
|
:ref="el => { if (isSelected(groupIndex, index)) selectedElement = el as HTMLElement }">
|
||||||
<img v-if="item.content_type === 'image'" :src="getComputedImageUrl(item)" alt="Image" class="favicon-image">
|
<img v-if="item.content_type === 'image'" :src="getComputedImageUrl(item)" alt="Image" class="favicon-image">
|
||||||
<img v-else-if="isUrl(item.content)" :src="getFaviconFromDb(item.favicon ?? '')" alt="Favicon" class="favicon">
|
<img v-else-if="hasFavicon(item.favicon ?? '')" :src="getFaviconFromDb(item.favicon ?? '')" alt="Favicon" class="favicon">
|
||||||
<FileIcon class="file" v-else />
|
<FileIcon class="file" v-else />
|
||||||
<span v-if="item.content_type === 'image'">Image ({{ item.dimensions || 'Loading...' }})</span>
|
<span v-if="item.content_type === 'image'">Image ({{ item.dimensions || 'Loading...' }})</span>
|
||||||
<span v-else>{{ truncateContent(item.content) }}</span>
|
<span v-else>{{ truncateContent(item.content) }}</span>
|
||||||
|
@ -225,13 +225,8 @@ const truncateContent = (content: string): string => {
|
||||||
return content.length > maxChars ? content.slice(0, maxChars - 3) + '...' : content;
|
return content.length > maxChars ? content.slice(0, maxChars - 3) + '...' : content;
|
||||||
};
|
};
|
||||||
|
|
||||||
const isUrl = (str: string): boolean => {
|
const hasFavicon = (str: string): boolean => {
|
||||||
try {
|
return str.trim() !== '';
|
||||||
new URL(str);
|
|
||||||
return true;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const isYoutubeWatchUrl = (url: string): boolean => {
|
const isYoutubeWatchUrl = (url: string): boolean => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue