Skip to content

Commit

Permalink
Improved evaluation of local path
Browse files Browse the repository at this point in the history
  • Loading branch information
MyHomeMyData committed Sep 29, 2024
1 parent 6ae5393 commit a278374
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ class ExtensionFlexcharts {
this.config = instanceSettings ? instanceSettings.native : {};
this.namespace = instanceSettings ? instanceSettings._id.substring('system.adapter.'.length) : 'flexcharts.0';
this.name = this.namespace.split('.')[0];
this.path = __dirname.split('ioBroker.'+this.name)[0]+'ioBroker.'+this.name;
this.path = __dirname.replace('/.dev-server/default/node_modules/iobroker.'+this.name,'').replace('/lib','');

this.adapter = adapter;

//this.adapter.log.debug(`this.path: /${this.path}`);
this.adapter.log.info(`Install extension on /${this.name}`);

this.app.use(`/${this.name}`, (req, res) => {
Expand Down Expand Up @@ -164,7 +165,7 @@ class ExtensionFlexcharts {
break;
}
} else {
this.demoChartGauge(result => {
this.demoChart(result => {
res.writeHead(200, { 'Content-Type': contentType });
content = new Buffer(content.toString().replace('{ solution: 42 }',JSON.stringify(result)));
if ('darkmode' in query) content = new Buffer(content.toString().replace("document.getElementById('main'),null,","document.getElementById('main'),'dark',"));
Expand Down

0 comments on commit a278374

Please sign in to comment.