allow to run on freebsd

This commit is contained in:
Antoni Sawicki 2018-06-23 00:40:27 -07:00
parent 40c0329d1a
commit 4526dfca64
2 changed files with 11 additions and 8 deletions

View File

@ -1,11 +1,14 @@
# WRP - Web Rendering Proxy
A HTTP proxy server that renders the web page in to a GIF/JPEG image associated with clickable imagemap of the original web links. It allows to use historical and obsolete web browsers on the modern web. It's still a work in progress but it's quite stable and usable for casual web browsing.
A HTTP proxy server that renders the web page in to a GIF/PNG/JPEG image associated with clickable imagemap of the original web links. It allows to use historical and obsolete web browsers on the modern web. It's still a work in progress but it's quite stable and usable for casual web browsing.
Version 2.0 brings support for PythonMagick (ImageMagick Library) that allows to optimize and reduce image size or covert to greyscale or bitmap for these cool computers without color displays.
## OS Support
WRP works on Mac OS X and Linux. It requires Python 2.7 and under Linux, PyQT4 or PyQT5.
WRP works on macOS (Mac OS X), Linux and FreeBSD. On macOS it uses Cocoa Webkit, on Linux/FreeBSD QT Webkit, for which needs PyQT4 or PyQT5.
## Linux Prerequisites
apt install python-qt5 python-pyqt5.qtwebkit
# Installation
* macOS - should just work
* Linux/FreeBSD install `python-pyqt5.qtwebkit`
## Configuration
Edit wrp.py, scroll past Copyright nonsense to find config parameters

8
wrp.py
View File

@ -86,7 +86,7 @@ RENDERS = {}
### Linux CODEPATH ###
#######################
if sys.platform == "linux" or sys.platform == "linux2":
if sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
try:
from PyQt5.QtCore import *
from PyQt5.QtGui import *
@ -861,7 +861,7 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
req_extension = ".jpg"
elif FORMAT == "PNG":
req_extension = ".png"
elif (sys.platform == "linux" or sys.platform == "linux2") and FORMAT == "AUTO":
elif (sys.platform.startswith('linux') or sys.platform.startswitch('freebsd')) and FORMAT == "AUTO":
req_extension = ".jpg"
elif sys.platform == "darwin" and FORMAT == "AUTO":
req_extension = ".gif"
@ -891,13 +891,13 @@ def main():
if(FORMAT != "AUTO" and FORMAT != "GIF" and FORMAT != "JPG" and FORMAT != "PNG"):
sys.exit("Unsupported image format \"%s\". Exiting." % FORMAT)
if (sys.platform == "linux" or sys.platform == "linux2") and FORMAT == "GIF" and not HasMagick:
if (sys.platform.startswith('linux') or sys.platform.startswith('freebsd')) and FORMAT == "GIF" and not HasMagick:
sys.exit("GIF format is not supported on this platform. Exiting.")
# Launch Proxy Thread
threading.Thread(target=run_proxy).start()
if sys.platform == "linux" or sys.platform == "linux2":
if sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
import signal
try:
import PyQt5.QtCore