mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-10 15:07:35 +01:00
Fix auto-webhook creation failure due to wrong scheme
This commit is contained in:
parent
43c2ee6b7b
commit
19a626e237
@ -24,7 +24,7 @@ from sqlalchemy import func
|
||||
from flask_github import GitHub
|
||||
from app import github, csrf
|
||||
from app.models import db, User, APIToken, Package, Permission
|
||||
from app.utils import loginUser, randomString
|
||||
from app.utils import loginUser, randomString, abs_url_for
|
||||
from app.blueprints.api.support import error, handleCreateRelease
|
||||
import hmac, requests, json
|
||||
|
||||
@ -180,7 +180,7 @@ def setup_webhook():
|
||||
|
||||
if current_user.github_access_token is None:
|
||||
return github.authorize("write:repo_hook", \
|
||||
redirect_uri=url_for("github.callback_webhook", pid=pid, _external=True))
|
||||
redirect_uri=abs_url_for("github.callback_webhook", pid=pid))
|
||||
|
||||
form = SetupWebhookForm(formdata=request.form)
|
||||
if request.method == "POST" and form.validate():
|
||||
@ -214,7 +214,7 @@ def handleMakeWebhook(gh_user, gh_repo, package, oauth, event, token):
|
||||
"active": True,
|
||||
"events": [event],
|
||||
"config": {
|
||||
"url": url_for("github.webhook", _external=True),
|
||||
"url": abs_url_for("github.webhook"),
|
||||
"content_type": "json",
|
||||
"secret": token.access_token
|
||||
},
|
||||
|
@ -19,6 +19,7 @@ from flask import render_template, url_for
|
||||
from flask_mail import Message
|
||||
from app import mail
|
||||
from app.tasks import celery
|
||||
from app.utils import abs_url_for
|
||||
|
||||
@celery.task()
|
||||
def sendVerifyEmail(newEmail, token):
|
||||
@ -34,7 +35,7 @@ def sendVerifyEmail(newEmail, token):
|
||||
If this was you, then please click this link to verify the address:
|
||||
|
||||
{}
|
||||
""".format(url_for('users.verify_email', token=token, _external=True))
|
||||
""".format(abs_url_for('users.verify_email', token=token))
|
||||
|
||||
msg.html = render_template("emails/verify.html", token=token)
|
||||
mail.send(msg)
|
||||
|
@ -16,12 +16,12 @@
|
||||
If this was you, then please click this link to verify the address:
|
||||
</p>
|
||||
|
||||
<a class="btn" href="{{ url_for('users.verify_email', token=token, _external=True) }}">
|
||||
<a class="btn" href="{{ abs_url_for('users.verify_email', token=token) }}">
|
||||
Confirm Email Address
|
||||
</a>
|
||||
|
||||
<p style="font-size: 80%;">
|
||||
Or paste this into your browser: {{ url_for('users.verify_email', token=token, _external=True) }}
|
||||
Or paste this into your browser: {{ abs_url_for('users.verify_email', token=token) }}
|
||||
<p>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -22,6 +22,12 @@ from app.models import *
|
||||
from app import app
|
||||
import random, string, os, imghdr
|
||||
|
||||
|
||||
@app.template_filter()
|
||||
def abs_url_for(path, **kwargs):
|
||||
scheme = "https" if app.config["BASE_URL"][:5] == "https" else "http"
|
||||
return url_for(path, _external=True, _scheme=scheme, **kwargs)
|
||||
|
||||
def get_int_or_abort(v, default=None):
|
||||
try:
|
||||
return int(v or default)
|
||||
|
Loading…
Reference in New Issue
Block a user