]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add ability to override search endpoint
authorChocobozzz <me@florianbigard.com>
Wed, 4 Mar 2020 15:11:21 +0000 (16:11 +0100)
committerChocobozzz <me@florianbigard.com>
Wed, 4 Mar 2020 15:11:21 +0000 (16:11 +0100)
client/src/app/search/search.service.ts

index 7610fee8cc6ed06ecfe5f088762ee786f16c1f9d..3cad5aaa795f538139e1c7f897785d85bd8c227c 100644 (file)
@@ -11,6 +11,7 @@ import { Video } from '@app/shared/video/video.model'
 import { AdvancedSearch } from '@app/search/advanced-search.model'
 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
 import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
+import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage'
 
 @Injectable()
 export class SearchService {
@@ -21,7 +22,11 @@ export class SearchService {
     private restExtractor: RestExtractor,
     private restService: RestService,
     private videoService: VideoService
-  ) {}
+  ) {
+    // Add ability to override search endpoint if the user updated this local storage key
+    const searchUrl = peertubeLocalStorage.getItem('search-url')
+    if (searchUrl) SearchService.BASE_SEARCH_URL = searchUrl
+  }
 
   searchVideos (parameters: {
     search: string,