new: Optionally make the capture page the default landing page

pull/920/head
Raphaël Vinot 2024-05-21 16:45:50 +02:00
parent 48b398c649
commit 5cbfbe26cd
2 changed files with 12 additions and 1 deletions

View File

@ -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.",

View File

@ -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