linny-r 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -60
- package/console.js +14 -16
- package/package.json +2 -1
- package/post-install.js +81 -0
- package/server.js +20 -18
- package/static/index.html +4 -4
- package/static/linny-r.css +1 -2
package/README.md
CHANGED
@@ -24,7 +24,7 @@ via the official documentation site https://linny-r.info.
|
|
24
24
|
Linny-R is developed as a JavaScript package, and requires that **Node.js** is installed on your computer.
|
25
25
|
Node.js can be downloaded from https://nodejs.org.
|
26
26
|
Make sure that you choose the correct installer for your computer.
|
27
|
-
Linny-R is developed using the *current* release. Presently (
|
27
|
+
Linny-R is developed using the *current* release. Presently (October 2022) this is 18.10.0.
|
28
28
|
|
29
29
|
Run the installer and accept the default settings.
|
30
30
|
There is **no** need to install the optional Tools for Native Modules.
|
@@ -35,28 +35,58 @@ Verify the installation by typing:
|
|
35
35
|
|
36
36
|
``node --version``
|
37
37
|
|
38
|
-
The response should be the version number of Node.js, for example: v18.
|
38
|
+
The response should be the version number of Node.js, for example: v18.10.0.
|
39
39
|
|
40
40
|
### Installing Linny-R
|
41
41
|
It is advisable to install Linny-R in a directory on your computer, not in a cloud.
|
42
|
-
In this installation guide, this directory is
|
43
|
-
|
42
|
+
In this installation guide, the path to this directory is denoted by `WORKING_DIRECTORY`,
|
43
|
+
so in all commands you should replace this with the actual directory path.
|
44
|
+
On a Windows machine you may choose something like `C:\Users\xyz\Documents\Linny-R`,
|
45
|
+
and on a macOS machine probably `/Users/xyz/Linny-R`.
|
44
46
|
|
45
|
-
|
47
|
+
To install Linny-R in this directory, type at the command line prompt:
|
46
48
|
|
47
|
-
|
49
|
+
``npm install --prefix WORKING_DIRECTORY linny-r``
|
50
|
+
|
51
|
+
`WORKING_DIRECTORY` should now contain a new sub-directory `node_modules`,
|
48
52
|
and two JSON files `package.json` and `package-lock.json` that should **not** be removed,
|
49
53
|
or you will have to re-install Linny-R.
|
50
54
|
|
51
|
-
|
52
|
-
|
55
|
+
After installation has been completed, `WORKING_DIRECTORY` will also contain a script file
|
56
|
+
to facilitate (single click) launch: on a macOS machine the shell script `linny-r.command`,
|
57
|
+
on a Windows machine the batch script `linny-r.bat`. By default, this script file contains
|
58
|
+
two commands: change to the Linny-R directory and then tell Node.js to launch the
|
59
|
+
start the Linny-R server. When configuring Linny-R for a network environment
|
60
|
+
where individual users each have their personal work space (e.g., a virtual drive U:),
|
61
|
+
you must edit the script file, adding the argument `workspace=path/to/workspace` to the
|
62
|
+
`node` command. This will instruct Linny-R to create the `user` directory in this workspace
|
63
|
+
directory instead of the Linny-R directory.
|
64
|
+
|
65
|
+
After installation has completed, `WORKING_DIRECTORY` should have this directory tree structure:
|
66
|
+
|
67
|
+
<pre>
|
68
|
+
WORKING_DIRECTORY
|
69
|
+
|
|
70
|
+
+-node_modules
|
71
|
+
|
|
72
|
+
+-@xmldom
|
73
|
+
|
|
74
|
+
+-linny-r
|
75
|
+
|
|
76
|
+
+-static
|
77
|
+
|
|
78
|
+
+-fonts
|
79
|
+
|
|
80
|
+
+-images
|
81
|
+
|
|
82
|
+
+-scripts
|
83
|
+
|
|
84
|
+
+-sounds
|
85
|
+
</pre>
|
53
86
|
|
54
|
-
The directory should contain this file `README.md`,
|
87
|
+
The `linny-r` directory should contain this file `README.md`,
|
55
88
|
the files `server.js` and `console.js` that will be run by Node.js,
|
56
89
|
and the sub-directory `static`.
|
57
|
-
After installation has been completed, it will have two more subdirectories `user` and `node_modules`,
|
58
|
-
and a script file to facilitate (single click) launch: on a macOS machine the shell script `linny-r.command`,
|
59
|
-
on a Windows machine the batch script `linny-r.bat`.
|
60
90
|
|
61
91
|
The `static` directory should contain three HTML files:
|
62
92
|
|
@@ -66,43 +96,8 @@ The `static` directory should contain three HTML files:
|
|
66
96
|
|
67
97
|
It should also contain the style sheet `linny-r.css` required by the GUI.
|
68
98
|
|
69
|
-
The subdirectories of `static` contain files that are served to the browser by the script
|
70
|
-
|
71
|
-
After installation has completed, the `Linny-R` directory should have this directory tree structure:
|
72
|
-
|
73
|
-
<pre>
|
74
|
-
Linny-R
|
75
|
-
|
|
76
|
-
+- static
|
77
|
-
| |
|
78
|
-
| + fonts
|
79
|
-
| |
|
80
|
-
| +- images
|
81
|
-
| |
|
82
|
-
| +- scripts
|
83
|
-
| |
|
84
|
-
| +- sounds
|
85
|
-
|
|
86
|
-
+- user
|
87
|
-
|
|
88
|
-
+-callback
|
89
|
-
|
|
90
|
-
+-channel
|
91
|
-
|
|
92
|
-
+-diagrams
|
93
|
-
|
|
94
|
-
+-modules
|
95
|
-
|
|
96
|
-
+-solver
|
97
|
-
</pre>
|
98
|
-
|
99
|
-
The sub-directories of the `user` directory are used by Linny-R to store files.
|
100
|
-
|
101
|
-
* `channel` and `callback` will be used to interact with Linny-R via its *Receiver*
|
102
|
-
* `diagrams` will be used to render Scalable Vector Graphics (SVG) files as Portable Network Graphics (PNG) using Inkscape (if installed)
|
103
|
-
* `modules` will contain models stored in the `local host` *repository*
|
104
|
-
* `solver` will contain the files that are exchanged with the Mixed Integer Linear Programming (MILP) solver
|
105
|
-
(the names of the files that will appear in this directory may vary, depending on the MILP-solver you use)
|
99
|
+
The subdirectories of `static` contain files that are served to the browser by the script
|
100
|
+
`server.js` when it is running in Node.js.
|
106
101
|
|
107
102
|
### Configuring the MILP solver
|
108
103
|
|
@@ -138,7 +133,7 @@ How to do this is explained on the page "Installing LP_solve on a Mac" on the Li
|
|
138
133
|
https://linny-r.info
|
139
134
|
|
140
135
|
When you have downloaded the file (just `lp_solve` for macOS, `lp_solve.exe` for Windows),
|
141
|
-
you must copy or move this file to
|
136
|
+
you must copy or move this file to your `WORKING_DIRECTORY`,
|
142
137
|
as this is where Linny-R will look for it when it does not find Gurobi.
|
143
138
|
|
144
139
|
On a macOS machine, you must then make the file `lp_solve` executable.
|
@@ -161,12 +156,13 @@ If you reach this stage, Linny-R will be able to run LP_solve.
|
|
161
156
|
### Running Linny-R
|
162
157
|
|
163
158
|
Open the Command Line Interface (CLI) of your computer.
|
164
|
-
On macOS,
|
159
|
+
On macOS, open `Terminal`, change to your `WORKING_DIRECTORY` and type:
|
160
|
+
|
161
|
+
``node node_modules/linny-r/server``
|
165
162
|
|
166
|
-
|
167
|
-
Then type:
|
163
|
+
On Windows, open `Command Prompt`, change to your `WORKING_DIRECTORY` and type:
|
168
164
|
|
169
|
-
``node server``
|
165
|
+
``node node_modules\linny-r\server``
|
170
166
|
|
171
167
|
The response should be something similar to:
|
172
168
|
|
@@ -175,7 +171,8 @@ Node.js server for Linny-R version 1.0
|
|
175
171
|
Node.js version: v18.9.0
|
176
172
|
</pre>
|
177
173
|
|
178
|
-
followed by some data on your Linny-R configuration.
|
174
|
+
followed by some data on your Linny-R configuration.
|
175
|
+
The last line will be something like:
|
179
176
|
|
180
177
|
<pre>
|
181
178
|
Listening at: http://127.0.0.1:5050
|
@@ -214,16 +211,30 @@ Meanwhile, in the CLI, you should see a server log message like:
|
|
214
211
|
Solve block 1 a
|
215
212
|
</pre>
|
216
213
|
|
214
|
+
#### User workspace
|
215
|
+
|
216
|
+
The user workspace is created when the server is run for the first time.
|
217
|
+
The sub-directories of this directory `user` are used by Linny-R to store files.
|
218
|
+
|
219
|
+
* `channel` and `callback` will be used to interact with Linny-R via its *Receiver*
|
220
|
+
* `diagrams` will be used to render Scalable Vector Graphics (SVG) files as
|
221
|
+
Portable Network Graphics (PNG) using Inkscape (if installed)
|
222
|
+
* `modules` will contain models stored in the `local host` *repository*
|
223
|
+
* `solver` will contain the files that are exchanged with the Mixed Integer Linear Programming (MILP) solver
|
224
|
+
(the names of the files that will appear in this directory may vary, depending on the MILP-solver you use)
|
225
|
+
|
226
|
+
|
227
|
+
|
217
228
|
#### Command line options
|
218
229
|
|
219
230
|
Optionally, you can add more arguments to the `node` command:
|
220
231
|
|
221
232
|
<pre>
|
233
|
+
dpi=[number] to overrule the default resolution (300 dpi) for Inkscape
|
222
234
|
launch to automatically launch Linny-R in your default browser
|
223
235
|
port=[number] to overrule the default port number (5050)
|
224
236
|
solver=[name] to overrule the default sequence (Gurobi, LP_solve)
|
225
237
|
workspace=[path] to overrule the default path for the user directory
|
226
|
-
dpi=[number] to overrule the default resolution (300 dpi) for Inkscape
|
227
238
|
</pre>
|
228
239
|
|
229
240
|
### Installing Inkscape
|
@@ -257,7 +268,7 @@ To facilitate start-up, you can create a shortcut icon on your desktop.
|
|
257
268
|
On a Windows machine, change to your Linny-R folder, right-click on the batch file `linny-r.bat`,
|
258
269
|
and select the *Create shortcut* option.
|
259
270
|
Then right-click on the shortcut file to edit its properties, and click the *Change Icon* button.
|
260
|
-
The dialog that then appears will allow you to go to the sub-folder `static\images`,
|
271
|
+
The dialog that then appears will allow you to go to the sub-folder `node_modules\linny-r\static\images`,
|
261
272
|
where you should select the file `linny-r.ico`.
|
262
273
|
Finally, rename the shortcut to `Linny-R` and move or copy it to your desktop.
|
263
274
|
|
@@ -267,7 +278,7 @@ On a macOS machine, open Terminal and change to your Linny-R directory, and then
|
|
267
278
|
|
268
279
|
to make the script file executable.
|
269
280
|
To set the icon, click on the icon of `linny-r.command` (which still is plain) and open the Info dialog by pressing ``Cmd+I``.
|
270
|
-
Then open your Linny-R folder in the Finder, change to the sub-folder `static/images`,
|
281
|
+
Then open your Linny-R folder in the Finder, change to the sub-folder `node_modules/linny-r/static/images`,
|
271
282
|
and from there drag/drop the file `linny-r.icns` on the icon shown in the top left corner of the Info dialog.
|
272
283
|
|
273
284
|
|
@@ -289,9 +300,9 @@ In that case, you can stop Node.js by stopping the Terminal.
|
|
289
300
|
|
290
301
|
The console-only version of Linny-R allows you to run a Linny-R model without a web browser.
|
291
302
|
This may be useful when you want run models from a script (shell script, Python, ...).
|
292
|
-
If you open a CLI box, change to
|
303
|
+
If you open a CLI box, change to your `WORKING_DIRECTORY`, and then type:
|
293
304
|
|
294
|
-
``node console``
|
305
|
+
``node node_modules/linny-r/console`` _(on Windows, use backslashes)_
|
295
306
|
|
296
307
|
you will see the command line options that allow you to run models in various ways.
|
297
308
|
|
package/console.js
CHANGED
@@ -41,31 +41,29 @@ SOFTWARE.
|
|
41
41
|
// (this will make the "module" files linny-r-xxx.js export their properties)
|
42
42
|
global.NODE = true;
|
43
43
|
|
44
|
-
const VERSION_NUMBER = '1.0.0';
|
45
|
-
|
46
|
-
const MAIN_DIRECTORY = process.cwd();
|
47
|
-
|
48
|
-
// Load the required Node.js modules
|
49
44
|
const
|
45
|
+
VERSION_NUMBER = '1.1.2',
|
46
|
+
WORKING_DIRECTORY = process.cwd(),
|
47
|
+
path = require('path'),
|
48
|
+
MAIN_DIRECTORY = path.join(WORKING_DIRECTORY, 'node_modules', 'linny-r'),
|
49
|
+
// Load the required Node.js modules
|
50
50
|
fs = require('fs'),
|
51
51
|
os = require('os'),
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
// Get the platform name (win32, macOS, linux) of the user's computer
|
56
|
-
const PLATFORM = os.platform();
|
52
|
+
readline = require('readline'),
|
53
|
+
// Get the platform name (win32, macOS, linux) of the user's computer
|
54
|
+
PLATFORM = os.platform();
|
57
55
|
|
58
56
|
// Immediately output some configuration information to the console
|
59
57
|
console.log('\nNode.js Linny-R console version', VERSION_NUMBER);
|
60
58
|
console.log('Node.js version:', process.version);
|
61
59
|
console.log('Platform:', PLATFORM, '(' + os.type() + ')');
|
62
60
|
console.log('Main directory:', MAIN_DIRECTORY);
|
61
|
+
console.log('Working directory:', WORKING_DIRECTORY);
|
63
62
|
|
64
|
-
// Load the MILP solver (dependent on Node.js: `fs`, `os` and `path`)
|
65
|
-
const MILPSolver = require('./static/scripts/linny-r-milp.js');
|
66
|
-
|
67
|
-
// Load the browser-compatible Linny-R scripts
|
68
63
|
const
|
64
|
+
// Load the MILP solver (dependent on Node.js: `fs`, `os` and `path`)
|
65
|
+
MILPSolver = require('./static/scripts/linny-r-milp.js'),
|
66
|
+
// Load the browser-compatible Linny-R scripts
|
69
67
|
config = require('./static/scripts/linny-r-config.js'),
|
70
68
|
utils = require('./static/scripts/linny-r-utils.js'),
|
71
69
|
vm = require('./static/scripts/linny-r-vm.js'),
|
@@ -681,7 +679,7 @@ function commandLineSettings() {
|
|
681
679
|
preferred_solver: '',
|
682
680
|
solver: '',
|
683
681
|
solver_path: '',
|
684
|
-
user_dir: path.join(
|
682
|
+
user_dir: path.join(WORKING_DIRECTORY, 'user')
|
685
683
|
};
|
686
684
|
let show_usage = process.argv.length < 3;
|
687
685
|
for(let i = 2; i < process.argv.length; i++) {
|
@@ -812,7 +810,7 @@ function commandLineSettings() {
|
|
812
810
|
}
|
813
811
|
// Check if lp_solve(.exe) exists in main directory
|
814
812
|
const
|
815
|
-
sp = path.join(
|
813
|
+
sp = path.join(WORKING_DIRECTORY,
|
816
814
|
'lp_solve' + (PLATFORM.startsWith('win') ? '.exe' : '')),
|
817
815
|
need_lps = !settings.solver || settings.preferred_solver === 'lp_solve';
|
818
816
|
try {
|
package/package.json
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "linny-r",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.3",
|
4
4
|
"description": "Executable graphical language with WYSIWYG editor for MILP models",
|
5
5
|
"main": "server.js",
|
6
6
|
"scripts": {
|
7
|
+
"post-install": "post-install.js",
|
7
8
|
"test": "echo \"Error: no test specified\" && exit 1"
|
8
9
|
},
|
9
10
|
"dependencies": {
|
package/post-install.js
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
/*
|
2
|
+
Linny-R is an executable graphical specification language for (mixed integer)
|
3
|
+
linear programming (MILP) problems, especially unit commitment problems (UCP).
|
4
|
+
The Linny-R language and tool have been developed by Pieter Bots at Delft
|
5
|
+
University of Technology, starting in 2009. The project to develop a browser-
|
6
|
+
based version started in 2017. See https://linny-r.org for more information.
|
7
|
+
|
8
|
+
This NodeJS script (post-install.js) creates a launch script for Linny-R
|
9
|
+
that facilitates start-up: the user can then type `linny-r` at the command
|
10
|
+
line prompt, and also create a clickable icon as desktop shortcut.
|
11
|
+
|
12
|
+
For macOS, the script file is `linny-r.command`, for Windows `linny-r.bat`.
|
13
|
+
The script comprises two commands:
|
14
|
+
|
15
|
+
cd path/to/linny-r/directory
|
16
|
+
node node_modules/linny-r/server launch
|
17
|
+
|
18
|
+
since Windows also supports the slash as path separator. The "launch"
|
19
|
+
command tells the script `server.js` to start Linny-R in the default
|
20
|
+
web browser.
|
21
|
+
|
22
|
+
Comments are added to the script file to facilitate customization of the
|
23
|
+
scripts by the user. The README.md file explains how the script file can be
|
24
|
+
used for single-click launch of Linny-R, and how the "workspace" parameter
|
25
|
+
can be used in a multi-user network environment to provide individual
|
26
|
+
workspaces for users.
|
27
|
+
*/
|
28
|
+
/*
|
29
|
+
Copyright (c) 2020-2022 Delft University of Technology
|
30
|
+
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
32
|
+
of this software and associated documentation files (the "Software"), to deal
|
33
|
+
in the Software without restriction, including without limitation the rights
|
34
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
35
|
+
copies of the Software, and to permit persons to whom the Software is
|
36
|
+
furnished to do so, subject to the following conditions:
|
37
|
+
|
38
|
+
The above copyright notice and this permission notice shall be included in
|
39
|
+
all copies or substantial portions of the Software.
|
40
|
+
|
41
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
42
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
43
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
44
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
45
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
46
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
47
|
+
SOFTWARE.
|
48
|
+
*/
|
49
|
+
|
50
|
+
const
|
51
|
+
path = require('path'),
|
52
|
+
WORKING_DIRECTORY = process.cwd(),
|
53
|
+
lines = [
|
54
|
+
'# The first line (without the comment symbol #) should be like this:',
|
55
|
+
'# cd ',
|
56
|
+
'',
|
57
|
+
'# Then this command to launch the Linny-R server should work:',
|
58
|
+
'node ' + path.join('node_modules', 'linny-r', 'server') + ' launch'
|
59
|
+
];
|
60
|
+
let sp;
|
61
|
+
if(PLATFORM.startsWith('win')) {
|
62
|
+
sp = path.join(WORKING_DIRECTORY, 'linny-r.bat');
|
63
|
+
lines[1] += 'C:\\path\\to\\main\\Linny-R\\directory';
|
64
|
+
} else {
|
65
|
+
sp = path.join(WORKING_DIRECTORY, 'linny-r.command');
|
66
|
+
lines[1] += '/path/to/main/Linny-R/directory';
|
67
|
+
}
|
68
|
+
lines[2] = 'cd ' + WORKING_DIRECTORY;
|
69
|
+
try {
|
70
|
+
try {
|
71
|
+
fs.accessSync(sp);
|
72
|
+
} catch(err) {
|
73
|
+
// Only write the script content if the file it does not yet exist
|
74
|
+
console.log('Creating launch script:', sp);
|
75
|
+
let code = lines.join(os.EOL);
|
76
|
+
if(PLATFORM.startsWith('win')) code = code.replace('#', '::');
|
77
|
+
fs.writeFileSync(sp, code, 'utf8');
|
78
|
+
}
|
79
|
+
} catch(err) {
|
80
|
+
console.log('WARNING: Failed to create launch script');
|
81
|
+
}
|
package/server.js
CHANGED
@@ -5,7 +5,7 @@ The Linny-R language and tool have been developed by Pieter Bots at Delft
|
|
5
5
|
University of Technology, starting in 2009. The project to develop a browser-
|
6
6
|
based version started in 2017. See https://linny-r.org for more information.
|
7
7
|
|
8
|
-
This NodeJS script (
|
8
|
+
This NodeJS script (server.js) provides a minimalist local host web server
|
9
9
|
(URL http://127.0.0.1:5050) that will serve the Linny-R GUI (HTML, CSS,
|
10
10
|
and JavaScript files, and images), process the requests from the browser
|
11
11
|
that pass the MILP equation model to the solver, and then return the solution
|
@@ -39,15 +39,17 @@ SOFTWARE.
|
|
39
39
|
|
40
40
|
const
|
41
41
|
// The version number of this Linny-R server in Node.js
|
42
|
-
VERSION_NUMBER = '1.
|
42
|
+
VERSION_NUMBER = '1.1.2',
|
43
43
|
|
44
44
|
// The URL of the official Linny-R website (with the most recent release)
|
45
45
|
PUBLIC_LINNY_R_URL = 'https://sysmod.tbm.tudelft.nl/linny-r',
|
46
46
|
|
47
47
|
// The current working directory (from where Node.js was started) is
|
48
48
|
// assumed to be the main directory
|
49
|
-
|
50
|
-
|
49
|
+
path = require('path'),
|
50
|
+
WORKING_DIRECTORY = process.cwd(),
|
51
|
+
MAIN_DIRECTORY = path.join(WORKING_DIRECTORY, 'node_modules', 'linny-r'),
|
52
|
+
|
51
53
|
// Get the required built-in Node.js modules
|
52
54
|
child_process = require('child_process'),
|
53
55
|
crypto = require('crypto'),
|
@@ -55,7 +57,6 @@ const
|
|
55
57
|
http = require('http'),
|
56
58
|
https = require('https'),
|
57
59
|
os = require('os'),
|
58
|
-
path = require('path'),
|
59
60
|
|
60
61
|
// Get the platform name (win32, macOS, linux) of the user's computer
|
61
62
|
PLATFORM = os.platform();
|
@@ -65,6 +66,7 @@ console.log('\nNode.js server for Linny-R version', VERSION_NUMBER);
|
|
65
66
|
console.log('Node.js version:', process.version);
|
66
67
|
console.log('Platform:', PLATFORM, '(' + os.type() + ')');
|
67
68
|
console.log('Main directory:', MAIN_DIRECTORY);
|
69
|
+
console.log('Working directory:', WORKING_DIRECTORY);
|
68
70
|
|
69
71
|
// Only then require the Node.js modules that are not "built-in"
|
70
72
|
|
@@ -104,8 +106,6 @@ const SOLVER = new MILPSolver(SETTINGS, WORKSPACE);
|
|
104
106
|
// Create launch script
|
105
107
|
createLaunchScript();
|
106
108
|
|
107
|
-
verifyScriptFiles();
|
108
|
-
|
109
109
|
// Create the HTTP server
|
110
110
|
const SERVER = http.createServer((req, res) => {
|
111
111
|
const u = new URL(req.url, 'http://127.0.0.1:' + SETTINGS.port);
|
@@ -831,11 +831,11 @@ function receiver(res, sp) {
|
|
831
831
|
let
|
832
832
|
rpath = anyOSpath(sp.get('path') || ''),
|
833
833
|
rfile = anyOSpath(sp.get('file') || '');
|
834
|
-
// Assume that path is relative
|
834
|
+
// Assume that path is relative to channel directory unless it starts with
|
835
835
|
// a (back)slash or specifiess drive or volume
|
836
836
|
if(!(rpath.startsWith(path.sep) || rpath.indexOf(':') >= 0 ||
|
837
|
-
rpath.startsWith(
|
838
|
-
rpath = path.join(
|
837
|
+
rpath.startsWith(WORKING_DIRECTORY))) {
|
838
|
+
rpath = path.join(WORKING_DIRECTORY, rpath);
|
839
839
|
}
|
840
840
|
// Verify that the channel path exists
|
841
841
|
try {
|
@@ -1321,7 +1321,7 @@ function commandLineSettings() {
|
|
1321
1321
|
preferred_solver: '',
|
1322
1322
|
solver: '',
|
1323
1323
|
solver_path: '',
|
1324
|
-
user_dir: path.join(
|
1324
|
+
user_dir: path.join(WORKING_DIRECTORY, 'user')
|
1325
1325
|
};
|
1326
1326
|
for(let i = 2; i < process.argv.length; i++) {
|
1327
1327
|
const lca = process.argv[i].toLowerCase();
|
@@ -1410,9 +1410,9 @@ function commandLineSettings() {
|
|
1410
1410
|
'WARNING: Failed to access the Gurobi command line application');
|
1411
1411
|
}
|
1412
1412
|
}
|
1413
|
-
// Check if lp_solve(.exe) exists in
|
1413
|
+
// Check if lp_solve(.exe) exists in working directory
|
1414
1414
|
const
|
1415
|
-
sp = path.join(
|
1415
|
+
sp = path.join(WORKING_DIRECTORY,
|
1416
1416
|
'lp_solve' + (PLATFORM.startsWith('win') ? '.exe' : '')),
|
1417
1417
|
need_lps = !settings.solver || settings.preferred_solver === 'lp_solve';
|
1418
1418
|
try {
|
@@ -1518,24 +1518,26 @@ function createLaunchScript() {
|
|
1518
1518
|
'# cd ',
|
1519
1519
|
'',
|
1520
1520
|
'# Then this command to launch the Linny-R server should work:',
|
1521
|
-
'node server launch'
|
1521
|
+
'node ' + path.join('node_modules', 'linny-r', 'server') + ' launch'
|
1522
1522
|
];
|
1523
1523
|
let sp;
|
1524
1524
|
if(PLATFORM.startsWith('win')) {
|
1525
|
-
sp = path.join(
|
1525
|
+
sp = path.join(WORKING_DIRECTORY, 'linny-r.bat');
|
1526
1526
|
lines[1] += 'C:\\path\\to\\main\\Linny-R\\directory';
|
1527
1527
|
} else {
|
1528
|
-
sp = path.join(
|
1528
|
+
sp = path.join(WORKING_DIRECTORY, 'linny-r.command');
|
1529
1529
|
lines[1] += '/path/to/main/Linny-R/directory';
|
1530
1530
|
}
|
1531
|
-
lines[2] = 'cd ' +
|
1531
|
+
lines[2] = 'cd ' + WORKING_DIRECTORY;
|
1532
1532
|
try {
|
1533
1533
|
try {
|
1534
1534
|
fs.accessSync(sp);
|
1535
1535
|
} catch(err) {
|
1536
1536
|
// Only write the script content if the file it does not yet exist
|
1537
1537
|
console.log('Creating launch script:', sp);
|
1538
|
-
|
1538
|
+
let code = lines.join(os.EOL);
|
1539
|
+
if(PLATFORM.startsWith('win')) code = code.replace('#', '::');
|
1540
|
+
fs.writeFileSync(sp, code, 'utf8');
|
1539
1541
|
}
|
1540
1542
|
} catch(err) {
|
1541
1543
|
console.log('WARNING: Failed to create launch script');
|
package/static/index.html
CHANGED
@@ -51,13 +51,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
51
51
|
-->
|
52
52
|
|
53
53
|
<link rel="shortcut icon" type="image/png" href="images/icon.png">
|
54
|
+
<!-- NOTE: do not display the page until after software update check -->
|
55
|
+
<style>body { display: none; }</style>
|
54
56
|
<script>
|
55
57
|
var
|
56
58
|
// NODE = false indicates that modules need not export their properties
|
57
59
|
NODE = false,
|
58
60
|
// Version number and release date
|
59
|
-
LINNY_R_VERSION = '1.1.
|
60
|
-
VERSION_RELEASE_DATE = '2022-
|
61
|
+
LINNY_R_VERSION = '1.1.2',
|
62
|
+
VERSION_RELEASE_DATE = '2022-10-11 10:25',
|
61
63
|
// Linny-R server hosting public channels
|
62
64
|
PUBLIC_LINNY_R_URL = 'https://sysmod.tbm.tudelft.nl/linny-r',
|
63
65
|
// Create the XML parser
|
@@ -141,8 +143,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
141
143
|
}
|
142
144
|
|
143
145
|
function checkForUpdates() {
|
144
|
-
UI.check_update_modal.element('reload-btn').style.display = 'none';
|
145
|
-
UI.check_update_modal.element('restart-btn').style.display = 'none';
|
146
146
|
fetch('auto-check')
|
147
147
|
.then((response) => response.text())
|
148
148
|
.then((data) => {
|