mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Merge pull request #2694 from mikiher/client-image-caching
Client side cover image caching
This commit is contained in:
		
						commit
						b4eed3bad2
					
				@ -49,8 +49,8 @@
 | 
				
			|||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
            <div v-if="media.coverPath">
 | 
					            <div v-if="media.coverPath">
 | 
				
			||||||
              <p class="text-center text-gray-200">Current</p>
 | 
					              <p class="text-center text-gray-200">Current</p>
 | 
				
			||||||
              <a :href="$store.getters['globals/getLibraryItemCoverSrcById'](libraryItemId, null, true)" target="_blank" class="bg-primary">
 | 
					              <a :href="$store.getters['globals/getLibraryItemCoverSrc'](libraryItem, null, true)" target="_blank" class="bg-primary">
 | 
				
			||||||
                <covers-preview-cover :src="$store.getters['globals/getLibraryItemCoverSrcById'](libraryItemId, null, true)" :width="100" :book-cover-aspect-ratio="bookCoverAspectRatio" />
 | 
					                <covers-preview-cover :src="$store.getters['globals/getLibraryItemCoverSrc'](libraryItem, null, true)" :width="100" :book-cover-aspect-ratio="bookCoverAspectRatio" />
 | 
				
			||||||
              </a>
 | 
					              </a>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
 | 
				
			|||||||
@ -8,11 +8,11 @@
 | 
				
			|||||||
        <p v-if="!recentEpisodes.length && !processing" class="text-center text-xl">{{ $strings.MessageNoEpisodes }}</p>
 | 
					        <p v-if="!recentEpisodes.length && !processing" class="text-center text-xl">{{ $strings.MessageNoEpisodes }}</p>
 | 
				
			||||||
        <template v-for="(episode, index) in episodesMapped">
 | 
					        <template v-for="(episode, index) in episodesMapped">
 | 
				
			||||||
          <div :key="episode.id" class="flex py-5 cursor-pointer relative" @click.stop="clickEpisode(episode)">
 | 
					          <div :key="episode.id" class="flex py-5 cursor-pointer relative" @click.stop="clickEpisode(episode)">
 | 
				
			||||||
            <covers-preview-cover :src="$store.getters['globals/getLibraryItemCoverSrcById'](episode.libraryItemId)" :width="96" :book-cover-aspect-ratio="bookCoverAspectRatio" :show-resolution="false" class="hidden md:block" />
 | 
					            <covers-preview-cover :src="$store.getters['globals/getLibraryItemCoverSrcById'](episode.libraryItemId, episode.updatedAt)" :width="96" :book-cover-aspect-ratio="bookCoverAspectRatio" :show-resolution="false" class="hidden md:block" />
 | 
				
			||||||
            <div class="flex-grow pl-4 max-w-2xl">
 | 
					            <div class="flex-grow pl-4 max-w-2xl">
 | 
				
			||||||
              <!-- mobile -->
 | 
					              <!-- mobile -->
 | 
				
			||||||
              <div class="flex md:hidden mb-2">
 | 
					              <div class="flex md:hidden mb-2">
 | 
				
			||||||
                <covers-preview-cover :src="$store.getters['globals/getLibraryItemCoverSrcById'](episode.libraryItemId)" :width="48" :book-cover-aspect-ratio="bookCoverAspectRatio" :show-resolution="false" class="md:hidden" />
 | 
					                <covers-preview-cover :src="$store.getters['globals/getLibraryItemCoverSrcById'](episode.libraryItemId, episode.updatedAt)" :width="48" :book-cover-aspect-ratio="bookCoverAspectRatio" :show-resolution="false" class="md:hidden" />
 | 
				
			||||||
                <div class="flex-grow px-2">
 | 
					                <div class="flex-grow px-2">
 | 
				
			||||||
                  <div class="flex items-center">
 | 
					                  <div class="flex items-center">
 | 
				
			||||||
                    <div class="flex" @click.stop>
 | 
					                    <div class="flex" @click.stop>
 | 
				
			||||||
 | 
				
			|||||||
@ -283,6 +283,9 @@ class LibraryItemController {
 | 
				
			|||||||
      return res.sendStatus(404)
 | 
					      return res.sendStatus(404)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (req.query.ts)
 | 
				
			||||||
 | 
					      res.set('Cache-Control', 'private, max-age=86400')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (raw) { // any value
 | 
					    if (raw) { // any value
 | 
				
			||||||
      if (global.XAccel) {
 | 
					      if (global.XAccel) {
 | 
				
			||||||
        const encodedURI = encodeUriPath(global.XAccel + libraryItem.media.coverPath)
 | 
					        const encodedURI = encodeUriPath(global.XAccel + libraryItem.media.coverPath)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user