• Getting IP Address

    From Mortifis@VERT/EMPTYKEG to All on Mon Jan 21 15:45:03 2019
    In the /web/root/index.ssjs I would like to grab the connecting user's IP address and pass it along to a system.open("script ip_add") as an argv but I cannot figure out exactly how to obtain that value, I know as an @-code it is @@IP@ but that doesn't seem to equate in js.

    ---
    þ Synchronet þ The Empty Keg BBS emptykeg.synchro.net:82 Lake Echo NS Canada
  • From echicken@VERT/ECBBS to Mortifis on Mon Jan 21 15:24:32 2019
    Re: Getting IP Address
    By: Mortifis to All on Mon Jan 21 2019 15:45:03

    In the /web/root/index.ssjs I would like to grab the connecting user's IP

    You can get it from http_request.remote_ip or client.ip_address, and these probably have the same value.

    address and pass it along to a system.open("script ip_add") as an argv but

    system.exec('/path/to/script ' + http_request.remote_ip);

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-425-5435
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Mortifis@VERT/EMPTYKEG to echicken on Mon Jan 21 17:06:04 2019
    Re: Getting IP Address
    By: Mortifis to All on Mon Jan 21 2019 15:45:03

    In the /web/root/index.ssjs I would like to grab the connecting user's IP

    You can get it from http_request.remote_ip or client.ip_address, and these probably have the same value.

    address and pass it along to a system.open("script ip_add") as an argv but

    system.exec('/path/to/script ' + http_request.remote_ip);

    Perfect, Thank You! ... in /sbbs/web/root/index.ssjs I used template.weather = system.popen("weather" + http_request.remote_ip); (Sorry, still using the stock Nightshade Theme) then in /sbbs/web/templates/nightshade/rightnav.ini I added @@weather@@ ... weather is a php script (cuz I suck at js) to grab the openweathermap after parsing the city via a file_get_contents from api.ipstack.com ... probably an easier way to do it but it works

    Perhaps you could give it a little test later and see if it gets your weather http://emptykeg.synchro.net

    ---
    þ Synchronet þ The Empty Keg BBS emptykeg.synchro.net:82 Lake Echo NS Canada