From 4526dfca64363e40b1113eb00010fd3e704b8b1b Mon Sep 17 00:00:00 2001 From: Antoni Sawicki Date: Sat, 23 Jun 2018 00:40:27 -0700 Subject: [PATCH] allow to run on freebsd --- README.md | 11 +++++++---- wrp.py | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6080c46..1dd384d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/wrp.py b/wrp.py index e30e82c..4a5401e 100755 --- a/wrp.py +++ b/wrp.py @@ -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