forked from MapComplete/MapComplete
Fix: use api.openstreetmap.org on many places, fix #1573
This commit is contained in:
parent
1930f7bb53
commit
8fccf78478
14 changed files with 36 additions and 35 deletions
|
@ -20,7 +20,7 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
private options: {
|
||||
bounds: Store<BBox>
|
||||
readonly allowedFeatures: TagsFilter
|
||||
backend?: "https://openstreetmap.org/" | string
|
||||
backend?: "https://api.openstreetmap.org/" | string
|
||||
/**
|
||||
* If given: this featureSwitch will not update if the store contains 'false'
|
||||
*/
|
||||
|
@ -41,7 +41,7 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
constructor(options: {
|
||||
bounds: Store<BBox>
|
||||
readonly allowedFeatures: TagsFilter
|
||||
backend?: "https://openstreetmap.org/" | string
|
||||
backend?: "https://api.openstreetmap.org/" | string
|
||||
/**
|
||||
* If given: this featureSwitch will not update if the store contains 'false'
|
||||
*/
|
||||
|
@ -54,7 +54,7 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
this._bounds = options.bounds
|
||||
this.allowedTags = options.allowedFeatures
|
||||
this.isActive = options.isActive ?? new ImmutableStore(true)
|
||||
this._backend = options.backend ?? "https://www.openstreetmap.org"
|
||||
this._backend = options.backend ?? "https://api.openstreetmap.org"
|
||||
this._bounds.addCallbackAndRunD((bbox) => this.loadData(bbox))
|
||||
this._patchRelations = options?.patchRelations ?? true
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ export default class ReplaceGeometryAction extends OsmChangeAction implements Pr
|
|||
throw "Invalid ID to conflate: " + this.wayToReplaceId
|
||||
}
|
||||
const url = `${
|
||||
this.state.osmConnection?._oauth_config?.url ?? "https://openstreetmap.org"
|
||||
this.state.osmConnection?._oauth_config?.url ?? "https://api.openstreetmap.org"
|
||||
}/api/0.6/${this.wayToReplaceId}/full`
|
||||
const rawData = await Utils.downloadJsonCached(url, 1000)
|
||||
parsed = OsmObject.ParseObjects(rawData.elements)
|
||||
|
|
|
@ -85,7 +85,7 @@ export class OsmConnection {
|
|||
this._oauth_config = {
|
||||
oauth_client_id: import.meta.env.VITE_OSM_OAUTH_CLIENT_ID,
|
||||
oauth_secret: import.meta.env.VITE_OSM_OAUTH_SECRET,
|
||||
url: "https://www.openstreetmap.org",
|
||||
url: "https://api.openstreetmap.org",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ export class OsmConnection {
|
|||
/**
|
||||
* The backend host, without path or trailing '/'
|
||||
*
|
||||
* new OsmConnection().Backend() // => "https://www.openstreetmap.org"
|
||||
* new OsmConnection().Backend() // => "https://api.openstreetmap.org"
|
||||
*/
|
||||
public Backend(): string {
|
||||
return this._oauth_config.url
|
||||
|
@ -365,7 +365,6 @@ export class OsmConnection {
|
|||
)
|
||||
})
|
||||
}
|
||||
const auth = this.auth
|
||||
const content = { lat, lon, text }
|
||||
const response = await this.post("notes.json", JSON.stringify(content), {
|
||||
"Content-Type": "application/json",
|
||||
|
@ -414,7 +413,6 @@ export class OsmConnection {
|
|||
'"\r\nContent-Type: application/gpx+xml',
|
||||
}
|
||||
|
||||
const auth = this.auth
|
||||
const boundary = "987654"
|
||||
|
||||
let body = ""
|
||||
|
|
|
@ -5,7 +5,7 @@ import OsmToGeoJson from "osmtogeojson"
|
|||
import { Feature, LineString, Polygon } from "geojson"
|
||||
|
||||
export abstract class OsmObject {
|
||||
private static defaultBackend = "https://www.openstreetmap.org/"
|
||||
private static defaultBackend = "https://api.openstreetmap.org/"
|
||||
protected static backendURL = OsmObject.defaultBackend
|
||||
private static polygonFeatures = OsmObject.constructPolygonFeatures()
|
||||
type: "node" | "way" | "relation"
|
||||
|
|
|
@ -17,7 +17,7 @@ export default class OsmObjectDownloader {
|
|||
private historyCache = new Map<string, UIEventSource<OsmObject[]>>()
|
||||
|
||||
constructor(
|
||||
backend: string = "https://www.openstreetmap.org",
|
||||
backend: string = "https://api.openstreetmap.org",
|
||||
changes?: {
|
||||
readonly pendingChanges: UIEventSource<ChangeDescription[]>
|
||||
readonly isUploading: Store<boolean>
|
||||
|
|
|
@ -219,7 +219,7 @@ class RewriteMetaInfoTags extends SimpleMetaTagger {
|
|||
move("changeset", "_last_edit:changeset")
|
||||
move("timestamp", "_last_edit:timestamp")
|
||||
move("version", "_version_number")
|
||||
feature.properties._backend = feature.properties._backend ?? "https://openstreetmap.org"
|
||||
feature.properties._backend = feature.properties._backend ?? "https://api.openstreetmap.org"
|
||||
return movedSomething
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ export default class NoteCommentElement extends Combine {
|
|||
|
||||
let userinfo = Stores.FromPromise(
|
||||
Utils.downloadJsonCached(
|
||||
"https://www.openstreetmap.org/api/0.6/user/" + comment.uid,
|
||||
"https://api.openstreetmap.org/api/0.6/user/" + comment.uid,
|
||||
24 * 60 * 60 * 1000
|
||||
)
|
||||
)
|
||||
|
|
|
@ -27,6 +27,9 @@ Note that these values can be prepare with javascript in the theme by using a [c
|
|||
public static readonly imageExtensions = new Set(["jpg", "png", "svg", "jpeg", ".gif"])
|
||||
|
||||
public static initDomPurify() {
|
||||
if (Utils.runningFromConsole) {
|
||||
return
|
||||
}
|
||||
DOMPurify.addHook("afterSanitizeAttributes", function (node) {
|
||||
// set all elements owning target to target=_blank + add noopener noreferrer
|
||||
if ("target" in node) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue