forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
94c61744c0
commit
04c8ccb0d2
89 changed files with 2353 additions and 1390 deletions
|
|
@ -35,8 +35,9 @@ export default class GenericImageProvider extends ImageProvider {
|
|||
id: value,
|
||||
isSpherical: undefined,
|
||||
originalAttribute: {
|
||||
key, value
|
||||
}
|
||||
key,
|
||||
value,
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export interface ProvidedImage {
|
|||
host?: string
|
||||
isSpherical: boolean
|
||||
license?: LicenseInfo
|
||||
originalAttribute?: {key: string, value: string}
|
||||
originalAttribute?: { key: string; value: string }
|
||||
}
|
||||
|
||||
export interface PanoramaView {
|
||||
|
|
|
|||
|
|
@ -180,13 +180,13 @@ export class ImageUploadManager {
|
|||
queue = [...queue]
|
||||
while (queue.length > 0) {
|
||||
const currentItem = queue.shift()
|
||||
if(!currentItem){
|
||||
if (!currentItem) {
|
||||
continue
|
||||
}
|
||||
const uploadOk = await this.handleQueueItem(currentItem)
|
||||
if(uploadOk){
|
||||
if (uploadOk) {
|
||||
this._queue.delete(currentItem)
|
||||
}else{
|
||||
} else {
|
||||
// Our local 'queue' is a copy where we've removed the failed item from
|
||||
// A next attempt to 'uploadQueue' will retry the upload
|
||||
}
|
||||
|
|
@ -255,7 +255,7 @@ export class ImageUploadManager {
|
|||
if (properties === undefined) {
|
||||
const downloaded = await new OsmObjectDownloader(
|
||||
this._osmConnection.Backend(),
|
||||
this._changes,
|
||||
this._changes
|
||||
).DownloadObjectAsync(args.featureId)
|
||||
if (downloaded === "deleted") {
|
||||
this._queue.delete(args)
|
||||
|
|
@ -264,16 +264,10 @@ export class ImageUploadManager {
|
|||
this._featureProperties.trackFeature(downloaded.asGeoJson())
|
||||
properties = this._featureProperties.getStore(args.featureId)
|
||||
}
|
||||
const action = new LinkImageAction(
|
||||
args.featureId,
|
||||
result.key,
|
||||
result.value,
|
||||
properties,
|
||||
{
|
||||
theme: args.layoutId ?? properties?.data?.["_orig_theme"] ?? this._theme.id,
|
||||
changeType: "add-image",
|
||||
},
|
||||
)
|
||||
const action = new LinkImageAction(args.featureId, result.key, result.value, properties, {
|
||||
theme: args.layoutId ?? properties?.data?.["_orig_theme"] ?? this._theme.id,
|
||||
changeType: "add-image",
|
||||
})
|
||||
await this._changes.applyAction(action)
|
||||
await this._changes.flushChanges("Image upload completed")
|
||||
return true
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export class Imgur extends ImageProvider {
|
|||
provider: this,
|
||||
id: value,
|
||||
isSpherical: false,
|
||||
originalAttribute: {key, value}
|
||||
originalAttribute: { key, value },
|
||||
},
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ export class Mapillary extends ImageProvider {
|
|||
response.camera_type === "spherical" || response.camera_type === "equirectangular",
|
||||
lat: geometry.coordinates[1],
|
||||
lon: geometry.coordinates[0],
|
||||
originalAttribute: {key, value}
|
||||
originalAttribute: { key, value },
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -260,14 +260,15 @@ export class Mapillary extends ImageProvider {
|
|||
return Mapillary.createLink(location, 17, image.id)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if we are in firefox strict mode (or if we are offline)
|
||||
* @private
|
||||
*/
|
||||
private static async checkStrictMode(): Promise<boolean> {
|
||||
try {
|
||||
const result = await fetch("https://scontent-bru2-1.xx.fbcdn.net/m1/v/t6/Xn8-ISUUYQyBD9FyACzPFRGZnBJRqIFmnQ_yd7FU6vxFYwD21fvAcZwDQoMzsScxcQyCWeBviKpWO4nX8yf--neJDvVjC4JlQtfBYb6TrpXQTniyafSFeZeePT_NVx3H6gMjceEvXHyvBqOOcCB_xQ?stp=c2048.2048.2000.988a_s1000x1000&_nc_gid=E2oHnrAtHutVvjaIm9qDLg&_nc_oc=AdkcScR9HuKt1X_K5-GrUeR5Paj8d7MsNFFYEBSmgc0IiBey_wS3RiNJpflWIKaQzNE&ccb=10-5&oh=00_AfNJ1Ki1IeGdUMxdFUc3ZX9VYIVFxVfXZ9MUATU3vj_RJw&oe=686AF002&_nc_sid=201bca")
|
||||
const result = await fetch(
|
||||
"https://scontent-bru2-1.xx.fbcdn.net/m1/v/t6/Xn8-ISUUYQyBD9FyACzPFRGZnBJRqIFmnQ_yd7FU6vxFYwD21fvAcZwDQoMzsScxcQyCWeBviKpWO4nX8yf--neJDvVjC4JlQtfBYb6TrpXQTniyafSFeZeePT_NVx3H6gMjceEvXHyvBqOOcCB_xQ?stp=c2048.2048.2000.988a_s1000x1000&_nc_gid=E2oHnrAtHutVvjaIm9qDLg&_nc_oc=AdkcScR9HuKt1X_K5-GrUeR5Paj8d7MsNFFYEBSmgc0IiBey_wS3RiNJpflWIKaQzNE&ccb=10-5&oh=00_AfNJ1Ki1IeGdUMxdFUc3ZX9VYIVFxVfXZ9MUATU3vj_RJw&oe=686AF002&_nc_sid=201bca"
|
||||
)
|
||||
console.log("Not blocked, got a forbidden", result.status)
|
||||
return false
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
|||
}
|
||||
const providedImage = await this.getInfo(value)
|
||||
providedImage.alt_id = alt_id
|
||||
providedImage.originalAttribute = {key, value}
|
||||
providedImage.originalAttribute = { key, value }
|
||||
return [providedImage]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,9 +61,9 @@ export class WikidataImageProvider extends ImageProvider {
|
|||
allImages.push(promises)
|
||||
}
|
||||
const resolved = await Promise.all(Utils.NoNull(allImages))
|
||||
const flattened = resolved.flatMap( x => x)
|
||||
if(flattened.length === 1){
|
||||
flattened[0].originalAttribute = {key, value}
|
||||
const flattened = resolved.flatMap((x) => x)
|
||||
if (flattened.length === 1) {
|
||||
flattened[0].originalAttribute = { key, value }
|
||||
}
|
||||
return flattened
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,8 +221,8 @@ export class WikimediaImageProvider extends ImageProvider {
|
|||
id: image,
|
||||
isSpherical: false,
|
||||
}
|
||||
if(key && value){
|
||||
providedImage.originalAttribute = {key, value}
|
||||
if (key && value) {
|
||||
providedImage.originalAttribute = { key, value }
|
||||
}
|
||||
return providedImage
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue