File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export interface ProxySettings {
2525 enabled : boolean ;
2626 name ?: string ;
2727 apiKey ?: string ;
28+ shouldFetchImages ?: boolean ;
2829}
2930
3031export enum View {
Original file line number Diff line number Diff line change 4848 />
4949 </ div >
5050 </ li >
51+ < li *ngIf ="settings.proxy.enabled " mdcListItem >
52+ < i mdcListItemGraphic class ="material-icons "> image</ i >
53+ < span mdcListItemText >
54+ Use the proxy to fetch images
55+ < span mdcListItemSecondaryText
56+ > Will fetch the episodes cover images using the proxy on loading
57+ failures</ span
58+ >
59+ </ span >
60+ < div mdcListItemMeta mdcSwitch >
61+ < input
62+ mdcSwitchInput
63+ type ="checkbox "
64+ [(ngModel)] ="settings.proxy.shouldFetchImages "
65+ />
66+ </ div >
67+ </ li >
5168 < li *ngIf ="browser.isWebExtension " mdcListItem >
5269 < i mdcListItemGraphic class ="material-icons "> open_in_new</ i >
5370 < span mdcListItemText >
Original file line number Diff line number Diff line change 11import { Pipe , PipeTransform } from '@angular/core' ;
22import { ScraperService } from 'src/app/services/scraper.service' ;
3+ import { SettingsService } from 'src/app/services/settings.service' ;
34
45export type ProxyPipeAction = 'resolveUrl' ;
56export type ProxyPipeValueType = 'image' ;
@@ -9,7 +10,10 @@ export type ProxyPipeValueType = 'image';
910 pure : true ,
1011} )
1112export class ProxyPipe implements PipeTransform {
12- constructor ( protected scraper : ScraperService ) { }
13+ constructor (
14+ protected settings : SettingsService ,
15+ protected scraper : ScraperService
16+ ) { }
1317
1418 private getImageOrFallback = (
1519 path : string ,
@@ -30,12 +34,15 @@ export class ProxyPipe implements PipeTransform {
3034 ) : Promise < string > {
3135 switch ( action ) {
3236 case 'resolveUrl' : {
33- const url = this . scraper . resolveUrl ( value ) ;
3437 switch ( type ) {
3538 case 'image' :
36- return await this . getImageOrFallback ( value , url ) ;
39+ if ( ! this . settings . proxy . shouldFetchImages ) {
40+ return value ;
41+ }
42+ const fallback = this . scraper . resolveUrl ( value ) ;
43+ return await this . getImageOrFallback ( value , fallback ) ;
3744 default :
38- return url ;
45+ return this . scraper . resolveUrl ( value ) ;
3946 }
4047 }
4148 default :
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ export class SettingsService {
8080 : {
8181 enabled : true ,
8282 name : CORSProxies [ 0 ] . name ,
83+ shouldFetchImages : false ,
8384 } ,
8485 openInNewTab :
8586 ! this . browser . isWebExtension || this . browser . isFirefox ? true : false ,
You can’t perform that action at this time.
0 commit comments