Fix: fixes to etymology: load wikidata on mobile (which uses m.wikidata.org, tripping the CSP); fix 'upload image of the streetsign' parameters

This commit is contained in:
Pieter Vander Vennet 2023-10-22 00:51:43 +02:00
parent bc37deafb5
commit 480956d45d
6 changed files with 15 additions and 7 deletions

View file

@ -64,8 +64,11 @@ export class ImageUploadManager {
/**
* Uploads the given image, applies the correct title and license for the known user.
* Will then add this image to the OSM-feature or the OSM-note
* @param file a jpg file to upload
* @param tagsStore The tags of the feature
* @param targetKey Use this key to save the attribute under. Default: 'image'
*/
public async uploadImageAndApply(file: File, tagsStore: UIEventSource<OsmTags>): Promise<void> {
public async uploadImageAndApply(file: File, tagsStore: UIEventSource<OsmTags>, targetKey?: string): Promise<void> {
const sizeInBytes = file.size
const tags = tagsStore.data
const featureId = <OsmId>tags.id
@ -95,7 +98,7 @@ export class ImageUploadManager {
].join("\n")
console.log("Upload done, creating ")
const action = await this.uploadImageWithLicense(featureId, title, description, file)
const action = await this.uploadImageWithLicense(featureId, title, description, file, targetKey)
if (!isNaN(Number(featureId))) {
// This is a map note
const url = action._url
@ -112,7 +115,8 @@ export class ImageUploadManager {
featureId: OsmId,
title: string,
description: string,
blob: File
blob: File,
targetKey: string | undefined
): Promise<LinkImageAction> {
this.increaseCountFor(this._uploadStarted, featureId)
const properties = this._featureProperties.getStore(featureId)
@ -132,6 +136,7 @@ export class ImageUploadManager {
}
}
console.log("Uploading done, creating action for", featureId)
key = targetKey ?? key
const action = new LinkImageAction(featureId, key, value, properties, {
theme: this._layout.id,
changeType: "add-image",