For me building interfaces through HTML / JS frameworks is by far easier then any other framework I have tried in the past. It's also not that strange, as by far the most UIs are based on the web nowadays, so the tools are superb (to me).
Sometimes I need a small tool or app that needs access to "native Windows" stuff - like the file system.
So I built a microserver executable. A very lightweight ASP.NET App (Minimal Web API) where I can build my interface in HTML and JS and communicate with XHR calls for things like "ProcessFiles" or read XXX.
The user launches the daemon and the interface can simply be installed by going to the localhost URL and launch a PWA in their favorite browser.
Note I don't want to use Electron, because I don't like that every app is running a full instance of Chromium on their own, with their won bugfixes, updates etc.
The daemon on itself is SUPER lightweight.
Some examples of these tools:
- an alternative to File Explorer that I'm working on.
- a State Machine Editor for my Unity projects.
Of course the whole "web server" in combination with i.e. a File Explorer sounds like a terrible idea from a security perspective.
One thing I do is enforce that the XHR call is coming from 127.0.0.1 and otherwise hard crash. Also it is of course on a "strange port" so I assume this is normally blocked by firewalls.
But not sure if this can be worked around by potential hackers.
- How risky is this approach in general?
- Are there any other simple things I can easily do to protect it from ever being abused?
Note
Leave for now out that there are new features to also natively read with the OS, I want to focus on the things above.