mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-18 15:47:23 +00:00
style: format collaboration changes
This commit is contained in:
@@ -199,8 +199,7 @@ class SpaceLaunchService:
|
|||||||
if not public_key_value or not key_id:
|
if not public_key_value or not key_id:
|
||||||
raise SpaceLaunchError('Space launch control-plane trust is not configured')
|
raise SpaceLaunchError('Space launch control-plane trust is not configured')
|
||||||
clock_skew = self._bounded_float(
|
clock_skew = self._bounded_float(
|
||||||
os.environ.get('LANGBOT_SPACE_CONTROL_PLANE_CLOCK_SKEW_SECONDS')
|
os.environ.get('LANGBOT_SPACE_CONTROL_PLANE_CLOCK_SKEW_SECONDS') or launch_config.get('clock_skew_seconds'),
|
||||||
or launch_config.get('clock_skew_seconds'),
|
|
||||||
default=30.0,
|
default=30.0,
|
||||||
minimum=0.0,
|
minimum=0.0,
|
||||||
maximum=300.0,
|
maximum=300.0,
|
||||||
@@ -211,9 +210,7 @@ class SpaceLaunchService:
|
|||||||
digest = hashlib.sha256(jti.encode('utf-8')).hexdigest()
|
digest = hashlib.sha256(jti.encode('utf-8')).hexdigest()
|
||||||
now = int(self._wall_time())
|
now = int(self._wall_time())
|
||||||
async with self._replay_lock:
|
async with self._replay_lock:
|
||||||
self._consumed_jtis = {
|
self._consumed_jtis = {existing: expiry for existing, expiry in self._consumed_jtis.items() if expiry > now}
|
||||||
existing: expiry for existing, expiry in self._consumed_jtis.items() if expiry > now
|
|
||||||
}
|
|
||||||
if digest in self._consumed_jtis:
|
if digest in self._consumed_jtis:
|
||||||
raise SpaceLaunchError('Launch assertion has already been consumed')
|
raise SpaceLaunchError('Launch assertion has already been consumed')
|
||||||
if len(self._consumed_jtis) >= 4096:
|
if len(self._consumed_jtis) >= 4096:
|
||||||
|
|||||||
@@ -1499,9 +1499,7 @@ class PersistenceManager:
|
|||||||
local_workspace_expression = (
|
local_workspace_expression = (
|
||||||
f"(((uuid)::text = {setting(TENANT_SETTING)}) AND ((source)::text = 'local'::text))"
|
f"(((uuid)::text = {setting(TENANT_SETTING)}) AND ((source)::text = 'local'::text))"
|
||||||
)
|
)
|
||||||
local_membership_expression = (
|
local_membership_expression = f'((workspace_uuid)::text = {setting(TENANT_SETTING)})'
|
||||||
f'((workspace_uuid)::text = {setting(TENANT_SETTING)})'
|
|
||||||
)
|
|
||||||
local_execution_expression = (
|
local_execution_expression = (
|
||||||
f'(((workspace_uuid)::text = {setting(TENANT_SETTING)}) AND (EXISTS ( SELECT 1\n'
|
f'(((workspace_uuid)::text = {setting(TENANT_SETTING)}) AND (EXISTS ( SELECT 1\n'
|
||||||
' FROM workspaces local_workspace\n'
|
' FROM workspaces local_workspace\n'
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ class InvitationDeliveryService:
|
|||||||
json=payload,
|
json=payload,
|
||||||
)
|
)
|
||||||
if response.status_code >= 400:
|
if response.status_code >= 400:
|
||||||
self._log_delivery_failure(config.provider or 'resend', RuntimeError(f'Resend returned {response.status_code}'))
|
self._log_delivery_failure(
|
||||||
|
config.provider or 'resend', RuntimeError(f'Resend returned {response.status_code}')
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -140,11 +142,7 @@ class InvitationDeliveryService:
|
|||||||
|
|
||||||
def _email_config(self) -> _EmailConfig:
|
def _email_config(self) -> _EmailConfig:
|
||||||
data = getattr(getattr(self.ap, 'instance_config', None), 'data', {}) or {}
|
data = getattr(getattr(self.ap, 'instance_config', None), 'data', {}) or {}
|
||||||
email = (
|
email = data.get('workspace', {}).get('invitations', {}).get('email', {})
|
||||||
data.get('workspace', {})
|
|
||||||
.get('invitations', {})
|
|
||||||
.get('email', {})
|
|
||||||
)
|
|
||||||
if not isinstance(email, dict):
|
if not isinstance(email, dict):
|
||||||
email = {}
|
email = {}
|
||||||
raw_provider = self._env('WORKSPACE__INVITATIONS__EMAIL__PROVIDER', email.get('provider', ''))
|
raw_provider = self._env('WORKSPACE__INVITATIONS__EMAIL__PROVIDER', email.get('provider', ''))
|
||||||
@@ -189,9 +187,7 @@ class InvitationDeliveryService:
|
|||||||
smtp_starttls = self._bool(
|
smtp_starttls = self._bool(
|
||||||
self._env('WORKSPACE__INVITATIONS__EMAIL__SMTP__STARTTLS', smtp_config.get('starttls', True))
|
self._env('WORKSPACE__INVITATIONS__EMAIL__SMTP__STARTTLS', smtp_config.get('starttls', True))
|
||||||
)
|
)
|
||||||
smtp_ssl = self._bool(
|
smtp_ssl = self._bool(self._env('WORKSPACE__INVITATIONS__EMAIL__SMTP__SSL', smtp_config.get('ssl', False)))
|
||||||
self._env('WORKSPACE__INVITATIONS__EMAIL__SMTP__SSL', smtp_config.get('ssl', False))
|
|
||||||
)
|
|
||||||
|
|
||||||
if provider == 'resend' and not (sender and resend_api_key and resend_api_url):
|
if provider == 'resend' and not (sender and resend_api_key and resend_api_url):
|
||||||
provider = None
|
provider = None
|
||||||
@@ -244,14 +240,9 @@ class InvitationDeliveryService:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _html(workspace_name: str, invitation_link: str) -> str:
|
def _html(workspace_name: str, invitation_link: str) -> str:
|
||||||
escaped_workspace = (
|
escaped_workspace = workspace_name.replace('&', '&').replace('<', '<').replace('>', '>')
|
||||||
workspace_name.replace('&', '&').replace('<', '<').replace('>', '>')
|
|
||||||
)
|
|
||||||
escaped_link = (
|
escaped_link = (
|
||||||
invitation_link.replace('&', '&')
|
invitation_link.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"')
|
||||||
.replace('<', '<')
|
|
||||||
.replace('>', '>')
|
|
||||||
.replace('"', '"')
|
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
'<p>You were invited to join '
|
'<p>You were invited to join '
|
||||||
|
|||||||
@@ -221,7 +221,12 @@ function SpaceOAuthCallbackContent() {
|
|||||||
setErrorMessage(t('common.spaceLoginFailed'));
|
setErrorMessage(t('common.spaceLoginFailed'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handleOAuthCallback(authCode ?? '', state ?? '', workspaceUuid, launchAssertion);
|
handleOAuthCallback(
|
||||||
|
authCode ?? '',
|
||||||
|
state ?? '',
|
||||||
|
workspaceUuid,
|
||||||
|
launchAssertion,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
if (!authCode) {
|
if (!authCode) {
|
||||||
setStatus('error');
|
setStatus('error');
|
||||||
|
|||||||
Reference in New Issue
Block a user