mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
Show correct embed URL
This commit is contained in:
parent
0a06d516e2
commit
7c5d395736
@ -1,23 +1,12 @@
|
||||
from flask import jsonify, url_for
|
||||
from flask import jsonify
|
||||
from flask_login import login_required
|
||||
|
||||
from redash import settings
|
||||
from redash.authentication.org_resolving import current_org
|
||||
from redash.handlers.api import api
|
||||
from redash.handlers.base import routes
|
||||
from redash.monitor import get_status
|
||||
from redash.permissions import require_super_admin
|
||||
|
||||
|
||||
def base_href():
|
||||
if settings.MULTI_ORG:
|
||||
base_href = url_for('redash.index', _external=True, org_slug=current_org.slug)
|
||||
else:
|
||||
base_href = url_for('redash.index', _external=True)
|
||||
|
||||
return base_href
|
||||
|
||||
|
||||
@routes.route('/ping', methods=['GET'])
|
||||
def ping():
|
||||
return 'PONG.'
|
||||
@ -31,13 +20,6 @@ def status_api():
|
||||
return jsonify(status)
|
||||
|
||||
|
||||
@routes.app_context_processor
|
||||
def inject_variables():
|
||||
return dict(name=settings.NAME,
|
||||
logo_url=settings.LOGO_URL,
|
||||
base_href=base_href())
|
||||
|
||||
|
||||
def init_app(app):
|
||||
from redash.handlers import embed, queries, static, authentication, admin
|
||||
app.register_blueprint(routes)
|
||||
|
@ -3,7 +3,7 @@ import logging
|
||||
|
||||
from flask import flash, redirect, render_template, request, url_for
|
||||
from flask_login import current_user, login_required, login_user, logout_user
|
||||
from redash import __version__, models, settings, limiter
|
||||
from redash import __version__, limiter, models, settings
|
||||
from redash.authentication import current_org, get_login_url
|
||||
from redash.authentication.account import (BadSignature, SignatureExpired,
|
||||
send_password_reset_email,
|
||||
@ -131,6 +131,15 @@ def logout(org_slug=None):
|
||||
return redirect(get_login_url(next=None))
|
||||
|
||||
|
||||
def base_href():
|
||||
if settings.MULTI_ORG:
|
||||
base_href = url_for('redash.index', _external=True, org_slug=current_org.slug)
|
||||
else:
|
||||
base_href = url_for('redash.index', _external=True)
|
||||
|
||||
return base_href
|
||||
|
||||
|
||||
@routes.route(org_scoped_rule('/api/session'), methods=['GET'])
|
||||
@login_required
|
||||
def session(org_slug=None):
|
||||
@ -160,6 +169,9 @@ def session(org_slug=None):
|
||||
client_config = {}
|
||||
|
||||
client_config.update(settings.COMMON_CLIENT_CONFIG)
|
||||
client_config.update({
|
||||
'basePath': base_href()
|
||||
})
|
||||
|
||||
return json_response({
|
||||
'user': user,
|
||||
|
@ -232,7 +232,7 @@ SCHEMA_RUN_TABLE_SIZE_CALCULATIONS = parse_boolean(os.environ.get("REDASH_SCHEMA
|
||||
# WARNING: With this option enabled, Redash reads query parameters from the request URL (risk of SQL injection!)
|
||||
ALLOW_PARAMETERS_IN_EMBEDS = parse_boolean(os.environ.get("REDASH_ALLOW_PARAMETERS_IN_EMBEDS", "false"))
|
||||
|
||||
### Common Client config
|
||||
# Common Client config
|
||||
COMMON_CLIENT_CONFIG = {
|
||||
'allowScriptsInUserInput': ALLOW_SCRIPTS_IN_USER_INPUT,
|
||||
'showPermissionsControl': FEATURE_SHOW_PERMISSIONS_CONTROL,
|
||||
|
Loading…
Reference in New Issue
Block a user