Repository: hunterirving/macproxy_plus Branch: master Commit: 68db2c9efee5 Files: 36 Total size: 175.8 KB Directory structure: gitextract_tn4uwse3/ ├── .gitignore ├── LICENSE ├── README.md ├── config.py.example ├── extensions/ │ ├── chatgpt/ │ │ ├── chatgpt.py │ │ └── requirements.txt │ ├── claude/ │ │ ├── claude.py │ │ └── requirements.txt │ ├── gemini/ │ │ ├── gemini.py │ │ └── requirements.txt │ ├── hackaday/ │ │ └── hackaday.py │ ├── hacksburg/ │ │ └── hacksburg.py │ ├── hunterirving/ │ │ └── hunterirving.py │ ├── kagi/ │ │ ├── kagi.py │ │ └── template.html │ ├── mistral/ │ │ ├── mistral.py │ │ └── requirements.txt │ ├── notyoutube/ │ │ ├── notyoutube.py │ │ └── videos.json │ ├── npr/ │ │ └── npr.py │ ├── override/ │ │ └── override.py │ ├── reddit/ │ │ └── reddit.py │ ├── waybackmachine/ │ │ └── waybackmachine.py │ ├── weather/ │ │ └── weather.py │ ├── websimulator/ │ │ └── websimulator.py │ ├── wiby/ │ │ └── wiby.py │ └── wikipedia/ │ └── wikipedia.py ├── presets/ │ ├── macweb2/ │ │ └── macweb2.py │ └── wii_internet_channel/ │ └── wii_internet_channel.py ├── proxy.py ├── requirements.txt ├── start_macproxy.ps1 ├── start_macproxy.sh └── utils/ ├── html_utils.py ├── image_utils.py └── system_utils.py ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] # Distribution / packaging venv/ current # PyCharm metadata .idea/ # Ignore all instances of config.py **/config.py # Ignore video files *.mp4 *.flim # Other extensions/youtube **/cached_images/ **/.DS_Store ================================================ FILE: LICENSE ================================================ Copyright 2013 Tyler G. Hicks-Wright Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: README.md ================================================ ## MacProxy Plus An extensible HTTP proxy that connects early computers to the Internet. This fork of MacProxy adds support for ```extensions```, which intercept requests for specific domains to serve simplified HTML interfaces, making it possible to browse the modern web from vintage hardware. Though originally designed for compatibility with early Macintoshes, MacProxy Plus should work to get many other vintage machines online. ### Demonstration Video (on YouTube) Teaching an Old Mac New Tricks ### Extensions Each extension has its own folder within the `extensions` directory. Extensions can be individually enabled or disabled via a `config.py` file in the root directory. To enable extensions: 1. In the root directory, rename ```config.py.example``` to ```config.py``` : ```shell mv config.py.example config.py ``` 2. In ```config.py```, enable/disable extensions by uncommenting/commenting lines in the ```ENABLED_EXTENSIONS``` list: ```python ENABLED_EXTENSIONS = [ #disabled_extension, "enabled_extension" ] ``` ### Starting MacProxy Plus On Unix-like systems (such as Linux or macOS), run the ```start_macproxy.sh``` script. It will create a Python virtual environment, install the required Python packages, and make the proxy server available on your local network. ```shell ./start_macproxy.sh ``` On Windows, run the analogous PowerShell script, ```start_macproxy.ps1```: ```powershell .\start_macproxy.ps1 ``` ### Connecting to MacProxy Plus from your Vintage Machine To use MacProxy Plus, you'll need to configure your vintage browser or operating system to connect to the proxy server running on your host machine. The specific steps will vary depending on your browser and OS, but if your system lets you set a proxy server, it should work. If you're using a BlueSCSI to get a vintage Mac online, this guide should help with the initial Internet setup.

![Configuring proxy settings in MacWeb 2.0c+](readme_images/proxy_settings.gif)
*Example: Configuring proxy settings in MacWeb 2.0c+* ### Example Extension: ChatGPT A ChatGPT extension is provided as an example. This extension serves a simple web interface that lets users interact with OpenAI's GPT models. To enable the ChatGPT extension, open ```config.py```, uncomment the ```chatgpt``` line in the ```ENABLED_EXTENSIONS``` list, and replace ```YOUR_OPENAI_API_KEY_HERE``` with your actual OpenAI API key. ```python open_ai_api_key = "YOUR_OPENAI_API_KEY_HERE" ENABLED_EXTENSIONS = [ "chatgpt" ] ``` Once enabled, Macproxy will reroute requests to ```http://chatgpt.com``` to this inteface.

