diff --git a/404.html b/404.html
new file mode 100644
index 000000000..fa1f722f3
--- /dev/null
+++ b/404.html
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+ MapComplete - page not found
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+ Not found...
+
+
+
+
+
+
+
diff --git a/Logic/DetermineLayout.ts b/Logic/DetermineLayout.ts
index 959cefa31..0026499f1 100644
--- a/Logic/DetermineLayout.ts
+++ b/Logic/DetermineLayout.ts
@@ -20,23 +20,18 @@ export default class DetermineLayout {
/**
* Gets the correct layout for this website
*/
- public static async GetLayout(): Promise<[LayoutConfig, string]> {
+ public static async GetLayout(): Promise {
const loadCustomThemeParam = QueryParameters.GetQueryParameter("userlayout", "false", "If not 'false', a custom (non-official) theme is loaded. This custom layout can be done in multiple ways: \n\n- The hash of the URL contains a base64-encoded .json-file containing the theme definition\n- The hash of the URL contains a lz-compressed .json-file, as generated by the custom theme generator\n- The parameter itself is an URL, in which case that URL will be downloaded. It should point to a .json of a theme")
const layoutFromBase64 = decodeURIComponent(loadCustomThemeParam.data);
if (layoutFromBase64.startsWith("http")) {
- const layout = await DetermineLayout.LoadRemoteTheme(layoutFromBase64)
- return [layout, undefined]
+ return await DetermineLayout.LoadRemoteTheme(layoutFromBase64)
}
if (layoutFromBase64 !== "false") {
// We have to load something from the hash (or from disk)
- let loaded = DetermineLayout.LoadLayoutFromHash(loadCustomThemeParam);
- if (loaded === null) {
- return [null, undefined]
- }
- return loaded
+ return DetermineLayout.LoadLayoutFromHash(loadCustomThemeParam)
}
let layoutId: string = undefined
@@ -64,12 +59,12 @@ export default class DetermineLayout {
}
}
- return [layoutToUse, undefined]
+ return layoutToUse
}
public static LoadLayoutFromHash(
userLayoutParam: UIEventSource
- ): [LayoutConfig, string] | null {
+ ): LayoutConfig | null {
let hash = location.hash.substr(1);
try {
// layoutFromBase64 contains the name of the theme. This is partly to do tracking with goat counter
@@ -109,7 +104,9 @@ export default class DetermineLayout {
const knownLayersDict = new Map()
for (const key in known_layers["default"]) {
- knownLayersDict.set(key, known_layers["default"][key])
+ const layer = known_layers["default"][key]
+ console.log("Found shared layer "+layer.id)
+ knownLayersDict.set(layer.id, layer)
}
const converState = {
@@ -123,7 +120,7 @@ export default class DetermineLayout {
const layoutToUse = new LayoutConfig(json, false);
userLayoutParam.setData(layoutToUse.id);
- return [layoutToUse, btoa(Utils.MinifyJSON(JSON.stringify(json)))];
+ return layoutToUse;
} catch (e) {
console.error(e)
if (hash === undefined || hash.length < 10) {
diff --git a/Models/ThemeConfig/LegacyJsonConvert.ts b/Models/ThemeConfig/LegacyJsonConvert.ts
index 5de97e5e3..7e0397137 100644
--- a/Models/ThemeConfig/LegacyJsonConvert.ts
+++ b/Models/ThemeConfig/LegacyJsonConvert.ts
@@ -406,7 +406,12 @@ export class UpdateLegacyLayer extends DesugaringStep 10) {
- // We save the layout to the user settings and local storage
- State.state.osmConnection.OnLoggedIn(() => {
- State.state.osmConnection
- .GetLongPreference("installed-theme-" + layoutToUse.id)
- .setData(encoded);
- });
- }
+
}
}
@@ -67,7 +60,7 @@ new Combine(["Initializing...
",
// @ts-ignore
DetermineLayout.GetLayout().then(value => {
console.log("Got ", value)
- Init.Init(value[0], value[1])
+ Init.Init(value)
}).catch(err => {
console.error("Error while initializing: ", err, err.stack)
})
diff --git a/package.json b/package.json
index 8f8772cd2..c5f078609 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,7 @@
"deploy:production": "cd ~/git/mapcomplete.github.io/ && git pull && cd - && rm -rf ./assets/generated && npm run prepare-deploy && npm run optimize-images && rm -rf ~/git/mapcomplete.github.io/* && cp -r dist/* ~/git/mapcomplete.github.io/ && cd ~/git/mapcomplete.github.io/ && echo \"mapcomplete.osm.be\" > CNAME && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean && npm run gittag",
"gittag": "ts-node scripts/printVersion.ts | bash",
"lint": "tslint --project . -c tslint.json '**.ts' ",
- "clean": "rm -rf .cache/ && (find *.html | grep -v \"\\(404|index\\|land\\|test\\|preferences\\|customGenerator\\|professional\\|automaton\\|theme\\).html\" | xargs rm) && (ls | grep \"^index_[a-zA-Z_]\\+\\.ts$\" | xargs rm) && (ls | grep \".*.webmanifest$\" | xargs rm)",
+ "clean": "rm -rf .cache/ && (find *.html | grep -v \"\\(404\\|index\\|land\\|test\\|preferences\\|customGenerator\\|professional\\|automaton\\|theme\\).html\" | xargs rm) && (ls | grep \"^index_[a-zA-Z_]\\+\\.ts$\" | xargs rm) && (ls | grep \".*.webmanifest$\" | xargs rm)",
"generate:dependency-graph": "node_modules/.bin/depcruise --exclude \"^node_modules\" --output-type dot Logic/State/MapState.ts > dependencies.dot && dot dependencies.dot -T svg -o dependencies.svg && rm dependencies.dot",
"genPostal": " ts-node ./scripts/postal_code_tools/createRoutablePoint.ts /home/pietervdvn/Downloads/postal_codes/postal_codes_town_hall_points.geojson /home/pietervdvn/Downloads/31370/Postcodes.geojson\n"
},