Zomboided / service.vpn.manager

VPN plugin for Kodi
GNU General Public License v2.0
305 stars 81 forks source link

List of included add-ons instead of only excluded? #370

Closed fragande closed 1 year ago

fragande commented 1 year ago

Sorry, this is more of a feature request / question but there's no discussion section.

I'm having a bit of trouble isolating the use of VPN to a single add-on. I only want the VPN active when using a particular add-on and nowhere else. Is there a better way of accomplishing this than adding every other add-on and Window ID to the excluded lists?

Zomboided commented 1 year ago

Turn off the connect on boot so it's off by default and then use the filter to enable it for the add-on you need it for.

fragande commented 1 year ago

Turn off the connect on boot so it's off by default and then use the filter to enable it for the add-on you need it for.

I'm sorry but which filter? There's only exclude, not include, right? Do you have to add every other add-on and Window ID to the exclude lists? The closest I can get otherwise is using "Select add-ons that use a specific VPN connection" but then the connection stays active after exiting the add-on in question and I have to manually disconnect.

EDIT:

Shitty workaround for now: adding the home screen Window ID (10000) to excluded windows as a disconnect trigger (kept reverting back to none for some reason). At least that means I don't have to manually disconnect, but also that I can never go back to the home screen while using the add-on.

Zomboided commented 1 year ago

It's detailed on the wiki. If the connection starts as the off default state (ie the connect on boot option), then it'll return to that state. You then use the filtering to select the add-on/window ID that you want to enable it. When you leave that add-on/window, it'll revery to off.

On Wed, Aug 3, 2022 at 7:41 PM fragande @.***> wrote:

Turn off the connect on boot so it's off by default and then use the filter to enable it for the add-on you need it for.

I'm sorry but which filter? There's only exclude, not include. Do you have to add every other add-on and Window ID to the exclude lists? The closest I can get otherwise is using "Select add-ons that use a specific VPN connection" but then the connection stays active after exiting the add-on in question and I have to manually disconnect.

— Reply to this email directly, view it on GitHub https://github.com/Zomboided/service.vpn.manager/issues/370#issuecomment-1204340301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECJZZJFDCHEVIUPNV4NSATVXK4MTANCNFSM55NFPT6A . You are receiving this because you modified the open/close state.Message ID: @.***>

fragande commented 1 year ago

It's detailed on the wiki. If the connection starts as the off default state (ie the connect on boot option), then it'll return to that state. You then use the filtering to select the add-on/window ID that you want to enable it. When you leave that add-on/window, it'll revery to off.

I have read the wiki but the only thing detailed is excluding add-ons/Window ID's or using a specific connection for certain add-ons. There's no filtering for including add-ons as far as I can tell so I don't understand what you mean by:

You then use the filtering to select the add-on/window ID that you want to enable it.

There's no such option.

Using the Select add-ons that use a specific VPN connection works for activating the connection but does not revert when exiting the add-on (with the Revert to previous VPN state for non-filtered add-ons setting enabled). It only reverts to disconnected when activating another add-on, not by exiting the current add-on back to home screen for example.

So it seems to me that the only way of accomplishing this is adding some Window ID (like home screen) to the excluded list as a disconnect trigger.

peno64 commented 1 year ago

For people also looking for this. This is how I have done it and it works fine. in VPN manager settings:

That is all. A small clarification with the last one. Window 10000 is the window of kodi when you exit an addon. So this makes VPN shutdown again. I guess this 10000 is fixed for all versions of kodi. You can check this by enabling Display window IDs as a notification. Then watch the id that appears when you exit an addon.

Zomboided commented 1 year ago

I don't think you need a window filter. Your first two steps work fine, with the first one being the critical one. Do you see different behaviour without the window filter? Can you describe the connection/disconnection you're seeing?

On Fri, Dec 30, 2022 at 5:38 PM peno64 @.***> wrote:

For people also looking for this. This is how I have done it and it works fine. in VPN manager settings:

  • Monitor, Automatically connect to first VPN off
  • Add-on Filter, Select add-ons that use a specific VPN connection. Choose your addons that need VPN. You can put them call in First or divide them among your defined VPN connections
  • Window Filter, Select window IDs that won't use a VPN, Excluded: 10000

That is all. A small clarification with the last one. Window 10000 is the window of kodi when you exit an addon. So this makes VPN shutdown again. I guess this 10000 is fixed for all versions of kodi. You can check this by enabling Display window IDs as a notification. Then watch the id that appears when you exit an addon.

— Reply to this email directly, view it on GitHub https://github.com/Zomboided/service.vpn.manager/issues/370#issuecomment-1368027018, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECJZZOWIOKIBEYMBEUGTUDWP4MYXANCNFSM55NFPT6A . You are receiving this because you modified the open/close state.Message ID: @.***>

peno64 commented 1 year ago

If I don't add the window filter then vpn stays on when I leave the addon...

fragande commented 1 year ago

For people also looking for this. This is how I have done it and it works fine. in VPN manager settings:

* Monitor, Automatically connect to first VPN off

* Add-on Filter, Select add-ons that use a  specific VPN connection. Choose your addons that need VPN. You can put them call in First or divide them among your defined VPN connections

* Window Filter, Select window IDs that won't use a VPN, Excluded: 10000

That is all. A small clarification with the last one. Window 10000 is the window of kodi when you exit an addon. So this makes VPN shutdown again. I guess this 10000 is fixed for all versions of kodi. You can check this by enabling Display window IDs as a notification. Then watch the id that appears when you exit an addon.

This is my solution as well even if it's suboptimal to say the least. You can't use a backup connection and can never go back to home screen when using the add-on which is a bit irritating. I've learned to live with it.

If I don't add the window filter then vpn stays on when I leave the addon...

Yes, a window ID as a disconnect trigger is a must. It can be any window though, I used a shortcut to the settings window at first. Now I've added all other window ID ranges other than the add-on itself and stay within the add-on at all times while using it.

Zomboided commented 1 year ago

I remember this now, it's been so long since I wrote this code.

The decision to ignore Kodi windows is deliberate. If the VPN is disconnected/connected to the original VPN each time the user leaves an addon (rather than just when they enter it), this potentially causes the VPN to bounce up and down all the time. Probably this could be resolved with a setting that always disconnects when the user returns to 'native' Kodi, but in my testing I found that as soon as addons called Kodi functions, this looked the same as them having exited the addon. Think chopping the connection as the user starts to play a video for instance.

This is what it is, the workaround is good, thanks for suggesting. I'm not gonna fix it because I'm not sure there's a good way to address this specfic use case without breaking many others (which is pretty much what @fragande is demonstrating with his view that the workaround is suboptimal)

On Fri, Dec 30, 2022 at 6:13 PM peno64 @.***> wrote:

If I don't add the window filter then vpn stays on when I leave the addon...

— Reply to this email directly, view it on GitHub https://github.com/Zomboided/service.vpn.manager/issues/370#issuecomment-1368039050, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECJZZKJUO7VARVVQYXX4VLWP4Q5VANCNFSM55NFPT6A . You are receiving this because you modified the open/close state.Message ID: @.***>

peno64 commented 1 year ago

Yes I also think there is no good work-around for it. It's how kodi works. While the video is playing you can also open extra addons, for example call the subtitle window and as it is now this works fine so I would not change it.

peno64 commented 1 year ago

Some other files could give now an error by previous change. I made another change that should work for all cases