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", "Copy the json configuration from the 'save-tab', paste it between the 'nowiki'-tags in the Wiki",
"Click 'save' to save the wiki page", "Click 'save' to save the wiki page",
"Share the link with the url parameter <span class='literal-code'>userlayout=wiki:YOURWIKIPAGE</span>, e.g. " + "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>`), ].map(li => `<li>${li}</li>`),
"</ol>", "</ol>",

View file

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

View file

@ -16,7 +16,7 @@
"build": "rm -rf dist/ && npm run generate && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*", "build": "rm -rf dist/ && npm run generate && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
"prepare-deploy": "npm run generate:editor-layer-index && npm run generate:layouts && npm run generate && npm run build && rm -rf .cache", "prepare-deploy": "npm run generate:editor-layer-index && npm run generate:layouts && npm run generate && npm run build && rm -rf .cache",
"deploy:staging": "npm run prepare-deploy && rm -rf /home/pietervdvn/git/pietervdvn.github.io/Staging/* && cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/Staging/ && cd /home/pietervdvn/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean", "deploy:staging": "npm run prepare-deploy && rm -rf /home/pietervdvn/git/pietervdvn.github.io/Staging/* && cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/Staging/ && cd /home/pietervdvn/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean",
"deploy:production": "rm -rf ./assets/generated && npm run prepare-deploy && npm run optimize-images && rm -rf /home/pietervdvn/git/pietervdvn.github.io/MapComplete/* && cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/MapComplete/ && cd /home/pietervdvn/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean", "deploy:production": "rm -rf ./assets/generated && npm run prepare-deploy && npm run optimize-images && rm -rf /home/pietervdvn/git/mapcomplete.github.io/* && cp -r dist/* /home/pietervdvn/git/mapcomplete.github.io/ && cd /home/pietervdvn/git/mapcomplete.github.io/ && echo \"mapcomplete.osm.be\" > CNAME && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean",
"clean": "rm -rf .cache/ && (find *.html | grep -v \"\\(index\\|land\\|test\\|preferences\\|customGenerator\\).html\" | xargs rm) && (find *.webmanifest | xargs rm)" "clean": "rm -rf .cache/ && (find *.html | grep -v \"\\(index\\|land\\|test\\|preferences\\|customGenerator\\).html\" | xargs rm) && (find *.webmanifest | xargs rm)"
}, },
"keywords": [ "keywords": [

View file

@ -270,7 +270,7 @@ for (const layoutName in all) {
}; };
const layout = all[layoutName]; const layout = all[layoutName];
validate(layout) validate(layout)
const manif = JSON.stringify(createManifest(layout, "/MapComplete")); const manif = JSON.stringify(createManifest(layout, ""));
const manifestLocation = encodeURIComponent(layout.id.toLowerCase()) + ".webmanifest"; const manifestLocation = encodeURIComponent(layout.id.toLowerCase()) + ".webmanifest";
writeFile(manifestLocation, manif, err); writeFile(manifestLocation, manif, err);