diff --git a/cli/app/commands/install/run.py b/cli/app/commands/install/run.py index c70eabeba..14dcef642 100644 --- a/cli/app/commands/install/run.py +++ b/cli/app/commands/install/run.py @@ -1,3 +1,4 @@ +import ipaddress import json import os import re @@ -439,6 +440,14 @@ def _show_success_message(self): self.logger.info("If you have any questions, please visit the community forum at https://discord.gg/skdcq39Wpv") self.logger.highlight("See you in the community!") + def _get_supertokens_connection_uri(self, protocol: str, api_host: str, supertokens_api_port: int): + protocol = protocol.replace("https", "http") + try: + ipaddress.ip_address(api_host) + return f"{protocol}://{api_host}" + except ValueError: + return f"{protocol}://{api_host}:{supertokens_api_port}" + def _update_environment_variables(self, env_values: dict) -> dict: updated_env = env_values.copy() host_ip = HostInformation.get_public_ip() @@ -461,7 +470,8 @@ def _update_environment_variables(self, env_values: dict) -> dict: "SUPERTOKENS_API_KEY": "NixopusSuperTokensAPIKey", "SUPERTOKENS_API_DOMAIN": f"{protocol}://{api_host}/api", "SUPERTOKENS_WEBSITE_DOMAIN": f"{protocol}://{view_host}", - "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{supertokens_api_port}".replace("https", "http"), + # TODO: temp fix, remove this once we have a secure connection + "SUPERTOKENS_CONNECTION_URI": self._get_supertokens_connection_uri(protocol, api_host, supertokens_api_port), } for key, value in key_map.items(): diff --git a/cli/pyproject.toml b/cli/pyproject.toml index 83df5556c..f30046450 100644 --- a/cli/pyproject.toml +++ b/cli/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nixopus" -version = "0.1.9" +version = "0.1.10" description = "A CLI for Nixopus" authors = ["Nixopus "] readme = "README.md" diff --git a/view/app/config/appInfo.ts b/view/app/config/appInfo.ts index 9df1b397f..afae35a05 100644 --- a/view/app/config/appInfo.ts +++ b/view/app/config/appInfo.ts @@ -2,8 +2,8 @@ import { getBaseUrl } from '@/redux/conf'; export const getAppInfo = async () => { const baseUrl = await getBaseUrl(); - const apiDomain = baseUrl.replace('/api', ''); - + const apiDomain = baseUrl.replace('://', 'TEMP').replace('/api', '').replace('TEMP', '://'); + return { // learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo appName: 'Nixopus',