### Other Extensions #### Claude (Anthropic) For the discerning LLM connoisseur. #### Weather Get the forecast for any zip code in the US. #### Wikipedia Read any of over 6 million encyclopedia articles - complete with clickable links and search function. #### Reddit Browse any subreddit or the Reddit homepage, with support for nested comments and downloadable images... in dithered black and white. #### WayBack Machine Enter any date between January 1st, 1996 and today, then browse the web as it existed at that point in time. Includes full download support for images and other files backed up by the Internet Archive. #### Web Simulator Type a URL that doesn't exist into the address bar, and Anthropic's Claude 3.5 Sonnet will interpret the domain and any query parameters to generate an imagined version of that page on the fly. Each HTTP request is serialized and sent to the AI, along with the full HTML of the last 3 pages you visited, allowing you to explore a vast, interconnected, alternate reality Internet where the only limit is your imagination. #### (not) YouTube A legally distinct parody of YouTube, which uses the fantastic homebrew application MacFlim (created by Fred Stark) to encode video files as a series of dithered black and white frames. #### Hackaday A pared-down, text-only version of hackaday.com, complete with articles, comments, and search functionality. #### npr.org Serves articles from the text-only version of the site (```text.npr.org```) and transforms relative urls into absolute urls for compatibility with MacWeb 2.0. #### wiby.me Browse Wiby's collection of personal, handmade webpages (fixes an issue where clicking "surprise me..." would not redirect users to their final destination). ### Future Work - more extensions for more sites - presets targeting specific vintage machines/browsers - wiki with how-to guides for different machines Happy Surfing 😎 ================================================ FILE: config.py.example ================================================ # To enable extensions, rename this file to "config.py" # and fill in the necessary API keys and other details. # Store API keys and other configuration details here: # OPEN_AI_API_KEY = "YOUR_OPENAI_API_KEY_HERE" # ANTHROPIC_API_KEY = "YOUR_ANTHROPIC_API_KEY_HERE" # GEMINI_API_KEY = "YOUR_GEMINI_API_KEY_HERE" # MISTRAL_API_KEY = "YOUR_MISTRAL_API_KEY_HERE" # KAGI_SESSION_TOKEN = "YOUR_KAGI_SESSION_TOKEN_HERE" # Used by weather extension (which currently only works for United States) # ZIP_CODE = "YOUR_ZIP_CODE" # Uncomment lines to enable desired extensions: ENABLED_EXTENSIONS = [ #"chatgpt", #"claude", #"gemini", #"hackaday", #"hacksburg", #"hunterirving", #"kagi", #"mistral", #"notyoutube", #"npr", #"reddit", #"waybackmachine", #"weather", #"websimulator", #"wiby", #"wikipedia", ] # While SIMPLIFY_HTML is True, you can use WHITELISTED_DOMAINS to disable post-processing for # specific sites (only perform HTTPS -> HTTP conversion and character conversion (if CONVERT_CHARACTERS is True), # without otherwise modifying the page's source code). WHITELISTED_DOMAINS = [ #"example.com", ] # Optionally, load a preset (.py file) from /presets, optimized for compatibility # with a specific web browser. Enabling a preset may override one or more of the # settings that follow below. # The default values target compatability with the MacWeb 2.0 browser. #PRESET = "wii_internet_channel" # -------------------------------------------------------------------------------------- # *** One or more of the following settings may be overridden if you enable a preset *** # -------------------------------------------------------------------------------------- # If True, parse HTML responses to strip specified tags and attributes. # If False, always return the full, unmodified HTML as served by the requested site or extension # (only perform HTTPS -> HTTP conversion and character conversion (if CONVERT_CHARACTERS is True), # without otherwise modifying the page's source code). SIMPLIFY_HTML = True # If SIMPLIFY_HTML is True, unwrap these HTML tags during processing: TAGS_TO_UNWRAP = [ "noscript", ] # If SIMPLIFY_HTML is True, strip these HTML tags during processing: TAGS_TO_STRIP = [ "script", "link", "style", "source", ] # If SIMPLIFY_HTML is True, strip these HTML attributes during processing: ATTRIBUTES_TO_STRIP = [ "style", "onclick", "class", "bgcolor", "text", "link", "vlink" ] # Process images for optimal rendering on your device/browser: CAN_RENDER_INLINE_IMAGES = False # Mostly used to conditionally enable landing page images (ex: waybackmachine.py) RESIZE_IMAGES = True MAX_IMAGE_WIDTH = 512 # Only used if RESIZE_IMAGES is True MAX_IMAGE_HEIGHT = 342 # Only used if RESIZE_IMAGES is True CONVERT_IMAGES = True CONVERT_IMAGES_TO_FILETYPE = "gif" # Only used if CONVERT_IMAGES is True DITHERING_ALGORITHM = "FLOYDSTEINBERG" # Only used if CONVERT_IMAGES is True and CONVERT_IMAGES_TO_FILETYPE == "gif" # In addition to the default web simulator prompt, add custom instructions to improve compatability with your web browser. WEB_SIMULATOR_PROMPT_ADDENDUM = """ IMPORTANT: The user's web browser only supports (most of) HTML 3.2 (you do not need to acknowledge this to the user, only understand it and use this knowledge to construct the HTML you respond with). Their browser has NO CSS support and NO JavaScript support. Never include