Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add profile delete button in GUI #326

Open
torerobo opened this issue Dec 26, 2019 · 8 comments
Open

Add profile delete button in GUI #326

torerobo opened this issue Dec 26, 2019 · 8 comments

Comments

@torerobo
Copy link

I imported a lot of profiles.ovpn Then I deleted them from the folder, but they all remained in the GUI. And it has grown. Openvpn gui does not have a delete profile button.

How to get rid of unnecessary profiles in gui at the moment?

@selvanair
Copy link
Collaborator

The profile should disappear from the GUI if deleted from the disk. But note that if any connections are active deleted profiles may still show up in the menu list until the last active connection is disconnected.

@jsbsmd
Copy link

jsbsmd commented Jan 27, 2020

I too would like the added delete feature instead of going into the drive to manually remove entries. Will be very useful when testing multiple connections.

@pitfisher
Copy link

pitfisher commented Jan 27, 2023

Hi! I want to try to implement this function. I already figured out how to add new pop-up menu item for config/connection removal, but I'm not really experienced in WinAPI so I could use your suggestion/guidance for best way to implement function to remove the config file directory from the disk. It also would really help if you could give info about what such function has to do in order to inform other parts of the program about executed removal.
I understand that giving this kind of explanations could take as long as an implementation of this function by more experienced contributor, so I'm fine with any kind of tips or info no matter how little, of course.

@selvanair
Copy link
Collaborator

Currently there is no way for the program to notice that a config file is deleted. The item will stay in the menu listing (until the GUI is restarted) but when attempted to connect, it will fail with "file not found error". Its not too hard to change that, and we may do "one day". If that is acceptable, you can just delete the file.

The reason why I haven't implemented a delete menu is because an ovpn file may have dependency files --- like certificates, scripts etc. Just deleting the .ovpn alone can leave unused files behind. We have a config parser and one can parse and find the dependencies and delete them too, but that's trickier than it looks. We can't be sure no other configs depend on those files. Two or more .ovpn files sharing a certificate or key is not uncommon.

The root of the problem is that config files and their dependencies end up in the folder in two different ways -- via import and via user copying them manually. To provide a clean add/delete/edit interface to the user, OpenVPN-GUI has to take full control of the "configuration store", track dependencies and their re-use, should not allow the user to directly access the store etc.. That would be a major overhaul.

I would suggest to just navigate to the folder and delete the files manually. We can add a menu to open the config folder to make this easier. We keep config files in their original form, unedited, and do not hide them away in some program-specific folder. They are all in %USERPROFILE%\OpenVPN for the user to see --- or in the global-config folder, but those cannot be deleted without admin privileges.

A "delete" feature applied only to configs imported via the import menu could be easier to implement. For now, each of those end up in a new subfolder containing a single .ovpn file with no dependencies. So deletion is less likely to affect other configs.

@pitfisher
Copy link

pitfisher commented Jan 28, 2023

Thanks for your answer!
I figured out yesterday that the program does not detect if config file was deleted from the disk and If I understood you correctly changing that behaviour would require a lot of work.
Then am I correct the best that can be done relatively easy is addition of a button that would open a directory with subdirectories of config files imported by current user? Would you consider such addition useful?
You also mentioned that implementing a button for deleting subfolders of .ovpn configs imported by current user would be realatively easy. Is there a way the program can distinguish whether config was imported or not? Probably it can be decided by the file path?

@selvanair
Copy link
Collaborator

Then am I correct the best that can be done relatively easy is addition of a button that would open a directory with subdirectories of config files imported by current user? Would you consider such addition useful?

That looks useful if coupled with code to also update the menu listing to match the changes. As for the current behaviour of not removing deleted files from the menu, as I wrote earlier, "Its not too hard to change... " that. When changes do not reflect in the menu it could be very confusing to the user. Or force a restart of the GUI to recognize the changes.

From the same view, the user could also re-organize the config folder and thus the nested config menu listing, not just prune files and folders. So, this could be a global menu item like "Manage Configs"? If the normal file-explorer dialog is used, we can put the onus on the user to know which files/folders can be safely deleted or moved around.

@selvanair
Copy link
Collaborator

selvanair commented Jan 30, 2023

@pitfisher I have implemented the part of updating the menu when files are deleted. Also, when new configs are added now they appear within the correct parent menu (instead of in the root menu) in the nested menu view. You will have to either set the config menu view (Settings->Advanced) to Nested or have >= 25 configs in multiple sub-folders to see what this means.

This has to be thoroughly tested before going upstream. Could you try to give it a test run and try to break it by adding or removing configs manually, deleting all configs, starting with none, one or many etc. ? You could also use it as starting point for the enhancement you have in mind.
See: https://github.com/selvanair/openvpn-gui/tree/config-menu

@selvanair
Copy link
Collaborator

@pitfisher did you get a chance to test the above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants