bookmarklet: use dynamic host and scheme from request headers
This commit is contained in:
parent
a9cf9fb096
commit
8214f241fa
3 changed files with 13 additions and 9 deletions
|
|
@ -48,6 +48,7 @@ def _dispatch_inner(data):
|
|||
query = data.get("query", {})
|
||||
body = data.get("body", {})
|
||||
gateway_host = data.get("gateway_host", "")
|
||||
scheme = data.get("scheme", "http")
|
||||
|
||||
def extract_id(prefix):
|
||||
try:
|
||||
|
|
@ -72,7 +73,7 @@ def _dispatch_inner(data):
|
|||
elif path == "/bookmark":
|
||||
return handle_bookmark(query)
|
||||
elif path == "/style":
|
||||
return handle_style_form()
|
||||
return handle_style_form(gateway_host=gateway_host, scheme=scheme)
|
||||
elif path == "/share/preview":
|
||||
return handle_share_preview()
|
||||
elif path == "/about":
|
||||
|
|
@ -121,14 +122,14 @@ def _dispatch_inner(data):
|
|||
pid = extract_id("/delete/")
|
||||
return handle_delete(pid) if pid is not None else _error(400)
|
||||
elif path == "/style":
|
||||
return handle_style_submit(body)
|
||||
return handle_style_submit(body, gateway_host=gateway_host, scheme=scheme)
|
||||
elif path == "/style/reset":
|
||||
set_setting("custom_template", "")
|
||||
return handle_style_form("Template reset to default.")
|
||||
return handle_style_form("Template reset to default.", gateway_host=gateway_host, scheme=scheme)
|
||||
elif path == "/style/vacuum":
|
||||
from db import vacuum_db
|
||||
vacuum_db()
|
||||
return handle_style_form("Database vacuumed.")
|
||||
return handle_style_form("Database vacuumed.", gateway_host=gateway_host, scheme=scheme)
|
||||
elif path == "/import":
|
||||
return handle_import_submit(body)
|
||||
elif path == "/reindex":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue