iOS Shortcut for Diversion

thelonelycoder

Part of the Furniture
Happy that this is working well for iOS devices....but where is the love for Android users? ;):D
A quick browse and test brought reasonable results with the Android app SSH button.



Switch blocking state sends the command 'diversion sh-a'



Fill in
SSH hostname: router IP address
SSH username: router login name
SSH password: router password
SSH port: Set SSH port in WebUI
One also can use password-less login with key.

These are the commands available at the moment, you can add each of them as a button to the app:
Code:
# Switches ad-blocking state
diversion sh-a

# Switches logging state
diversion sh-l

# Enables Diversion services
diversion sh-enable

# Disables Diversion services
diversion sh-disable

# Restarts Diversion services
diversion sh-restart

# Blocking list fast switch
diversion sh-fs

There is only a return of OK in that app, no way of knowing what it actually did.
 
Last edited:

sentinelvdx

Very Senior Member
A quick browse and test brought reasonable results with the Android app SSH button.


Switch blocking state sends the command 'diversion sh-a'


Fill in
SSH hostname: router IP address
SSH username: router login name
SSH password: router password
SSH port: Set SSH port in WebUI
One also can use password-less login with key.

These are the commands available at the moment:
Code:
# Switches ad-blocking state
diversion sh-a

# Switches logging state
diversion sh-l

# Enables Diversion services
diversion sh-enable

# Disables Diversion services
diversion sh-disable

# Restarts Diversion services
diversion sh-restart

# Blocking list fast switch
diversion sh-fs

There is only a return of OK in that app, no way of knowing what it actually did.
Thanks!

I have noticed "diversion sh-enable" does enable diversion, but does not enable ad-blocking.

I have to enable it through ssh. Any idea what we could add to enable it on same command?

Sent from my SM-G965F Duos
 

sentinelvdx

Very Senior Member
you can enable it in the same app using the first one:

Code:
# Switches ad-blocking state
diversion sh-a

Nope, it doesn't work

Update: after doing it a second time it did work... think yiu have to wait 20 secs after diversion sh-enable

Sent from my SM-G965F Duos
 

Kingp1n

Very Senior Member
Is there a similar app we can use for android users?

Update: Disregard..think I found my answer!
 

Swistheater

Very Senior Member
This is a shortcut for the iOS Shortcuts app

Required steps to use "Diversion Adblocker x.x" shortcut
- Have Diversion installed on your router
- In Diversion run u to check for updates, update if one is available
- Have an iOS device, this works on iPhone, iPad and probably iPod too
- Have iOS 12 or later running on device
- Install the Shortcuts app from the App Store from your device
- Open the preferred versions link in Safari on your device:
v1.0: https://www.icloud.com/shortcuts/b2a9202ee2914e5f974ca3bef6830136
v1.1 (requires Diversion v4.1.x): https://www.icloud.com/shortcuts/db2078e544af4917848fed5cb4b0031f
- Tap on OPEN at top of page (Pull down on page if option is not shown)
- Tap on "Get Shortcut"
- Fill in the Credentials for your Router where Diversion is installed on:
  1. Host: Routers IP address
  2. Port: SSH port (usually 22)
  3. User: The SSH and WebUI user name for your router
  4. Password: The Password for your router
Done!

In the Shortcuts app Library you now have "Diversion Adblocker x.x":


If you tap on the icon, you'll get the options screen in v1.1:


"Diversion options" has a sub-menu:


As confirmation for an action you'll get an alert such as this one.
The "(tick) ad-blocking enabled" is the direct output from Diversion.
all of us android users are feeling sad ....
 

thelonelycoder

Part of the Furniture
all of us android users are feeling sad ....
See post #41, there may be better Android apps to do this but nothing similar to Shortcuts exists outside the iOS sphere AFAIK.
 

doczenith1

Very Senior Member
Is there anyway to add a command to "process all list"? My thought being that I have non-tech friends using my hosted whitelist. If they send me a URL that they need whitelisted I can add it to the hosted whitelist and then they can use a SSH Button command to update the hosted whitelist on their router.
 

thelonelycoder

Part of the Furniture
Is there anyway to add a command to "process all list"? My thought being that I have non-tech friends using my hosted whitelist. If they send me a URL that they need whitelisted I can add it to the hosted whitelist and then they can use a SSH Button command to update the hosted whitelist on their router.

Good idea, will add it to the next version.
 

thelonelycoder

Part of the Furniture
iOS Shortcut v1.3 is now available

