Chore: formatting

This commit is contained in:
Pieter Vander Vennet 2024-06-16 16:06:26 +02:00
parent 35eff07c80
commit c08fe03ed0
422 changed files with 31594 additions and 43019 deletions

View file

@ -18,15 +18,13 @@ export default class AllImageProviders {
WikidataImageProvider.singleton,
WikimediaImageProvider.singleton,
// The 'genericImageProvider' is a fallback that scans various other tags for tags, unless the URL starts with one of the given prefixes
new GenericImageProvider(
[
...Imgur.defaultValuePrefix,
...WikimediaImageProvider.commonsPrefixes,
...Mapillary.valuePrefixes,
...AllImageProviders.dontLoadFromPrefixes,
"Category:"
]
),
new GenericImageProvider([
...Imgur.defaultValuePrefix,
...WikimediaImageProvider.commonsPrefixes,
...Mapillary.valuePrefixes,
...AllImageProviders.dontLoadFromPrefixes,
"Category:",
]),
]
public static apiUrls: string[] = [].concat(
...AllImageProviders.ImageAttributionSource.map((src) => src.apiUrls())

View file

@ -71,6 +71,4 @@ export default abstract class ImageProvider {
public abstract DownloadAttribution(providedImage: ProvidedImage): Promise<LicenseInfo>
public abstract apiUrls(): string[]
}

View file

@ -73,15 +73,15 @@ export class ImageUploadManager {
}
}
public canBeUploaded(file: File): true | {error: Translation} {
public canBeUploaded(file: File): true | { error: Translation } {
const sizeInBytes = file.size
const self = this
if (sizeInBytes > this._uploader.maxFileSizeInMegabytes * 1000000) {
const error = Translations.t.image.toBig.Subs({
const error = Translations.t.image.toBig.Subs({
actual_size: Math.floor(sizeInBytes / 1000000) + "MB",
max_size: self._uploader.maxFileSizeInMegabytes + "MB",
})
return {error}
return { error }
}
return true
}
@ -98,9 +98,8 @@ export class ImageUploadManager {
tagsStore: UIEventSource<OsmTags>,
targetKey?: string
): Promise<void> {
const canBeUploaded = this.canBeUploaded(file)
if(canBeUploaded !== true){
if (canBeUploaded !== true) {
throw canBeUploaded.error
}