Git Product home page Git Product logo

Comments (11)

d4fseeker avatar d4fseeker commented on May 14, 2024

Same problem here on fresh install.
Fixed it by editing the lib/servers.js (/usr/local/lib/node_modules/log.io/lib/servers.js) and adding the following line after line 360:

app.use(express.basicAuth(config.auth.user,config.auth.pass));

It now reads with the line before and after:

staticPath = (_ref = config.staticPath) != null ? _ref : __dirname + '/../';
app.use(express.basicAuth(config.auth.user,config.auth.pass));
return app.use(express"static")

You probably want to add an if/else conditioning to whether the auth already exists.

from log.io.

peterfroehlich avatar peterfroehlich commented on May 14, 2024

Same here.

from log.io.

ecaron avatar ecaron commented on May 14, 2024

@d4fseeker, should the change in /usr/local/lib/node_modules/log.io/lib/server.js be wrapped in a:

if (config.auth) {
app.use(express.basicAuth(config.auth.user,config.auth.pass));
}

from log.io.

d4fseeker avatar d4fseeker commented on May 14, 2024

I cannot access a log.io install atm, so you'll have to check but if I remember correctly the wrapper class always exists and thus would return bool/true no matter what.
You'd have to check config.auth.user and config.auth.pass to bypass that, e.g:

if(config.auth.user != null && config.auth.pass != null)
app.use(express.basicAuth(config.auth.user,config.auth.pass));

I have to admit I'm not sure if comparing against null is sufficient since CoffeeScript has made me lazy with it's "?" operator.

from log.io.

gu3st avatar gu3st commented on May 14, 2024

To be perfectly equivalent with Coffeescript's "?" Operator, you'd need to check for both null and undefined.

from log.io.

jochenonline avatar jochenonline commented on May 14, 2024

This is the correct syntax:

if (config.auth && config.auth.user && config.auth.pass) {
    app.use(express.basicAuth(config.auth.user,config.auth.pass));
}

from log.io.

blackrosezy avatar blackrosezy commented on May 14, 2024

and here is the coffee script :

staticPath = config.staticPath ? __dirname + '/../'
app.use express.basicAuth(config.auth.user, config.auth.pass)  if config.auth and config.auth.user and config.auth.pass
app.use express.static staticPath

from log.io.

Dual-Boot avatar Dual-Boot commented on May 14, 2024

HI,

For me I fixed it like this (near line 360) file /usr/local/lib/node_modules/log.io/lib/server.js :
staticPath = (_ref = config.staticPath) != null ? _ref : __dirname + '/../';
// add fix start
app.use(express.basicAuth(config.auth.user, config.auth.pass))
if (config.auth && config.auth.user && config.auth.pass)
// fix end
return app.use(express"static");

And It works.

Regards,

from log.io.

albertojm avatar albertojm commented on May 14, 2024

Hi, I've downloaded & installed log.io today and still have no auth, my config file looks like:

exports.config = {
host: '0.0.0.0',
port: 28778,

// Enable HTTP Basic Authentication
auth: {
user: "test",
pass: "test123"
},

/*
// Enable HTTPS/SSL
ssl: {
key: '/path/to/privatekey.pem',
cert: '/path/to/certificate.pem'
},
*/

/*
// Restrict access to websocket (socket.io)
// Uses socket.io 'origins' syntax
restrictSocket: ':',
*/

/*
// Restrict access to http server (express)
restrictHTTP: [
"192.168.29.39",
"10.0.*"
]
*/
}

Any hint on why this is happening?

Thanks for your help.

from log.io.

vansteki avatar vansteki commented on May 14, 2024

@albertojm, i install by npm today and i have same problom.

if you check /usr/lib/node_modules/log.io/src/server.coffee, you'll find something missing around line 180 and 181:
if @auth?
app.use express.basicAuth @auth.user, @auth.pass

it looks like code in npm is not the same in current repo...?

try add these to /usr/lib/node_modules/log.io/lib/server.js

app = express();
...
   //just add these three line below
   if (this.auth != null) {
          app.use(express.basicAuth(this.auth.user, this.auth.pass));
   }
...
if (config.restrictHTTP) {

then edit config file and run

it works for me!

from log.io.

crackfoo avatar crackfoo commented on May 14, 2024

Thanks @vansteki ! that worked for me too.

from log.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.