Skip to content

feat: Cdi check #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions supertokens_python/recipe/dashboard/api/implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from supertokens_python import Supertokens
from supertokens_python.normalised_url_domain import NormalisedURLDomain
from supertokens_python.normalised_url_path import NormalisedURLPath
from supertokens_python.querier import Querier
from supertokens_python.utils import is_version_gte

from ..constants import DASHBOARD_API
from ..interfaces import APIInterface
Expand Down Expand Up @@ -54,6 +56,14 @@ async def dashboard_get(
NormalisedURLPath(DASHBOARD_API)
).get_as_string_dangerous()

is_search_enabled: bool = False
querier = Querier.get_instance(options.recipe_id)
cdiVersion = await querier.get_api_version()
if not cdiVersion:
return ""
if is_version_gte(cdiVersion, "2.20"):
is_search_enabled = True

return Template(
dedent(
"""
Expand All @@ -65,6 +75,7 @@ async def dashboard_get(
window.dashboardAppPath = "${dashboardPath}"
window.connectionURI = "${connectionURI}"
window.authMode = "${authMode}"
window.isSearchEnabled = "${isSearchEnabled}"
</script>
<script defer src="${bundleDomain}/static/js/bundle.js"></script></head>
<link href="${bundleDomain}/static/css/main.css" rel="stylesheet" type="text/css">
Expand All @@ -82,6 +93,7 @@ async def dashboard_get(
dashboardPath=dashboard_path,
connectionURI=connection_uri,
authMode=auth_mode,
isSearchEnabled=is_search_enabled,
)

self.dashboard_get = dashboard_get