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 maxFileSizeInMegabytes = 10
|
||||
public static readonly apiUrl = "https://api.imgur.com/3/image"
|
||||
|
||||
public static readonly supportingUrls = ["https://i.imgur.com"]
|
||||
private constructor() {
|
||||
super()
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import { Utils } from "../../Utils"
|
|||
import { Point } from "geojson"
|
||||
import MvtSource from "../FeatureSource/Sources/MvtSource"
|
||||
import AllImageProviders from "../ImageProviders/AllImageProviders"
|
||||
import { Imgur } from "../ImageProviders/Imgur"
|
||||
|
||||
interface ImageFetcher {
|
||||
/**
|
||||
|
@ -353,7 +354,7 @@ type P4CService = (typeof P4CImageFetcher.services)[number]
|
|||
|
||||
export class CombinedFetcher {
|
||||
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) {
|
||||
this.sources = [
|
||||
|
|
|
@ -700,7 +700,7 @@ export default class SpecialVisualizations {
|
|||
{
|
||||
funcName: "image_upload",
|
||||
docs: "Creates a button where a user can upload an image to IMGUR",
|
||||
needsUrls: [Imgur.apiUrl],
|
||||
needsUrls: [Imgur.apiUrl, ...Imgur.supportingUrls],
|
||||
args: [
|
||||
{
|
||||
name: "image-key",
|
||||
|
@ -1098,7 +1098,7 @@ export default class SpecialVisualizations {
|
|||
defaultValue: "id",
|
||||
},
|
||||
],
|
||||
needsUrls: [Imgur.apiUrl],
|
||||
needsUrls: [Imgur.apiUrl, ...Imgur.supportingUrls],
|
||||
|
||||
constr: (state, tags, args) => {
|
||||
const id = tags.data[args[0] ?? "id"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue