rework pwa
This commit is contained in:
parent
8784e141eb
commit
31480c10a4
7
app.py
7
app.py
@ -126,6 +126,9 @@ def login() -> Union[Response, str]:
|
|||||||
session["logged_in"] = True
|
session["logged_in"] = True
|
||||||
session["username"] = username
|
session["username"] = username
|
||||||
session["auth_credentials"] = encoded_credentials
|
session["auth_credentials"] = encoded_credentials
|
||||||
|
next_url = request.args.get("next")
|
||||||
|
if next_url:
|
||||||
|
return redirect(next_url)
|
||||||
return redirect(url_for("home"))
|
return redirect(url_for("home"))
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
pass # Fall through to error
|
pass # Fall through to error
|
||||||
@ -162,12 +165,16 @@ def user_accounts() -> Union[Response, str]:
|
|||||||
@app.route("/share", methods=["GET"])
|
@app.route("/share", methods=["GET"])
|
||||||
def share() -> Response:
|
def share() -> Response:
|
||||||
"""Handles shared text from PWA."""
|
"""Handles shared text from PWA."""
|
||||||
|
if not session.get("logged_in"):
|
||||||
|
return redirect(url_for("index", next=request.url))
|
||||||
shared_text = request.args.get("text")
|
shared_text = request.args.get("text")
|
||||||
return redirect(url_for("add_account", shared_text=shared_text))
|
return redirect(url_for("add_account", shared_text=shared_text))
|
||||||
|
|
||||||
@app.route("/accounts/add", methods=["GET", "POST"])
|
@app.route("/accounts/add", methods=["GET", "POST"])
|
||||||
def add_account() -> Union[Response, str]:
|
def add_account() -> Union[Response, str]:
|
||||||
"""Handles adding a new user account."""
|
"""Handles adding a new user account."""
|
||||||
|
if not session.get("logged_in"):
|
||||||
|
return redirect(url_for("index", next=request.url))
|
||||||
base_url = app.config["BASE_URL"]
|
base_url = app.config["BASE_URL"]
|
||||||
shared_text = request.args.get('shared_text')
|
shared_text = request.args.get('shared_text')
|
||||||
|
|
||||||
|
@ -19,8 +19,9 @@
|
|||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"theme_color": "#ffffff",
|
"theme_color": "#ffffff",
|
||||||
"share_target": {
|
"share_target": {
|
||||||
"action": "share",
|
"action": "/share",
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
|
"enctype": "application/x-www-form-urlencoded",
|
||||||
"params": {
|
"params": {
|
||||||
"text": "text"
|
"text": "text"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user