Skip to content

Commit

Permalink
Merge pull request #28 from volkmarnissen/hassio-addon
Browse files Browse the repository at this point in the history
Fix for hassio Addon
  • Loading branch information
volkmarnissen authored Oct 26, 2024
2 parents e01a682 + d21e9c3 commit 63d880c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/httpServerBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ export class HttpServerBase {
let config = Config.getConfiguration()
if (config.hassiotoken) {
let address = (req.socket.address() as AddressInfo).address
if (!address || !['172.30.33.1','172.30.32.1', '127.0.0.1'].includes(address)) {
if (!address || (address.indexOf('172.30.33.1') < 0 &&
address.indexOf('172.30.32.1') < 0 &&
address.indexOf('127.0.0.1') < 0 )) {
log.log(LogLevelEnum.warn, 'Denied: IP Address is not allowed ' + address)
this.returnResult(req, res, HttpErrorsEnum.ErrForbidden, 'Unauthorized (See server log)')
return
Expand Down

0 comments on commit 63d880c

Please sign in to comment.