Open StyXman opened 4 years ago
If you follow the link, you'll see I managed some progress :) The current wall I hit is:
TypeError: L.K.Config.project is undefined DataInspector.js:70:22
createSidebarPanel http://dionecanali.hd.free.fr/praetorian/diablo:6789/src/front/DataInspector.js:70
initialize http://dionecanali.hd.free.fr/praetorian/diablo:6789/src/front/DataInspector.js:36
NewClass http://dionecanali.hd.free.fr/praetorian/diablo:6789/node_modules/leaflet/dist/leaflet-src.js:301
initialize http://dionecanali.hd.free.fr/praetorian/diablo:6789/src/front/Map.js:16
NewClass http://dionecanali.hd.free.fr/praetorian/diablo:6789/node_modules/leaflet/dist/leaflet-src.js:301
<anonymous> http://dionecanali.hd.free.fr/praetorian/diablo:6789/osm-carto/#16/43.5842/7.1194:34
It seems like I managed to do it! Attached is the diff, in case anyone is interested.
diff --git a/src/Config.js b/src/Config.js
index 8378846..845f99f 100644
--- a/src/Config.js
+++ b/src/Config.js
@@ -166,26 +166,26 @@ Config.prototype.parseOptions = function () {
Config.prototype.initStatics = function () {
this._js = [
- '/node_modules/leaflet/dist/leaflet-src.js',
- '/node_modules/leaflet-formbuilder/Leaflet.FormBuilder.js',
- '/src/front/Core.js',
- '/config/',
+ '../node_modules/leaflet/dist/leaflet-src.js',
+ '../node_modules/leaflet-formbuilder/Leaflet.FormBuilder.js',
+ '../src/front/Core.js',
+ '../config/',
'./config/',
- '/src/front/Autocomplete.js',
- '/src/front/DataInspector.js',
- '/src/front/MetatilesBounds.js',
- '/src/front/Sidebar.js',
- '/src/front/Toolbar.js',
- '/src/front/FormBuilder.js',
- '/src/front/Settings.js',
- '/src/front/Command.js',
- '/src/front/Map.js'
+ '../src/front/Autocomplete.js',
+ '../src/front/DataInspector.js',
+ '../src/front/MetatilesBounds.js',
+ '../src/front/Sidebar.js',
+ '../src/front/Toolbar.js',
+ '../src/front/FormBuilder.js',
+ '../src/front/Settings.js',
+ '../src/front/Command.js',
+ '../src/front/Map.js'
];
this._css = [
- '/node_modules/leaflet/dist/leaflet.css',
- '/src/front/Sidebar.css',
- '/src/front/Toolbar.css',
- '/src/front/Core.css'
+ '../node_modules/leaflet/dist/leaflet.css',
+ '../src/front/Sidebar.css',
+ '../src/front/Toolbar.css',
+ '../src/front/Core.css'
];
};
diff --git a/src/plugins/base-exporters/index.js b/src/plugins/base-exporters/index.js
index 0b3caad..8a085ee 100644
--- a/src/plugins/base-exporters/index.js
+++ b/src/plugins/base-exporters/index.js
@@ -41,7 +41,7 @@ var BaseExporters = function (config) {
config.registerExporter('png32', path.join(__dirname, 'PNG.js'));
config.registerExporter('png256', path.join(__dirname, 'PNG.js'));
config.on('parseopts', this.parseOpts);
- config.addJS('/src/plugins/base-exporters/front/export.js');
+ config.addJS('../src/plugins/base-exporters/front/export.js');
};
BaseExporters.prototype.parseOpts = function (e) {
diff --git a/src/plugins/hash/index.js b/src/plugins/hash/index.js
index cd20a94..77943b4 100644
--- a/src/plugins/hash/index.js
+++ b/src/plugins/hash/index.js
@@ -1,6 +1,6 @@
var Hash = function (config) {
- config.addJS('/node_modules/leaflet-hash/leaflet-hash.js');
- config.addJS('/hash.js');
+ config.addJS('../node_modules/leaflet-hash/leaflet-hash.js');
+ config.addJS('../hash.js');
config.on('server:init', this.attachRoutes.bind(this));
};
Should I do a PR?
I have also run into this trying to put kosmtik behind an ingress controller. Would be swell to be able to have relative URLs to assets. Is there any reason NOT to make this the default behavior?
Should I do a PR?
Yes! Sorry for my very late response.
Is there any reason NOT to make this the default behavior?
ERRNOTIME ;)
Hi. I know this is an unusual request, so if you think it's not reasonable, I can understand.
I'm trying to put kosmtik behind a reverse proxy. The problem is that kosmtik returns absolute paths for all the assets, so even when the main page returns fine, all the assets give 404s. Example:
http://dionecanali.hd.free.fr/praetorian/diablo:6789/osm-carto/#16/43.5842/7.1194
Line 6 already has this:
Would it be possible to make those paths relative? If I knew enough JS/node, I would do it myself in my own instance and not bother the project with this.