diff --git a/handlers.py b/handlers.py index 35e89dc..aa84873 100644 --- a/handlers.py +++ b/handlers.py @@ -338,12 +338,29 @@ def handle_search(query): ) -def handle_add_form(msg=""): +def handle_add_form(msg="", action_type="index"): + if action_type == "subscribe": + return _respond( + f"

subscribe

" + f"

Subscribe to a friend's TinyWeb instance to sync their index

" + f'
' + f'{_csrf_field()}' + f'

' + f'' + f"
" + f"

or add a single site

" + f"

{msg}

" + f'back' + ) return _respond( f"

add url

" f"

Add a site via URL or Reticulum destination hash

" f'
' f'{_csrf_field()}' + f'

' f'
' f'or
' f'

' @@ -351,6 +368,7 @@ def handle_add_form(msg=""): f'

' f'' f"
" + f"

or manage subscriptions

" f"

{msg}

" f'back' ) @@ -921,6 +939,7 @@ def handle_subscriptions(msg=""): f' ' f'' f'' + f'

or subscribe to an instance

' f'

{msg}

' f'
{listing}' f'
back' @@ -1286,7 +1305,8 @@ def _dispatch_inner(data): if path == "/": return handle_search(query) elif path == "/add": - return handle_add_form() + action_type = query.get("type", ["index"])[0] + return handle_add_form(action_type=action_type if action_type == "subscribe" else "index") elif path == "/pages": return handle_pages(query) elif path.startswith("/edit/"):