diff --git a/config/generic.json.sample b/config/generic.json.sample index 97bfaf2..6ac9402 100644 --- a/config/generic.json.sample +++ b/config/generic.json.sample @@ -7,6 +7,7 @@ "website_listen_port": 5100, "systemd_service_name": "lookyloo", "default_public": true, + "index_is_capture": false, "users": {}, "time_delta_on_index": { "weeks": 1, @@ -90,6 +91,7 @@ "website_listen_port": "Port Flask will listen on.", "systemd_service_name": "(Optional) Name of the systemd service if your project has one.", "default_public": "If true, the capture is public and will be visible on the index page by default (can be unticked on the capture page).", + "index_is_capture": "If true, the capture page is the default landing page (faster for big instances).", "users": "It is some kind of an admin accounts. Format: {username: password}", "time_delta_on_index": "Time interval of the capture displayed on the index", "async_capture_processes": "Number of async_capture processes to start. This should not be higher than the number of splash instances you have running. A very high number will use *a lot* of ram.", diff --git a/website/web/__init__.py b/website/web/__init__.py index a542380..6eef395 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -78,6 +78,15 @@ login_manager.init_app(app) # User agents manager user_agents = UserAgents() +if get_config('generic', 'index_is_capture'): + @app.route('/', methods=['GET']) + def landing_page() -> WerkzeugResponse: + return redirect(url_for('capture_web')) +else: + @app.route('/', methods=['GET']) + def landing_page() -> WerkzeugResponse: + return redirect(url_for('index')) + @login_manager.user_loader # type: ignore[misc] def user_loader(username: str) -> User | None: @@ -1317,7 +1326,7 @@ def get_index_params(request: Request) -> tuple[bool, str]: # ##### Index level methods ##### -@app.route('/', methods=['GET']) +@app.route('/index', methods=['GET']) def index() -> str: if request.method == 'HEAD': # Just returns ack if the webserver is running