Javascript is client side so you'd have to find some way to get the server
I have no idea what "Nightshade Web Interface" is, however, so all this may be totally wrong :)
I mostly run the Nightshade Web Interface, which I to read/reply/post to Dove-Net .. I am sure the answer to this question would apply to any theme...
I'd like to execute a system command and display the output ... I know howto
do this in PHP but not JS ... more specific, running RPI Raspbian I can,from a
terminal, run uptime and get the uptime of the OS since last reboot ... been racking my brain over it and my walnut is rattled ... any ideas?
:) I totally suck at JS ... I know how to accomplish this easily in php ie: <?php
$up = system("uptime", $retval); // $up = $retval and is stored for later use while the output of system is immediately printed to console (or webpage if called from that)
is there a JS equivalent to PHP's system() that I can store as @MYUPTIME@ type var for use in the web interface theme?
Javascript is client side so you'd have to find some way to get the server
The Synchronet web server can run server-side javascript.
---
echicken
Re: Re: Web Interface
By: Mortifis to echicken on Sat Oct 13 2018 10:28:20
Re: Re: Web Interface
By: Mortifis to echicken on Sat Oct 13 2018 10:28:20
:) I totally suck at JS ... I know how to accomplish this easily in php ie: <?php
$up = system("uptime", $retval); // $up = $retval and is stored for later use while the output of system is immediately printed to console (or webpage if called from that)
You can run PHP on your Synchronet webserver if you really want to. There's some info about that on the wiki.
is there a JS equivalent to PHP's system() that I can store as @MYUPTIME@ type var for use in the web interface theme?
In Synchronet JS we have the 'system' object, which has an 'uptime' property. In an SSJS file you could do this to write your BBS uptime to the client:
write(system.uptime);
Or:
write('My uptime: ' + system.uptime);
This is Synchronet's uptime and not the OS', if that matters to you.
The system object also has a 'popen' method that could be useful. If you're on Linux you could probably do:
var up = system.popen('uptime');
writeln('My uptime: ' + up[0]);
Or:
var up = system.popen('uptime')[0];
writeln('My uptime: ' + up);
As far as @MYUPTIME@ goes, I don't know my way around the old web templating
system enough to comment on how you would integrate any of this with it.
---
echicken
I mostly run the Nightshade Web Interface, which I to read/reply/post to Dove-Net .. I am sure the answer to this question would apply to any theme ... I'd like to execute a system command and display the output ... I know how to do this in PHP but not JS ... more specific, running RPI Raspbian I can, from a terminal, run uptime and get the uptime of the OS since last reboot ... been racking my brain over it and my walnut is rattled ... any ideas?
Re: Web Interface05:20 pm
By: Mortifis to All on Fri Oct 12 2018
Interface, which I to read/reply/post toI mostly run the Nightshade Web
this question would apply to anyDove-Net .. I am sure the answer to
command and display the output ...theme ... I'd like to execute a system
... more specific, running RPII know how to do this in PHP but not JS
uptime and get the uptime of the OSRaspbian I can, from a terminal, run
brain over it and my walnut issince last reboot ... been racking my
method (only works on *nix). Or yourattled ... any ideas?
There's the Synchronet system.popen()
could just "uptime > uptime.txt" and thenread/parse uptime.txt in your
script.
I've been playing with system.open in various
locations ... trying to create a @MYUPTIME@
that can be read from the sbbs.msg so I guess
the right question yo ask is, are custom @-
codes possible and if yes where would one
define them?
thus the /web files with the extension .ssjs ;)
Javascript is client side so you'd have to find some way to get the
server
The Synchronet web server can run server-side javascript.
Javascript is client side so you'd have to find some way to get the server to give you the uptime. Take a look at this thread for ideas.
I have no idea what "Nightshade Web Interface" is, however, so all this may be totally wrong :)
thus the /web files with the extension .ssjs ;)
Important so that the server knows to execute the script locally
rather than just serve it directly to the client (as it might with a
.js or .html or whatever other extension file).
And .xjs should not be forgotten, as it lets you add inline SSJS to a
file that will be served to a client:
On 2018 Oct 18 15:24:42, you wrote to me:
thus the /web files with the extension .ssjs ;)
Important so that the server knows to execute the script locally
rather than just serve it directly to the client (as it might with a .js or .html or whatever other extension file).
yup... i was mainly looking that the "ss" in "ssjs" means "server side" in the same was that "js" means "javascript" ;)
getting php working with sbbs, either, do i'll come up with another way to handle choosing a file of quotes to select a quote from to be included on my index page... each quote is separated from the next by a lone "%" character on an otherwise empty line... the php thing generated a binary index file for each file of quotes and then chose a random number between zero and the highest index number available for that file... i'll have to see if i can find the code... hopefully it wasn't lost when the other server went walkabout the day after the old BBS server left...
getting php working with sbbs, either, do i'll come up with another
way to handle choosing a file of quotes to select a quote from to be
included on my index page... each quote is separated from the next by
a lone "%" character on an otherwise empty line... the php thing
generated a binary index file for each file of quotes and then chose
a random number between zero and the highest index number available
for that file... i'll have to see if i can find the code... hopefully
it wasn't lost when the other server went walkabout the day after the
old BBS server left...
The whole thing could be replicated in JS,
but there are a few ways you could go about doing it.
One nice thing is that it could be made usable on the console as well
as the web side of things.
Are the quote files very large or do they grow over time?
a specific or random quote from a specific or random file... i don't have a clue how easy it would be to convert it from php to js... it has been years since i last did much of anything with php...
a specific or random quote from a specific or random file... i don't
have a clue how easy it would be to convert it from php to js... it
has been years since i last did much of anything with php...
If you want to zip this up and post it somewhere, I can have a go at
it. (PHP stuff isn't strictly needed, but I used to do PHP and might
be able to take some hints from the original code).
Sysop: | sneaky |
---|---|
Location: | Ashburton,NZ |
Users: | 31 |
Nodes: | 8 (0 / 8) |
Uptime: | 102:31:57 |
Calls: | 2,071 |
Calls today: | 1 |
Files: | 11,134 |
Messages: | 947,019 |