.
This commit is contained in:
parent
b1b372c8fc
commit
11ab0f695b
BIN
PassThroughBrowser.aia
Normal file
BIN
PassThroughBrowser.aia
Normal file
Binary file not shown.
BIN
PassThroughBrowser.apk
Normal file
BIN
PassThroughBrowser.apk
Normal file
Binary file not shown.
27
README.md
27
README.md
|
@ -1,3 +1,28 @@
|
|||
# passthroughbrowser
|
||||
|
||||
Waydroid Passthrough Browser - Open links in host browser
|
||||
Waydroid Passthrough Browser - Open links in host browser
|
||||
|
||||
Passthrough Browser has two components --- a server and a client. The server is
|
||||
a Python program written with Flask, while the client is an Android app written
|
||||
using [MIT App Inventor](https://appinventor.mit.edu). The server listens for
|
||||
HTTP POST connections on TCP port 8888 on an IP address only accessible to
|
||||
programs running on the host or in the Waydroid container. When it receives a
|
||||
properly formatted request, it opens the host's browser to the URL specified in
|
||||
the request. The client, when installed in Waydroid, is intended to be set as
|
||||
the default browser. After this is done, whenever an Android app attempts to
|
||||
open a Web page, it will open the Passthrough Browser client just as it would
|
||||
launch any other browser. The client then sends the URL to the server, which
|
||||
causes the host browser to open.
|
||||
|
||||
## Installation
|
||||
|
||||
Run `./install_both.sh`. (Make sure Waydroid is running first.) Installing the
|
||||
client requires running a command as root; the script uses `sudo`. You may need
|
||||
to enter your password during installation.
|
||||
|
||||
## Credits
|
||||
|
||||
The client app uses the
|
||||
[CustomWebView](https://github.com/vknow360/CustomWebView/tree/beta) (beta
|
||||
version) App Inventor extension by Sunny Gupta. CustomWebView is used under the
|
||||
MIT licese.
|
||||
|
|
4
install_both.sh
Executable file
4
install_both.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
./install_server.sh
|
||||
echo "----------"
|
||||
./install_client.sh
|
12
install_client.sh
Executable file
12
install_client.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
echo "Running 'sudo waydroid app install PassThroughBrowser.apk'. Please enter your"
|
||||
echo "password if prompted:"
|
||||
sudo waydroid app install PassThroughBrowser.apk
|
||||
cat << HERE
|
||||
To set up the Passthrough Browser client:
|
||||
1. Open Settings in Waydroid.
|
||||
2. Click/tap "Apps and Notifications."
|
||||
3. Click/tap "Default apps."
|
||||
4. Click/tap "Browser app."
|
||||
5. Click/tap "Passthrough Browser."
|
||||
HERE
|
12
install_server.sh
Executable file
12
install_server.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
mkdir -p ~/.config/autostart
|
||||
mkdir -p ~/.local/bin/
|
||||
cat > ~/.config/autostart/passthrough_browser_server.desktop << HERE
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Passthrough Browser Server
|
||||
Exec=$HOME/.local/bin/passthrough_browser_server
|
||||
HERE
|
||||
cp server.py ~/.local/bin/passthrough_browser_server
|
||||
echo "To start the Passthrough Browser server, log out and log back in. (Wait until"
|
||||
echo "you have set the client up, if it isn't already installed.)"
|
44
server.py
Executable file
44
server.py
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env python3
|
||||
from flask import Flask
|
||||
from flask import request, Response
|
||||
import webbrowser
|
||||
import time
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/', methods = ['GET', 'POST'])
|
||||
def page():
|
||||
if request.method == 'GET':
|
||||
return """\
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Passthrough Browser Server</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Passthrough Browser Server</h1>
|
||||
<p>This is the server for <a href=https://git.kj7rrv.com/kj7rrv/passthroughbrowser>Passthrough Browser</a>. Passthrough Browser is an Android app that, when set as the default browser in Waydroid, causes links to open in the host computer's browser.</p>
|
||||
<p>If you have not yet installed the client app in Waydroid, follow these steps to install it:</p>
|
||||
<ul>
|
||||
<li>Open Waydroid</li>
|
||||
<li>Open a terminal</li>
|
||||
<li><code>cd</code> to the directory where you downloaded Passthrough Browser</li>
|
||||
<li><code>./install_client.sh</code></li>
|
||||
<li>Follow the instructions on the command line</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
elif request.method == 'POST':
|
||||
webbrowser.open(request.form['url'])
|
||||
return Response('', 203)
|
||||
|
||||
if __name__ == '__main__':
|
||||
while True:
|
||||
try:
|
||||
app.run(host='192.168.250.1', port=8888)
|
||||
except OSError as e:
|
||||
print(e)
|
||||
time.sleep(3)
|
||||
|
Loading…
Reference in New Issue
Block a user