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