[Feature] Request elevated privileges only when needed #16
Labels
critical
Critical priority
enhancement
New feature or request
feature accepted
Feature has been accepted
help wanted
Extra attention is needed
The launcher on Windows currently requests elevated privileges upon running the program.
It would be better user experience and more secure to only request elevated privileges for the operations that need it. A few examples:
fs
module orfs-extra
) in a protected folder (such as Program Files).On macOS the launcher does not require elevation immediately, which is a better approach. It only requests elevated privileges when installing mono or SDL, so no changes would be necessary for macOS.
Need to figure out:
fs
throws an error, catch that to request privileges and redo the operation).node-windows
package?Update 1
The way to do this would be to use
sudo-prompt
(which is already being used on macOS for mono and SDL installations, it works for Windows too).Code that requires admin privileges would need to be refactored to be able to be run "standalone", since sudo-prompt only works by executing command line scripts.
Two node.js command line script files would need to be created:
Related code would need to be refactored to be able to be run as
sudo_prompt.exec('node script.js <args>')
, as standalone routines with input arguments and stdout logs reporting progress that will be handled in the main launcher application, and proper handling of error exit codes.By default, the launcher will run without admin privileges and will use sudo-prompt to elevate in these two cases.
The FSOLauncher.ini config file location will also have to be changed to a non-admin-privileges location, like %APPDATA%. Currently, it is created wherever the launcher itself is installed, in the same folder. So if the launcher was installed in Program Files, it wouldn't be able to read the config file.
The text was updated successfully, but these errors were encountered: