shared text
This commit is contained in:
parent
d3fe4ad380
commit
e04bdea613
4
app.py
4
app.py
@ -162,12 +162,16 @@ def user_accounts() -> Union[Response, str]:
|
||||
@app.route("/share", methods=["GET"])
|
||||
def share() -> Response:
|
||||
"""Handles shared text from PWA."""
|
||||
if not session.get("logged_in"):
|
||||
return redirect(url_for("index"))
|
||||
shared_text = request.args.get("text")
|
||||
return redirect(url_for("add_account", shared_text=shared_text))
|
||||
|
||||
@app.route("/accounts/add", methods=["GET", "POST"])
|
||||
def add_account() -> Union[Response, str]:
|
||||
"""Handles adding a new user account."""
|
||||
if not session.get("logged_in"):
|
||||
return redirect(url_for("index"))
|
||||
base_url = app.config["BASE_URL"]
|
||||
shared_text = request.args.get('shared_text')
|
||||
|
||||
|
@ -131,11 +131,15 @@
|
||||
}
|
||||
});
|
||||
|
||||
const sharedText = '{{ shared_text|safe }}';
|
||||
const sharedTextJson = '{{ shared_text|tojson|safe }}';
|
||||
console.log('sharedTextJson:', sharedTextJson);
|
||||
const sharedText = JSON.parse(sharedTextJson);
|
||||
console.log('sharedText:', sharedText);
|
||||
|
||||
if (sharedText) {
|
||||
const accountDetailsTextarea = document.getElementById('accountDetails');
|
||||
if (accountDetailsTextarea) {
|
||||
console.log('Setting accountDetailsTextarea value to:', sharedText);
|
||||
accountDetailsTextarea.value = sharedText;
|
||||
const event = new Event('input', {
|
||||
bubbles: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user