feat: Allow any application to toggle the tunnels, useful for automation#69
Open
laralex wants to merge 1 commit intoamnezia-vpn:masterfrom
Open
feat: Allow any application to toggle the tunnels, useful for automation#69laralex wants to merge 1 commit intoamnezia-vpn:masterfrom
laralex wants to merge 1 commit intoamnezia-vpn:masterfrom
Conversation
IntentReceiver. The user-facing "allow remote control intents" knob remains the sole gate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wanted to make an external app to conveniently toggle the tunnels. Useful in Russia where you need to toggle it a lot, and using the Android dropdown menu is inconvenient.
In the current code base the external application must request CONTROL_TUNNELS permission in its manifest in order to broadcast messages to IntentReceiver.
However, there are some applications like Automate/Tasker/MacroDroid, that allow implementing simple programs without programming. Unfortunately, they don't request this permission in the manifest, thus the broadcast messages to IntentReceiver don't work. You have to actually go to Android Studio and make the app from scratch to request this permission.
So I made this change to your Android client, to remove requirement on the CONTROL_TUNNELS from the IntentReceiver.
And then I could control the tunnel from Automate. * Here I demonstrate the Automate app that I made, it's very convenient
https://github.com/user-attachments/assets/d1f0eced-acf3-4500-8533-2eabcdf2999f
Note that the user can still keep the checkbox "allow remote control intents" disabled, and so no other app by default will be able to control Amnezia client
Please consider this change, as I think it's useful, and if some external malicious application like MAX from Russian authorities wants to disable all VPN tunnels from Amnezia, they still can do it by simply requesting this permission in the manifest. So it's a sloppy guard