Skip to content

Commit

Permalink
change image links from public to local (#5)
Browse files Browse the repository at this point in the history
* change image links from public to local
Apply endemecio02/node-red-contrib-httpauth#3 from @sakazuki

* Fix path join

* Use Express built-in methods

* Minor syntax
  • Loading branch information
Alkarex authored Oct 12, 2023
1 parent b871d24 commit 8ff84fd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nodes/http-auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</p>

<p>
<img src="https://raw.githubusercontent.com/alexandrainst/node-red-http-basic-auth/main/images/flow.png" />
<img src="node-red-http-basic-auth/images/flow.png" />
<p>

<h2>Config</h2>
Expand Down
16 changes: 16 additions & 0 deletions nodes/http-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,20 @@ module.exports = function (RED) {
}

RED.nodes.registerType('http-basic-auth', HttpAuthNode);

if (RED.httpAdmin) {
const path = require('path');
RED.httpAdmin.get('/node-red-http-basic-auth/images/:name', (req, res, next) => {
const options = {
root: path.join(__dirname, '..', 'images'),
dotfiles: 'deny',
};
const fileName = req.params.name;
res.sendFile(fileName, options, (err) => {
if (err) {
next(err);
}
});
});
}
};

0 comments on commit 8ff84fd

Please sign in to comment.