atauenis / webone

HTTP 1.x proxy that makes old web browsers usable again in the Web 2.0 world.
Other
518 stars 18 forks source link

Add support for moving of default webone.conf #10

Closed atauenis closed 4 years ago

atauenis commented 4 years ago

Currently WebOne is using only webone.conf in application's directory as default configuration file. But when the app is installed via DEB or RPM package, both the app and its config file begins placed in /usr/share/WebOne/, which is not a good place for config files.

I think that WebOne should try to load default webone.conf not only from app directory, and corresponding to rules of used OS.

E.g.:

  1. On Windows: 1.1. .\webone.conf 1.2. %AppData%\WebOne\webone.conf 1.3. C:\Users\username\webone.conf (or C:\Users\username\Documents\webone.conf)
  2. On Linux: 2.1 ./webone.conf 2.2. /var/WebOne/webone.conf 2.3. ~/webone.conf or ~/.webone
  3. On macOS: 3.1. ??? (what that on Apple)

Also temporary directory for converter results also should be settable in config file or be auto-set corresponding on used OS: %TEMP%, $TMPDIR, /tmp/, /var/tmp/, etc.

All deb/rpm packages should install the default config file to correct folder.

Probably this can be do by renaming default webone.conf to webone.conf.skel, and then auto-copying of it to correct directory regarding to access rules. So, if the app is runned with user rights, copy to ~/.webone or %AppData%\WebOne\webone.conf. Or if the app is runned on Linux through sudo, copy it to /var/WebOne/webone.conf . But if there are a real .\webone.conf, the app should use it (meaning that user attempted to use the WebOne from a temporary folder, not from /usr/share/WebOne/ through /usr/bin/WebOne symlink).

atauenis commented 4 years ago

Okay. Added the support for opening webone.conf from regular system configuration file directories on Windows and *nix. However, if the file is still present in server's directory or in current working directory, it will be used instead (as it was before). By default all builds still have the file out-of-box. So nothing changed for most of all.

On Linux (on packaging time) it should be renamed to webone.conf.skel. Then on first run WebOne it will copy it to /etc/WebOne/webone.conf or ~/.config/WebOne/webone.conf, depending on access rights. Probably this may be do via post-install scripts in deb/rpm, but qmfrederik/dotnet-packaging currently does not provides any documentation about how to add such scripts.

On Windows I think that there is not need to rename .conf to .conf.skel, as Windows is more friendly to portable apps than Linux.