Files
minisrv/zefie_wtvp_minisrv/includes/ServiceVault/wtv-tricks/benchmark-finished.js
zefie 9314705def v0.9.54 combined merge from dev
* initial (very incomplete) work on PC Services Admin (eg csops)
  * primitive account listing
  * add ban/unban/delete functionality
* fix wtv-tricks theme
* fix wtv-tricks theme (cSetup)
* better tricks code
* fix session_data.getTicketData()
* speedtest and other tricks stuff
* better protection against direct access to finished url
* dependancies update (run `npm update`)
* Bump path-to-regexp and express in /zefie_wtvp_minisrv (#29)

Bumps [path-to-regexp](https://github.com/pillarjs/path-to-regexp) to 0.1.12 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together.

Updates `path-to-regexp` from 0.1.10 to 0.1.12
- [Release notes](https://github.com/pillarjs/path-to-regexp/releases)
- [Changelog](https://github.com/pillarjs/path-to-regexp/blob/master/History.md)
- [Commits](https://github.com/pillarjs/path-to-regexp/compare/v0.1.10...v0.1.12)

Updates `express` from 4.21.1 to 4.21.2
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.2/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.21.1...4.21.2)

---
updated-dependencies:
- dependency-name: path-to-regexp
  dependency-type: indirect
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix up path functions

* force version 1.2.1 of newsie due to breaking change

* remove debug log print for usenet

* fix account directory was broken due to previous changes

* fix wtv-home:/home was hiding options bar

* bump to 0.9.54

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 19:30:33 -05:00

80 lines
2.3 KiB
JavaScript

var minisrv_service_file = true;
headers = `200 OK
Connection: Keep-Alive
wtv-expire-all: wtv-tricks:/benchmark
Content-type: text/html`
data = `<html>
<display nosave nosend skipback>
<script src=/ROMCache/h.js></script><script src=/ROMCache/n.js></script><script>
head('Speed Test Result')</script>`;
var start_time = parseInt(session_data.getTicketData("benchmark_starttime"));
if (isNaN(start_time)) {
data += "Invalid data, please try your benchmark again";
} else {
var end_time = Math.floor(new Date().getTime());
if (!session_data.getTicketData("benchmark_endtime")) {
session_data.setTicketData("benchmark_endtime", end_time);
} else {
end_time = session_data.getTicketData("benchmark_endtime");
}
var download_time = end_time - start_time;
var image_filename = wtvshared.getServiceDep("/wtv-tricks/benchmark.jpg", true);
var image_size = fs.statSync(image_filename).size
var image_size_kb = parseFloat(image_size / 1024).toFixed(3);
var throughput = parseFloat((image_size / download_time) * 1024).toFixed(0);
data += `
<table>
<tr>
<td height=20>
<tr>
<td valign=top align=right width=200><shadow>POP Number:</shadow>
<td width=10>
<td valign=top>&phone;
<tr>
<td valign=top align=right><shadow>Connected at:</shadow>
<td width=10>
<td valign=top>&rate;
<tr>
<td valign=top align=right><shadow>Modem f/w:</shadow>
<td width=10>
<td valign=top>&modem;
<tr>
<td height=40>
<tr>
<td valign=top align=right width=200><shadow>Image Size:</shadow>
<td width=10>
<td valign=top>${image_size_kb} KBytes
<tr>
<td valign=top align=right><shadow>Start Time:</shadow>
<td width=10>
<td valign=top>${new Date(start_time).toISOString().replace('T', ' ').substr(0, 19)}
<tr>
<td valign=top align=right><shadow>End Time:</shadow>
<td width=10>
<td valign=top>${new Date(end_time).toISOString().replace('T', ' ').substr(0, 19)}
<tr>
<td valign=top align=right><shadow>Total Time:</shadow>
<td width=10>
<td valign=top>${parseFloat(download_time / 1000).toFixed(1)} seconds
<tr>
<td valign=top align=right><shadow>Throughput:</shadow>
<td width=10>
<td valign=top>${throughput} bytes/sec
</table>
`;
}
data += `
<p>
<p>
<a selected href="wtv-tricks:/benchmark">Re-Test</a>
<td width=30>
<a href="wtv-tricks:/tricks">Back to Tricks</a>
</CENTER>
</BODY>
</HTML>
`;