Skip to content

[WIP] Add Linux VPS support and installation files - #1

Merged
khawarahemad merged 1 commit into
mainfrom
copilot/add-linux-vps-support
Jan 30, 2026
Merged

khawarahemad merged 1 commit into
mainfrom
copilot/add-linux-vps-support

Conversation

Copilot AI commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Add Linux/VPS Support and Installation Files

Please add the following files to make this project work seamlessly on Linux VPS environments:

1. Create requirements.txt

selenium>=4.0.0

2. Create ViewMax_Linux.py (Linux-compatible version)

This should be a cross-platform version that auto-detects the OS and chromedriver path. Key improvements:

import threading
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from concurrent.futures import ThreadPoolExecutor
import sys
import time
import os
import platform

# Lock for thread-safe printing
log_lock = threading.Lock()

def get_chromedriver_path():
    """Auto-detect chromedriver path based on OS."""
    system = platform.system()
    
    if system == "Linux":
        # Common Linux paths
        common_paths = [
            "/usr/bin/chromedriver",
            "/usr/local/bin/chromedriver",
            "/usr/lib/chromium-browser/chromedriver",
            "/snap/bin/chromium.chromedriver"
        ]
        for path in common_paths:
            if os.path.exists(path):
                return path
        # If not found, let Selenium find it in PATH
        return "chromedriver"
    elif system == "Darwin":  # macOS
        return "/opt/homebrew/bin/chromedriver"
    else:  # Windows
        return "chromedriver.exe"

def get_chrome_options():
    """Configure Chrome options for Linux/VPS environment."""
    chrome_options = Options()
    
    # Essential options for headless operation
    chrome_options.add_argument("--headless")
    chrome_options.add_argument("--no-sandbox")
    chrome_options.add_argument("--disable-dev-shm-usage")
    chrome_options.add_argument("--disable-gpu")
    
    # Additional options for VPS/server environments
    chrome_options.add_argument("--disable-software-rasterizer")
    chrome_options.add_argument("--disable-extensions")
    chrome_options.add_argument("--disable-setuid-sandbox")
    chrome_options.add_argument("--disable-infobars")
    chrome_options.add_argument("--window-size=1920,1080")
    chrome_options.add_argument("--start-maximized")
    chrome_options.add_argument("--disable-blink-features=AutomationControlled")
    
    # User agent to avoid detection
    chrome_options.add_argument("user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36")
    
    # Memory optimization for VPS
    chrome_options.add_argument("--disable-background-networking")
    chrome_options.add_argument("--disable-background-timer-throttling")
    chrome_options.add_argument("--disable-backgrounding-occluded-windows")
    chrome_options.add_argument("--disable-breakpad")
    chrome_options.add_argument("--disable-component-extensions-with-background-pages")
    chrome_options.add_argument("--disable-features=TranslateUI,BlinkGenPropertyTrees")
    chrome_options.add_argument("--disable-ipc-flooding-protection")
    chrome_options.add_argument("--disable-renderer-backgrounding")
    
    return chrome_options

def visit_site_safe(url, browser_id, progress, progress_message):
    """Safe method: Visit the site using a single browser instance."""
    driver = None
    try:
        chrome_options = get_chrome_options()
        chromedriver_path = get_chromedriver_path()
        
        service = Service(chromedriver_path)
        driver = webdriver.Chrome(service=service, options=chrome_options)
        
        # Update progress message for the browser visiting
        with log_lock:
            progress_message[browser_id] = f"Browser {browser_id + 1} visiting {url}"
        
        driver.get(url)
        time.sleep(3)  # Wait for page to load
        progress[browser_id] = True
        
        # Update progress message for the browser completion
        with log_lock:
            progress_message[browser_id] = f"Browser {browser_id + 1} has completed."
    except Exception as e:
        with log_lock:
            progress_message[browser_id] = f"Browser {browser_id + 1} failed: {str(e)}"
        progress[browser_id] = False
    finally:
        if driver:
            try:
                driver.quit()
            except:
                pass

def visit_site_extreme(url, browser_id, progress, progress_message):
    """Extreme method: Visit the site using multiple browser instances."""
    driver = None
    try:
        chrome_options = get_chrome_options()
        chromedriver_path = get_chromedriver_path()
        
        service = Service(chromedriver_path)
        driver = webdriver.Chrome(service=service, options=chrome_options)
        
        # Update progress message for the browser visiting
        with log_lock:
            progress_message[browser_id] = f"Browser {browser_id + 1} visiting {url}"
        
        driver.get(url)
        time.sleep(3)  # Wait for page to load
        progress[browser_id] = True
        
        # Update progre...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---Let Copilot coding agent [set things up for you](https://github.com/khawarahemad/ViewMax/issues/new?title=+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.

@khawarahemad
khawarahemad marked this pull request as ready for review January 30, 2026 09:38
@khawarahemad
khawarahemad merged commit 19619e7 into main Jan 30, 2026
@khawarahemad

Copy link
Copy Markdown
Owner

new added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants