Add abs_url_samesite

This commit is contained in:
rubenwardy
2022-01-21 14:23:27 +00:00
parent a32b63f932
commit 97e2e1c16e
2 changed files with 9 additions and 6 deletions

View File

@@ -15,7 +15,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from urllib.parse import urljoin, urlparse
from urllib.parse import urljoin, urlparse, urlunparse
import user_agents
from flask import request, abort
@@ -40,6 +40,10 @@ def abs_url_for(endpoint: str, **kwargs):
def abs_url(path):
return urljoin(app.config["BASE_URL"], path)
def abs_url_samesite(path):
base = urlparse(app.config["BASE_URL"])
return urlunparse(base._replace(path=path))
def url_current(abs=False):
args = MultiDict(request.args)
dargs = dict(args.lists())