forked from MapComplete/MapComplete
		
	Fix: fix loading images for CSP, fix #2161
This commit is contained in:
		
							parent
							
								
									349c6538a0
								
							
						
					
					
						commit
						2569d0cb66
					
				
					 3 changed files with 5 additions and 4 deletions
				
			
		|  | @ -12,7 +12,7 @@ export class Imgur extends ImageProvider implements ImageUploader { | ||||||
|     public readonly defaultKeyPrefixes: string[] = ["image"] |     public readonly defaultKeyPrefixes: string[] = ["image"] | ||||||
|     public readonly maxFileSizeInMegabytes = 10 |     public readonly maxFileSizeInMegabytes = 10 | ||||||
|     public static readonly apiUrl = "https://api.imgur.com/3/image" |     public static readonly apiUrl = "https://api.imgur.com/3/image" | ||||||
| 
 |     public static readonly supportingUrls = ["https://i.imgur.com"] | ||||||
|     private constructor() { |     private constructor() { | ||||||
|         super() |         super() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -9,6 +9,7 @@ import { Utils } from "../../Utils" | ||||||
| import { Point } from "geojson" | import { Point } from "geojson" | ||||||
| import MvtSource from "../FeatureSource/Sources/MvtSource" | import MvtSource from "../FeatureSource/Sources/MvtSource" | ||||||
| import AllImageProviders from "../ImageProviders/AllImageProviders" | import AllImageProviders from "../ImageProviders/AllImageProviders" | ||||||
|  | import { Imgur } from "../ImageProviders/Imgur" | ||||||
| 
 | 
 | ||||||
| interface ImageFetcher { | interface ImageFetcher { | ||||||
|     /** |     /** | ||||||
|  | @ -353,7 +354,7 @@ type P4CService = (typeof P4CImageFetcher.services)[number] | ||||||
| 
 | 
 | ||||||
| export class CombinedFetcher { | export class CombinedFetcher { | ||||||
|     private readonly sources: ReadonlyArray<CachedFetcher> |     private readonly sources: ReadonlyArray<CachedFetcher> | ||||||
|     public static apiUrls = P4CImageFetcher.apiUrls |     public static apiUrls = [...P4CImageFetcher.apiUrls, Imgur.apiUrl, ...Imgur.supportingUrls] | ||||||
| 
 | 
 | ||||||
|     constructor(radius: number, maxage: Date, indexedFeatures: IndexedFeatureSource) { |     constructor(radius: number, maxage: Date, indexedFeatures: IndexedFeatureSource) { | ||||||
|         this.sources = [ |         this.sources = [ | ||||||
|  |  | ||||||
|  | @ -700,7 +700,7 @@ export default class SpecialVisualizations { | ||||||
|             { |             { | ||||||
|                 funcName: "image_upload", |                 funcName: "image_upload", | ||||||
|                 docs: "Creates a button where a user can upload an image to IMGUR", |                 docs: "Creates a button where a user can upload an image to IMGUR", | ||||||
|                 needsUrls: [Imgur.apiUrl], |                 needsUrls: [Imgur.apiUrl, ...Imgur.supportingUrls], | ||||||
|                 args: [ |                 args: [ | ||||||
|                     { |                     { | ||||||
|                         name: "image-key", |                         name: "image-key", | ||||||
|  | @ -1098,7 +1098,7 @@ export default class SpecialVisualizations { | ||||||
|                         defaultValue: "id", |                         defaultValue: "id", | ||||||
|                     }, |                     }, | ||||||
|                 ], |                 ], | ||||||
|                 needsUrls: [Imgur.apiUrl], |                 needsUrls: [Imgur.apiUrl, ...Imgur.supportingUrls], | ||||||
| 
 | 
 | ||||||
|                 constr: (state, tags, args) => { |                 constr: (state, tags, args) => { | ||||||
|                     const id = tags.data[args[0] ?? "id"] |                     const id = tags.data[args[0] ?? "id"] | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue