worldpossible / contentshell

HTML and related files for the shell of RACHEL
6 stars 11 forks source link

IP Address displayed in banner on RACHEL index.php #9

Closed needlestack closed 8 years ago

needlestack commented 8 years ago

From @spatiald on July 17, 2015 15:55

I think we should change the code this way:

ORIGINAL pulls the hostname IP which tends to return 127.0.1.1

<div id="ip">http://<?php echo gethostbyname(gethostname()); ?>/</div>

This is because the code pulls the hostname IP from /etc/hosts:

root@WRTD-303N-Server:/media/RACHEL/rachel# cat /etc/hosts
127.0.0.1   localhost
127.0.1.1   WRTD-303N-Server

PROPOSED

<div align="right" id="ip"><b>Server IP</b> </br><? echo $_SERVER["SERVER_ADDR"]; ?></div>

This is what the proposed solution looks like (caveat, I haven't tested in various IP scenarios yet...ie. connect to internet vs not connected to internet): rachel-proposed-header

The 192.168.255.94 address is an internal network for me and the current eth0 interface on the CAP.

Copied from original issue: rachelproject/rachelplus#17

needlestack commented 8 years ago

I support this change - it solves another problem I've seen a few times, where in certain Windows configurations the function call is slow and causes the page to hang for several seconds before rendering.

The labeling is good too, though perhaps "Address" would be better than "IP"?

The only concern is that in Windows setups it might come up as "localhost" for the address, which wouldn't work on other machines. But I don't know that would be any worse than the issues we run into now. And RPi setups are far more common anyway.

I say go ahead!

Cheers, Jonathan

On Fri, Jul 17, 2015 at 8:55 AM, Sam Kinch notifications@github.com wrote:

I think we should change the code this way:

ORIGINAL pulls the hostname IP which tends to return 127.0.1.1

http:///

This is because the code pulls the hostname IP from /etc/hosts:

root@WRTD-303N-Server:/media/RACHEL/rachel# cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 WRTD-303N-Server

PROPOSED

RACHEL Server IP

This is what the proposed solution looks like (caveat, I haven't tested in various IP scenarios yet...ie. connect to internet vs not connected to internet): [image: rachel-proposed-header] https://cloud.githubusercontent.com/assets/5751915/8751380/aff6c04c-2c7a-11e5-9622-b59342db78fb.png

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17.

needlestack commented 8 years ago

From @j-schwartz on July 17, 2015 18:49

I made this change in the contentshell: https://github.com/rachelproject/contentshell/blob/master/index.php

needlestack commented 8 years ago

From @spatiald on July 17, 2015 21:7

Along with Jonathan’s IP -> Server comment, should probably remove the word “RACHEL” as the banner says it quite proudly?

So we are all tracking…here is the revised line modified:

Server Address

On Jul 17, 2015, at 2:46 PM, Jonathan Field notifications@github.com wrote:

I support this change - it solves another problem I've seen a few times, where in certain Windows configurations the function call is slow and causes the page to hang for several seconds before rendering.

The labeling is good too, though perhaps "Address" would be better than "IP"?

The only concern is that in Windows setups it might come up as "localhost" for the address, which wouldn't work on other machines. But I don't know that would be any worse than the issues we run into now. And RPi setups are far more common anyway.

I say go ahead!

Cheers, Jonathan

On Fri, Jul 17, 2015 at 8:55 AM, Sam Kinch notifications@github.com wrote:

I think we should change the code this way:

ORIGINAL pulls the hostname IP which tends to return 127.0.1.1

http:///

This is because the code pulls the hostname IP from /etc/hosts:

root@WRTD-303N-Server:/media/RACHEL/rachel# cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 WRTD-303N-Server

PROPOSED

RACHEL Server IP

This is what the proposed solution looks like (caveat, I haven't tested in various IP scenarios yet...ie. connect to internet vs not connected to internet): [image: rachel-proposed-header] https://cloud.githubusercontent.com/assets/5751915/8751380/aff6c04c-2c7a-11e5-9622-b59342db78fb.png

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17.

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17#issuecomment-122371028.

needlestack commented 8 years ago

Agreed

On Fri, Jul 17, 2015 at 2:07 PM, Sam Kinch notifications@github.com wrote:

Along with Jonathan’s IP -> Server comment, should probably remove the word “RACHEL” as the banner says it quite proudly?

So we are all tracking…here is the revised line modified:

Server Address

On Jul 17, 2015, at 2:46 PM, Jonathan Field notifications@github.com wrote:

I support this change - it solves another problem I've seen a few times, where in certain Windows configurations the function call is slow and causes the page to hang for several seconds before rendering.

The labeling is good too, though perhaps "Address" would be better than "IP"?

The only concern is that in Windows setups it might come up as "localhost" for the address, which wouldn't work on other machines. But I don't know that would be any worse than the issues we run into now. And RPi setups are far more common anyway.

I say go ahead!

Cheers, Jonathan

On Fri, Jul 17, 2015 at 8:55 AM, Sam Kinch notifications@github.com wrote:

I think we should change the code this way:

ORIGINAL pulls the hostname IP which tends to return 127.0.1.1

http:///

This is because the code pulls the hostname IP from /etc/hosts:

root@WRTD-303N-Server:/media/RACHEL/rachel# cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 WRTD-303N-Server

PROPOSED

RACHEL Server IP

This is what the proposed solution looks like (caveat, I haven't tested in various IP scenarios yet...ie. connect to internet vs not connected to internet): [image: rachel-proposed-header] < https://cloud.githubusercontent.com/assets/5751915/8751380/aff6c04c-2c7a-11e5-9622-b59342db78fb.png

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17.

— Reply to this email directly or view it on GitHub < https://github.com/rachelproject/rachelplus/issues/17#issuecomment-122371028 .

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17#issuecomment-122416221 .

needlestack commented 8 years ago

From @spatiald on July 24, 2015 0:53

So the server address displayed on the main page is only the one the user puts in the address bar. It isn't the eth0 address. Is there a way for php or javascript to parse a file and display the contents? If so, I have a script that will drop ip list (one per line) of the eth0 and wlan0 addresses.

needlestack commented 8 years ago

From @bnordha on July 24, 2015 0:55

Isn’t it better that way?

I can think of scenarios where at the same location

needlestack commented 8 years ago

From @spatiald on July 24, 2015 1:0

My thought is that you would display both the eth0 and wlan0 IPs…just a thought. The only concern I can think of is maybe the prison where you wouldn’t want to broadcast out your IP.

We changed it initially to make it easy to find out the eth0 IP and, if there was no IP on eth0, it would display 192.168.88.1 address.

On Jul 17, 2015, at 2:46 PM, Jonathan Field notifications@github.com wrote:

I support this change - it solves another problem I've seen a few times, where in certain Windows configurations the function call is slow and causes the page to hang for several seconds before rendering.

The labeling is good too, though perhaps "Address" would be better than "IP"?

The only concern is that in Windows setups it might come up as "localhost" for the address, which wouldn't work on other machines. But I don't know that would be any worse than the issues we run into now. And RPi setups are far more common anyway.

I say go ahead!

Cheers, Jonathan

On Fri, Jul 17, 2015 at 8:55 AM, Sam Kinch notifications@github.com wrote:

I think we should change the code this way:

ORIGINAL pulls the hostname IP which tends to return 127.0.1.1

http:///

This is because the code pulls the hostname IP from /etc/hosts:

root@WRTD-303N-Server:/media/RACHEL/rachel# cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 WRTD-303N-Server

PROPOSED

RACHEL Server IP

This is what the proposed solution looks like (caveat, I haven't tested in various IP scenarios yet...ie. connect to internet vs not connected to internet): [image: rachel-proposed-header] https://cloud.githubusercontent.com/assets/5751915/8751380/aff6c04c-2c7a-11e5-9622-b59342db78fb.png

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17.

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17#issuecomment-122371028.

needlestack commented 8 years ago

From @spatiald on August 27, 2015 18:48

@j-schwartz Any thoughts on this issue in regards to my last comment on prisons?

needlestack commented 8 years ago

From @j-schwartz on August 27, 2015 18:55

I agree with displaying both. I don't think that's a problem for the prisons (broadcasing a LAN IP).

On Thu, Aug 27, 2015 at 11:48 AM Sam Kinch notifications@github.com wrote:

@j-schwartz https://github.com/j-schwartz Any thoughts on this issue in regards to my last comment on prisons?

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135520153 .

needlestack commented 8 years ago

From @spatiald on August 27, 2015 19:1

So right now, the IP displayed in the header is the IP the person is going to for RACHEL. My issue with that is that it is not really helpful. I was hoping someone might know a way to display the current WIFI and WAN IPs (parsed via javascript or some other means)? Web isn’t really my expertise. :) /s

On Aug 27, 2015, at 2:55 PM, Jeremy Schwartz notifications@github.com wrote:

I agree with displaying both. I don't think that's a problem for the prisons (broadcasing a LAN IP).

On Thu, Aug 27, 2015 at 11:48 AM Sam Kinch notifications@github.com wrote:

@j-schwartz https://github.com/j-schwartz Any thoughts on this issue in regards to my last comment on prisons?

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135520153 .

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135522698.

needlestack commented 8 years ago

So the original method -- <?php echo gethostbyname(gethostname()); ?> -- seemed to get the LAN IP on Windows (my testing environment), but it seems not to work on other systems (as well as sometimes being slow). Getting PHP to parse a file shouldn't be a problem -- but perhaps it's better to parse the output of something like ifconfig or ipconfig on Windows? In any case it's going to have to be smart enough to detect and work on different systems.

On Thu, Aug 27, 2015 at 12:01 PM, Sam Kinch notifications@github.com wrote:

So right now, the IP displayed in the header is the IP the person is going to for RACHEL. My issue with that is that it is not really helpful. I was hoping someone might know a way to display the current WIFI and WAN IPs (parsed via javascript or some other means)? Web isn’t really my expertise. :) /s

On Aug 27, 2015, at 2:55 PM, Jeremy Schwartz notifications@github.com wrote:

I agree with displaying both. I don't think that's a problem for the prisons (broadcasing a LAN IP).

On Thu, Aug 27, 2015 at 11:48 AM Sam Kinch notifications@github.com wrote:

@j-schwartz https://github.com/j-schwartz Any thoughts on this issue in regards to my last comment on prisons?

— Reply to this email directly or view it on GitHub < https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135520153

.

— Reply to this email directly or view it on GitHub < https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135522698 .

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135524242 .

needlestack commented 8 years ago

Reviving old thread - I am reworking the RACHEL index page at the moment and wanted to address this. I am going to make it use ifconfig (or ipconfig on windows) to look up the IP address of the server. Seems to work reliably for the ethernet address. I don't have a WiFi enabled PI so I don't know how the wifi shows up - Sam, you mentioned wlan0 - is that always the name of the interface? If so, I can pretty easily have it display both a LAN and WIFI address...

Let me know.

On Thu, Aug 27, 2015 at 9:34 PM, Jonathan Field jfield@gmail.com wrote:

So the original method -- <?php echo gethostbyname(gethostname()); ?> -- seemed to get the LAN IP on Windows (my testing environment), but it seems not to work on other systems (as well as sometimes being slow). Getting PHP to parse a file shouldn't be a problem -- but perhaps it's better to parse the output of something like ifconfig or ipconfig on Windows? In any case it's going to have to be smart enough to detect and work on different systems.

On Thu, Aug 27, 2015 at 12:01 PM, Sam Kinch notifications@github.com wrote:

So right now, the IP displayed in the header is the IP the person is going to for RACHEL. My issue with that is that it is not really helpful. I was hoping someone might know a way to display the current WIFI and WAN IPs (parsed via javascript or some other means)? Web isn’t really my expertise. :) /s

On Aug 27, 2015, at 2:55 PM, Jeremy Schwartz notifications@github.com wrote:

I agree with displaying both. I don't think that's a problem for the prisons (broadcasing a LAN IP).

On Thu, Aug 27, 2015 at 11:48 AM Sam Kinch notifications@github.com wrote:

@j-schwartz https://github.com/j-schwartz Any thoughts on this issue in regards to my last comment on prisons?

— Reply to this email directly or view it on GitHub < https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135520153

.

— Reply to this email directly or view it on GitHub < https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135522698 .

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135524242 .

needlestack commented 8 years ago

From @spatiald on November 24, 2015 4:51

Yup - should be wlan0 on all the builds we are using (rasbian and ubuntu)

Yeah my OCD has always bothered me that it wasn't clean.

Thanks for working on that.  :)

Sam

On Mon, Nov 23, 2015 at 8:17 PM, Jonathan Field notifications@github.com wrote:

Reviving old thread - I am reworking the RACHEL index page at the moment and wanted to address this. I am going to make it use ifconfig (or ipconfig on windows) to look up the IP address of the server. Seems to work reliably for the ethernet address. I don't have a WiFi enabled PI so I don't know how the wifi shows up - Sam, you mentioned wlan0 - is that always the name of the interface? If so, I can pretty easily have it display both a LAN and WIFI address... Let me know. On Thu, Aug 27, 2015 at 9:34 PM, Jonathan Field jfield@gmail.com wrote:

So the original method -- <?php echo gethostbyname(gethostname()); ?> -- seemed to get the LAN IP on Windows (my testing environment), but it seems not to work on other systems (as well as sometimes being slow). Getting PHP to parse a file shouldn't be a problem -- but perhaps it's better to parse the output of something like ifconfig or ipconfig on Windows? In any case it's going to have to be smart enough to detect and work on different systems.

On Thu, Aug 27, 2015 at 12:01 PM, Sam Kinch notifications@github.com wrote:

So right now, the IP displayed in the header is the IP the person is going to for RACHEL. My issue with that is that it is not really helpful. I was hoping someone might know a way to display the current WIFI and WAN IPs (parsed via javascript or some other means)? Web isn’t really my expertise. :) /s

On Aug 27, 2015, at 2:55 PM, Jeremy Schwartz notifications@github.com wrote:

I agree with displaying both. I don't think that's a problem for the prisons (broadcasing a LAN IP).

On Thu, Aug 27, 2015 at 11:48 AM Sam Kinch notifications@github.com wrote:

@j-schwartz https://github.com/j-schwartz Any thoughts on this issue in regards to my last comment on prisons?

— Reply to this email directly or view it on GitHub < https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135520153

.

— Reply to this email directly or view it on GitHub < https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135522698 .

— Reply to this email directly or view it on GitHub https://github.com/rachelproject/rachelplus/issues/17#issuecomment-135524242 .


Reply to this email directly or view it on GitHub: https://github.com/rachelproject/rachelplus/issues/17#issuecomment-159120315

needlestack commented 8 years ago

From @j-schwartz on March 3, 2016 2:10

This issue should really be moved to contentshell

needlestack commented 8 years ago

From @richsegal on April 9, 2016 22:46

Do we need the IP address at all? It is only really only useful on localhost to help administrators direct networked users to the correct host. Maybe it can be moved to the administration page?

I find it redundant and possible confusing to networked users who have already managed to type in the correct address to see the page in the first place. For powering potential, we configure our network so that http://rachel/ loads the RACHEL home page so it can only cause confusion in our environment.

needlestack commented 8 years ago

From @spatiald on April 9, 2016 23:37

Now that we have an admin page, I think that would be a good idea. Keeps the initial menu clean, too.

needlestack commented 8 years ago

Agreed

needlestack commented 8 years ago

One thing to note - the original reason I put the IP address in was for RACHEL usb - UwAmp would open a browser window on launch pointed to RACHEL, but there was no easy way to see how other users could access the system (the browser addressbar would just say localhost). So the IP address was helpful there. When we get to redoing RACHEL usb, I'll figure out how to best deal with that case. For the rest, I agree it's a distraction.

needlestack commented 8 years ago

Done. We'll see how we want to handle Windws/USB versions of RACHEL when we get to building a new version of that.