Inspired by the idea of having digital paper: one file script, scripted for each specific case, save-able, recreatable, copyable (just like paper)
Download and install latest binary: (PC terminal)
git clone https://gitlab.com/shts/SHTS.git & cd SHTS & install.bat & cd .. & rmdir /s /q SHTS
Download and install latest binary: (PC powershell)
git clone https://gitlab.com/shts/SHTS.git; cd SHTS; ./install.bat; cd ..; Remove-Item -Path SHTS -Recurse -Force
Download and install latest binary: (MAC)
...
SHTS is a program that runs .shts and .shtml files. These files are run as if it were .shtml files, with the ability to use the extra functions that SHTS provides.
SHTS exposes the SHTS interface to the shts file which contains 4 functions.
Examples can be found here
SHTS.save(content)
This functions saves the HTML content provided as argument to the current file that is running. To create a viable application, the developer of the script is still responsible of making this work and making sure that the data that needs to be loaded and saved is inside a HTML tag. It is recommended to use the following code to save the HTML to the current file:
window.addEventListener("beforeunload", (event) => {
const content = document.documentElement.outerHTML;
SHTS.save(content);
});
Note that SHTS.save(content)
will reload the browser with the new content.
SHTS.new(content)
Same as save, but for a new file, depending on the command line argument --save-before. If this argument is given by the user, the file is saved at the new location given by the user. If not, the user will get the option to save the file at a specific location when the user closes the application.
SHTS.startServer(port, bridge_info)
This starts a server. bridge_info can be {protocol:'tcp', port:9090}
to start a TCP bridge or {protocol:'udp', inport:9090, outport:9091}
to start an UDP bridge.
SHTS.stopServer()
This functions stops the server. The server is also automatically closed when the script is closed.
Note that all functions are Async and that as of yet these functions do not return the result back to javascript. Therefore it is difficult to know if for example a server has started succesfully. It's a thing.
Maybe in the future file system handles should be able to be saved on a user-level using the localStorage property.
SHTS can be started with a few command arguments to augment the program behaviour. The arguments are:
--allow-network-access
For allowing the server to start.--deny-network-access
For disabling the message to allow to start the server.--disable-save-warning
For disabling the message when the user cancels the save dialog.--save-before-creating
Default the application creates a tempfile when html content is loaded to a new file with SHTS.new(content).
With this argument the user is presented with the save dialog when the SHTS.new(content) function is called instead.For development reasons the argument --open-DevTools
is added to open the DevTools of the browser.
SHTS program.shts [--allow-network-access] [--deny-network-access] [--disable-save-warning] [--save-before-creating] [--open-DevTools]
- Interfaces that need permissions in the browser do not work as of yet, like AudioCapture, VideoCapture, Geolocation, Midi MidiSysex (midi), Notifications, ClipboardReadWrite ClipboardSanitizedWrite (clipboard), BackgroundSync, ProtectedMediaIdentifier, Sensors, PaymentHandler, DurableStorage, IdleDetection, WakeLockScreen, WakeLockSystem, PeriodicBackgroundSync, Nfc.
- fullscreen mode
- cztomczak for cefpython and a good example script that is used as starting point.