Adapt the web backend for the rng selection.

This commit is contained in:
2026-06-25 23:53:10 +02:00
parent e54a8e4f6d
commit dffbd1f6ea
3 changed files with 26 additions and 3 deletions
+10 -2
View File
@@ -4,8 +4,16 @@
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<link rel="stylesheet" href="ZGUI.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="TrimSPelec.js"></script>
<!script src="TrimSPWeb.js"></script>
<script src="TrimSPweb.js"></script>
<script>
// Electron exposes CommonJS module support; plain browsers do not.
// Load the Electron-specific helpers only for the standalone app.
if (typeof module !== 'undefined' && module.exports) {
document.write('<script src="TrimSPelec.js"><\\/script>');
} else {
document.write('<script src="plotly.js"><\\/script>');
}
</script>
<script src="TrimSPlib.js"></script>
<script src="myplots.js"></script>
<!script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
+4
View File
@@ -3748,6 +3748,10 @@ async function startSequence() {
randStr = (Math.random() + 1).toString(36).substring(7);
All["fileNamePrefix"] = randStr;
All["workPath"] = "/tmp/" + randStr;
// prep_cfg() reads these values from the DOM, so keep the hidden web
// fields synchronized with the randomized server-side run directory.
document.getElementById("fileNamePrefix").value = All["fileNamePrefix"];
document.getElementById("workPath").value = All["workPath"];
updateStatusBar({ backend: 'Web backend' });
}
updateStatusBar({ workPath: All["workPath"], run: 'Starting run...' });
+12 -1
View File
@@ -6,6 +6,12 @@ function writeAsciiFile(filename,content) {
//console.log(filename, content);
// Prepare CGI args use POST for long files
let cgiargs = "fn="+filename; // POST
// Forward the GUI-selected RNG backend to the CGI wrapper, which passes it
// to trimspNL as the optional second command-line argument.
let rngType = document.getElementById("rngType");
if (rngType) {
cgiargs += "&rngType=" + rngType.value;
}
let lines = content.split(/\n/);
let prefix = filename.split(/\//);
for (let i=0; i<lines.length; i++) {
@@ -48,6 +54,12 @@ function writeAsciiFile2(filename,content) {
//console.log(filename, content);
// Prepare CGI args use GET for short files
let cgiargs = "?fn="+filename; // GET
// Keep GET and POST requests equivalent for callers that still use this
// short-file helper.
let rngType = document.getElementById("rngType");
if (rngType) {
cgiargs += "&rngType=" + rngType.value;
}
let lines = content.split(/\n/);
let prefix = filename.split(/\//);
for (let i=0; i<lines.length; i++) {
@@ -121,4 +133,3 @@ function fileExists(filename) {
return 1;
}
}