What's new in v1.3
- Adds blocking list update through Shortcuts
- Adds hosted lists update and processing through Shortcuts
- Adds Exit button to cancel operation
- Rearranged menu
- Diversion shortcut 1.3 requires Diversion 4.1.3

How to install on your iOS device
See this page on diversion.ch or read instructions in post #1. Once the new Shortcut is configured and working, you may safely delete older version(s) from your Library.

 

doczenith1

Very Senior Member
Would it be possible to publish the new commands for us Android users similar to what you did in post #41? Thank you.
 

thelonelycoder

Part of the Furniture
Would it be possible to publish the new commands for us Android users similar to what you did in post #41? Thank you.
This is the current list of iOS commands. Note that some only are helpful with a return.
Code:
# Runs the ads counter
diversion ac sh

# Switches ad-blocking state
diversion sh-a

# Switches logging state
diversion sh-l

# Enables Diversion services
diversion sh-enable

# Disables Diversion services
diversion sh-disable

# Restarts Diversion services
diversion sh-restart

# Blocking list fast switch
diversion sh-fs

# Shows state of Diversion
diversion sh-state

# Updates the blocking list(s)
diversion sh-bl-update

# Updates and processes hosted lists
diversion sh-hl-process
 

thelonelycoder

Part of the Furniture
I have noticed "diversion sh-enable" does enable diversion, but does not enable ad-blocking.

I have to enable it through ssh. Any idea what we could add to enable it on same command?
The enable/disable/restart commands only do what it says: Switching the currently active services. You'd have to re-enable ad-blocking with the respective command.
 

Clark Griswald

Very Senior Member
thelonelycoder
I wanted to let you know that your ios shortcut has been greatly appreciated in my household! Much less frustrating, than my wife unplugging the usb, then unplugging/plugging in router's power.
Again, Thank You!!
 

thelonelycoder

Part of the Furniture
thelonelycoder
I wanted to let you know that your ios shortcut has been greatly appreciated in my household! Much less frustrating, than my wife unplugging the usb, then unplugging/plugging in router's power.
Again, Thank You!!
WHO exactly messes with the router? The wife and kids or you?
 

Clark Griswald

Very Senior Member
WHO exactly messes with the router? The wife and kids or you?
My wonderful wife was online trying to purchase a "special limited release" Disney purse.
I used the occasion to learn how to reinstall all the wonderful scripts. Your iOS shortcut Disable/Enable option is greatly appreciated!
Unfortunately, I am the only person allowed to "mess" with the network, so all blame goes on me, whenever a hiccup occurs.
Again, Thank You for your great work/efforts towards scripts, which allow the routers to do much more than the stock fw!
 

ScottW

Regular Contributor
@thelonelycoder -

The iOS shortcut works great, very handy, thanks!!

I wanted a "disable ad-blocking for XX minutes" function, so attempted to add one. Using "diversion sh-a && echo diversion sh-a | at now + 30 minutes" for the action mostly works, but creates some issues if used a second time before the "at" job has run (because every invocation is a "toggle", and multiple jobs get created). And of course this requires installing "at" from entware.

Any better way to do this?
 

thelonelycoder

Part of the Furniture
@thelonelycoder -

The iOS shortcut works great, very handy, thanks!!

I wanted a "disable ad-blocking for XX minutes" function, so attempted to add one. Using "diversion sh-a && echo diversion sh-a | at now + 30 minutes" for the action mostly works, but creates some issues if used a second time before the "at" job has run (because every invocation is a "toggle", and multiple jobs get created). And of course this requires installing "at" from entware.

Any better way to do this?
I don't know. A crude way would be to create a file with content such as:
Code:
#!/bin/sh
sleep 1800
diversion sh-a >/dev/null 2>&1
And then add such a command as the shortcut:
Code:
diversion sh-a; sh /path/to/file &
 

donduck

Occasional Visitor
I'm on iOS 13.2.3 and have the Diversion 1.3 shortcut installed. (Currently running amtm 3.1.2 & Diversion 4.1.9)

It seems once Diversion is "Disabled" or ad-block state is "Switched", the iOS shortcut can no longer reconnect. (I get an error message: "Run Script Over SSH could not connect to the SSH server")
 

thelonelycoder

Part of the Furniture
I'm on iOS 13.2.3 and have the Diversion 1.3 shortcut installed. (Currently running amtm 3.1.2 & Diversion 4.1.9)

It seems once Diversion is "Disabled" or ad-block state is "Switched", the iOS shortcut can no longer reconnect. (I get an error message: "Run Script Over SSH could not connect to the SSH server")
That is a router problem. Check the Syslog.
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top