Small changes to support multiple hosts

This commit is contained in:
Pieter Vander Vennet 2020-12-13 20:20:18 +01:00
parent 905b8a3e86
commit a1d0607715
4 changed files with 6 additions and 6 deletions

View file

@ -42,7 +42,7 @@ export default class SharePanel extends UIElement {
"Copy the json configuration from the 'save-tab', paste it between the 'nowiki'-tags in the Wiki",
"Click 'save' to save the wiki page",
"Share the link with the url parameter <span class='literal-code'>userlayout=wiki:YOURWIKIPAGE</span>, e.g. " +
`<a href='./index.html?userlayout=${proposedNameEnc}' target='_blank'>https://pietervdvn.github.io/MapComplete/index.html?userlayout=${proposedNameEnc}</a>`
`<a href='./index.html?userlayout=${proposedNameEnc}' target='_blank'>https://mapcomplete.osm.be?userlayout=${proposedNameEnc}</a>`
].map(li => `<li>${li}</li>`),
"</ol>",

View file

@ -146,14 +146,14 @@ export class ShareScreen extends UIElement {
this._options = new VerticalCombine(optionCheckboxes)
const url = (currentLocation ?? new UIEventSource(undefined)).map(() => {
let literalText = "https://pietervdvn.github.io/MapComplete/" + layout.id.toLowerCase() + ".html"
const host = window.location.host;
let literalText = `https://${host}/${layout.id.toLowerCase()}.html`
const parts = Utils.NoEmpty(Utils.NoNull(optionParts.map((eventSource) => eventSource.data)));
let hash = "";
if (layoutDefinition !== undefined) {
literalText = "https://pietervdvn.github.io/MapComplete/index.html"
literalText = `https://${host}/index.html`
if (layout.id.startsWith("wiki:")) {
parts.push("userlayout=" + encodeURIComponent(layout.id))
} else {