mirror of
https://github.com/docmost/docmost.git
synced 2026-08-29 18:14:58 +08:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17ee613b8b |
@@ -51,17 +51,6 @@ DRAWIO_URL=
|
||||
# Gotenberg URL for server-side PDF export
|
||||
GOTENBERG_URL=
|
||||
|
||||
# Integration OAuth apps (create one per provider you enable)
|
||||
INTEGRATION_GITHUB_CLIENT_ID=
|
||||
INTEGRATION_GITHUB_CLIENT_SECRET=
|
||||
# Set only for GitHub Enterprise Server, e.g https://github.example.com
|
||||
INTEGRATION_GITHUB_BASE_URL=
|
||||
|
||||
INTEGRATION_GITLAB_CLIENT_ID=
|
||||
INTEGRATION_GITLAB_CLIENT_SECRET=
|
||||
# Set only for self-hosted GitLab, e.g https://gitlab.example.com
|
||||
INTEGRATION_GITLAB_BASE_URL=
|
||||
|
||||
DISABLE_TELEMETRY=false
|
||||
|
||||
# Allow other sites to embed Docmost in an iframe.
|
||||
|
||||
@@ -294,7 +294,6 @@
|
||||
"Export space": "Bereich exportieren",
|
||||
"Export {{type}}": "Exportiere {{type}}",
|
||||
"File exceeds the {{limit}} attachment limit": "Datei überschreitet das Anhängelimit von {{limit}}",
|
||||
"Media": "Medien",
|
||||
"Align left": "Links ausrichten",
|
||||
"Align right": "Rechts ausrichten",
|
||||
"Align center": "Zentrieren",
|
||||
@@ -388,8 +387,6 @@
|
||||
"Insert horizontal rule divider": "Horizontale Trennlinie einfügen",
|
||||
"Page break": "Seitenumbruch",
|
||||
"Insert a page break for printing.": "Einen Seitenumbruch zum Drucken einfügen.",
|
||||
"Footnote": "Fußnote",
|
||||
"Insert a footnote reference.": "Einen Fußnotenverweis einfügen.",
|
||||
"Upload any image from your device.": "Laden Sie ein beliebiges Bild von Ihrem Gerät hoch.",
|
||||
"Upload any video from your device.": "Laden Sie ein beliebiges Video von Ihrem Gerät hoch.",
|
||||
"Upload any audio from your device.": "Laden Sie beliebige Audiodateien von Ihrem Gerät hoch.",
|
||||
@@ -707,11 +704,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "Aktivieren Sie den MCP-Server, damit KI-Assistenten und -Tools mit den Inhalten Ihres Arbeitsbereichs interagieren können.",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP ist nur in der Docmost Enterprise-Edition verfügbar. Kontaktieren Sie sales@docmost.com.",
|
||||
"MCP Server URL": "MCP-Server-URL",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "Verbinde AI-Assistenten über OAuth mit deinem Docmost-Konto.",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "AI-Assistenten müssen sich über OAuth mit einem Docmost-Konto verbinden. API-Schlüssel können nicht mit dem MCP-Server verwendet werden.",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "Verwenden Sie Ihren API-Schlüssel zur Authentifizierung. API-Schlüssel können in Ihren Kontoeinstellungen verwaltet werden.",
|
||||
"Supported tools": "Unterstützte Tools",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "In Ihrem Arbeitsbereich ist MCP aktiviert. Verwenden Sie Ihren API-Schlüssel, um KI-Assistenten anzubinden.",
|
||||
"MCP server URL:": "MCP-Server-URL:",
|
||||
"Learn more": "Mehr erfahren",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "Verwalten Sie API-Schlüssel für alle Nutzer im Arbeitsbereich. Siehe die <anchor>API-Dokumentation</anchor> für Details zur Verwendung.",
|
||||
@@ -1294,48 +1289,5 @@
|
||||
"{{count}} rows deleted_one": "1 row deleted",
|
||||
"{{count}} rows deleted_other": "{{count}} rows deleted",
|
||||
"{{count}} selected_one": "1 selected",
|
||||
"{{count}} selected_other": "{{count}} selected",
|
||||
"Compare": "Vergleichen",
|
||||
"Compare versions": "Versionen vergleichen",
|
||||
"Select version from {{date}}": "Version vom {{date}} auswählen",
|
||||
"Version actions for {{date}}": "Versionsaktionen für {{date}}",
|
||||
"Comparing {{newer}} and {{older}}": "{{newer}} und {{older}} werden verglichen",
|
||||
"Exit compare": "Vergleich beenden",
|
||||
"Search attachments...": "Anhänge suchen...",
|
||||
"Error loading attachments.": "Fehler beim Laden der Anhänge.",
|
||||
"No attachments on this page yet.": "Auf dieser Seite gibt es noch keine Anhänge.",
|
||||
"Uploaded by {{name}}": "Hochgeladen von {{name}}",
|
||||
"Download {{name}}": "{{name}} herunterladen",
|
||||
"Access revoked": "Zugriff widerrufen",
|
||||
"Authorize application": "Anwendung autorisieren",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}} möchte auf {{workspace}} zugreifen",
|
||||
"Not you? Switch account": "Nicht du? Konto wechseln",
|
||||
"This application will be able to:": "Diese Anwendung kann Folgendes:",
|
||||
"Write": "Schreiben",
|
||||
"Invalid authorization request": "Ungültige Autorisierungsanfrage",
|
||||
"Authorize": "Autorisieren",
|
||||
"Application": "Anwendung",
|
||||
"Permissions": "Berechtigungen",
|
||||
"Authorized": "Autorisiert",
|
||||
"Revoke access": "Zugriff widerrufen",
|
||||
"Revoke access for {{name}}": "Zugriff für {{name}} widerrufen",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "Möchtest du den Zugriff für {{name}} wirklich widerrufen? Die Anwendung kann dann nicht mehr auf dein Konto zugreifen.",
|
||||
"Something went wrong. Please try again.": "Etwas ist schiefgelaufen. Bitte versuche es erneut.",
|
||||
"Remove {{name}}": "{{name}} entfernen",
|
||||
"Make sure you trust this application before authorizing it.": "Stelle sicher, dass du dieser Anwendung vertraust, bevor du sie autorisierst.",
|
||||
"You will be redirected to": "Du wirst weitergeleitet zu",
|
||||
"View content without making changes.": "Inhalte ansehen, ohne Änderungen vorzunehmen.",
|
||||
"Create and modify content.": "Inhalte erstellen und bearbeiten.",
|
||||
"Applications and AI assistants you have authorized to access your account.": "Anwendungen und AI-Assistenten, denen du den Zugriff auf dein Konto autorisiert hast.",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "MCP ist für deinen Workspace aktiviert. Verbinde AI-Assistenten über OAuth mit deinem Docmost-Konto.",
|
||||
"Authorized apps": "Autorisierte Apps",
|
||||
"No authorized apps yet.": "Noch keine autorisierten Apps.",
|
||||
"Workspace knowledge only": "Nur Workspace-Wissen",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "Beschränke den AI-Chat darauf, nur anhand deiner Workspace-Seiten und hochgeladenen Dateien zu antworten. Es wird kein externes Wissen verwendet.",
|
||||
"Toggle workspace knowledge only": "Nur Workspace-Wissen umschalten",
|
||||
"Read-only mode": "Schreibgeschützter Modus",
|
||||
"AI Chat can search and read workspace content, but cannot create or edit pages.": "AI-Chat kann Workspace-Inhalte durchsuchen und lesen, aber keine Seiten erstellen oder bearbeiten.",
|
||||
"Toggle AI Chat read-only mode": "Schreibgeschützten Modus für AI-Chat umschalten",
|
||||
"Title only": "Nur Titel",
|
||||
"you": "du"
|
||||
"{{count}} selected_other": "{{count}} selected"
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.": "Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.",
|
||||
"Are you sure you want to remove this user from the space? The user will lose all access to this space.": "Are you sure you want to remove this user from the space? The user will lose all access to this space.",
|
||||
"Are you sure you want to restore this version? Any changes not versioned will be lost.": "Are you sure you want to restore this version? Any changes not versioned will be lost.",
|
||||
"Assigned to {{name}}": "Assigned to {{name}}",
|
||||
"Can become members of groups and spaces in workspace": "Can become members of groups and spaces in workspace",
|
||||
"Can create and edit pages in space.": "Can create and edit pages in space.",
|
||||
"Can edit": "Can edit",
|
||||
@@ -23,7 +22,6 @@
|
||||
"Can view": "Can view",
|
||||
"Can view pages in space but not edit.": "Can view pages in space but not edit.",
|
||||
"Cancel": "Cancel",
|
||||
"Card": "Card",
|
||||
"Change email": "Change email",
|
||||
"Change password": "Change password",
|
||||
"Change photo": "Change photo",
|
||||
@@ -32,8 +30,6 @@
|
||||
"Choose your preferred interface language.": "Choose your preferred interface language.",
|
||||
"Choose your preferred page width.": "Choose your preferred page width.",
|
||||
"Confirm": "Confirm",
|
||||
"Connect to {{name}} to preview": "Connect to {{name}} to preview",
|
||||
"Connected as {{label}}": "Connected as {{label}}",
|
||||
"Copy as Markdown": "Copy as Markdown",
|
||||
"Copy link": "Copy link",
|
||||
"Create": "Create",
|
||||
@@ -45,40 +41,30 @@
|
||||
"Dark": "Dark",
|
||||
"Date": "Date",
|
||||
"Delete": "Delete",
|
||||
"Initiative": "Initiative",
|
||||
"Last modified by {{name}}": "Last modified by {{name}}",
|
||||
"Open in Slack": "Open in Slack",
|
||||
"Paid": "Paid",
|
||||
"Paste as": "Paste as",
|
||||
"Project": "Project",
|
||||
"Uninstall {{name}}": "Uninstall {{name}}",
|
||||
"Disconnect {{name}}": "Disconnect {{name}}",
|
||||
"This disconnects your {{name}} account. Links are not enriched for you until you reconnect.": "This disconnects your {{name}} account. Links are not enriched for you until you reconnect.",
|
||||
"This disables the {{name}} integration for the entire workspace. Members' connections are removed and links are not enriched.": "This disables the {{name}} integration for the entire workspace. Members' connections are removed and links are not enriched.",
|
||||
"Remove from page": "Remove from page",
|
||||
"Base options": "Base options",
|
||||
"Delete group": "Delete group",
|
||||
"Are you sure you want to delete this page? This will delete its children and page history. This action is irreversible.": "Are you sure you want to delete this page? This will delete its children and page history. This action is irreversible.",
|
||||
"Description": "Description",
|
||||
"Details": "Details",
|
||||
"e.g ACME": "e.g. ACME",
|
||||
"e.g ACME Inc": "e.g. ACME Inc",
|
||||
"e.g Developers": "e.g. Developers",
|
||||
"e.g Group for developers": "e.g. Group for developers",
|
||||
"e.g product": "e.g. product",
|
||||
"e.g Product Team": "e.g. Product Team",
|
||||
"e.g Sales": "e.g. Sales",
|
||||
"e.g Space for product team": "e.g. Space for product team",
|
||||
"e.g Space for sales team to collaborate": "e.g. Space for sales team to collaborate",
|
||||
"e.g ACME": "e.g ACME",
|
||||
"e.g ACME Inc": "e.g ACME Inc",
|
||||
"e.g Developers": "e.g Developers",
|
||||
"e.g Group for developers": "e.g Group for developers",
|
||||
"e.g product": "e.g product",
|
||||
"e.g Product Team": "e.g Product Team",
|
||||
"e.g Sales": "e.g Sales",
|
||||
"e.g Space for product team": "e.g Space for product team",
|
||||
"e.g Space for sales team to collaborate": "e.g Space for sales team to collaborate",
|
||||
"Edit": "Edit",
|
||||
"Read": "Read",
|
||||
"Edit group": "Edit group",
|
||||
"Email": "Email",
|
||||
"Enter a strong password": "Enter a strong password",
|
||||
"Enter valid email addresses separated by comma or space max_50": "Enter valid email addresses separated by comma or space [max: 50]",
|
||||
"enter valid emails addresses": "Enter valid email addresses",
|
||||
"enter valid emails addresses": "enter valid emails addresses",
|
||||
"Enter your current password": "Enter your current password",
|
||||
"enter your full name": "Enter your full name",
|
||||
"enter your full name": "enter your full name",
|
||||
"Enter your new password": "Enter your new password",
|
||||
"Enter your new preferred email": "Enter your new preferred email",
|
||||
"Enter your password": "Enter your password",
|
||||
@@ -126,7 +112,7 @@
|
||||
"Import pages": "Import pages",
|
||||
"Import pages & space settings": "Import pages & space settings",
|
||||
"Importing pages": "Importing pages",
|
||||
"invalid invitation link": "Invalid invitation link",
|
||||
"invalid invitation link": "invalid invitation link",
|
||||
"Invitation signup": "Invitation signup",
|
||||
"Invite by email": "Invite by email",
|
||||
"Invite members": "Invite members",
|
||||
@@ -164,8 +150,6 @@
|
||||
"page": "page",
|
||||
"Page deleted successfully": "Page deleted successfully",
|
||||
"Page history": "Page history",
|
||||
"replies": "replies",
|
||||
"reply": "reply",
|
||||
"Select version": "Select version",
|
||||
"Highlight changes": "Highlight changes",
|
||||
"Page import is in progress. Please do not close this tab.": "Page import is in progress. Please do not close this tab.",
|
||||
@@ -200,8 +184,6 @@
|
||||
"Invitation sent": "Invitation sent",
|
||||
"Settings": "Settings",
|
||||
"Setup workspace": "Setup workspace",
|
||||
"show less": "show less",
|
||||
"show more": "show more",
|
||||
"Sign In": "Sign In",
|
||||
"Sign Up": "Sign Up",
|
||||
"Slug": "Slug",
|
||||
@@ -224,9 +206,7 @@
|
||||
"Theme": "Theme",
|
||||
"To change your email, you have to enter your password and new email.": "To change your email, you have to enter your password and new email.",
|
||||
"Toggle full page width": "Toggle full page width",
|
||||
"Toggle {{name}} integration": "Toggle {{name}} integration",
|
||||
"Unable to import pages. Please try again.": "Unable to import pages. Please try again.",
|
||||
"Unassigned": "Unassigned",
|
||||
"untitled": "untitled",
|
||||
"Untitled": "Untitled",
|
||||
"Updated successfully": "Updated successfully",
|
||||
@@ -243,7 +223,7 @@
|
||||
"Your password must be a minimum of 8 characters.": "Your password must be a minimum of 8 characters.",
|
||||
"Sidebar toggle": "Sidebar toggle",
|
||||
"Comments": "Comments",
|
||||
"404 page not found": "404! Page not found",
|
||||
"404 page not found": "404 page not found",
|
||||
"Sorry, we can't find the page you are looking for.": "Sorry, we can't find the page you are looking for.",
|
||||
"Take me back to homepage": "Take me back to homepage",
|
||||
"Forgot password": "Forgot password",
|
||||
@@ -443,7 +423,7 @@
|
||||
"Insert current date": "Insert current date",
|
||||
"Time": "Time",
|
||||
"Insert current time": "Insert current time",
|
||||
"Draw and sketch excalidraw diagrams": "Draw and sketch Excalidraw diagrams",
|
||||
"Draw and sketch excalidraw diagrams": "Draw and sketch excalidraw diagrams",
|
||||
"Multiple": "Multiple",
|
||||
"Turn into": "Turn into",
|
||||
"Text align": "Text align",
|
||||
@@ -584,7 +564,7 @@
|
||||
"Make sure to save these codes in a secure place. Your old backup codes are no longer valid.": "Make sure to save these codes in a secure place. Your old backup codes are no longer valid.",
|
||||
"Your new backup codes": "Your new backup codes",
|
||||
"I've saved my backup codes": "I've saved my backup codes",
|
||||
"Failed to setup MFA": "Failed to set up MFA",
|
||||
"Failed to setup MFA": "Failed to setup MFA",
|
||||
"Setup & Verify": "Setup & Verify",
|
||||
"Add to authenticator": "Add to authenticator",
|
||||
"1. Scan this QR code with your authenticator app": "1. Scan this QR code with your authenticator app",
|
||||
@@ -658,7 +638,7 @@
|
||||
"Enterprise": "Enterprise",
|
||||
"Download attachment": "Download attachment",
|
||||
"Allowed email domains": "Allowed email domains",
|
||||
"Only users with email addresses from these domains can signup via SSO.": "Only users with email addresses from these domains can sign up via SSO.",
|
||||
"Only users with email addresses from these domains can signup via SSO.": "Only users with email addresses from these domains can signup via SSO.",
|
||||
"Enter valid domain names separated by comma or space": "Enter valid domain names separated by comma or space",
|
||||
"Enforce two-factor authentication": "Enforce two-factor authentication",
|
||||
"Once enforced, all members must enable two-factor authentication to access the workspace.": "Once enforced, all members must enable two-factor authentication to access the workspace.",
|
||||
@@ -727,11 +707,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "Enable the MCP server to allow AI assistants and tools to interact with your workspace content.",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.",
|
||||
"MCP Server URL": "MCP Server URL",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "Connect AI assistants with your Docmost account via OAuth.",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "Use your API key for authentication. You can manage API keys in your account settings.",
|
||||
"Supported tools": "Supported tools",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "Your workspace has MCP enabled. Use your API key to connect AI assistants.",
|
||||
"MCP server URL:": "MCP server URL:",
|
||||
"Learn more": "Learn more",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.",
|
||||
@@ -849,7 +827,7 @@
|
||||
"Choose how this page should stay accurate.": "Choose how this page should stay accurate.",
|
||||
"Recurring verification": "Recurring verification",
|
||||
"Verifiers re-confirm this page on a schedule.": "Verifiers re-confirm this page on a schedule.",
|
||||
"Re-verify on a schedule (e.g every 30 days )": "Re-verify on a schedule (e.g. every 30 days)",
|
||||
"Re-verify on a schedule (e.g every 30 days )": "Re-verify on a schedule (e.g every 30 days )",
|
||||
"Page stays editable at all times": "Page stays editable at all times",
|
||||
"Best for runbooks, FAQs, living documentation": "Best for runbooks, FAQs, living documentation",
|
||||
"Approval workflow": "Approval workflow",
|
||||
@@ -925,7 +903,7 @@
|
||||
"Publish": "Publish",
|
||||
"Security": "Security",
|
||||
"Enforce SSO": "Enforce SSO",
|
||||
"Once enforced, members will not be able to login with email and password.": "Once enforced, members will not be able to log in with email and password.",
|
||||
"Once enforced, members will not be able to login with email and password.": "Once enforced, members will not be able to login with email and password.",
|
||||
"AI-generated content may not be accurate.": "AI-generated content may not be accurate.",
|
||||
"AI Chat": "AI Chat",
|
||||
"Analyze for insights": "Analyze for insights",
|
||||
@@ -1271,7 +1249,7 @@
|
||||
"Not started": "Not started",
|
||||
"Number": "Number",
|
||||
"One month ago": "One month ago",
|
||||
"One month from now": "In one month",
|
||||
"One month from now": "One month from now",
|
||||
"One week ago": "One week ago",
|
||||
"One week from now": "One week from now",
|
||||
"Open as page": "Open as page",
|
||||
@@ -1326,30 +1304,6 @@
|
||||
"No attachments on this page yet.": "No attachments on this page yet.",
|
||||
"Uploaded by {{name}}": "Uploaded by {{name}}",
|
||||
"Download {{name}}": "Download {{name}}",
|
||||
"Access revoked": "Access revoked",
|
||||
"Authorize application": "Authorize application",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}} wants to access {{workspace}}",
|
||||
"Not you? Switch account": "Not you? Switch account",
|
||||
"This application will be able to:": "This application will be able to:",
|
||||
"Write": "Write",
|
||||
"Invalid authorization request": "Invalid authorization request",
|
||||
"Authorize": "Authorize",
|
||||
"Application": "Application",
|
||||
"Permissions": "Permissions",
|
||||
"Authorized": "Authorized",
|
||||
"Revoke access": "Revoke access",
|
||||
"Revoke access for {{name}}": "Revoke access for {{name}}",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.",
|
||||
"Something went wrong. Please try again.": "Something went wrong. Please try again.",
|
||||
"Remove {{name}}": "Remove {{name}}",
|
||||
"Make sure you trust this application before authorizing it.": "Make sure you trust this application before authorizing it.",
|
||||
"You will be redirected to": "You will be redirected to",
|
||||
"View content without making changes.": "View content without making changes.",
|
||||
"Create and modify content.": "Create and modify content.",
|
||||
"Applications and AI assistants you have authorized to access your account.": "Applications and AI assistants you have authorized to access your account.",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.",
|
||||
"Authorized apps": "Authorized apps",
|
||||
"No authorized apps yet.": "No authorized apps yet.",
|
||||
"Workspace knowledge only": "Workspace knowledge only",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.",
|
||||
"Toggle workspace knowledge only": "Toggle workspace knowledge only",
|
||||
|
||||
@@ -294,7 +294,6 @@
|
||||
"Export space": "Exportar espacio",
|
||||
"Export {{type}}": "Exportar {{type}}",
|
||||
"File exceeds the {{limit}} attachment limit": "El archivo supera el límite de {{limit}} adjuntos",
|
||||
"Media": "Multimedia",
|
||||
"Align left": "Alinear a la izquierda",
|
||||
"Align right": "Alinear a la derecha",
|
||||
"Align center": "Alinear al centro",
|
||||
@@ -388,8 +387,6 @@
|
||||
"Insert horizontal rule divider": "Insertar regla horizontal",
|
||||
"Page break": "Salto de página",
|
||||
"Insert a page break for printing.": "Inserta un salto de página para imprimir.",
|
||||
"Footnote": "Nota al pie",
|
||||
"Insert a footnote reference.": "Insertar una referencia de nota al pie.",
|
||||
"Upload any image from your device.": "Sube cualquier imagen desde tu dispositivo.",
|
||||
"Upload any video from your device.": "Sube cualquier video desde tu dispositivo.",
|
||||
"Upload any audio from your device.": "Sube cualquier audio desde tu dispositivo.",
|
||||
@@ -707,11 +704,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "Habilite el servidor MCP para permitir que asistentes de IA y herramientas interactúen con el contenido de su espacio de trabajo.",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP solo está disponible en la edición empresarial de Docmost. Contacte con sales@docmost.com.",
|
||||
"MCP Server URL": "URL del servidor MCP",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "Conecta asistentes de IA con tu cuenta de Docmost mediante OAuth.",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "Los asistentes de IA deben conectarse con una cuenta de Docmost mediante OAuth. No se pueden usar claves API con el servidor MCP.",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "Use su clave API para la autenticación. Puede gestionar las claves API en la configuración de su cuenta.",
|
||||
"Supported tools": "Herramientas compatibles",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "Su espacio de trabajo tiene MCP habilitado. Use su clave API para conectar asistentes de IA.",
|
||||
"MCP server URL:": "URL del servidor MCP:",
|
||||
"Learn more": "Más información",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "Gestiona las claves de API para todos los usuarios en el espacio de trabajo. Consulta la <anchor>documentación de la API</anchor> para detalles de uso.",
|
||||
@@ -1191,8 +1186,8 @@
|
||||
"Default value": "Valor predeterminado",
|
||||
"Delete property": "Eliminar propiedad",
|
||||
"Delete view": "Eliminar vista",
|
||||
"Delete {{count}} rows?_one": "¿Eliminar 1 fila?",
|
||||
"Delete {{count}} rows?_other": "¿Eliminar {{count}} filas?",
|
||||
"Delete {{count}} rows?_one": "Delete 1 row?",
|
||||
"Delete {{count}} rows?_other": "Delete {{count}} rows?",
|
||||
"Descending": "Descendente",
|
||||
"Discard": "Descartar",
|
||||
"Doesn't contain": "No contiene",
|
||||
@@ -1291,51 +1286,8 @@
|
||||
"Value": "Valor",
|
||||
"View updated for everyone": "Vista actualizada para todos",
|
||||
"You have unsaved changes. Do you want to discard them?": "Tiene cambios no guardados. ¿Quiere descartarlos?",
|
||||
"{{count}} rows deleted_one": "1 fila eliminada",
|
||||
"{{count}} rows deleted_other": "{{count}} filas eliminadas",
|
||||
"{{count}} selected_one": "1 seleccionado",
|
||||
"{{count}} selected_other": "{{count}} seleccionadas",
|
||||
"Compare": "Comparar",
|
||||
"Compare versions": "Comparar versiones",
|
||||
"Select version from {{date}}": "Seleccionar la versión del {{date}}",
|
||||
"Version actions for {{date}}": "Acciones de la versión del {{date}}",
|
||||
"Comparing {{newer}} and {{older}}": "Comparando {{newer}} y {{older}}",
|
||||
"Exit compare": "Salir de la comparación",
|
||||
"Search attachments...": "Buscar archivos adjuntos...",
|
||||
"Error loading attachments.": "Error al cargar los archivos adjuntos.",
|
||||
"No attachments on this page yet.": "Todavía no hay archivos adjuntos en esta página.",
|
||||
"Uploaded by {{name}}": "Subido por {{name}}",
|
||||
"Download {{name}}": "Descargar {{name}}",
|
||||
"Access revoked": "Acceso revocado",
|
||||
"Authorize application": "Autorizar aplicación",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}} quiere acceder a {{workspace}}",
|
||||
"Not you? Switch account": "¿No eres tú? Cambiar de cuenta",
|
||||
"This application will be able to:": "Esta aplicación podrá:",
|
||||
"Write": "Escribir",
|
||||
"Invalid authorization request": "Solicitud de autorización no válida",
|
||||
"Authorize": "Autorizar",
|
||||
"Application": "Aplicación",
|
||||
"Permissions": "Permisos",
|
||||
"Authorized": "Autorizado",
|
||||
"Revoke access": "Revocar acceso",
|
||||
"Revoke access for {{name}}": "Revocar acceso para {{name}}",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "¿Seguro que quieres revocar el acceso de {{name}}? La aplicación ya no podrá acceder a tu cuenta.",
|
||||
"Something went wrong. Please try again.": "Algo salió mal. Inténtalo de nuevo.",
|
||||
"Remove {{name}}": "Eliminar {{name}}",
|
||||
"Make sure you trust this application before authorizing it.": "Asegúrate de confiar en esta aplicación antes de autorizarla.",
|
||||
"You will be redirected to": "Serás redirigido a",
|
||||
"View content without making changes.": "Ver contenido sin realizar cambios.",
|
||||
"Create and modify content.": "Crear y modificar contenido.",
|
||||
"Applications and AI assistants you have authorized to access your account.": "Aplicaciones y asistentes de IA que has autorizado para acceder a tu cuenta.",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "Tu espacio de trabajo tiene MCP habilitado. Conecta asistentes de IA con tu cuenta de Docmost mediante OAuth.",
|
||||
"Authorized apps": "Aplicaciones autorizadas",
|
||||
"No authorized apps yet.": "Todavía no hay aplicaciones autorizadas.",
|
||||
"Workspace knowledge only": "Solo conocimiento del espacio de trabajo",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "Restringe AI Chat para que responda solo con información de las páginas y archivos subidos de tu espacio de trabajo. No usará conocimiento externo.",
|
||||
"Toggle workspace knowledge only": "Alternar solo conocimiento del espacio de trabajo",
|
||||
"Read-only mode": "Modo de solo lectura",
|
||||
"AI Chat can search and read workspace content, but cannot create or edit pages.": "AI Chat puede buscar y leer el contenido del espacio de trabajo, pero no puede crear ni editar páginas.",
|
||||
"Toggle AI Chat read-only mode": "Alternar modo de solo lectura de AI Chat",
|
||||
"Title only": "Solo título",
|
||||
"you": "tú"
|
||||
"{{count}} rows deleted_one": "1 row deleted",
|
||||
"{{count}} rows deleted_other": "{{count}} rows deleted",
|
||||
"{{count}} selected_one": "1 selected",
|
||||
"{{count}} selected_other": "{{count}} selected"
|
||||
}
|
||||
|
||||
@@ -294,7 +294,6 @@
|
||||
"Export space": "Exporter l'espace",
|
||||
"Export {{type}}": "Exporter {{type}}",
|
||||
"File exceeds the {{limit}} attachment limit": "Le fichier dépasse la limite de {{limit}} pièces jointes",
|
||||
"Media": "Médias",
|
||||
"Align left": "Aligner à gauche",
|
||||
"Align right": "Aligner à droite",
|
||||
"Align center": "Aligner au centre",
|
||||
@@ -388,8 +387,6 @@
|
||||
"Insert horizontal rule divider": "Insérer un séparateur de règle horizontale",
|
||||
"Page break": "Saut de page",
|
||||
"Insert a page break for printing.": "Insérer un saut de page pour l’impression.",
|
||||
"Footnote": "Note de bas de page",
|
||||
"Insert a footnote reference.": "Insérer une référence de note de bas de page.",
|
||||
"Upload any image from your device.": "Téléchargez n'importe quelle image depuis votre appareil.",
|
||||
"Upload any video from your device.": "Téléchargez n'importe quelle vidéo depuis votre appareil.",
|
||||
"Upload any audio from your device.": "Téléchargez n'importe quel fichier audio depuis votre appareil.",
|
||||
@@ -707,11 +704,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "Activez le serveur MCP pour permettre aux assistants et outils IA d'interagir avec le contenu de votre espace de travail.",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP n'est disponible que dans l'édition Entreprise de Docmost. Contactez sales@docmost.com.",
|
||||
"MCP Server URL": "URL du serveur MCP",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "Connectez des assistants IA à votre compte Docmost via OAuth.",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "Les assistants IA doivent se connecter avec un compte Docmost via OAuth. Les clés API ne peuvent pas être utilisées avec le serveur MCP.",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "Utilisez votre clé API pour l'authentification. Vous pouvez gérer les clés API dans les paramètres de votre compte.",
|
||||
"Supported tools": "Outils pris en charge",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "Votre espace de travail a MCP activé. Utilisez votre clé API pour connecter des assistants IA.",
|
||||
"MCP server URL:": "URL du serveur MCP :",
|
||||
"Learn more": "En savoir plus",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "Gérez les clés API pour tous les utilisateurs de l'espace de travail. Consultez la <anchor>documentation API</anchor> pour plus de détails sur l'utilisation.",
|
||||
@@ -1191,8 +1186,8 @@
|
||||
"Default value": "Valeur par défaut",
|
||||
"Delete property": "Supprimer la propriété",
|
||||
"Delete view": "Supprimer la vue",
|
||||
"Delete {{count}} rows?_one": "Supprimer 1 ligne ?",
|
||||
"Delete {{count}} rows?_other": "Supprimer {{count}} lignes ?",
|
||||
"Delete {{count}} rows?_one": "Delete 1 row?",
|
||||
"Delete {{count}} rows?_other": "Delete {{count}} rows?",
|
||||
"Descending": "Décroissant",
|
||||
"Discard": "Ignorer",
|
||||
"Doesn't contain": "Ne contient pas",
|
||||
@@ -1291,51 +1286,8 @@
|
||||
"Value": "Valeur",
|
||||
"View updated for everyone": "Vue mise à jour pour tout le monde",
|
||||
"You have unsaved changes. Do you want to discard them?": "Vous avez des modifications non enregistrées. Voulez-vous les ignorer ?",
|
||||
"{{count}} rows deleted_one": "1 ligne supprimée",
|
||||
"{{count}} rows deleted_other": "{{count}} lignes supprimées",
|
||||
"{{count}} selected_one": "1 sélectionné(e)",
|
||||
"{{count}} selected_other": "{{count}} sélectionné(e)s",
|
||||
"Compare": "Comparer",
|
||||
"Compare versions": "Comparer les versions",
|
||||
"Select version from {{date}}": "Sélectionner la version du {{date}}",
|
||||
"Version actions for {{date}}": "Actions de version pour le {{date}}",
|
||||
"Comparing {{newer}} and {{older}}": "Comparaison de {{newer}} et {{older}}",
|
||||
"Exit compare": "Quitter la comparaison",
|
||||
"Search attachments...": "Rechercher des pièces jointes...",
|
||||
"Error loading attachments.": "Erreur lors du chargement des pièces jointes.",
|
||||
"No attachments on this page yet.": "Aucune pièce jointe sur cette page pour le moment.",
|
||||
"Uploaded by {{name}}": "Téléversé par {{name}}",
|
||||
"Download {{name}}": "Télécharger {{name}}",
|
||||
"Access revoked": "Accès révoqué",
|
||||
"Authorize application": "Autoriser l’application",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}} souhaite accéder à {{workspace}}",
|
||||
"Not you? Switch account": "Ce n’est pas vous ? Changer de compte",
|
||||
"This application will be able to:": "Cette application pourra :",
|
||||
"Write": "Écriture",
|
||||
"Invalid authorization request": "Demande d’autorisation invalide",
|
||||
"Authorize": "Autoriser",
|
||||
"Application": "Application",
|
||||
"Permissions": "Autorisations",
|
||||
"Authorized": "Autorisé",
|
||||
"Revoke access": "Révoquer l’accès",
|
||||
"Revoke access for {{name}}": "Révoquer l’accès pour {{name}}",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "Êtes-vous sûr de vouloir révoquer l’accès pour {{name}} ? L’application ne pourra plus accéder à votre compte.",
|
||||
"Something went wrong. Please try again.": "Une erreur s’est produite. Veuillez réessayer.",
|
||||
"Remove {{name}}": "Supprimer {{name}}",
|
||||
"Make sure you trust this application before authorizing it.": "Assurez-vous de faire confiance à cette application avant de l’autoriser.",
|
||||
"You will be redirected to": "Vous serez redirigé vers",
|
||||
"View content without making changes.": "Afficher le contenu sans apporter de modifications.",
|
||||
"Create and modify content.": "Créer et modifier du contenu.",
|
||||
"Applications and AI assistants you have authorized to access your account.": "Applications et assistants IA que vous avez autorisés à accéder à votre compte.",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "MCP est activé dans votre espace de travail. Connectez des assistants IA à votre compte Docmost via OAuth.",
|
||||
"Authorized apps": "Applications autorisées",
|
||||
"No authorized apps yet.": "Aucune application autorisée pour le moment.",
|
||||
"Workspace knowledge only": "Connaissances de l’espace de travail uniquement",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "Limiter AI Chat aux réponses provenant uniquement des pages de votre espace de travail et des fichiers téléversés. Il n’utilisera pas de connaissances externes.",
|
||||
"Toggle workspace knowledge only": "Activer/désactiver les connaissances de l’espace de travail uniquement",
|
||||
"Read-only mode": "Mode lecture seule",
|
||||
"AI Chat can search and read workspace content, but cannot create or edit pages.": "AI Chat peut rechercher et lire le contenu de l’espace de travail, mais ne peut pas créer ni modifier des pages.",
|
||||
"Toggle AI Chat read-only mode": "Activer/désactiver le mode lecture seule d’AI Chat",
|
||||
"Title only": "Titre uniquement",
|
||||
"you": "vous"
|
||||
"{{count}} rows deleted_one": "1 row deleted",
|
||||
"{{count}} rows deleted_other": "{{count}} rows deleted",
|
||||
"{{count}} selected_one": "1 selected",
|
||||
"{{count}} selected_other": "{{count}} selected"
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
"Templates": "Modelli",
|
||||
"Theme": "Tema",
|
||||
"To change your email, you have to enter your password and new email.": "Per cambiare la tua email, devi inserire la tua password e la nuova email.",
|
||||
"Toggle full page width": "Attiva/disattiva larghezza intera della pagina",
|
||||
"Toggle full page width": "Attiva/disattiva larghezza completa della pagina",
|
||||
"Unable to import pages. Please try again.": "Impossibile importare le pagine. Riprova.",
|
||||
"untitled": "senza titolo",
|
||||
"Untitled": "Senza titolo",
|
||||
@@ -294,7 +294,6 @@
|
||||
"Export space": "Esporta spazio",
|
||||
"Export {{type}}": "Esporta {{type}}",
|
||||
"File exceeds the {{limit}} attachment limit": "Il file supera il limite per gli allegati di {{limit}}",
|
||||
"Media": "Contenuti multimediali",
|
||||
"Align left": "Allinea a sinistra",
|
||||
"Align right": "Allinea a destra",
|
||||
"Align center": "Allinea al centro",
|
||||
@@ -388,8 +387,6 @@
|
||||
"Insert horizontal rule divider": "Inserisci divisore di regola orizzontale",
|
||||
"Page break": "Interruzione di pagina",
|
||||
"Insert a page break for printing.": "Inserisci un'interruzione di pagina per la stampa.",
|
||||
"Footnote": "Nota a piè di pagina",
|
||||
"Insert a footnote reference.": "Inserisci un riferimento a una nota a piè di pagina.",
|
||||
"Upload any image from your device.": "Carica un'immagine dal tuo dispositivo.",
|
||||
"Upload any video from your device.": "Carica qualsiasi video dal tuo dispositivo.",
|
||||
"Upload any audio from your device.": "Carica qualsiasi audio dal tuo dispositivo.",
|
||||
@@ -707,11 +704,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "Abilita il server MCP per consentire ad assistenti e strumenti IA di interagire con i contenuti del tuo spazio di lavoro.",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP è disponibile solo nell'edizione Enterprise di Docmost. Contatta sales@docmost.com.",
|
||||
"MCP Server URL": "URL del server MCP",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "Connetti gli assistenti AI al tuo account Docmost tramite OAuth.",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "Gli assistenti AI devono connettersi con un account Docmost tramite OAuth. Le chiavi API non possono essere utilizzate con il server MCP.",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "Usa la tua chiave API per l'autenticazione. Puoi gestire le chiavi API nelle impostazioni del tuo account.",
|
||||
"Supported tools": "Strumenti supportati",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "Il tuo spazio di lavoro ha MCP abilitato. Usa la tua chiave API per collegare gli assistenti IA.",
|
||||
"MCP server URL:": "URL del server MCP:",
|
||||
"Learn more": "Scopri di più",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "Gestisci le API key per tutti gli utenti nello spazio di lavoro. Consulta la <anchor>documentazione API</anchor> per i dettagli sull'utilizzo.",
|
||||
@@ -1191,8 +1186,8 @@
|
||||
"Default value": "Valore predefinito",
|
||||
"Delete property": "Elimina proprietà",
|
||||
"Delete view": "Elimina vista",
|
||||
"Delete {{count}} rows?_one": "Eliminare 1 riga?",
|
||||
"Delete {{count}} rows?_other": "Eliminare {{count}} righe?",
|
||||
"Delete {{count}} rows?_one": "Delete 1 row?",
|
||||
"Delete {{count}} rows?_other": "Delete {{count}} rows?",
|
||||
"Descending": "Decrescente",
|
||||
"Discard": "Ignora",
|
||||
"Doesn't contain": "Non contiene",
|
||||
@@ -1291,51 +1286,8 @@
|
||||
"Value": "Valore",
|
||||
"View updated for everyone": "Vista aggiornata per tutti",
|
||||
"You have unsaved changes. Do you want to discard them?": "Hai modifiche non salvate. Vuoi ignorarle?",
|
||||
"{{count}} rows deleted_one": "1 riga eliminata",
|
||||
"{{count}} rows deleted_other": "{{count}} righe eliminate",
|
||||
"{{count}} selected_one": "1 selezionato",
|
||||
"{{count}} selected_other": "{{count}} selezionati",
|
||||
"Compare": "Confronta",
|
||||
"Compare versions": "Confronta versioni",
|
||||
"Select version from {{date}}": "Seleziona la versione del {{date}}",
|
||||
"Version actions for {{date}}": "Azioni della versione del {{date}}",
|
||||
"Comparing {{newer}} and {{older}}": "Confronto tra {{newer}} e {{older}}",
|
||||
"Exit compare": "Esci dal confronto",
|
||||
"Search attachments...": "Cerca allegati...",
|
||||
"Error loading attachments.": "Errore durante il caricamento degli allegati.",
|
||||
"No attachments on this page yet.": "Ancora nessun allegato in questa pagina.",
|
||||
"Uploaded by {{name}}": "Caricato da {{name}}",
|
||||
"Download {{name}}": "Scarica {{name}}",
|
||||
"Access revoked": "Accesso revocato",
|
||||
"Authorize application": "Autorizza applicazione",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}} vuole accedere a {{workspace}}",
|
||||
"Not you? Switch account": "Non sei tu? Cambia account",
|
||||
"This application will be able to:": "Questa applicazione potrà:",
|
||||
"Write": "Scrivere",
|
||||
"Invalid authorization request": "Richiesta di autorizzazione non valida",
|
||||
"Authorize": "Autorizza",
|
||||
"Application": "Applicazione",
|
||||
"Permissions": "Autorizzazioni",
|
||||
"Authorized": "Autorizzato",
|
||||
"Revoke access": "Revoca accesso",
|
||||
"Revoke access for {{name}}": "Revoca l'accesso per {{name}}",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "Sei sicuro di voler revocare l'accesso per {{name}}? L'applicazione non potrà più accedere al tuo account.",
|
||||
"Something went wrong. Please try again.": "Qualcosa è andato storto. Riprova.",
|
||||
"Remove {{name}}": "Rimuovi {{name}}",
|
||||
"Make sure you trust this application before authorizing it.": "Assicurati di fidarti di questa applicazione prima di autorizzarla.",
|
||||
"You will be redirected to": "Verrai reindirizzato a",
|
||||
"View content without making changes.": "Visualizza il contenuto senza apportare modifiche.",
|
||||
"Create and modify content.": "Crea e modifica contenuti.",
|
||||
"Applications and AI assistants you have authorized to access your account.": "Applicazioni e assistenti AI che hai autorizzato ad accedere al tuo account.",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "Il tuo workspace ha MCP abilitato. Connetti gli assistenti AI al tuo account Docmost tramite OAuth.",
|
||||
"Authorized apps": "App autorizzate",
|
||||
"No authorized apps yet.": "Ancora nessuna app autorizzata.",
|
||||
"Workspace knowledge only": "Solo conoscenze del workspace",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "Limita AI Chat a rispondere solo in base alle pagine del tuo workspace e ai file caricati. Non userà conoscenze esterne.",
|
||||
"Toggle workspace knowledge only": "Attiva/disattiva solo conoscenze del workspace",
|
||||
"Read-only mode": "Modalità di sola lettura",
|
||||
"AI Chat can search and read workspace content, but cannot create or edit pages.": "AI Chat può cercare e leggere i contenuti del workspace, ma non può creare o modificare pagine.",
|
||||
"Toggle AI Chat read-only mode": "Attiva/disattiva la modalità di sola lettura di AI Chat",
|
||||
"Title only": "Solo titolo",
|
||||
"you": "tu"
|
||||
"{{count}} rows deleted_one": "1 row deleted",
|
||||
"{{count}} rows deleted_other": "{{count}} rows deleted",
|
||||
"{{count}} selected_one": "1 selected",
|
||||
"{{count}} selected_other": "{{count}} selected"
|
||||
}
|
||||
|
||||
@@ -294,7 +294,6 @@
|
||||
"Export space": "エクスポートスペース",
|
||||
"Export {{type}}": "{{type}}をエクスポート",
|
||||
"File exceeds the {{limit}} attachment limit": "ファイルが{{limit}}の添付制限を超えています",
|
||||
"Media": "メディア",
|
||||
"Align left": "左揃え",
|
||||
"Align right": "右揃え",
|
||||
"Align center": "中央揃え",
|
||||
@@ -388,8 +387,6 @@
|
||||
"Insert horizontal rule divider": "区切り線を挿入します",
|
||||
"Page break": "改ページ",
|
||||
"Insert a page break for printing.": "印刷用に改ページを挿入します。",
|
||||
"Footnote": "脚注",
|
||||
"Insert a footnote reference.": "脚注参照を挿入します。",
|
||||
"Upload any image from your device.": "デバイスから画像をアップロードします",
|
||||
"Upload any video from your device.": "デバイスから動画をアップロードします",
|
||||
"Upload any audio from your device.": "デバイスから音声ファイルをアップロードします。",
|
||||
@@ -707,11 +704,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "MCP サーバーを有効にして、AI アシスタントやツールがワークスペースのコンテンツとやり取りできるようにします。",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP は Docmost のエンタープライズ版でのみ利用可能です。sales@docmost.com までお問い合わせください。",
|
||||
"MCP Server URL": "MCP サーバーの URL",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "OAuth を使用して AI アシスタントを Docmost アカウントに接続します。",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "AI アシスタントは OAuth を使用して Docmost アカウントに接続する必要があります。MCP サーバーでは API キーは使用できません。",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "認証には API キーを使用してください。API キーはアカウント設定で管理できます。",
|
||||
"Supported tools": "サポートされているツール",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "このワークスペースでは MCP が有効になっています。AI アシスタントを接続するには API キーを使用してください。",
|
||||
"MCP server URL:": "MCP サーバーの URL:",
|
||||
"Learn more": "詳細を見る",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "ワークスペース内のすべてのユーザーのAPIキーを管理します。利用方法の詳細は<anchor>APIドキュメント</anchor>をご覧ください。",
|
||||
@@ -1294,48 +1289,5 @@
|
||||
"{{count}} rows deleted_one": "1 row deleted",
|
||||
"{{count}} rows deleted_other": "{{count}} rows deleted",
|
||||
"{{count}} selected_one": "1 selected",
|
||||
"{{count}} selected_other": "{{count}} selected",
|
||||
"Compare": "比較",
|
||||
"Compare versions": "バージョンを比較",
|
||||
"Select version from {{date}}": "{{date}} のバージョンを選択",
|
||||
"Version actions for {{date}}": "{{date}} のバージョンの操作",
|
||||
"Comparing {{newer}} and {{older}}": "{{newer}} と {{older}} を比較中",
|
||||
"Exit compare": "比較を終了",
|
||||
"Search attachments...": "添付ファイルを検索…",
|
||||
"Error loading attachments.": "添付ファイルの読み込み中にエラーが発生しました。",
|
||||
"No attachments on this page yet.": "このページにはまだ添付ファイルがありません。",
|
||||
"Uploaded by {{name}}": "アップロード者: {{name}}",
|
||||
"Download {{name}}": "{{name}} をダウンロード",
|
||||
"Access revoked": "アクセスが取り消されました",
|
||||
"Authorize application": "アプリケーションを認可",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}} が {{workspace}} へのアクセスを求めています",
|
||||
"Not you? Switch account": "あなたではありませんか? アカウントを切り替え",
|
||||
"This application will be able to:": "このアプリケーションで可能なこと:",
|
||||
"Write": "書き込み",
|
||||
"Invalid authorization request": "無効な認可リクエストです",
|
||||
"Authorize": "認可",
|
||||
"Application": "アプリケーション",
|
||||
"Permissions": "権限",
|
||||
"Authorized": "認可済み",
|
||||
"Revoke access": "アクセスを取り消す",
|
||||
"Revoke access for {{name}}": "{{name}} のアクセスを取り消す",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "{{name}} のアクセスを取り消してもよろしいですか? このアプリケーションは今後あなたのアカウントにアクセスできなくなります。",
|
||||
"Something went wrong. Please try again.": "問題が発生しました。もう一度お試しください。",
|
||||
"Remove {{name}}": "{{name}} を削除",
|
||||
"Make sure you trust this application before authorizing it.": "認可する前に、このアプリケーションを信頼できることを確認してください。",
|
||||
"You will be redirected to": "次へリダイレクトされます",
|
||||
"View content without making changes.": "変更を加えずにコンテンツを表示します。",
|
||||
"Create and modify content.": "コンテンツを作成および変更します。",
|
||||
"Applications and AI assistants you have authorized to access your account.": "あなたのアカウントへのアクセスを認可したアプリケーションと AI アシスタント。",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "このワークスペースでは MCP が有効になっています。OAuth を使用して AI アシスタントを Docmost アカウントに接続します。",
|
||||
"Authorized apps": "認可済みアプリ",
|
||||
"No authorized apps yet.": "認可済みアプリはまだありません。",
|
||||
"Workspace knowledge only": "ワークスペースの知識のみ",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "AIチャットの回答を、ワークスペース内のページとアップロードされたファイルのみに制限します。外部の知識は使用されません。",
|
||||
"Toggle workspace knowledge only": "「ワークスペースの知識のみ」を切り替え",
|
||||
"Read-only mode": "読み取り専用モード",
|
||||
"AI Chat can search and read workspace content, but cannot create or edit pages.": "AIチャットはワークスペースのコンテンツを検索および閲覧できますが、ページの作成や編集はできません。",
|
||||
"Toggle AI Chat read-only mode": "AIチャットの読み取り専用モードを切り替え",
|
||||
"Title only": "タイトルのみ",
|
||||
"you": "あなた"
|
||||
"{{count}} selected_other": "{{count}} selected"
|
||||
}
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
"Account": "계정",
|
||||
"Active": "활성",
|
||||
"Add": "추가",
|
||||
"Add group members": "그룹에 멤버 추가",
|
||||
"Add groups": "그룹 추가",
|
||||
"Add group members": "팀에 사용자 추가",
|
||||
"Add groups": "팀 생성",
|
||||
"Add members": "사용자 추가",
|
||||
"Add to groups": "그룹에 추가",
|
||||
"Add to groups": "팀에 추가",
|
||||
"Add space members": "Space에 사용자 추가",
|
||||
"Add to favorites": "즐겨찾기에 추가",
|
||||
"Admin": "관리자",
|
||||
"Are you sure you want to delete this group? Members will lose access to resources this group has access to.": "이 그룹을 삭제하시겠습니까? 그룹 멤버는 이 그룹이 가진 모든 권한을 잃게 됩니다.",
|
||||
"Are you sure you want to delete this group? Members will lose access to resources this group has access to.": "이 팀을 삭제하시겠습니까? 해당 팀에 속한 사용자들은 이 팀이 가진 모든 권한을 잃게 됩니다.",
|
||||
"Are you sure you want to delete this page?": "이 페이지를 삭제하시겠습니까?",
|
||||
"Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.": "이 사용자를 그룹에서 제거하시겠습니까? 사용자는 이 그룹이 가진 모든 권한을 잃게 됩니다.",
|
||||
"Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.": "이 사용자를 팀에서 제거하시겠습니까? 사용자는 이 팀이 가진 모든 권한을 잃게 됩니다.",
|
||||
"Are you sure you want to remove this user from the space? The user will lose all access to this space.": "이 사용자를 Space에서 제거하시겠습니까? 사용자는 이 Space에 대한 모든 접근 권한을 잃게 됩니다.",
|
||||
"Are you sure you want to restore this version? Any changes not versioned will be lost.": "이 버전으로 복원하시겠습니까? 저장되지 않은 모든 변경사항이 손실됩니다.",
|
||||
"Can become members of groups and spaces in workspace": "워크스페이스의 그룹 및 스페이스의 멤버가 될 수 있음",
|
||||
"Can become members of groups and spaces in workspace": "Workspace 내 팀 및 Space의 사용자가 될 수 있습니다.",
|
||||
"Can create and edit pages in space.": "Space에 페이지를 생성하고 편집할 수 있습니다.",
|
||||
"Can edit": "편집할 수 있음",
|
||||
"Can manage workspace": "워크스페이스를 관리할 수 있음",
|
||||
"Can manage workspace but cannot delete it": "워크스페이스를 관리할 수 있지만, 삭제할 수 없음",
|
||||
"Can manage workspace": "Workspace를 관리할 수 있음",
|
||||
"Can manage workspace but cannot delete it": "Workspace를 관리할 수 있지만, 삭제는 불가능.",
|
||||
"Can view": "볼 수 있음",
|
||||
"Can view pages in space but not edit.": "Space의 페이지를 볼 수 있지만, 편집은 불가능.",
|
||||
"Cancel": "취소",
|
||||
@@ -33,17 +33,17 @@
|
||||
"Copy as Markdown": "Markdown으로 복사",
|
||||
"Copy link": "링크 복사",
|
||||
"Create": "생성",
|
||||
"Create group": "그룹 생성",
|
||||
"Create group": "팀 생성",
|
||||
"Create page": "페이지 생성",
|
||||
"Create space": "Space 생성",
|
||||
"Create workspace": "워크스페이스 생성",
|
||||
"Create workspace": "Workspace 생성",
|
||||
"Current password": "현재 비밀번호",
|
||||
"Dark": "어두운",
|
||||
"Date": "날짜",
|
||||
"Delete": "삭제",
|
||||
"Remove from page": "페이지에서 제거",
|
||||
"Base options": "베이스 옵션",
|
||||
"Delete group": "그룹 삭제",
|
||||
"Delete group": "팀 삭제",
|
||||
"Are you sure you want to delete this page? This will delete its children and page history. This action is irreversible.": "이 페이지를 삭제하시겠습니까? 하위 페이지와 페이지 기록이 모두 삭제됩니다. 이 작업은 되돌릴 수 없습니다.",
|
||||
"Description": "설명",
|
||||
"Details": "세부사항",
|
||||
@@ -58,7 +58,7 @@
|
||||
"e.g Space for sales team to collaborate": "예: 영업 팀이 협업하는 스페이스",
|
||||
"Edit": "편집",
|
||||
"Read": "읽기",
|
||||
"Edit group": "그룹 편집",
|
||||
"Edit group": "팀 편집",
|
||||
"Email": "이메일",
|
||||
"Enter a strong password": "강력한 비밀번호를 입력하세요",
|
||||
"Enter valid email addresses separated by comma or space max_50": "유효한 이메일 주소를 쉼표나 공백으로 구분하여 입력하세요 [최대: 50]",
|
||||
@@ -103,10 +103,10 @@
|
||||
"Full page width": "전체 페이지 너비",
|
||||
"Full width": "전체 너비",
|
||||
"General": "일반",
|
||||
"Group": "그룹",
|
||||
"Group description": "그룹 설명",
|
||||
"Group name": "그룹 이름",
|
||||
"Groups": "그룹",
|
||||
"Group": "팀",
|
||||
"Group description": "팀 설명",
|
||||
"Group name": "팀 이름",
|
||||
"Groups": "팀",
|
||||
"Has full access to space settings and pages.": "Space 설정과 페이지에 대한 전체 접근 권한이 있습니다.",
|
||||
"Home": "홈",
|
||||
"Import pages": "페이지 가져오기",
|
||||
@@ -119,14 +119,14 @@
|
||||
"Invite new members": "새 사용자 초대",
|
||||
"Invite People": "사용자 초대",
|
||||
"Invited members who are yet to accept their invitation will appear here.": "초대를 아직 수락하지 않은 초대된 사용자가 여기에 표시됩니다.",
|
||||
"Invited members will be granted access to spaces the groups can access": "초대된 멤버에게는 그룹이 접근할 수 있는 스페이스에 대한 액세스 권한이 부여됩니다",
|
||||
"Join the workspace": "워크스페이스 참여",
|
||||
"Invited members will be granted access to spaces the groups can access": "초대된 사용자는 팀이 접근할 수 있는 Space에 대한 접근 권한을 받게 됩니다",
|
||||
"Join the workspace": "Workspace 참여",
|
||||
"Language": "언어",
|
||||
"Light": "밝은",
|
||||
"Link copied": "링크 복사됨",
|
||||
"Login": "로그인",
|
||||
"Logout": "로그아웃",
|
||||
"Manage Group": "그룹 관리",
|
||||
"Manage Group": "팀 관리",
|
||||
"Manage members": "사용자 관리",
|
||||
"member": "사용자",
|
||||
"Member": "사용자",
|
||||
@@ -139,7 +139,7 @@
|
||||
"New email": "새 이메일",
|
||||
"New page": "새 페이지",
|
||||
"New password": "새 비밀번호",
|
||||
"No group found": "그룹을 찾을 수 없음",
|
||||
"No group found": "그룹을 찾을 수 없습니다",
|
||||
"No page history saved yet.": "아직 저장된 페이지 기록이 없습니다.",
|
||||
"No pages yet": "아직 페이지가 없습니다",
|
||||
"No shared pages": "공유된 페이지가 없습니다.",
|
||||
@@ -148,7 +148,7 @@
|
||||
"Overview": "개요",
|
||||
"Owner": "소유자",
|
||||
"page": "페이지",
|
||||
"Page deleted successfully": "페이지 삭제됨",
|
||||
"Page deleted successfully": "페이지 삭제 완료",
|
||||
"Page history": "페이지 기록",
|
||||
"Select version": "버전 선택",
|
||||
"Highlight changes": "변경 사항 강조",
|
||||
@@ -156,7 +156,7 @@
|
||||
"Pages": "페이지",
|
||||
"pages": "페이지",
|
||||
"Password": "비밀번호",
|
||||
"Password changed successfully": "비밀번호 변경됨",
|
||||
"Password changed successfully": "비밀번호 변경 완료",
|
||||
"People": "사용자",
|
||||
"Pending": "대기 중",
|
||||
"Please confirm your action": "작업을 확인해 주세요",
|
||||
@@ -166,15 +166,15 @@
|
||||
"Recently updated": "최근 업데이트",
|
||||
"Remove": "제거",
|
||||
"Remove from favorites": "즐겨찾기에서 제거",
|
||||
"Remove group member": "그룹 멤버 제거",
|
||||
"Remove group member": "팀에서 사용자 제거",
|
||||
"Remove space member": "Space에서 사용자 제거",
|
||||
"Restore": "복원",
|
||||
"Role": "역할",
|
||||
"Save": "저장",
|
||||
"Search": "검색",
|
||||
"Search for groups": "그룹 검색",
|
||||
"Search for groups": "팀 검색",
|
||||
"Search for users": "사용자 검색",
|
||||
"Search for users and groups": "사용자 및 그룹 검색",
|
||||
"Search for users and groups": "사용자 및 팀 검색",
|
||||
"Search...": "검색...",
|
||||
"Select language": "언어 선택",
|
||||
"Select role": "역할 선택",
|
||||
@@ -199,8 +199,8 @@
|
||||
"Search for spaces": "스페이스 검색",
|
||||
"Start typing to search...": "검색하려면 입력을 시작하세요...",
|
||||
"Status": "상태",
|
||||
"Successfully imported": "가져오기 완료",
|
||||
"Successfully restored": "복원 완료",
|
||||
"Successfully imported": "가져오기에 성공했습니다",
|
||||
"Successfully restored": "복원에 성공했습니다",
|
||||
"System settings": "시스템 설정",
|
||||
"Templates": "템플릿",
|
||||
"Theme": "테마",
|
||||
@@ -209,7 +209,7 @@
|
||||
"Unable to import pages. Please try again.": "페이지를 가져올 수 없습니다. 다시 시도해주세요.",
|
||||
"untitled": "제목 없음",
|
||||
"Untitled": "제목 없음",
|
||||
"Updated successfully": "업데이트 완료",
|
||||
"Updated successfully": "성공적으로 업데이트되었습니다",
|
||||
"User": "사용자",
|
||||
"Workspace": "워크스페이스",
|
||||
"Workspace Name": "워크스페이스 이름",
|
||||
@@ -245,15 +245,15 @@
|
||||
"Are you sure you want to delete this comment?": "이 댓글을 삭제하시겠습니까?",
|
||||
"Delete chat": "채팅 삭제",
|
||||
"Are you sure you want to delete '{{title}}'? This action cannot be undone.": "'{{title}}'을(를) 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",
|
||||
"Comment created successfully": "댓글 생성됨",
|
||||
"Comment created successfully": "댓글 생성 완료",
|
||||
"Error creating comment": "댓글 생성 오류",
|
||||
"Comment updated successfully": "댓글 업데이트됨",
|
||||
"Comment updated successfully": "댓글 업데이트 완료",
|
||||
"Failed to update comment": "댓글 업데이트 실패",
|
||||
"Comment deleted successfully": "댓글 삭제됨",
|
||||
"Comment deleted successfully": "댓글 삭제 완료",
|
||||
"Failed to delete comment": "댓글 삭제 실패",
|
||||
"Comment resolved successfully": "댓글이 해결로 표시됨",
|
||||
"Comment re-opened successfully": "댓글이 열린 상태로 표시됨",
|
||||
"Comment unresolved successfully": "댓글이 미해결로 표시됨",
|
||||
"Comment resolved successfully": "댓글 처리 완료",
|
||||
"Comment re-opened successfully": "댓글이 성공적으로 다시 열렸습니다",
|
||||
"Comment unresolved successfully": "댓글 해결이 성공적으로 취소되었습니다",
|
||||
"Failed to resolve comment": "댓글 처리 실패",
|
||||
"Resolve comment": "댓글 해결",
|
||||
"Unresolve comment": "댓글 해결 취소",
|
||||
@@ -263,19 +263,19 @@
|
||||
"Are you sure you want to unresolve this comment thread?": "이 댓글 스레드를 미해결로 변경하시겠습니까?",
|
||||
"Resolved": "해결됨",
|
||||
"No active comments.": "활성 댓글이 없습니다.",
|
||||
"Revoke invitation": "초대 폐기",
|
||||
"Revoke": "폐기",
|
||||
"Revoke invitation": "초대 취소",
|
||||
"Revoke": "취소",
|
||||
"Don't": "하지 않음",
|
||||
"Are you sure you want to revoke this invitation? The user will not be able to join the workspace.": "이 초대를 폐기하시겠습니까? 사용자가 워크스페이스에 참여할 수 없게 됩니다.",
|
||||
"Are you sure you want to revoke this invitation? The user will not be able to join the workspace.": "이 초대를 취소하시겠습니까? 사용자가 Workspace에 참여할 수 없게 됩니다.",
|
||||
"Resend invitation": "초대 재전송",
|
||||
"Anyone with this link can join this workspace.": "이 링크를 가진 모든 사용자가 이 워크스페이스에 참여할 수 있습니다.",
|
||||
"Anyone with this link can join this workspace.": "이 링크를 가진 모든 사용자가 이 Workspace에 참여할 수 있습니다.",
|
||||
"Invite link": "초대 링크",
|
||||
"Copy": "복사",
|
||||
"Copy to space": "스페이스로 복사",
|
||||
"Copied": "복사됨",
|
||||
"Duplicate": "복제",
|
||||
"Select a user": "사용자 선택",
|
||||
"Select a group": "그룹 선택",
|
||||
"Select a group": "팀 선택",
|
||||
"Export all pages and attachments in this space.": "이 Space의 모든 페이지와 첨부파일을 내보냅니다.",
|
||||
"Delete space": "Space 삭제",
|
||||
"Are you sure you want to delete this space?": "이 Space을 삭제하시겠습니까?",
|
||||
@@ -290,11 +290,10 @@
|
||||
"Export failed:": "내보내기 실패:",
|
||||
"export error": "내보내기 오류",
|
||||
"Export page": "페이지 내보내기",
|
||||
"Export successful": "내보내기 완료",
|
||||
"Export successful": "내보내기 성공",
|
||||
"Export space": "Space 내보내기",
|
||||
"Export {{type}}": "{{type}} 내보내기",
|
||||
"File exceeds the {{limit}} attachment limit": "첨부 파일 크기 제한 {{limit}}을 초과했습니다",
|
||||
"Media": "미디어",
|
||||
"Align left": "왼쪽 정렬",
|
||||
"Align right": "오른쪽 정렬",
|
||||
"Align center": "가운데 정렬",
|
||||
@@ -388,8 +387,6 @@
|
||||
"Insert horizontal rule divider": "가로 구분선 삽입",
|
||||
"Page break": "페이지 나누기",
|
||||
"Insert a page break for printing.": "인쇄용 페이지 나누기를 삽입합니다.",
|
||||
"Footnote": "각주",
|
||||
"Insert a footnote reference.": "각주 참조를 삽입합니다.",
|
||||
"Upload any image from your device.": "기기에서 이미지를 업로드하세요.",
|
||||
"Upload any video from your device.": "기기에서 비디오를 업로드하세요.",
|
||||
"Upload any audio from your device.": "기기에서 오디오를 업로드하세요.",
|
||||
@@ -450,12 +447,12 @@
|
||||
"Today, {{time}}": "오늘, {{time}}",
|
||||
"Yesterday, {{time}}": "어제, {{time}}",
|
||||
"now": "지금",
|
||||
"Space created successfully": "스페이스 생성됨",
|
||||
"Space updated successfully": "스페이스 업데이트됨",
|
||||
"Space deleted successfully": "스페이스 삭제됨",
|
||||
"Members added successfully": "멤버 추가됨",
|
||||
"Member removed successfully": "멤버 삭제됨",
|
||||
"Member role updated successfully": "멤버 역할 업데이트됨",
|
||||
"Space created successfully": "스페이스가 성공적으로 생성되었습니다",
|
||||
"Space updated successfully": "스페이스가 성공적으로 업데이트되었습니다",
|
||||
"Space deleted successfully": "스페이스가 성공적으로 삭제되었습니다",
|
||||
"Members added successfully": "멤버가 성공적으로 추가되었습니다",
|
||||
"Member removed successfully": "멤버가 성공적으로 제거되었습니다",
|
||||
"Member role updated successfully": "멤버 역할이 성공적으로 업데이트되었습니다",
|
||||
"Created by: <b>{{creatorName}}</b>": "작성자: <b>{{creatorName}}</b>",
|
||||
"Created at: {{time}}": "작성 시간: {{time}}",
|
||||
"Edited by {{name}} {{time}}": "{{name}}님이 {{time}}에 편집함",
|
||||
@@ -468,7 +465,7 @@
|
||||
"Choose {{format}} file": "{{format}} 파일 선택",
|
||||
"Reading": "읽기",
|
||||
"Delete member": "멤버 삭제",
|
||||
"Member deleted successfully": "멤버 삭제됨",
|
||||
"Member deleted successfully": "멤버가 성공적으로 삭제되었습니다",
|
||||
"Are you sure you want to delete this workspace member? This action is irreversible.": "이 워크스페이스 멤버를 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",
|
||||
"Deactivate member": "멤버 비활성화",
|
||||
"Activate member": "멤버 활성화",
|
||||
@@ -501,32 +498,32 @@
|
||||
"Delete share": "공유 삭제",
|
||||
"Are you sure you want to delete this shared link?": "이 공유 링크를 삭제하시겠습니까?",
|
||||
"Publicly shared pages from spaces you are a member of will appear here": "회원으로 속한 스페이스의 공개 공유 페이지가 여기에 표시됩니다",
|
||||
"Share deleted successfully": "공유 삭제됨",
|
||||
"Share deleted successfully": "공유가 성공적으로 삭제되었습니다",
|
||||
"Share not found": "공유를 찾을 수 없습니다",
|
||||
"Failed to share page": "페이지 공유에 실패했습니다",
|
||||
"Disable public sharing": "공개 공유 비활성화",
|
||||
"Prevent members from sharing pages publicly.": "멤버가 페이지를 공개적으로 공유하지 못하게 합니다.",
|
||||
"Toggle public sharing": "공개 공유 전환",
|
||||
"Toggle space public sharing": "스페이스 공개 공유 전환",
|
||||
"Disable public sharing": "공유 비활성화",
|
||||
"Prevent members from sharing pages publicly.": "멤버들이 페이지를 공개적으로 공유하지 못하도록 방지하십시오.",
|
||||
"Toggle public sharing": "공유 전환",
|
||||
"Toggle space public sharing": "공간 공유 전환",
|
||||
"Allow viewers to comment": "뷰어가 댓글을 달 수 있도록 허용",
|
||||
"Allow viewers to add comments on pages in this space.": "이 공간 내 페이지에 뷰어가 댓글을 추가할 수 있도록 허용합니다.",
|
||||
"Toggle viewer comments": "뷰어 댓글 전환",
|
||||
"Public sharing is disabled at the workspace level": "공개 공유가 워크스페이스 수준에서 비활성화됨",
|
||||
"Prevent pages in this space from being shared publicly.": "이 스페이스의 페이지가 공개 공유되지 않도록 합니다.",
|
||||
"Public sharing is disabled at the workspace level": "워크스페이스 수준에서 공유가 비활성화되었습니다.",
|
||||
"Prevent pages in this space from being shared publicly.": "이 공간의 페이지가 공개적으로 공유되지 않도록 방지하십시오.",
|
||||
"Page permissions": "페이지 권한},{",
|
||||
"Control who can view and edit individual pages. Available with an enterprise license.": "개별 페이지의 조회 및 편집 권한을 제어합니다. 엔터프라이즈 라이선스에서 이용 가능합니다.",
|
||||
"Enable public sharing": "공개 공유 활성화",
|
||||
"Are you sure you want to enable public sharing? Members will be able to share pages publicly.": "공개 공유를 활성화하시겠습니까? 멤버가 페이지를 공개적으로 공유할 수 있게 됩니다.",
|
||||
"Are you sure you want to disable public sharing? All existing shared links in this workspace will be deleted.": "공개 공유를 비활성화하시겠습니까? 이 워크스페이스의 기존 공유 링크가 모두 삭제됩니다.",
|
||||
"Are you sure you want to enable public sharing for this space?": "이 스페이스에 대해 공개 공유를 활성화하시겠습니까?",
|
||||
"Are you sure you want to disable public sharing? All existing shared links in this space will be deleted.": "공개 공유를 비활성화하시겠습니까? 이 스페이스의 기존 공유 링크가 모두 삭제됩니다.",
|
||||
"Public sharing is disabled": "공개 공유가 비활성화됨",
|
||||
"Public sharing has been disabled at the workspace level.": "공개 공유가 워크스페이스 수준에서 비활성화되었습니다.",
|
||||
"Public sharing has been disabled for this space.": "이 스페이스의 공개 공유가 비활성화되었습니다.",
|
||||
"Enable public sharing": "공유 활성화",
|
||||
"Are you sure you want to enable public sharing? Members will be able to share pages publicly.": "공유를 활성화하시겠습니까? 멤버들이 페이지를 공개적으로 공유할 수 있게 됩니다.",
|
||||
"Are you sure you want to disable public sharing? All existing shared links in this workspace will be deleted.": "정말로 공유를 비활성화하시겠습니까? 이 워크스페이스의 모든 기존 공유 링크가 삭제됩니다.",
|
||||
"Are you sure you want to enable public sharing for this space?": "이 공간의 공유를 활성화하시겠습니까?",
|
||||
"Are you sure you want to disable public sharing? All existing shared links in this space will be deleted.": "정말로 공유를 비활성화하시겠습니까? 이 공간의 모든 기존 공유 링크가 삭제됩니다.",
|
||||
"Public sharing is disabled": "공유가 비활성화되었습니다.",
|
||||
"Public sharing has been disabled at the workspace level.": "워크스페이스 수준에서 공유가 비활성화되었습니다.",
|
||||
"Public sharing has been disabled for this space.": "이 공간의 공유가 비활성화되었습니다.",
|
||||
"Copy page": "페이지 복사",
|
||||
"Copy page to a different space.": "다른 공간으로 페이지 복사하기.",
|
||||
"Page copied successfully": "페이지 복사됨",
|
||||
"Page duplicated successfully": "페이지 복제됨",
|
||||
"Page copied successfully": "페이지가 성공적으로 복사되었습니다",
|
||||
"Page duplicated successfully": "페이지가 성공적으로 복제되었습니다",
|
||||
"Find": "찾기",
|
||||
"Not found": "찾을 수 없음",
|
||||
"Previous Match (Shift+Enter)": "이전 일치 항목 (Shift+Enter)",
|
||||
@@ -542,13 +539,13 @@
|
||||
"Error": "오류",
|
||||
"Failed to disable MFA": "MFA 비활성화에 실패했습니다",
|
||||
"Disable two-factor authentication": "2단계 인증 비활성화",
|
||||
"Disabling two-factor authentication will make your account less secure. You'll only need your password to sign in.": "2단계 인증을 비활성화하면 계정의 보안이 낮아집니다. 로그인 시 비밀번호만 필요하게 됩니다.",
|
||||
"Please enter your password to disable two-factor authentication:": "2단계 인증 비활성화를 위해 비밀번호를 입력하세요:",
|
||||
"Two-factor authentication has been enabled": "2단계 인증이 활성화됨",
|
||||
"Two-factor authentication has been disabled": "2단계 인증이 비활성화됨",
|
||||
"Disabling two-factor authentication will make your account less secure. You'll only need your password to sign in.": "이중 인증을 비활성화하면 계정의 보안이 낮아집니다. 로그인 시 비밀번호만 필요하게 됩니다.",
|
||||
"Please enter your password to disable two-factor authentication:": "이중 인증 비활성화를 위해 비밀번호를 입력하세요:",
|
||||
"Two-factor authentication has been enabled": "2단계 인증이 활성화되었습니다",
|
||||
"Two-factor authentication has been disabled": "2단계 인증이 비활성화되었습니다",
|
||||
"2-step verification": "2단계 인증",
|
||||
"Protect your account with an additional verification layer when signing in.": "로그인 시 추가 인증 단계를 통해 계정을 보호하세요.",
|
||||
"Two-factor authentication is active on your account.": "2단계 인증이 계정에 활성화되어 있습니다.",
|
||||
"Two-factor authentication is active on your account.": "이중 인증이 계정에 활성화되어 있습니다.",
|
||||
"Add 2FA method": "2FA 방법 추가",
|
||||
"Backup codes": "백업 코드",
|
||||
"Disable": "비활성화",
|
||||
@@ -578,13 +575,13 @@
|
||||
"Save your backup codes": "백업 코드를 저장하세요",
|
||||
"These codes can be used to access your account if you lose access to your authenticator app. Each code can only be used once.": "인증 앱에 대한 접근 권한을 잃은 경우, 이 코드를 사용하여 귀하의 계정에 접근할 수 있습니다. 각 코드는 한 번만 사용할 수 있습니다.",
|
||||
"Print": "인쇄",
|
||||
"Two-factor authentication has been set up. Please log in again.": "2단계 인증이 설정되었습니다. 다시 로그인해 주세요.",
|
||||
"Two-Factor authentication required": "2단계 인증 필요",
|
||||
"Two-factor authentication has been set up. Please log in again.": "이중 인증이 설정되었습니다. 다시 로그인해 주세요.",
|
||||
"Two-Factor authentication required": "2단계 인증이 필요합니다",
|
||||
"Your workspace requires two-factor authentication for all users": "이 워크스페이스는 모든 사용자에게 2단계 인증을 요구합니다",
|
||||
"To continue accessing your workspace, you must set up two-factor authentication. This adds an extra layer of security to your account.": "워크스페이스에 계속 액세스하려면 2단계 인증을 설정해야 합니다. 이는 계정의 보안을 한층 강화합니다.",
|
||||
"To continue accessing your workspace, you must set up two-factor authentication. This adds an extra layer of security to your account.": "워크스페이스 접근을 계속하려면 이중 인증을 설정해야 합니다. 이는 계정에 추가 보안 계층을 추가합니다.",
|
||||
"Set up two-factor authentication": "2단계 인증 설정",
|
||||
"Cancel and logout": "취소하고 로그아웃",
|
||||
"Your workspace requires two-factor authentication. Please set it up to continue.": "워크스페이스에서는 2단계 인증이 필요합니다. 계속하려면 설정해 주세요.",
|
||||
"Your workspace requires two-factor authentication. Please set it up to continue.": "워크스페이스에서는 이중 인증이 필요합니다. 계속하려면 설정해 주세요.",
|
||||
"This adds an extra layer of security to your account by requiring a verification code from your authenticator app.": "인증앱에서 얻은 인증 코드를 요구하여 계정의 보안에 추가적인 계층을 추가합니다.",
|
||||
"Password is required": "비밀번호는 필수입니다",
|
||||
"Password must be at least 8 characters": "비밀번호는 8자 이상이어야 합니다",
|
||||
@@ -593,10 +590,10 @@
|
||||
"Enter the 6-digit code found in your authenticator app": "인증 앱에 표시된 6자리 코드를 입력하세요",
|
||||
"Need help authenticating?": "인증에 도움이 필요하십니까?",
|
||||
"MFA QR Code": "MFA QR 코드",
|
||||
"Account created successfully. Please log in to set up two-factor authentication.": "계정 생성됨. 2단계 인증을 설정하려면 로그인해 주세요.",
|
||||
"Password reset successful. Please log in with your new password and complete two-factor authentication.": "비밀번호 재설정됨. 새 비밀번호로 로그인하여 2단계 인증을 완료하세요.",
|
||||
"Password reset successful. Please log in with your new password to set up two-factor authentication.": "비밀번호 재설정됨. 새 비밀번호로 로그인하여 2단계 인증을 설정하세요.",
|
||||
"Password reset was successful. Please log in with your new password.": "비밀번호 재설정됨. 새 비밀번호로 로그인하세요.",
|
||||
"Account created successfully. Please log in to set up two-factor authentication.": "계정이 성공적으로 생성되었습니다. 이중 인증을 설정하려면 로그인해 주세요.",
|
||||
"Password reset successful. Please log in with your new password and complete two-factor authentication.": "비밀번호 재설정 성공. 새 비밀번호로 로그인하여 이중 인증을 완료하세요.",
|
||||
"Password reset successful. Please log in with your new password to set up two-factor authentication.": "비밀번호 재설정 성공. 새 비밀번호로 로그인하여 이중 인증을 설정하세요.",
|
||||
"Password reset was successful. Please log in with your new password.": "비밀번호 재설정이 성공적으로 완료되었습니다. 새 비밀번호로 로그인하세요.",
|
||||
"Two-factor authentication": "2단계 인증",
|
||||
"Use authenticator app instead": "대신 인증 앱 사용",
|
||||
"Verify backup code": "백업 코드 확인",
|
||||
@@ -618,7 +615,7 @@
|
||||
"Permanently delete": "영구 삭제",
|
||||
"<b>{{name}}</b> moved this page to Trash {{time}}.": "<b>{{name}}</b>님이 {{time}}에 이 페이지를 휴지통으로 이동했습니다.",
|
||||
"Page moved to trash": "페이지가 휴지통으로 이동되었습니다",
|
||||
"Page restored successfully": "페이지 복원됨",
|
||||
"Page restored successfully": "페이지가 성공적으로 복원되었습니다",
|
||||
"Deleted by": "삭제한 사람",
|
||||
"Deleted at": "삭제 시간",
|
||||
"Preview": "미리보기",
|
||||
@@ -641,7 +638,7 @@
|
||||
"Only users with email addresses from these domains can signup via SSO.": "이 도메인의 이메일 주소를 가진 사용자만 SSO를 통해 가입할 수 있습니다.",
|
||||
"Enter valid domain names separated by comma or space": "쉼표 또는 공백으로 구분된 유효한 도메인 이름을 입력하세요",
|
||||
"Enforce two-factor authentication": "2단계 인증 강제",
|
||||
"Once enforced, all members must enable two-factor authentication to access the workspace.": "시행되면 모든 멤버가 워크스페이스에 액세스하기 위해 2단계 인증을 활성화해야 합니다.",
|
||||
"Once enforced, all members must enable two-factor authentication to access the workspace.": "시행되면 모든 멤버가 작업 공간에 액세스하기 위해 이중 인증을 활성화해야 합니다.",
|
||||
"Toggle MFA enforcement": "MFA 강제 설정 전환",
|
||||
"Display name": "표시 이름",
|
||||
"Allow signup": "가입 허용",
|
||||
@@ -660,7 +657,7 @@
|
||||
"Remove image": "이미지 제거",
|
||||
"Failed to remove image": "이미지 제거 실패",
|
||||
"Image exceeds 10MB limit.": "이미지가 10MB 용량 제한을 초과합니다.",
|
||||
"Image removed successfully": "이미지 삭제됨",
|
||||
"Image removed successfully": "이미지가 성공적으로 제거되었습니다",
|
||||
"API key": "API 키",
|
||||
"API keys": "API 키",
|
||||
"API management": "API 관리",
|
||||
@@ -672,7 +669,7 @@
|
||||
"Last use": "최근 사용",
|
||||
"No API keys found": "API 키를 찾을 수 없습니다",
|
||||
"No expiration": "유효기간 없음",
|
||||
"Revoked successfully": "폐기 완료",
|
||||
"Revoked successfully": "성공적으로 취소되었습니다",
|
||||
"Select expiration date": "만료일 선택",
|
||||
"This action cannot be undone. Any applications using this API key will stop working.": "이 작업은 되돌릴 수 없습니다. 이 API 키를 사용하는 모든 응용 프로그램이 작동을 멈출 것입니다.",
|
||||
"Update": "업데이트",
|
||||
@@ -707,11 +704,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "AI 어시스턴트와 도구가 워크스페이스 콘텐츠와 상호작용할 수 있도록 MCP 서버를 활성화하세요.",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP는 Docmost 엔터프라이즈 에디션에서만 제공됩니다. sales@docmost.com으로 문의하세요.",
|
||||
"MCP Server URL": "MCP 서버 URL",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "OAuth를 통해 AI 도우미를 Docmost 계정에 연결합니다.",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "AI 도우미는 OAuth를 통해 Docmost 계정에 연결해야 합니다. MCP 서버에서는 API 키를 사용할 수 없습니다.",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "인증을 위해 API 키를 사용하세요. API 키는 계정 설정에서 관리할 수 있습니다.",
|
||||
"Supported tools": "지원되는 도구",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "워크스페이스에 MCP가 활성화되어 있습니다. AI 어시스턴트를 연결하려면 API 키를 사용하세요.",
|
||||
"MCP server URL:": "MCP 서버 URL:",
|
||||
"Learn more": "자세히 알아보기",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "워크스페이스의 모든 사용자를 위한 API 키를 관리하세요. 사용 방법은 <anchor>API 문서</anchor>를 참고하세요.",
|
||||
@@ -944,8 +939,8 @@
|
||||
"Try again": "다시 시도",
|
||||
"Untitled chat": "제목 없는 채팅",
|
||||
"What can I help you with?": "무엇을 도와드릴까요?",
|
||||
"Are you sure you want to revoke this {{credential}}": "이 {{credential}}을(를) 폐기하시겠습니까?",
|
||||
"Automatically provision users and groups from your identity provider via SCIM.": "SCIM을 통해 ID 공급자로부터 사용자와 그룹을 자동으로 프로비저닝합니다.",
|
||||
"Are you sure you want to revoke this {{credential}}": "이 {{credential}}을 취소하시겠습니까?",
|
||||
"Automatically provision users and groups from your identity provider via SCIM.": "SCIM을 통해 ID 공급자에서 사용자와 그룹을 자동으로 프로비저닝합니다.",
|
||||
"Configure your identity provider with this URL to provision users and groups.": "사용자와 그룹을 프로비저닝할 수 있도록 이 URL로 ID 공급자를 구성하세요.",
|
||||
"Create {{credential}}": "{{credential}} 만들기",
|
||||
"{{credential}} created": "{{credential}} 생성됨",
|
||||
@@ -958,7 +953,7 @@
|
||||
"Important": "중요",
|
||||
"Make sure to copy your {{credential}} now. You won't be able to see it again!": "지금 {{credential}}를 복사해 두세요. 다시는 볼 수 없습니다!",
|
||||
"Never": "안 함",
|
||||
"Revoke {{credential}}": "{{credential}} 폐기",
|
||||
"Revoke {{credential}}": "{{credential}} 취소",
|
||||
"SCIM endpoint URL": "SCIM 엔드포인트 URL",
|
||||
"SCIM provisioning": "SCIM 프로비저닝",
|
||||
"SCIM takes precedence over SSO group sync while enabled.": "SCIM이 활성화되어 있는 동안에는 SSO 그룹 동기화보다 SCIM이 우선 적용됩니다.",
|
||||
@@ -1191,8 +1186,8 @@
|
||||
"Default value": "기본값",
|
||||
"Delete property": "속성 삭제",
|
||||
"Delete view": "보기 삭제",
|
||||
"Delete {{count}} rows?_one": "1개 행을 삭제하시겠습니까?",
|
||||
"Delete {{count}} rows?_other": "{{count}}개 행을 삭제하시겠습니까?",
|
||||
"Delete {{count}} rows?_one": "Delete 1 row?",
|
||||
"Delete {{count}} rows?_other": "Delete {{count}} rows?",
|
||||
"Descending": "내림차순",
|
||||
"Discard": "삭제",
|
||||
"Doesn't contain": "포함하지 않음",
|
||||
@@ -1291,51 +1286,8 @@
|
||||
"Value": "값",
|
||||
"View updated for everyone": "보기가 모두에게 업데이트되었습니다",
|
||||
"You have unsaved changes. Do you want to discard them?": "저장되지 않은 변경 사항이 있습니다. 버리시겠습니까?",
|
||||
"{{count}} rows deleted_one": "1개 행 삭제 완료",
|
||||
"{{count}} rows deleted_other": "{{count}}개 행 삭제 완료",
|
||||
"{{count}} selected_one": "1개 선택됨",
|
||||
"{{count}} selected_other": "{{count}}개 선택됨",
|
||||
"Compare": "비교",
|
||||
"Compare versions": "버전 비교",
|
||||
"Select version from {{date}}": "{{date}}의 버전 선택",
|
||||
"Version actions for {{date}}": "{{date}} 버전 작업",
|
||||
"Comparing {{newer}} and {{older}}": "{{newer}} 및 {{older}} 비교 중",
|
||||
"Exit compare": "비교 종료",
|
||||
"Search attachments...": "첨부파일 검색...",
|
||||
"Error loading attachments.": "첨부파일을 불러오는 중 오류가 발생했습니다.",
|
||||
"No attachments on this page yet.": "이 페이지에는 아직 첨부파일이 없습니다.",
|
||||
"Uploaded by {{name}}": "업로드한 사람: {{name}}",
|
||||
"Download {{name}}": "{{name}} 다운로드",
|
||||
"Access revoked": "액세스가 취소되었습니다",
|
||||
"Authorize application": "애플리케이션 승인",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}}에서 {{workspace}}에 액세스하려고 합니다",
|
||||
"Not you? Switch account": "본인이 아니신가요? 계정을 전환하세요",
|
||||
"This application will be able to:": "이 애플리케이션이 수행할 수 있는 작업:",
|
||||
"Write": "쓰기",
|
||||
"Invalid authorization request": "잘못된 승인 요청",
|
||||
"Authorize": "승인",
|
||||
"Application": "애플리케이션",
|
||||
"Permissions": "권한",
|
||||
"Authorized": "승인됨",
|
||||
"Revoke access": "액세스 취소",
|
||||
"Revoke access for {{name}}": "{{name}}의 액세스 취소",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "정말로 {{name}}의 액세스를 취소하시겠습니까? 이 애플리케이션은 더 이상 회원님의 계정에 액세스할 수 없습니다.",
|
||||
"Something went wrong. Please try again.": "문제가 발생했습니다. 다시 시도해 주세요.",
|
||||
"Remove {{name}}": "{{name}} 제거",
|
||||
"Make sure you trust this application before authorizing it.": "이 애플리케이션을 승인하기 전에 신뢰할 수 있는지 확인하세요.",
|
||||
"You will be redirected to": "다음으로 리디렉션됩니다",
|
||||
"View content without making changes.": "변경하지 않고 콘텐츠를 봅니다.",
|
||||
"Create and modify content.": "콘텐츠를 생성하고 수정합니다.",
|
||||
"Applications and AI assistants you have authorized to access your account.": "회원님의 계정에 액세스하도록 승인한 애플리케이션 및 AI 도우미입니다.",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "워크스페이스에서 MCP가 활성화되어 있습니다. OAuth를 통해 AI 도우미를 Docmost 계정에 연결하세요.",
|
||||
"Authorized apps": "승인된 앱",
|
||||
"No authorized apps yet.": "아직 승인된 앱이 없습니다.",
|
||||
"Workspace knowledge only": "워크스페이스 지식만 사용",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "AI 채팅이 워크스페이스 페이지와 업로드된 파일의 내용만 바탕으로 답변하도록 제한합니다. 외부 지식은 사용하지 않습니다.",
|
||||
"Toggle workspace knowledge only": "워크스페이스 지식만 사용 전환",
|
||||
"Read-only mode": "읽기 전용 모드",
|
||||
"AI Chat can search and read workspace content, but cannot create or edit pages.": "AI 채팅은 워크스페이스 콘텐츠를 검색하고 읽을 수 있지만, 페이지를 생성하거나 편집할 수는 없습니다.",
|
||||
"Toggle AI Chat read-only mode": "AI 채팅 읽기 전용 모드 전환",
|
||||
"Title only": "제목만",
|
||||
"you": "회원님"
|
||||
"{{count}} rows deleted_one": "1 row deleted",
|
||||
"{{count}} rows deleted_other": "{{count}} rows deleted",
|
||||
"{{count}} selected_one": "1 selected",
|
||||
"{{count}} selected_other": "{{count}} selected"
|
||||
}
|
||||
|
||||
@@ -294,7 +294,6 @@
|
||||
"Export space": "Exporteer ruimte",
|
||||
"Export {{type}}": "Exporteer {{type}}",
|
||||
"File exceeds the {{limit}} attachment limit": "Bestand overschrijdt de bijlagelimiet van {{limit}}",
|
||||
"Media": "Media",
|
||||
"Align left": "Links uitlijnen",
|
||||
"Align right": "Rechts uitlijnen",
|
||||
"Align center": "Centreren",
|
||||
@@ -388,8 +387,6 @@
|
||||
"Insert horizontal rule divider": "Horizontale lijn invoegen",
|
||||
"Page break": "Pagina-einde",
|
||||
"Insert a page break for printing.": "Voeg een pagina-einde in voor het afdrukken.",
|
||||
"Footnote": "Voetnoot",
|
||||
"Insert a footnote reference.": "Voeg een voetnootverwijzing in.",
|
||||
"Upload any image from your device.": "Upload een afbeelding vanaf uw apparaat.",
|
||||
"Upload any video from your device.": "Upload een video vanaf uw apparaat.",
|
||||
"Upload any audio from your device.": "Upload een audio vanaf uw apparaat.",
|
||||
@@ -707,11 +704,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "Schakel de MCP-server in zodat AI-assistenten en tools kunnen interageren met de inhoud van uw werkruimte.",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP is alleen beschikbaar in de Docmost Enterprise-editie. Neem contact op met sales@docmost.com.",
|
||||
"MCP Server URL": "MCP-server-URL",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "Verbind AI-assistenten met je Docmost-account via OAuth.",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "AI-assistenten moeten verbinding maken met een Docmost-account via OAuth. API-sleutels kunnen niet worden gebruikt met de MCP-server.",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "Gebruik uw API-sleutel voor authenticatie. U kunt API-sleutels beheren in uw accountinstellingen.",
|
||||
"Supported tools": "Ondersteunde tools",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "In uw werkruimte is MCP ingeschakeld. Gebruik uw API-sleutel om AI-assistenten te koppelen.",
|
||||
"MCP server URL:": "MCP-server-URL:",
|
||||
"Learn more": "Meer informatie",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "Beheer API-sleutels voor alle gebruikers in de werkruimte. Bekijk de <anchor>API-documentatie</anchor> voor gebruiksdetails.",
|
||||
@@ -1294,48 +1289,5 @@
|
||||
"{{count}} rows deleted_one": "1 rij verwijderd",
|
||||
"{{count}} rows deleted_other": "{{count}} rijen verwijderd",
|
||||
"{{count}} selected_one": "1 geselecteerd",
|
||||
"{{count}} selected_other": "{{count}} geselecteerd",
|
||||
"Compare": "Vergelijken",
|
||||
"Compare versions": "Versies vergelijken",
|
||||
"Select version from {{date}}": "Selecteer versie van {{date}}",
|
||||
"Version actions for {{date}}": "Versieacties voor {{date}}",
|
||||
"Comparing {{newer}} and {{older}}": "{{newer}} en {{older}} vergelijken",
|
||||
"Exit compare": "Vergelijken afsluiten",
|
||||
"Search attachments...": "Bijlagen zoeken...",
|
||||
"Error loading attachments.": "Fout bij het laden van bijlagen.",
|
||||
"No attachments on this page yet.": "Er zijn nog geen bijlagen op deze pagina.",
|
||||
"Uploaded by {{name}}": "Geüpload door {{name}}",
|
||||
"Download {{name}}": "{{name}} downloaden",
|
||||
"Access revoked": "Toegang ingetrokken",
|
||||
"Authorize application": "Applicatie autoriseren",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}} wil toegang tot {{workspace}}",
|
||||
"Not you? Switch account": "Ben jij dit niet? Wissel van account",
|
||||
"This application will be able to:": "Deze applicatie kan het volgende doen:",
|
||||
"Write": "Schrijven",
|
||||
"Invalid authorization request": "Ongeldig autorisatieverzoek",
|
||||
"Authorize": "Autoriseren",
|
||||
"Application": "Applicatie",
|
||||
"Permissions": "Machtigingen",
|
||||
"Authorized": "Geautoriseerd",
|
||||
"Revoke access": "Toegang intrekken",
|
||||
"Revoke access for {{name}}": "Toegang voor {{name}} intrekken",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "Weet je zeker dat je de toegang voor {{name}} wilt intrekken? De applicatie heeft dan geen toegang meer tot je account.",
|
||||
"Something went wrong. Please try again.": "Er is iets misgegaan. Probeer het opnieuw.",
|
||||
"Remove {{name}}": "{{name}} verwijderen",
|
||||
"Make sure you trust this application before authorizing it.": "Zorg ervoor dat je deze applicatie vertrouwt voordat je haar autoriseert.",
|
||||
"You will be redirected to": "Je wordt doorgestuurd naar",
|
||||
"View content without making changes.": "Inhoud bekijken zonder wijzigingen aan te brengen.",
|
||||
"Create and modify content.": "Inhoud maken en wijzigen.",
|
||||
"Applications and AI assistants you have authorized to access your account.": "Applicaties en AI-assistenten die je hebt geautoriseerd om toegang te krijgen tot je account.",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "MCP is ingeschakeld voor je werkruimte. Verbind AI-assistenten met je Docmost-account via OAuth.",
|
||||
"Authorized apps": "Geautoriseerde apps",
|
||||
"No authorized apps yet.": "Nog geen geautoriseerde apps.",
|
||||
"Workspace knowledge only": "Alleen werkruimtek kennis",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "Beperk AI Chat tot het beantwoorden op basis van alleen je werkruimtepagina's en geüploade bestanden. Er wordt geen externe kennis gebruikt.",
|
||||
"Toggle workspace knowledge only": "Alleen werkruimtekennis in-/uitschakelen",
|
||||
"Read-only mode": "Alleen-lezenmodus",
|
||||
"AI Chat can search and read workspace content, but cannot create or edit pages.": "AI Chat kan werkruimte-inhoud doorzoeken en lezen, maar kan geen pagina's maken of bewerken.",
|
||||
"Toggle AI Chat read-only mode": "Alleen-lezenmodus voor AI Chat in-/uitschakelen",
|
||||
"Title only": "Alleen titel",
|
||||
"you": "jij"
|
||||
"{{count}} selected_other": "{{count}} geselecteerd"
|
||||
}
|
||||
|
||||
@@ -294,7 +294,6 @@
|
||||
"Export space": "Exportar espaço",
|
||||
"Export {{type}}": "Exportar para {{type}}",
|
||||
"File exceeds the {{limit}} attachment limit": "O arquivo excede o limite de anexos {{limit}}",
|
||||
"Media": "Mídia",
|
||||
"Align left": "Alinhar à esquerda",
|
||||
"Align right": "Alinhar à direita",
|
||||
"Align center": "Alinhar ao centro",
|
||||
@@ -388,8 +387,6 @@
|
||||
"Insert horizontal rule divider": "Insira um divisor horizontal",
|
||||
"Page break": "Quebra de página",
|
||||
"Insert a page break for printing.": "Insira uma quebra de página para impressão.",
|
||||
"Footnote": "Nota de rodapé",
|
||||
"Insert a footnote reference.": "Inserir uma referência de nota de rodapé.",
|
||||
"Upload any image from your device.": "Envie qualquer imagem do seu dispositivo.",
|
||||
"Upload any video from your device.": "Envie qualquer vídeo do seu dispositivo.",
|
||||
"Upload any audio from your device.": "Envie qualquer áudio do seu dispositivo.",
|
||||
@@ -707,11 +704,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "Ative o servidor MCP para permitir que assistentes de IA e ferramentas interajam com o conteúdo do seu espaço de trabalho.",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "O MCP está disponível apenas na edição empresarial do Docmost. Contate sales@docmost.com.",
|
||||
"MCP Server URL": "URL do servidor MCP",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "Conecte assistentes de IA à sua conta do Docmost via OAuth.",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "Os assistentes de IA devem se conectar com uma conta do Docmost via OAuth. Chaves de API não podem ser usadas com o servidor MCP.",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "Use sua chave de API para autenticação. Você pode gerenciar chaves de API nas configurações da sua conta.",
|
||||
"Supported tools": "Ferramentas compatíveis",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "Seu espaço de trabalho tem MCP habilitado. Use sua chave de API para conectar assistentes de IA.",
|
||||
"MCP server URL:": "URL do servidor MCP:",
|
||||
"Learn more": "Saiba mais",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "Gerencie as chaves de API de todos os usuários do workspace. Veja a <anchor>documentação da API</anchor> para detalhes de uso.",
|
||||
@@ -1294,48 +1289,5 @@
|
||||
"{{count}} rows deleted_one": "1 row deleted",
|
||||
"{{count}} rows deleted_other": "{{count}} rows deleted",
|
||||
"{{count}} selected_one": "1 selected",
|
||||
"{{count}} selected_other": "{{count}} selected",
|
||||
"Compare": "Comparar",
|
||||
"Compare versions": "Comparar versões",
|
||||
"Select version from {{date}}": "Selecionar versão de {{date}}",
|
||||
"Version actions for {{date}}": "Ações da versão de {{date}}",
|
||||
"Comparing {{newer}} and {{older}}": "Comparando {{newer}} e {{older}}",
|
||||
"Exit compare": "Sair da comparação",
|
||||
"Search attachments...": "Pesquisar anexos...",
|
||||
"Error loading attachments.": "Erro ao carregar anexos.",
|
||||
"No attachments on this page yet.": "Ainda não há anexos nesta página.",
|
||||
"Uploaded by {{name}}": "Enviado por {{name}}",
|
||||
"Download {{name}}": "Baixar {{name}}",
|
||||
"Access revoked": "Acesso revogado",
|
||||
"Authorize application": "Autorizar aplicativo",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}} quer acessar {{workspace}}",
|
||||
"Not you? Switch account": "Não é você? Trocar conta",
|
||||
"This application will be able to:": "Este aplicativo poderá:",
|
||||
"Write": "Escrever",
|
||||
"Invalid authorization request": "Solicitação de autorização inválida",
|
||||
"Authorize": "Autorizar",
|
||||
"Application": "Aplicativo",
|
||||
"Permissions": "Permissões",
|
||||
"Authorized": "Autorizado",
|
||||
"Revoke access": "Revogar acesso",
|
||||
"Revoke access for {{name}}": "Revogar acesso de {{name}}",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "Tem certeza de que deseja revogar o acesso de {{name}}? O aplicativo não poderá mais acessar sua conta.",
|
||||
"Something went wrong. Please try again.": "Algo deu errado. Tente novamente.",
|
||||
"Remove {{name}}": "Remover {{name}}",
|
||||
"Make sure you trust this application before authorizing it.": "Certifique-se de confiar neste aplicativo antes de autorizá-lo.",
|
||||
"You will be redirected to": "Você será redirecionado para",
|
||||
"View content without making changes.": "Visualizar conteúdo sem fazer alterações.",
|
||||
"Create and modify content.": "Criar e modificar conteúdo.",
|
||||
"Applications and AI assistants you have authorized to access your account.": "Aplicativos e assistentes de IA que você autorizou a acessar sua conta.",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "Seu workspace tem o MCP ativado. Conecte assistentes de IA à sua conta do Docmost via OAuth.",
|
||||
"Authorized apps": "Aplicativos autorizados",
|
||||
"No authorized apps yet.": "Ainda não há aplicativos autorizados.",
|
||||
"Workspace knowledge only": "Somente conhecimento do workspace",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "Restrinja o AI Chat para responder apenas com base nas páginas do seu workspace e nos arquivos enviados. Ele não usará conhecimento externo.",
|
||||
"Toggle workspace knowledge only": "Alternar somente conhecimento do workspace",
|
||||
"Read-only mode": "Modo somente leitura",
|
||||
"AI Chat can search and read workspace content, but cannot create or edit pages.": "O AI Chat pode pesquisar e ler o conteúdo do workspace, mas não pode criar nem editar páginas.",
|
||||
"Toggle AI Chat read-only mode": "Alternar modo somente leitura do AI Chat",
|
||||
"Title only": "Somente título",
|
||||
"you": "você"
|
||||
"{{count}} selected_other": "{{count}} selected"
|
||||
}
|
||||
|
||||
@@ -294,7 +294,6 @@
|
||||
"Export space": "Экспорт пространства",
|
||||
"Export {{type}}": "Экспорт {{type}}",
|
||||
"File exceeds the {{limit}} attachment limit": "Файл превышает лимит вложений {{limit}}",
|
||||
"Media": "Медиа",
|
||||
"Align left": "По левому краю",
|
||||
"Align right": "По правому краю",
|
||||
"Align center": "По центру",
|
||||
@@ -388,8 +387,6 @@
|
||||
"Insert horizontal rule divider": "Вставить горизонтальный разделитель",
|
||||
"Page break": "Разрыв страницы",
|
||||
"Insert a page break for printing.": "Вставить разрыв страницы для печати.",
|
||||
"Footnote": "Сноска",
|
||||
"Insert a footnote reference.": "Вставить ссылку на сноску.",
|
||||
"Upload any image from your device.": "Загрузить любое изображение с вашего устройства.",
|
||||
"Upload any video from your device.": "Загрузить любое видео с вашего устройства.",
|
||||
"Upload any audio from your device.": "Загрузите любой аудиофайл с вашего устройства.",
|
||||
@@ -707,11 +704,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "Включите сервер MCP, чтобы ИИ-ассистенты и инструменты могли взаимодействовать с содержимым вашего рабочего пространства.",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP доступен только в корпоративной версии Docmost. Свяжитесь по адресу sales@docmost.com.",
|
||||
"MCP Server URL": "URL сервера MCP",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "Подключайте AI-помощников к вашей учетной записи Docmost через OAuth.",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "AI-помощники должны подключаться к учетной записи Docmost через OAuth. Ключи API нельзя использовать с MCP-сервером.",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "Используйте ваш API-ключ для аутентификации. Управлять API-ключами можно в настройках аккаунта.",
|
||||
"Supported tools": "Поддерживаемые инструменты",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "В вашем рабочем пространстве включён MCP. Используйте свой API-ключ для подключения ИИ-ассистентов.",
|
||||
"MCP server URL:": "URL сервера MCP:",
|
||||
"Learn more": "Подробнее",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "Управляйте API-ключами для всех пользователей в рабочем пространстве. Смотрите <anchor>документацию по API</anchor> для получения информации об использовании.",
|
||||
@@ -1191,8 +1186,8 @@
|
||||
"Default value": "Значение по умолчанию",
|
||||
"Delete property": "Удалить свойство",
|
||||
"Delete view": "Удалить представление",
|
||||
"Delete {{count}} rows?_one": "Удалить 1 строку?",
|
||||
"Delete {{count}} rows?_other": "Удалить {{count}} строк?",
|
||||
"Delete {{count}} rows?_one": "Delete 1 row?",
|
||||
"Delete {{count}} rows?_other": "Delete {{count}} rows?",
|
||||
"Descending": "По убыванию",
|
||||
"Discard": "Отменить",
|
||||
"Doesn't contain": "Не содержит",
|
||||
@@ -1291,51 +1286,8 @@
|
||||
"Value": "Значение",
|
||||
"View updated for everyone": "Представление обновлено для всех",
|
||||
"You have unsaved changes. Do you want to discard them?": "У вас есть несохранённые изменения. Хотите их отменить?",
|
||||
"{{count}} rows deleted_one": "1 строка удалена",
|
||||
"{{count}} rows deleted_other": "{{count}} строк удалено",
|
||||
"{{count}} selected_one": "1 выбрано",
|
||||
"{{count}} selected_other": "{{count}} выбрано",
|
||||
"Compare": "Сравнить",
|
||||
"Compare versions": "Сравнить версии",
|
||||
"Select version from {{date}}": "Выбрать версию от {{date}}",
|
||||
"Version actions for {{date}}": "Действия с версией от {{date}}",
|
||||
"Comparing {{newer}} and {{older}}": "Сравнение {{newer}} и {{older}}",
|
||||
"Exit compare": "Выйти из режима сравнения",
|
||||
"Search attachments...": "Поиск вложений...",
|
||||
"Error loading attachments.": "Ошибка при загрузке вложений.",
|
||||
"No attachments on this page yet.": "На этой странице пока нет вложений.",
|
||||
"Uploaded by {{name}}": "Загружено пользователем {{name}}",
|
||||
"Download {{name}}": "Скачать {{name}}",
|
||||
"Access revoked": "Доступ отозван",
|
||||
"Authorize application": "Авторизовать приложение",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}} запрашивает доступ к {{workspace}}",
|
||||
"Not you? Switch account": "Не вы? Сменить аккаунт",
|
||||
"This application will be able to:": "Это приложение сможет:",
|
||||
"Write": "Запись",
|
||||
"Invalid authorization request": "Недопустимый запрос на авторизацию",
|
||||
"Authorize": "Авторизовать",
|
||||
"Application": "Приложение",
|
||||
"Permissions": "Разрешения",
|
||||
"Authorized": "Авторизовано",
|
||||
"Revoke access": "Отозвать доступ",
|
||||
"Revoke access for {{name}}": "Отозвать доступ для {{name}}",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "Вы уверены, что хотите отозвать доступ для {{name}}? Приложение больше не сможет получить доступ к вашей учетной записи.",
|
||||
"Something went wrong. Please try again.": "Что-то пошло не так. Пожалуйста, попробуйте еще раз.",
|
||||
"Remove {{name}}": "Удалить {{name}}",
|
||||
"Make sure you trust this application before authorizing it.": "Прежде чем авторизовать это приложение, убедитесь, что вы ему доверяете.",
|
||||
"You will be redirected to": "Вы будете перенаправлены на",
|
||||
"View content without making changes.": "Просматривать содержимое без внесения изменений.",
|
||||
"Create and modify content.": "Создавать и изменять содержимое.",
|
||||
"Applications and AI assistants you have authorized to access your account.": "Приложения и AI-помощники, которым вы разрешили доступ к своей учетной записи.",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "В вашем рабочем пространстве включен MCP. Подключайте AI-помощников к вашей учетной записи Docmost через OAuth.",
|
||||
"Authorized apps": "Авторизованные приложения",
|
||||
"No authorized apps yet.": "Пока нет авторизованных приложений.",
|
||||
"Workspace knowledge only": "Только знания рабочего пространства",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "Ограничить AI Chat ответами только на основе страниц вашего рабочего пространства и загруженных файлов. Внешние знания использоваться не будут.",
|
||||
"Toggle workspace knowledge only": "Переключить режим \"Только знания рабочего пространства\"",
|
||||
"Read-only mode": "Режим только для чтения",
|
||||
"AI Chat can search and read workspace content, but cannot create or edit pages.": "AI Chat может искать и читать содержимое рабочего пространства, но не может создавать или редактировать страницы.",
|
||||
"Toggle AI Chat read-only mode": "Переключить режим только для чтения для AI Chat",
|
||||
"Title only": "Только заголовок",
|
||||
"you": "вы"
|
||||
"{{count}} rows deleted_one": "1 row deleted",
|
||||
"{{count}} rows deleted_other": "{{count}} rows deleted",
|
||||
"{{count}} selected_one": "1 selected",
|
||||
"{{count}} selected_other": "{{count}} selected"
|
||||
}
|
||||
|
||||
@@ -294,7 +294,6 @@
|
||||
"Export space": "Експорт простору",
|
||||
"Export {{type}}": "Експорт {{type}}",
|
||||
"File exceeds the {{limit}} attachment limit": "Файл перевищує ліміт вкладень {{limit}}",
|
||||
"Media": "Медіа",
|
||||
"Align left": "По лівому краю",
|
||||
"Align right": "По правому краю",
|
||||
"Align center": "По центру",
|
||||
@@ -388,8 +387,6 @@
|
||||
"Insert horizontal rule divider": "Вставити горизонтальний роздільник",
|
||||
"Page break": "Розрив сторінки",
|
||||
"Insert a page break for printing.": "Вставте розрив сторінки для друку.",
|
||||
"Footnote": "Виноска",
|
||||
"Insert a footnote reference.": "Вставити посилання на виноску.",
|
||||
"Upload any image from your device.": "Завантажити будь-яке зображення з вашого пристрою.",
|
||||
"Upload any video from your device.": "Завантажити будь-яке відео з вашого пристрою.",
|
||||
"Upload any audio from your device.": "Завантажте будь-який аудіофайл зі свого пристрою.",
|
||||
@@ -707,11 +704,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "Увімкніть MCP‑сервер, щоб дозволити ШІ‑помічникам та інструментам взаємодіяти з вмістом вашого робочого простору.",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP доступний лише в корпоративній редакції Docmost. Зверніться до sales@docmost.com.",
|
||||
"MCP Server URL": "URL сервера MCP",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "Підключайте AI-асистентів до свого облікового запису Docmost через OAuth.",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "AI-асистенти повинні підключатися до облікового запису Docmost через OAuth. Ключі API не можна використовувати з MCP-сервером.",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "Використовуйте свій API‑ключ для аутентифікації. Ви можете керувати API‑ключами в налаштуваннях облікового запису.",
|
||||
"Supported tools": "Підтримувані інструменти",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "У вашому робочому просторі MCP увімкнено. Використайте свій API‑ключ, щоб підключити ШІ‑помічників.",
|
||||
"MCP server URL:": "URL сервера MCP:",
|
||||
"Learn more": "Дізнатися більше",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "Керуйте ключами API для всіх користувачів у робочому просторі. Перегляньте <anchor>документацію API</anchor> для деталей використання.",
|
||||
@@ -1294,48 +1289,5 @@
|
||||
"{{count}} rows deleted_one": "1 row deleted",
|
||||
"{{count}} rows deleted_other": "{{count}} rows deleted",
|
||||
"{{count}} selected_one": "1 selected",
|
||||
"{{count}} selected_other": "{{count}} selected",
|
||||
"Compare": "Порівняти",
|
||||
"Compare versions": "Порівняти версії",
|
||||
"Select version from {{date}}": "Виберіть версію від {{date}}",
|
||||
"Version actions for {{date}}": "Дії з версією від {{date}}",
|
||||
"Comparing {{newer}} and {{older}}": "Порівняння {{newer}} і {{older}}",
|
||||
"Exit compare": "Вийти з режиму порівняння",
|
||||
"Search attachments...": "Пошук вкладень...",
|
||||
"Error loading attachments.": "Помилка завантаження вкладень.",
|
||||
"No attachments on this page yet.": "На цій сторінці ще немає вкладень.",
|
||||
"Uploaded by {{name}}": "Завантажено користувачем {{name}}",
|
||||
"Download {{name}}": "Завантажити {{name}}",
|
||||
"Access revoked": "Доступ відкликано",
|
||||
"Authorize application": "Авторизувати застосунок",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}} хоче отримати доступ до {{workspace}}",
|
||||
"Not you? Switch account": "Не ви? Змінити обліковий запис",
|
||||
"This application will be able to:": "Цей застосунок зможе:",
|
||||
"Write": "Запис",
|
||||
"Invalid authorization request": "Недійсний запит на авторизацію",
|
||||
"Authorize": "Авторизувати",
|
||||
"Application": "Застосунок",
|
||||
"Permissions": "Дозволи",
|
||||
"Authorized": "Авторизовано",
|
||||
"Revoke access": "Відкликати доступ",
|
||||
"Revoke access for {{name}}": "Відкликати доступ для {{name}}",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "Ви впевнені, що хочете відкликати доступ для {{name}}? Застосунок більше не зможе отримувати доступ до вашого облікового запису.",
|
||||
"Something went wrong. Please try again.": "Щось пішло не так. Спробуйте ще раз.",
|
||||
"Remove {{name}}": "Видалити {{name}}",
|
||||
"Make sure you trust this application before authorizing it.": "Перш ніж авторизувати цей застосунок, переконайтеся, що ви йому довіряєте.",
|
||||
"You will be redirected to": "Вас буде перенаправлено на",
|
||||
"View content without making changes.": "Переглядати вміст без внесення змін.",
|
||||
"Create and modify content.": "Створювати та змінювати вміст.",
|
||||
"Applications and AI assistants you have authorized to access your account.": "Застосунки та AI-асистенти, яким ви надали дозвіл на доступ до свого облікового запису.",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "У вашому робочому просторі ввімкнено MCP. Підключайте AI-асистентів до свого облікового запису Docmost через OAuth.",
|
||||
"Authorized apps": "Авторизовані застосунки",
|
||||
"No authorized apps yet.": "Авторизованих застосунків ще немає.",
|
||||
"Workspace knowledge only": "Лише знання робочого простору",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "Обмежити AI Chat відповідями лише на основі сторінок вашого робочого простору та завантажених файлів. Зовнішні знання не використовуватимуться.",
|
||||
"Toggle workspace knowledge only": "Перемкнути режим лише знань робочого простору",
|
||||
"Read-only mode": "Режим лише читання",
|
||||
"AI Chat can search and read workspace content, but cannot create or edit pages.": "AI Chat може шукати та читати вміст робочого простору, але не може створювати або редагувати сторінки.",
|
||||
"Toggle AI Chat read-only mode": "Перемкнути режим лише читання для AI Chat",
|
||||
"Title only": "Лише заголовок",
|
||||
"you": "ви"
|
||||
"{{count}} selected_other": "{{count}} selected"
|
||||
}
|
||||
|
||||
@@ -294,7 +294,6 @@
|
||||
"Export space": "导出空间",
|
||||
"Export {{type}}": "导出为 {{type}}",
|
||||
"File exceeds the {{limit}} attachment limit": "文件超出了 {{limit}} 类型附件限制",
|
||||
"Media": "媒体",
|
||||
"Align left": "靠左对齐",
|
||||
"Align right": "靠右对齐",
|
||||
"Align center": "居中对齐",
|
||||
@@ -388,8 +387,6 @@
|
||||
"Insert horizontal rule divider": "插入水平分割线",
|
||||
"Page break": "分页符",
|
||||
"Insert a page break for printing.": "插入一个用于打印的分页符。",
|
||||
"Footnote": "脚注",
|
||||
"Insert a footnote reference.": "插入脚注引用。",
|
||||
"Upload any image from your device.": "从设备上传任何图像",
|
||||
"Upload any video from your device.": "从设备上传任何视频",
|
||||
"Upload any audio from your device.": "从您的设备上传任意音频文件。",
|
||||
@@ -707,11 +704,9 @@
|
||||
"Enable the MCP server to allow AI assistants and tools to interact with your workspace content.": "启用 MCP 服务器以允许 AI 助手和工具与您的工作区内容交互。",
|
||||
"MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP 仅在 Docmost 企业版中提供。请联系 sales@docmost.com。",
|
||||
"MCP Server URL": "MCP 服务器 URL",
|
||||
"Connect AI assistants with your Docmost account via OAuth.": "通过 OAuth 将 AI 助手连接到你的 Docmost 账户。",
|
||||
"Enforce OAuth": "Enforce OAuth",
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "AI 助手必须通过 OAuth 使用 Docmost 账户连接。MCP 服务器不能使用 API 密钥。",
|
||||
"Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP",
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.": "使用您的 API 密钥进行身份验证。您可以在账户设置中管理 API 密钥。",
|
||||
"Supported tools": "支持的工具",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.": "您的工作区已启用 MCP。使用您的 API 密钥连接 AI 助手。",
|
||||
"MCP server URL:": "MCP 服务器 URL:",
|
||||
"Learn more": "了解更多",
|
||||
"Manage API keys for all users in the workspace. View the <anchor>API documentation</anchor> for usage details.": "为工作区内所有用户管理 API 密钥。有关使用详情,请查阅<anchor>API 文档</anchor>。",
|
||||
@@ -1294,48 +1289,5 @@
|
||||
"{{count}} rows deleted_one": "已删除 1 行",
|
||||
"{{count}} rows deleted_other": "已删除 {{count}} 行",
|
||||
"{{count}} selected_one": "已选择 1 项",
|
||||
"{{count}} selected_other": "已选择 {{count}} 项",
|
||||
"Compare": "比较",
|
||||
"Compare versions": "比较版本",
|
||||
"Select version from {{date}}": "选择 {{date}} 的版本",
|
||||
"Version actions for {{date}}": "{{date}} 的版本操作",
|
||||
"Comparing {{newer}} and {{older}}": "正在比较 {{newer}} 和 {{older}}",
|
||||
"Exit compare": "退出比较",
|
||||
"Search attachments...": "搜索附件……",
|
||||
"Error loading attachments.": "加载附件时出错。",
|
||||
"No attachments on this page yet.": "此页面上还没有附件。",
|
||||
"Uploaded by {{name}}": "由 {{name}} 上传",
|
||||
"Download {{name}}": "下载 {{name}}",
|
||||
"Access revoked": "访问权限已撤销",
|
||||
"Authorize application": "授权应用程序",
|
||||
"{{name}} wants to access {{workspace}}": "{{name}} 想要访问 {{workspace}}",
|
||||
"Not you? Switch account": "不是你?切换账户",
|
||||
"This application will be able to:": "此应用程序将能够:",
|
||||
"Write": "写入",
|
||||
"Invalid authorization request": "无效的授权请求",
|
||||
"Authorize": "授权",
|
||||
"Application": "应用程序",
|
||||
"Permissions": "权限",
|
||||
"Authorized": "已授权",
|
||||
"Revoke access": "撤销访问权限",
|
||||
"Revoke access for {{name}}": "撤销 {{name}} 的访问权限",
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.": "你确定要撤销 {{name}} 的访问权限吗?该应用程序将无法再访问你的账户。",
|
||||
"Something went wrong. Please try again.": "出了点问题。请重试。",
|
||||
"Remove {{name}}": "移除 {{name}}",
|
||||
"Make sure you trust this application before authorizing it.": "在授权之前,请确保你信任此应用程序。",
|
||||
"You will be redirected to": "你将被重定向到",
|
||||
"View content without making changes.": "查看内容而不进行更改。",
|
||||
"Create and modify content.": "创建和修改内容。",
|
||||
"Applications and AI assistants you have authorized to access your account.": "你已授权访问你账户的应用程序和 AI 助手。",
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.": "你的工作区已启用 MCP。通过 OAuth 将 AI 助手连接到你的 Docmost 账户。",
|
||||
"Authorized apps": "已授权的应用",
|
||||
"No authorized apps yet.": "尚无已授权的应用。",
|
||||
"Workspace knowledge only": "仅限工作区知识",
|
||||
"Restrict AI Chat to answering from your workspace pages and uploaded files only. It will not use outside knowledge.": "将 AI 聊天限制为仅根据你的工作区页面和已上传文件进行回答。它不会使用外部知识。",
|
||||
"Toggle workspace knowledge only": "切换“仅限工作区知识”",
|
||||
"Read-only mode": "只读模式",
|
||||
"AI Chat can search and read workspace content, but cannot create or edit pages.": "AI 聊天可以搜索和读取工作区内容,但不能创建或编辑页面。",
|
||||
"Toggle AI Chat read-only mode": "切换 AI 聊天只读模式",
|
||||
"Title only": "仅标题",
|
||||
"you": "你"
|
||||
"{{count}} selected_other": "已选择 {{count}} 项"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import { useTranslation } from "react-i18next";
|
||||
import { useRedirectToCloudSelect } from "@/ee/hooks/use-redirect-to-cloud-select.tsx";
|
||||
import { useTrackOrigin } from "@/hooks/use-track-origin";
|
||||
|
||||
|
||||
const SetupWorkspace = lazy(() => import("@/pages/auth/setup-workspace.tsx"));
|
||||
const LoginPage = lazy(() => import("@/pages/auth/login"));
|
||||
const Home = lazy(() => import("@/pages/dashboard/home"));
|
||||
@@ -74,16 +73,6 @@ const FavoritesPage = lazy(() => import("@/pages/favorites/favorites-page"));
|
||||
const AiChat = lazy(() => import("@/ee/ai-chat/pages/ai-chat.tsx"));
|
||||
const VerifyEmail = lazy(() => import("@/ee/pages/verify-email.tsx"));
|
||||
const LabelPage = lazy(() => import("@/pages/label/label-page"));
|
||||
const OAuthConsent = lazy(() => import("@/ee/oauth/pages/oauth-consent.tsx"));
|
||||
const Integrations = lazy(
|
||||
() => import("@/features/integration/pages/integrations.tsx"),
|
||||
);
|
||||
const Connections = lazy(
|
||||
() => import("@/features/integration/pages/connections.tsx"),
|
||||
);
|
||||
const SlackLinkPage = lazy(
|
||||
() => import("@/features/integration/pages/slack-link.tsx"),
|
||||
);
|
||||
|
||||
export default function App() {
|
||||
const { t } = useTranslation();
|
||||
@@ -106,7 +95,6 @@ export default function App() {
|
||||
<Route path={"/password-reset"} element={<PasswordReset />} />
|
||||
<Route path={"/login/mfa"} element={<MfaChallengePage />} />
|
||||
<Route path={"/login/mfa/setup"} element={<MfaSetupRequiredPage />} />
|
||||
<Route path={"/oauth/consent"} element={<OAuthConsent />} />
|
||||
|
||||
{!isCloud() && (
|
||||
<Route path={"/setup/register"} element={<SetupWorkspace />} />
|
||||
@@ -131,7 +119,6 @@ export default function App() {
|
||||
<Route path={"/pdf-render/:pageId"} element={<PdfRenderPage />} />
|
||||
<Route path={"/share/:shareId"} element={<ShareRedirect />} />
|
||||
<Route path={"/p/:pageSlug"} element={<PageRedirect />} />
|
||||
<Route path={"/integrations/slack/link"} element={<SlackLinkPage />} />
|
||||
|
||||
<Route element={<Layout />}>
|
||||
<Route path={"/home"} element={<Home />} />
|
||||
@@ -161,11 +148,6 @@ export default function App() {
|
||||
element={<AccountPreferences />}
|
||||
/>
|
||||
<Route path={"account/api-keys"} element={<UserApiKeys />} />
|
||||
<Route
|
||||
path={"account/api-keys/authorized-apps"}
|
||||
element={<UserApiKeys />}
|
||||
/>
|
||||
<Route path={"account/connections"} element={<Connections />} />
|
||||
<Route path={"workspace"} element={<WorkspaceSettings />} />
|
||||
<Route path={"members"} element={<WorkspaceMembers />} />
|
||||
<Route path={"api-keys"} element={<WorkspaceApiKeys />} />
|
||||
@@ -178,7 +160,6 @@ export default function App() {
|
||||
<Route path={"ai/mcp"} element={<AiSettings />} />
|
||||
<Route path={"audit"} element={<AuditLogs />} />
|
||||
<Route path={"verifications"} element={<VerifiedPages />} />
|
||||
<Route path={"integrations"} element={<Integrations />} />
|
||||
{!isCloud() && <Route path={"license"} element={<License />} />}
|
||||
{isCloud() && <Route path={"billing"} element={<Billing />} />}
|
||||
</Route>
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import { rem } from '@mantine/core';
|
||||
|
||||
interface Props {
|
||||
size?: number | string;
|
||||
}
|
||||
|
||||
export function GithubIcon({ size }: Props) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 512 512"
|
||||
style={{ width: rem(size), height: rem(size) }}
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M256 6.3C114.6 6.3 0 120.9 0 262.3c0 113.3 73.3 209 175 242.9 12.8 2.2 17.6-5.4 17.6-12.2 0-6.1-.3-26.2-.3-47.7-64.3 11.8-81-15.7-86.1-30.1-2.9-7.4-15.4-30.1-26.2-36.2-9-4.8-21.8-16.6-.3-17 20.2-.3 34.6 18.6 39.4 26.2 23 38.7 59.8 27.8 74.6 21.1 2.2-16.6 9-27.8 16.3-34.2-57-6.4-116.5-28.5-116.5-126.4 0-27.8 9.9-50.9 26.2-68.8-2.6-6.4-11.5-32.6 2.6-67.8 0 0 21.4-6.7 70.4 26.2 20.5-5.8 42.2-8.6 64-8.6s43.5 2.9 64 8.6c49-33.3 70.4-26.2 70.4-26.2 14.1 35.2 5.1 61.4 2.6 67.8 16.3 17.9 26.2 40.6 26.2 68.8 0 98.2-59.8 120-116.8 126.4 9.3 8 17.3 23.4 17.3 47.4 0 34.2-.3 61.8-.3 70.4 0 6.7 4.8 14.7 17.6 12.2C438.7 471.3 512 375.3 512 262.3c0-141.4-114.6-256-256-256"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import { rem } from '@mantine/core';
|
||||
|
||||
interface Props {
|
||||
size?: number | string;
|
||||
}
|
||||
|
||||
export function GitlabIcon({ size }: Props) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="93.97 97.52 192.05 184.99"
|
||||
style={{ width: rem(size), height: rem(size) }}
|
||||
>
|
||||
<path
|
||||
fill="#e24329"
|
||||
d="m282.83 170.73-.27-.69-26.14-68.22a6.8 6.8 0 0 0-2.69-3.24 7 7 0 0 0-8 .43 7 7 0 0 0-2.32 3.52l-17.65 54h-71.47l-17.65-54a6.86 6.86 0 0 0-2.32-3.53 7 7 0 0 0-8-.43 6.87 6.87 0 0 0-2.69 3.24L97.44 170l-.26.69a48.54 48.54 0 0 0 16.1 56.1l.09.07.24.17 39.82 29.82 19.7 14.91 12 9.06a8.07 8.07 0 0 0 9.76 0l12-9.06 19.7-14.91 40.06-30 .1-.08a48.56 48.56 0 0 0 16.08-56.04"
|
||||
/>
|
||||
<path
|
||||
fill="#fc6d26"
|
||||
d="m282.83 170.73-.27-.69a88.3 88.3 0 0 0-35.15 15.8L190 229.25c19.55 14.79 36.57 27.64 36.57 27.64l40.06-30 .1-.08a48.56 48.56 0 0 0 16.1-56.08"
|
||||
/>
|
||||
<path
|
||||
fill="#fca326"
|
||||
d="m153.43 256.89 19.7 14.91 12 9.06a8.07 8.07 0 0 0 9.76 0l12-9.06 19.7-14.91S209.55 244 190 229.25c-19.55 14.75-36.57 27.64-36.57 27.64"
|
||||
/>
|
||||
<path
|
||||
fill="#fc6d26"
|
||||
d="M132.58 185.84A88.2 88.2 0 0 0 97.44 170l-.26.69a48.54 48.54 0 0 0 16.1 56.1l.09.07.24.17 39.82 29.82L190 229.21Z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import { rem } from '@mantine/core';
|
||||
|
||||
interface Props {
|
||||
size?: number | string;
|
||||
}
|
||||
|
||||
export function GoogleDocsIcon({ size }: Props) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 47 65"
|
||||
style={{ width: rem(size), height: rem(size) }}
|
||||
>
|
||||
<path
|
||||
fill="#4285F4"
|
||||
d="M29.375 0H4.406C1.983 0 0 1.994 0 4.432v56.136C0 63.006 1.983 65 4.406 65h38.188C45.017 65 47 63.006 47 60.568v-42.84L36.719 10.34z"
|
||||
/>
|
||||
<path
|
||||
fill="#A1C2FA"
|
||||
d="M29.375 0v13.295c0 2.449 1.972 4.432 4.406 4.432H47z"
|
||||
/>
|
||||
<path
|
||||
fill="#F1F1F1"
|
||||
d="M11.75 47.273h23.5v-2.955h-23.5zm0 5.909h17.625v-2.955H11.75zm0-20.682v2.955h23.5V32.5zm0 8.864h23.5v-2.955h-23.5z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -1,16 +1,10 @@
|
||||
export { AirtableIcon } from "./airtable-icon.tsx";
|
||||
export { FigmaIcon } from "./figma-icon.tsx";
|
||||
export { GithubIcon } from "./github-icon.tsx";
|
||||
export { GitlabIcon } from "./gitlab-icon.tsx";
|
||||
export { GoogleDocsIcon } from "./google-docs-icon.tsx";
|
||||
export { GoogleDriveIcon } from "./google-drive-icon.tsx";
|
||||
export { GoogleSheetsIcon } from "./google-sheets-icon.tsx";
|
||||
export { JiraIcon } from "./jira-icon.tsx";
|
||||
export { LinearIcon } from "./linear-icon.tsx";
|
||||
export { TypeformIcon } from "./typeform-icon.tsx";
|
||||
export { VimeoIcon } from "./vimeo-icon.tsx";
|
||||
export { MiroIcon } from "./miro-icon.tsx";
|
||||
export { SlackIcon } from "./slack-icon.tsx";
|
||||
export { GoogleDriveIcon } from "./google-drive-icon.tsx";
|
||||
export { GoogleSheetsIcon } from "./google-sheets-icon.tsx";
|
||||
export { FramerIcon } from "./framer-icon.tsx";
|
||||
export { LoomIcon } from "./loom-icon.tsx";
|
||||
export { YoutubeIcon } from "./youtube-icon.tsx";
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import { rem } from '@mantine/core';
|
||||
|
||||
interface Props {
|
||||
size?: number | string;
|
||||
}
|
||||
|
||||
export function JiraIcon({ size }: Props) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 512 512"
|
||||
style={{ width: rem(size), height: rem(size) }}
|
||||
>
|
||||
<defs>
|
||||
<linearGradient id="jira-a" x1="380.896" x2="279.145" y1="390.609" y2="282.574" gradientTransform="matrix(1 0 0 -1 0 514)" gradientUnits="userSpaceOnUse">
|
||||
<stop offset=".176" stopColor="#0052cc" />
|
||||
<stop offset="1" stopColor="#2684ff" />
|
||||
</linearGradient>
|
||||
<linearGradient id="jira-b" x1="265.965" x2="148.117" y1="270.661" y2="152.607" gradientTransform="matrix(1 0 0 -1 0 514)" gradientUnits="userSpaceOnUse">
|
||||
<stop offset=".176" stopColor="#0052cc" />
|
||||
<stop offset="1" stopColor="#2684ff" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path
|
||||
fill="#2684ff"
|
||||
d="M490.6 7.4H243.9c0 59.6 49.9 108 111.2 108h45.6v42.2c0 59.6 49.9 108 111.2 108V28.1c.1-11.7-9.2-20.7-21.3-20.7"
|
||||
/>
|
||||
<path
|
||||
fill="url(#jira-a)"
|
||||
d="M368.7 126.5H121.9c0 59.6 49.9 108 111.2 108h45.6v42.9c0 59.6 49.9 108 111.2 108V147.3c.2-11.1-9.1-20.8-21.2-20.8"
|
||||
/>
|
||||
<path
|
||||
fill="url(#jira-b)"
|
||||
d="M246.7 246.3H0c0 59.6 49.9 108 111.2 108h45.6v42.2c0 59.6 49.9 108 111.2 108V267.1c.1-11.8-9.9-20.8-21.3-20.8"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import { rem } from '@mantine/core';
|
||||
|
||||
interface Props {
|
||||
size?: number | string;
|
||||
}
|
||||
|
||||
export function LinearIcon({ size }: Props) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 100 100"
|
||||
style={{ width: rem(size), height: rem(size) }}
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M1.22541 61.5228c-.2225-.9485.90748-1.5459 1.59638-.857L39.3342 97.1782c.6889.6889.0915 1.8189-.857 1.5964C20.0515 94.4522 5.54779 79.9485 1.22541 61.5228ZM.00189135 46.8891c-.01764375.2833.08887215.5599.28957165.7606L52.3503 99.7085c.2007.2007.4773.3075.7606.2896 2.3692-.1476 4.6938-.46 6.9624-.9259.7645-.157 1.0301-1.0963.4782-1.6481L2.57595 39.4485c-.55186-.5519-1.49117-.2863-1.648174.4782-.465915 2.2686-.77832 4.5932-.92588465 6.9624ZM4.21093 29.7054c-.16649.3738-.08169.8106.20765 1.1l64.77602 64.776c.2894.2894.7262.3742 1.1.2077 1.7861-.7956 3.5171-1.6927 5.1855-2.684.5521-.328.6373-1.0867.1832-1.5407L8.43566 24.3367c-.45409-.4541-1.21271-.3689-1.54074.1832-.99132 1.6684-1.88843 3.3994-2.68399 5.1855ZM12.6587 18.074c-.3701-.3701-.393-.9637-.0443-1.3541C21.7795 6.45931 35.1114 0 49.9519 0 77.5927 0 100 22.4073 100 50.0481c0 14.8405-6.4593 28.1724-16.7199 37.3375-.3903.3487-.984.3258-1.3542-.0443L12.6587 18.074Z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -8,20 +8,11 @@ export function MiroIcon({ size }: Props) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="3 2 395 395"
|
||||
viewBox="0 0 24 24"
|
||||
style={{ width: rem(size), height: rem(size) }}
|
||||
>
|
||||
<path
|
||||
fill="#FFDD33"
|
||||
d="M3 100.754C3 46.2604 47.2435 2 101.754 2H299.246C353.756 2 398 46.2435 398 100.754V298.246C398 352.756 353.756 397 299.246 397H101.754C47.2435 397 3 352.756 3 298.246V100.754Z"
|
||||
/>
|
||||
<path
|
||||
fill="#1C1C1E"
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M265.573 77.3491H229.74L259.629 129.85L193.906 77.3491H158.072L190.934 141.468L122.238 77.3491H86.4041L122.238 159.031L86.4041 322.377H122.238L190.934 147.396L158.072 322.377H193.906L259.629 135.693L229.74 322.377H265.573L331.297 118.232L265.573 77.4335V77.3491Z"
|
||||
/>
|
||||
d="M17.392 0H13.9L17 4.808 10.444 0H6.949l3.102 6.3L3.494 0H0l3.05 8.131L0 24h3.494L10.05 6.985 6.949 24h3.494L17 5.494 13.899 24h3.493L24 3.672 17.392 0z" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
import { rem } from '@mantine/core';
|
||||
|
||||
interface Props {
|
||||
size?: number | string;
|
||||
}
|
||||
|
||||
export function SlackIcon({ size }: Props) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 512 512"
|
||||
style={{ width: rem(size), height: rem(size) }}
|
||||
>
|
||||
<path
|
||||
d="M107.9 323.6c0 29.7-24 53.8-53.8 53.8S.3 353.4.3 323.6c0-29.7 24-53.8 53.8-53.8h53.8zm26.9 0c0-29.7 24-53.8 53.8-53.8s53.8 24 53.8 53.8V458c0 29.7-24 53.8-53.8 53.8s-53.8-24-53.8-53.8z"
|
||||
fill="#e01e5a"
|
||||
/>
|
||||
<path
|
||||
d="M188.6 107.7c-29.7 0-53.8-24-53.8-53.8S158.8.1 188.6.1s53.8 24 53.8 53.8v53.8zm0 27.3c29.7 0 53.8 24 53.8 53.8s-24 53.8-53.8 53.8H53.8C24 242.6 0 218.5 0 188.8S24 135 53.8 135z"
|
||||
fill="#36c5f0"
|
||||
/>
|
||||
<path
|
||||
d="M404.1 188.8c0-29.7 24-53.8 53.8-53.8s53.8 24 53.8 53.8-24 53.8-53.8 53.8h-53.8zm-26.9 0c0 29.7-24 53.8-53.8 53.8-29.7 0-53.8-24-53.8-53.8V54c0-29.7 24-53.8 53.8-53.8s53.8 24 53.8 53.8z"
|
||||
fill="#2eb67d"
|
||||
/>
|
||||
<path
|
||||
d="M323.4 404.3c29.7 0 53.8 24 53.8 53.8 0 29.7-24 53.8-53.8 53.8-29.7 0-53.8-24-53.8-53.8v-53.8zm0-26.9c-29.7 0-53.8-24-53.8-53.8s24-53.8 53.8-53.8h134.8c29.7 0 53.8 24 53.8 53.8 0 29.7-24 53.8-53.8 53.8z"
|
||||
fill="#ecb22e"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
IconKey,
|
||||
IconWorld,
|
||||
IconSparkles,
|
||||
IconPlug,
|
||||
IconHistory,
|
||||
IconShieldCheck,
|
||||
} from "@tabler/icons-react";
|
||||
@@ -75,11 +74,6 @@ const groupedData: DataGroup[] = [
|
||||
path: "/settings/account/api-keys",
|
||||
feature: Feature.API_KEYS,
|
||||
},
|
||||
{
|
||||
label: "Connections",
|
||||
icon: IconPlug,
|
||||
path: "/settings/account/connections",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -131,12 +125,6 @@ const groupedData: DataGroup[] = [
|
||||
role: "owner",
|
||||
env: "selfhosted",
|
||||
},
|
||||
{
|
||||
label: "Integrations",
|
||||
icon: IconPlug,
|
||||
path: "/settings/integrations",
|
||||
role: "admin",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
Anchor,
|
||||
Badge,
|
||||
Group,
|
||||
List,
|
||||
Text,
|
||||
@@ -108,11 +107,11 @@ export default function McpSettings() {
|
||||
</CopyButton>
|
||||
</Group>
|
||||
<Text size="sm" c="dimmed" mt="xs">
|
||||
{t("Connect AI assistants with your Docmost account via OAuth.")}
|
||||
{t(
|
||||
"Use your API key for authentication. You can manage API keys in your account settings.",
|
||||
)}
|
||||
</Text>
|
||||
|
||||
<McpEnforceOauthSetting />
|
||||
|
||||
<div>
|
||||
<Text size="sm" fw={500} mt="md" mb={4}>
|
||||
{t("Supported tools")}
|
||||
@@ -155,56 +154,3 @@ export default function McpSettings() {
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
function McpEnforceOauthSetting() {
|
||||
const { t } = useTranslation();
|
||||
const [workspace, setWorkspace] = useAtom(workspaceAtom);
|
||||
const [checked, setChecked] = useState(workspace?.settings?.ai?.enforceMcpOauth);
|
||||
const hasAccess = useHasFeature(Feature.MCP_CONTROLS);
|
||||
const upgradeLabel = useUpgradeLabel();
|
||||
|
||||
const handleChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const value = event.currentTarget.checked;
|
||||
try {
|
||||
const updatedWorkspace = await updateWorkspace({ enforceMcpOauth: value });
|
||||
setChecked(value);
|
||||
setWorkspace(updatedWorkspace);
|
||||
} catch (err) {
|
||||
notifications.show({
|
||||
message: err?.response?.data?.message,
|
||||
color: "red",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Group justify="space-between" wrap="nowrap" gap="xl" mt="md">
|
||||
<div>
|
||||
<Group gap="xs" align="center">
|
||||
<Text size="sm" fw={500}>
|
||||
{t("Enforce OAuth")}
|
||||
</Text>
|
||||
{!hasAccess && (
|
||||
<Badge variant="light" size="sm" radius="sm">
|
||||
{t("Enterprise")}
|
||||
</Badge>
|
||||
)}
|
||||
</Group>
|
||||
<Text size="sm" c="dimmed">
|
||||
{t(
|
||||
"AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.",
|
||||
)}
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
<Tooltip label={upgradeLabel} disabled={hasAccess} refProp="rootRef">
|
||||
<Switch
|
||||
defaultChecked={checked}
|
||||
onChange={handleChange}
|
||||
disabled={!hasAccess}
|
||||
aria-label={t("Toggle enforce OAuth for MCP")}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Group>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState } from "react";
|
||||
import { Anchor, Alert, Button, Group, Space, Tabs, Text } from "@mantine/core";
|
||||
import { Anchor, Alert, Button, Group, Space, Text } from "@mantine/core";
|
||||
import { IconInfoCircle } from "@tabler/icons-react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import SettingsTitle from "@/components/settings/settings-title";
|
||||
@@ -17,8 +17,6 @@ import { useAtom } from "jotai";
|
||||
import { workspaceAtom } from "@/features/user/atoms/current-user-atom.ts";
|
||||
import useUserRole from "@/hooks/use-user-role.tsx";
|
||||
import { DocumentTitle } from "@/components/ui/document-title.tsx";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { AuthorizedAppsPanel } from "@/ee/oauth/components/authorized-apps-panel.tsx";
|
||||
|
||||
export default function UserApiKeys() {
|
||||
const { t } = useTranslation();
|
||||
@@ -31,11 +29,6 @@ export default function UserApiKeys() {
|
||||
const { data, isLoading } = useGetApiKeysQuery({ cursor });
|
||||
const [workspace] = useAtom(workspaceAtom);
|
||||
const { isAdmin } = useUserRole();
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const activeTab = location.pathname.endsWith("/authorized-apps")
|
||||
? "authorized-apps"
|
||||
: "api-keys";
|
||||
const mcpEnabled = workspace?.settings?.ai?.mcp === true;
|
||||
const restrictToAdmins = workspace?.settings?.api?.restrictToAdmins === true;
|
||||
const canCreate = !restrictToAdmins || isAdmin;
|
||||
@@ -54,27 +47,26 @@ export default function UserApiKeys() {
|
||||
setRevokeModalOpened(true);
|
||||
};
|
||||
|
||||
const handleTabChange = (value: string | null) => {
|
||||
navigate(
|
||||
value === "authorized-apps"
|
||||
? "/settings/account/api-keys/authorized-apps"
|
||||
: "/settings/account/api-keys",
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<DocumentTitle
|
||||
title={activeTab === "authorized-apps" ? t("Authorized apps") : t("API keys")}
|
||||
/>
|
||||
<DocumentTitle title={t("API keys")} />
|
||||
|
||||
<SettingsTitle title={t("API keys")} />
|
||||
|
||||
{mcpEnabled && (
|
||||
<Text size="sm" c="dimmed" mb="md">
|
||||
<Trans
|
||||
i18nKey="View the <anchor>API documentation</anchor> for usage details."
|
||||
components={{
|
||||
anchor: <Anchor href="https://docmost.com/api-docs" target="_blank" size="sm" />,
|
||||
}}
|
||||
/>
|
||||
</Text>
|
||||
|
||||
{mcpEnabled && canCreate && (
|
||||
<Alert variant="light" color="blue" mb="md" p="sm" icon={<IconInfoCircle />}>
|
||||
<Text size="sm">
|
||||
{t(
|
||||
"Your workspace has MCP enabled. Connect AI assistants with your Docmost account via OAuth.",
|
||||
"Your workspace has MCP enabled. Use your API key to connect AI assistants.",
|
||||
)}{" "}
|
||||
<Anchor
|
||||
href="https://docmost.com/docs/user-guide/mcp"
|
||||
@@ -93,70 +85,37 @@ export default function UserApiKeys() {
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
<Tabs color="dark" value={activeTab} onChange={handleTabChange}>
|
||||
<Tabs.List>
|
||||
<Tabs.Tab fw={500} value="api-keys">
|
||||
{t("API keys")}
|
||||
</Tabs.Tab>
|
||||
<Tabs.Tab fw={500} value="authorized-apps">
|
||||
{t("Authorized apps")}
|
||||
</Tabs.Tab>
|
||||
</Tabs.List>
|
||||
|
||||
<Tabs.Panel value="api-keys" pt="md">
|
||||
|
||||
<Group justify="space-between" align="center" mb="md">
|
||||
<Text size="sm" c="dimmed">
|
||||
<Trans
|
||||
i18nKey="View the <anchor>API documentation</anchor> for usage details."
|
||||
components={{
|
||||
anchor: <Anchor href="https://docmost.com/api-docs" target="_blank" size="sm" />,
|
||||
}}
|
||||
/>
|
||||
</Text>
|
||||
|
||||
{canCreate && (
|
||||
<Button
|
||||
onClick={() => setCreateModalOpened(true)}
|
||||
style={{ flexShrink: 0 }}
|
||||
>
|
||||
{t("Create API Key")}
|
||||
</Button>
|
||||
)}
|
||||
{canCreate ? (
|
||||
<Group justify="flex-end" mb="md">
|
||||
<Button onClick={() => setCreateModalOpened(true)}>
|
||||
{t("Create API Key")}
|
||||
</Button>
|
||||
</Group>
|
||||
) : restrictToAdmins ? (
|
||||
<Alert variant="light" color="yellow" mb="md" p="sm" icon={<IconInfoCircle />}>
|
||||
<Text size="sm">
|
||||
{t("API key creation is restricted to admins by your workspace administrator.")}
|
||||
</Text>
|
||||
</Alert>
|
||||
) : null}
|
||||
|
||||
{!canCreate && restrictToAdmins && (
|
||||
<Alert variant="light" color="yellow" mb="md" p="sm" icon={<IconInfoCircle />}>
|
||||
<Text size="sm">
|
||||
{t("API key creation is restricted to admins by your workspace administrator.")}
|
||||
</Text>
|
||||
</Alert>
|
||||
)}
|
||||
<ApiKeyTable
|
||||
apiKeys={data?.items || []}
|
||||
isLoading={isLoading}
|
||||
onUpdate={handleUpdate}
|
||||
onRevoke={handleRevoke}
|
||||
/>
|
||||
|
||||
<ApiKeyTable
|
||||
apiKeys={data?.items || []}
|
||||
isLoading={isLoading}
|
||||
onUpdate={handleUpdate}
|
||||
onRevoke={handleRevoke}
|
||||
<Space h="md" />
|
||||
|
||||
{data?.items.length > 0 && (
|
||||
<Paginate
|
||||
hasPrevPage={data?.meta?.hasPrevPage}
|
||||
hasNextPage={data?.meta?.hasNextPage}
|
||||
onNext={() => goNext(data?.meta?.nextCursor)}
|
||||
onPrev={goPrev}
|
||||
/>
|
||||
|
||||
<Space h="md" />
|
||||
|
||||
{data?.items.length > 0 && (
|
||||
<Paginate
|
||||
hasPrevPage={data?.meta?.hasPrevPage}
|
||||
hasNextPage={data?.meta?.hasNextPage}
|
||||
onNext={() => goNext(data?.meta?.nextCursor)}
|
||||
onPrev={goPrev}
|
||||
/>
|
||||
)}
|
||||
|
||||
</Tabs.Panel>
|
||||
|
||||
<Tabs.Panel value="authorized-apps" pt="md">
|
||||
<AuthorizedAppsPanel />
|
||||
</Tabs.Panel>
|
||||
</Tabs>
|
||||
)}
|
||||
|
||||
<CreateApiKeyModal
|
||||
opened={createModalOpened}
|
||||
|
||||
@@ -22,8 +22,5 @@ export const Feature = {
|
||||
PERSONAL_SPACES: 'spaces:personal',
|
||||
DOCX_EXPORT: 'export:docx',
|
||||
BASES: 'bases',
|
||||
INTEGRATIONS: 'integrations',
|
||||
OAUTH: 'oauth',
|
||||
AI_CONTROLS: 'ai:controls',
|
||||
MCP_CONTROLS: 'mcp:controls',
|
||||
} as const;
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import { Text } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { OAuthGrantsTable } from "@/ee/oauth/components/oauth-grants-table";
|
||||
import { useOAuthGrantsQuery } from "@/ee/oauth/queries/oauth-query";
|
||||
|
||||
export function AuthorizedAppsPanel() {
|
||||
const { t } = useTranslation();
|
||||
const { data, isLoading } = useOAuthGrantsQuery();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Text size="sm" c="dimmed" mb="md">
|
||||
{t("Applications and AI assistants you have authorized to access your account.")}
|
||||
</Text>
|
||||
|
||||
<OAuthGrantsTable grants={data || []} isLoading={isLoading} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
import { ActionIcon, Badge, Group, Skeleton, Table, Text, Tooltip } from "@mantine/core";
|
||||
import { IconTrash } from "@tabler/icons-react";
|
||||
import { modals } from "@mantine/modals";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import NoTableResults from "@/components/common/no-table-results";
|
||||
import { formatLocalized, useDateFnsLocale } from "@/lib/date-locale.ts";
|
||||
import { IOAuthGrant } from "@/ee/oauth/types/oauth.types";
|
||||
import { useRevokeOAuthGrantMutation } from "@/ee/oauth/queries/oauth-query";
|
||||
|
||||
// Callback hosts identify the app; the full URL belongs on the consent screen.
|
||||
function callbackHosts(redirectUris: string[] = []): string[] {
|
||||
const hosts = redirectUris.map((uri) => {
|
||||
try {
|
||||
const url = new URL(uri);
|
||||
return url.protocol === "http:" || url.protocol === "https:"
|
||||
? url.host
|
||||
: url.protocol;
|
||||
} catch {
|
||||
return uri;
|
||||
}
|
||||
});
|
||||
return Array.from(new Set(hosts));
|
||||
}
|
||||
|
||||
type OAuthGrantsTableProps = {
|
||||
grants: IOAuthGrant[];
|
||||
isLoading?: boolean;
|
||||
};
|
||||
|
||||
function TableSkeleton() {
|
||||
return (
|
||||
<>
|
||||
{Array.from({ length: 3 }).map((_, i) => (
|
||||
<Table.Tr key={i}>
|
||||
<Table.Td>
|
||||
<Skeleton height={14} width={140} />
|
||||
</Table.Td>
|
||||
<Table.Td>
|
||||
<Group gap={4}>
|
||||
<Skeleton height={20} width={50} />
|
||||
<Skeleton height={20} width={55} />
|
||||
</Group>
|
||||
</Table.Td>
|
||||
<Table.Td>
|
||||
<Skeleton height={14} width={90} />
|
||||
</Table.Td>
|
||||
<Table.Td>
|
||||
<Skeleton height={14} width={90} />
|
||||
</Table.Td>
|
||||
<Table.Td>
|
||||
<Skeleton height={28} width={28} circle />
|
||||
</Table.Td>
|
||||
</Table.Tr>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export function OAuthGrantsTable({ grants, isLoading }: OAuthGrantsTableProps) {
|
||||
const { t } = useTranslation();
|
||||
const locale = useDateFnsLocale();
|
||||
const revokeMutation = useRevokeOAuthGrantMutation();
|
||||
|
||||
const scopeMeta: Record<string, { color: string; label: string }> = {
|
||||
read: { color: "blue", label: t("Read") },
|
||||
write: { color: "orange", label: t("Write") },
|
||||
};
|
||||
|
||||
const formatDate = (date: string | null) => {
|
||||
if (!date) return t("Never");
|
||||
return formatLocalized(date, "MMM dd, yyyy", "PP", locale);
|
||||
};
|
||||
|
||||
const openRevokeModal = (grant: IOAuthGrant) =>
|
||||
modals.openConfirmModal({
|
||||
title: t("Revoke access"),
|
||||
centered: true,
|
||||
children: (
|
||||
<Text size="sm">
|
||||
{t(
|
||||
"Are you sure you want to revoke access for {{name}}? The application will no longer be able to access your account.",
|
||||
{ name: grant.clientName },
|
||||
)}
|
||||
</Text>
|
||||
),
|
||||
labels: { confirm: t("Revoke access"), cancel: t("Cancel") },
|
||||
confirmProps: { color: "red" },
|
||||
onConfirm: () => revokeMutation.mutate(grant.id),
|
||||
});
|
||||
|
||||
return (
|
||||
<Table.ScrollContainer minWidth={600}>
|
||||
<Table highlightOnHover verticalSpacing="sm">
|
||||
<Table.Thead>
|
||||
<Table.Tr>
|
||||
<Table.Th>{t("Application")}</Table.Th>
|
||||
<Table.Th>{t("Permissions")}</Table.Th>
|
||||
<Table.Th>{t("Authorized")}</Table.Th>
|
||||
<Table.Th>{t("Last used")}</Table.Th>
|
||||
<Table.Th aria-label={t("Action")} />
|
||||
</Table.Tr>
|
||||
</Table.Thead>
|
||||
|
||||
<Table.Tbody>
|
||||
{isLoading ? (
|
||||
<TableSkeleton />
|
||||
) : grants.length > 0 ? (
|
||||
grants.map((grant) => (
|
||||
<Table.Tr key={grant.id}>
|
||||
<Table.Td>
|
||||
<Text fz="sm" fw={500}>
|
||||
{grant.clientName}
|
||||
</Text>
|
||||
<Text
|
||||
fz="xs"
|
||||
c="dimmed"
|
||||
title={grant.redirectUris?.join("\n")}
|
||||
style={{ overflowWrap: "anywhere" }}
|
||||
>
|
||||
{callbackHosts(grant.redirectUris).join(", ")}
|
||||
</Text>
|
||||
</Table.Td>
|
||||
|
||||
<Table.Td>
|
||||
<Group gap={4}>
|
||||
{grant.scopes.map((scope) => {
|
||||
const meta = scopeMeta[scope];
|
||||
if (!meta) return null;
|
||||
return (
|
||||
<Badge
|
||||
key={scope}
|
||||
variant="light"
|
||||
color={meta.color}
|
||||
size="sm"
|
||||
>
|
||||
{meta.label}
|
||||
</Badge>
|
||||
);
|
||||
})}
|
||||
</Group>
|
||||
</Table.Td>
|
||||
|
||||
<Table.Td>
|
||||
<Text fz="sm" style={{ whiteSpace: "nowrap" }}>
|
||||
{formatDate(grant.createdAt)}
|
||||
</Text>
|
||||
</Table.Td>
|
||||
|
||||
<Table.Td>
|
||||
<Text fz="sm" style={{ whiteSpace: "nowrap" }}>
|
||||
{formatDate(grant.lastUsedAt)}
|
||||
</Text>
|
||||
</Table.Td>
|
||||
|
||||
<Table.Td>
|
||||
<Tooltip label={t("Revoke access")}>
|
||||
<ActionIcon
|
||||
variant="subtle"
|
||||
color="red"
|
||||
aria-label={t("Revoke access for {{name}}", {
|
||||
name: grant.clientName,
|
||||
})}
|
||||
onClick={() => openRevokeModal(grant)}
|
||||
>
|
||||
<IconTrash size={16} />
|
||||
</ActionIcon>
|
||||
</Tooltip>
|
||||
</Table.Td>
|
||||
</Table.Tr>
|
||||
))
|
||||
) : (
|
||||
<NoTableResults colSpan={5} text={t("No authorized apps yet.")} />
|
||||
)}
|
||||
</Table.Tbody>
|
||||
</Table>
|
||||
</Table.ScrollContainer>
|
||||
);
|
||||
}
|
||||
@@ -1,333 +0,0 @@
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import {
|
||||
Alert,
|
||||
Anchor,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Checkbox,
|
||||
Container,
|
||||
Divider,
|
||||
Group,
|
||||
Loader,
|
||||
Paper,
|
||||
Stack,
|
||||
Text,
|
||||
ThemeIcon,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import {
|
||||
IconAlertTriangle,
|
||||
IconEye,
|
||||
IconPencil,
|
||||
} from "@tabler/icons-react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useAtom } from "jotai";
|
||||
import { RESET } from "jotai/utils";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useLocation, useSearchParams } from "react-router-dom";
|
||||
import { AuthLayout } from "@/features/auth/components/auth-layout.tsx";
|
||||
import classes from "@/features/auth/components/auth.module.css";
|
||||
import { DocumentTitle } from "@/components/ui/document-title.tsx";
|
||||
import { UserInfo } from "@/components/common/user-info.tsx";
|
||||
import useCurrentUser from "@/features/user/hooks/use-current-user";
|
||||
import { currentUserAtom } from "@/features/user/atoms/current-user-atom";
|
||||
import { logout } from "@/features/auth/services/auth-service";
|
||||
import { ICurrentUser } from "@/features/user/types/user.types";
|
||||
import APP_ROUTE from "@/lib/app-route.ts";
|
||||
import {
|
||||
approveOAuthAuthorization,
|
||||
getOAuthAuthorizeInfo,
|
||||
} from "@/ee/oauth/services/oauth-service";
|
||||
import {
|
||||
IApproveAuthorizationPayload,
|
||||
IAuthorizeParams,
|
||||
IOAuthAuthorizeInfo,
|
||||
} from "@/ee/oauth/types/oauth.types";
|
||||
|
||||
function loginRedirectUrl(pathname: string, search: string): string {
|
||||
return `${APP_ROUTE.AUTH.LOGIN}?redirect=${encodeURIComponent(pathname + search)}`;
|
||||
}
|
||||
|
||||
function errorStatus(error: any): number | undefined {
|
||||
return error?.response?.status;
|
||||
}
|
||||
|
||||
function errorText(error: any): string | undefined {
|
||||
const data = error?.response?.data;
|
||||
if (typeof data?.error_description === "string") return data.error_description;
|
||||
if (Array.isArray(data?.message)) return data.message.join(", ");
|
||||
return data?.message;
|
||||
}
|
||||
|
||||
const OAUTH_PARAM_NAMES = [
|
||||
"response_type",
|
||||
"client_id",
|
||||
"redirect_uri",
|
||||
"state",
|
||||
"code_challenge",
|
||||
"code_challenge_method",
|
||||
"scope",
|
||||
"resource",
|
||||
];
|
||||
|
||||
function pickOAuthParams(params: IAuthorizeParams): IAuthorizeParams {
|
||||
const picked: IAuthorizeParams = {};
|
||||
for (const name of OAUTH_PARAM_NAMES) {
|
||||
if (params[name] !== undefined) {
|
||||
picked[name] = params[name];
|
||||
}
|
||||
}
|
||||
return picked;
|
||||
}
|
||||
|
||||
export default function OAuthConsent() {
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
const params = useMemo<IAuthorizeParams>(
|
||||
() => Object.fromEntries(searchParams.entries()),
|
||||
[searchParams],
|
||||
);
|
||||
|
||||
const currentUserQuery = useCurrentUser();
|
||||
const infoQuery = useQuery({
|
||||
queryKey: ["oauth-authorize-info", params],
|
||||
queryFn: () => getOAuthAuthorizeInfo(params),
|
||||
});
|
||||
|
||||
const isUnauthenticated =
|
||||
errorStatus(currentUserQuery.error) === 401 ||
|
||||
errorStatus(infoQuery.error) === 401;
|
||||
|
||||
useEffect(() => {
|
||||
if (isUnauthenticated) {
|
||||
window.location.replace(
|
||||
loginRedirectUrl(location.pathname, location.search),
|
||||
);
|
||||
}
|
||||
}, [isUnauthenticated, location.pathname, location.search]);
|
||||
|
||||
const isLoading =
|
||||
isUnauthenticated || currentUserQuery.isLoading || infoQuery.isLoading;
|
||||
|
||||
return (
|
||||
<AuthLayout>
|
||||
<DocumentTitle title={t("Authorize application")} />
|
||||
<Container size={460} className={classes.container}>
|
||||
<Box p="xl">
|
||||
{isLoading ? (
|
||||
<Center mih={200}>
|
||||
<Loader />
|
||||
</Center>
|
||||
) : infoQuery.data && currentUserQuery.data ? (
|
||||
<ConsentCard
|
||||
info={infoQuery.data}
|
||||
currentUser={currentUserQuery.data}
|
||||
params={params}
|
||||
/>
|
||||
) : (
|
||||
<InvalidRequestCard
|
||||
description={errorText(infoQuery.error ?? currentUserQuery.error)}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
</Container>
|
||||
</AuthLayout>
|
||||
);
|
||||
}
|
||||
|
||||
function InvalidRequestCard({ description }: { description?: string }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Stack align="center" gap="sm">
|
||||
<ThemeIcon size={48} radius="xl" variant="light" color="red">
|
||||
<IconAlertTriangle size={26} stroke={1.5} />
|
||||
</ThemeIcon>
|
||||
<Title order={3} ta="center" fw={600}>
|
||||
{t("Invalid authorization request")}
|
||||
</Title>
|
||||
{description && (
|
||||
<Text size="sm" c="dimmed" ta="center">
|
||||
{description}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
type ConsentCardProps = {
|
||||
info: IOAuthAuthorizeInfo;
|
||||
currentUser: ICurrentUser;
|
||||
params: IAuthorizeParams;
|
||||
};
|
||||
|
||||
function ConsentCard({ info, currentUser, params }: ConsentCardProps) {
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
const [, setCurrentUser] = useAtom(currentUserAtom);
|
||||
const [approvedScopes, setApprovedScopes] = useState<string[]>(
|
||||
info.scopes.filter((scope) => scope === "read" || scope === "write"),
|
||||
);
|
||||
const [submitting, setSubmitting] = useState<"approve" | "deny" | null>(null);
|
||||
|
||||
const scopeRows = [
|
||||
{
|
||||
scope: "read",
|
||||
icon: <IconEye size={16} stroke={1.5} />,
|
||||
label: t("Read"),
|
||||
description: t("View data in your workspace without making changes."),
|
||||
},
|
||||
{
|
||||
scope: "write",
|
||||
icon: <IconPencil size={16} stroke={1.5} />,
|
||||
label: t("Write"),
|
||||
description: t("Create and modify data in your workspace."),
|
||||
},
|
||||
];
|
||||
|
||||
function toggleScope(scope: string, checked: boolean) {
|
||||
setApprovedScopes((prev) =>
|
||||
checked ? [...prev, scope] : prev.filter((item) => item !== scope),
|
||||
);
|
||||
}
|
||||
|
||||
async function submitDecision(approved: boolean) {
|
||||
setSubmitting(approved ? "approve" : "deny");
|
||||
const oauthParams = pickOAuthParams(params);
|
||||
const payload: IApproveAuthorizationPayload = approved
|
||||
? { ...oauthParams, approved: true, approvedScopes }
|
||||
: { ...oauthParams, approved: false };
|
||||
|
||||
try {
|
||||
const res = await approveOAuthAuthorization(payload);
|
||||
window.location.replace(res.redirectUrl);
|
||||
} catch (err) {
|
||||
if (errorStatus(err) === 401) {
|
||||
window.location.replace(
|
||||
loginRedirectUrl(location.pathname, location.search),
|
||||
);
|
||||
return;
|
||||
}
|
||||
setSubmitting(null);
|
||||
notifications.show({
|
||||
message: errorText(err) || t("Something went wrong. Please try again."),
|
||||
color: "red",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function switchAccount() {
|
||||
if (submitting !== null) {
|
||||
return;
|
||||
}
|
||||
setCurrentUser(RESET);
|
||||
try {
|
||||
await logout();
|
||||
} finally {
|
||||
window.location.replace(
|
||||
loginRedirectUrl(location.pathname, location.search),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack gap="lg">
|
||||
<Title order={3} ta="center" fw={600}>
|
||||
{t("{{name}} wants to access {{workspace}}", {
|
||||
name: info.clientName,
|
||||
workspace: currentUser.workspace.name,
|
||||
})}
|
||||
</Title>
|
||||
|
||||
<Paper withBorder radius="md" p="sm">
|
||||
<Group justify="space-between" wrap="nowrap">
|
||||
<UserInfo user={currentUser.user} />
|
||||
<Anchor
|
||||
component="button"
|
||||
type="button"
|
||||
size="xs"
|
||||
c="dimmed"
|
||||
disabled={submitting !== null}
|
||||
onClick={switchAccount}
|
||||
style={{ whiteSpace: "nowrap" }}
|
||||
>
|
||||
{t("Not you? Switch account")}
|
||||
</Anchor>
|
||||
</Group>
|
||||
</Paper>
|
||||
|
||||
<Divider />
|
||||
|
||||
<Stack gap="sm">
|
||||
<Text size="sm" fw={500}>
|
||||
{t("This application will be able to:")}
|
||||
</Text>
|
||||
{scopeRows.map((row) => {
|
||||
const requested = info.scopes.includes(row.scope);
|
||||
return (
|
||||
<Checkbox
|
||||
key={row.scope}
|
||||
size="sm"
|
||||
checked={approvedScopes.includes(row.scope)}
|
||||
disabled={!requested || submitting !== null}
|
||||
onChange={(event) =>
|
||||
toggleScope(row.scope, event.currentTarget.checked)
|
||||
}
|
||||
label={
|
||||
<Group gap={6} wrap="nowrap">
|
||||
{row.icon}
|
||||
<Text size="sm" fw={500}>
|
||||
{row.label}
|
||||
</Text>
|
||||
</Group>
|
||||
}
|
||||
description={row.description}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Stack>
|
||||
|
||||
<div>
|
||||
<Text size="xs" c="dimmed">
|
||||
{t("You will be redirected to")}
|
||||
</Text>
|
||||
<Text size="xs" ff="monospace" style={{ overflowWrap: "anywhere" }}>
|
||||
{info.redirectUri}
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
{!info.verified && (
|
||||
<Alert
|
||||
variant="light"
|
||||
color="yellow"
|
||||
py="xs"
|
||||
icon={<IconAlertTriangle size={16} />}
|
||||
>
|
||||
{t("Make sure you trust this application before authorizing it.")}
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
<Group grow>
|
||||
<Button
|
||||
variant="default"
|
||||
onClick={() => submitDecision(false)}
|
||||
loading={submitting === "deny"}
|
||||
disabled={submitting === "approve"}
|
||||
>
|
||||
{t("Cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => submitDecision(true)}
|
||||
loading={submitting === "approve"}
|
||||
disabled={approvedScopes.length === 0 || submitting === "deny"}
|
||||
>
|
||||
{t("Authorize")}
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
import {
|
||||
useMutation,
|
||||
useQuery,
|
||||
useQueryClient,
|
||||
UseQueryResult,
|
||||
} from "@tanstack/react-query";
|
||||
import {
|
||||
getOAuthGrants,
|
||||
revokeOAuthGrant,
|
||||
} from "@/ee/oauth/services/oauth-service";
|
||||
import { IOAuthGrant } from "@/ee/oauth/types/oauth.types";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export function useOAuthGrantsQuery(): UseQueryResult<IOAuthGrant[], Error> {
|
||||
return useQuery({
|
||||
queryKey: ["oauth-grants"],
|
||||
queryFn: () => getOAuthGrants(),
|
||||
staleTime: 0,
|
||||
gcTime: 0,
|
||||
});
|
||||
}
|
||||
|
||||
export function useRevokeOAuthGrantMutation() {
|
||||
const queryClient = useQueryClient();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return useMutation<void, Error, string>({
|
||||
mutationFn: (grantId) => revokeOAuthGrant(grantId),
|
||||
onSuccess: () => {
|
||||
notifications.show({ message: t("Access revoked") });
|
||||
queryClient.invalidateQueries({
|
||||
predicate: (item) =>
|
||||
["oauth-grants"].includes(item.queryKey[0] as string),
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
const errorMessage = error["response"]?.data?.message;
|
||||
notifications.show({
|
||||
message: errorMessage || t("Something went wrong. Please try again."),
|
||||
color: "red",
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
import api from "@/lib/api-client";
|
||||
import {
|
||||
IApproveAuthorizationPayload,
|
||||
IAuthorizeParams,
|
||||
IOAuthAuthorizeInfo,
|
||||
IOAuthGrant,
|
||||
} from "@/ee/oauth/types/oauth.types";
|
||||
|
||||
export async function getOAuthAuthorizeInfo(
|
||||
params: IAuthorizeParams,
|
||||
): Promise<IOAuthAuthorizeInfo> {
|
||||
const req = await api.post<IOAuthAuthorizeInfo>(
|
||||
"/oauth/authorize-info",
|
||||
params,
|
||||
);
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function approveOAuthAuthorization(
|
||||
payload: IApproveAuthorizationPayload,
|
||||
): Promise<{ redirectUrl: string }> {
|
||||
const req = await api.post<{ redirectUrl: string }>(
|
||||
"/oauth/authorize",
|
||||
payload,
|
||||
);
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function getOAuthGrants(): Promise<IOAuthGrant[]> {
|
||||
const req = await api.post<IOAuthGrant[]>("/oauth/grants", {});
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function revokeOAuthGrant(grantId: string): Promise<void> {
|
||||
await api.post("/oauth/grants/revoke", { grantId });
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
export interface IOAuthAuthorizeInfo {
|
||||
clientName: string;
|
||||
redirectUri: string;
|
||||
scopes: string[];
|
||||
clientCreatedAt: string;
|
||||
verified: boolean;
|
||||
}
|
||||
|
||||
export interface IOAuthGrant {
|
||||
id: string;
|
||||
clientName: string;
|
||||
redirectUris: string[];
|
||||
scopes: string[];
|
||||
createdAt: string;
|
||||
lastUsedAt: string | null;
|
||||
}
|
||||
|
||||
export type IAuthorizeParams = Record<string, string>;
|
||||
|
||||
export type IApproveAuthorizationPayload = {
|
||||
[param: string]: unknown;
|
||||
approved: boolean;
|
||||
approvedScopes?: string[];
|
||||
};
|
||||
@@ -5,10 +5,6 @@ import { uploadPdfAction } from "../pdf/upload-pdf-action";
|
||||
import { createMentionAction } from "@/features/editor/components/link/internal-link-paste.ts";
|
||||
import { INTERNAL_LINK_REGEX } from "@/lib/constants.ts";
|
||||
import { Editor } from "@tiptap/core";
|
||||
import { matchIntegrationLink } from "@docmost/editor-ext";
|
||||
import { integrationPasteMenuKey } from "@/features/editor/extensions/integration-paste-menu";
|
||||
import { queryClient } from "@/main.tsx";
|
||||
import { Integration } from "@/features/integration/types/integration.types";
|
||||
import {
|
||||
getAttachmentInfo,
|
||||
uploadFile,
|
||||
@@ -26,16 +22,6 @@ const ATTACHMENT_NODE_TYPES = [
|
||||
|
||||
const ATTACHMENT_URL_RE = /\/api\/files\/([0-9a-f-]+)\//;
|
||||
|
||||
// Only installed providers get card treatment; anything else pastes as an
|
||||
// ordinary link. The cache is prefetched when the page editor mounts;
|
||||
// a cold cache also means ordinary link.
|
||||
function isIntegrationInstalled(provider: string): boolean {
|
||||
const installed = queryClient.getQueryData<Integration[]>([
|
||||
"installed-integrations",
|
||||
]);
|
||||
return Boolean(installed?.some((i) => i.type === provider));
|
||||
}
|
||||
|
||||
export const handlePaste = (
|
||||
editor: Editor,
|
||||
event: ClipboardEvent,
|
||||
@@ -44,59 +30,6 @@ export const handlePaste = (
|
||||
) => {
|
||||
const clipboardData = event.clipboardData.getData("text/plain");
|
||||
|
||||
const integrationMatch = matchIntegrationLink(clipboardData.trim());
|
||||
if (
|
||||
integrationMatch &&
|
||||
editor.state.selection.empty &&
|
||||
isIntegrationInstalled(integrationMatch.provider)
|
||||
) {
|
||||
event.preventDefault();
|
||||
const pastedUrl = clipboardData.trim();
|
||||
editor
|
||||
.chain()
|
||||
.focus()
|
||||
.setIntegrationLink({
|
||||
url: pastedUrl,
|
||||
provider: integrationMatch.provider,
|
||||
})
|
||||
// Anchor the "Paste as" menu to the inserted node, in the SAME
|
||||
// transaction: BubbleMenu ignores meta-only transactions (it only
|
||||
// re-evaluates when the doc or selection changed). Locate the node via
|
||||
// the range this transaction's own steps touched, never by url, so a
|
||||
// duplicate of the same link elsewhere in the doc can't steal the menu.
|
||||
.command(({ tr }) => {
|
||||
let start: number | null = null;
|
||||
let end: number | null = null;
|
||||
tr.mapping.maps.forEach((map, index) => {
|
||||
const rest = tr.mapping.slice(index + 1);
|
||||
map.forEach((_oldStart, _oldEnd, newStart, newEnd) => {
|
||||
const mappedStart = rest.map(newStart, -1);
|
||||
const mappedEnd = rest.map(newEnd, 1);
|
||||
start = start === null ? mappedStart : Math.min(start, mappedStart);
|
||||
end = end === null ? mappedEnd : Math.max(end, mappedEnd);
|
||||
});
|
||||
});
|
||||
if (start === null || end === null) return true;
|
||||
|
||||
let pastedPos: number | null = null;
|
||||
tr.doc.nodesBetween(
|
||||
start,
|
||||
Math.min(end, tr.doc.content.size),
|
||||
(node, pos) => {
|
||||
if (node.type.name === "integrationLink") {
|
||||
pastedPos = pos;
|
||||
}
|
||||
},
|
||||
);
|
||||
if (pastedPos !== null) {
|
||||
tr.setMeta(integrationPasteMenuKey, { pos: pastedPos });
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.run();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (INTERNAL_LINK_REGEX.test(clipboardData)) {
|
||||
// we have to do this validation here to allow the default link extension to takeover if needs be
|
||||
event.preventDefault();
|
||||
|
||||
@@ -4,6 +4,8 @@ import Lightbox, { type Slide } from "yet-another-react-lightbox";
|
||||
import type { LightboxRequest } from "@/features/editor/atoms/editor-atoms";
|
||||
import { getFileUrl } from "@/lib/config.ts";
|
||||
import "yet-another-react-lightbox/styles.css";
|
||||
import "yet-another-react-lightbox/plugins/captions.css";
|
||||
import Captions from "yet-another-react-lightbox/plugins/captions";
|
||||
import Download from "yet-another-react-lightbox/plugins/download";
|
||||
import Fullscreen from "yet-another-react-lightbox/plugins/fullscreen";
|
||||
import Video from "yet-another-react-lightbox/plugins/video";
|
||||
@@ -51,11 +53,13 @@ function getFilename(src: string) {
|
||||
function getMedia(rawSrc: string, type?: string, alt?: string): Slide {
|
||||
const src = getFileUrl(rawSrc);
|
||||
const filename = getFilename(rawSrc);
|
||||
const caption = alt || filename;
|
||||
|
||||
if (type === "video") {
|
||||
return {
|
||||
type: "video",
|
||||
sources: [{ src, type: getVideoMimeType(rawSrc) }],
|
||||
title: caption,
|
||||
download: { url: src, filename },
|
||||
};
|
||||
} else {
|
||||
@@ -63,6 +67,7 @@ function getMedia(rawSrc: string, type?: string, alt?: string): Slide {
|
||||
type: "image",
|
||||
src,
|
||||
alt: alt || undefined,
|
||||
title: caption,
|
||||
download: { url: src, filename },
|
||||
};
|
||||
}
|
||||
@@ -119,11 +124,6 @@ export default function LightboxView({
|
||||
|
||||
const [pageSlides, setPageSlides] = useState<Slide[]>([]);
|
||||
const [loadedMediaKey, setLoadedMediaKey] = useState<string | null>(null);
|
||||
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) setIsFullscreen(false);
|
||||
}, [open]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
@@ -161,21 +161,9 @@ export default function LightboxView({
|
||||
close={onClose}
|
||||
index={index}
|
||||
slides={slides}
|
||||
plugins={[Download, Fullscreen, Video, Zoom]}
|
||||
styles={{
|
||||
container: { backgroundColor: "rgba(0, 0, 0, 0.8)" },
|
||||
icon: { width: 24, height: 24 },
|
||||
toolbar: {
|
||||
margin: 8,
|
||||
borderRadius: 8,
|
||||
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
||||
},
|
||||
}}
|
||||
controller={{ closeOnBackdropClick: !isFullscreen }}
|
||||
on={{
|
||||
enterFullscreen: () => setIsFullscreen(true),
|
||||
exitFullscreen: () => setIsFullscreen(false),
|
||||
}}
|
||||
plugins={[Captions, Download, Fullscreen, Video, Zoom]}
|
||||
styles={{ container: { backgroundColor: "rgba(0, 0, 0, 0.8)" } }}
|
||||
captions={{ descriptionTextAlign: "center" }}
|
||||
video={{ controls: true, playsInline: true }}
|
||||
zoom={{
|
||||
scrollToZoom: true,
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
// Light-scheme text per hue, measured to pass 4.5:1 on the light-variant
|
||||
// badge background; hexes are darkened .9 shades for hues whose scale
|
||||
// never gets dark enough.
|
||||
const BADGE_TEXT_LIGHT: Record<string, string> = {
|
||||
dark: "var(--mantine-color-dark-9)",
|
||||
gray: "var(--mantine-color-gray-9)",
|
||||
red: "var(--mantine-color-red-9)",
|
||||
pink: "var(--mantine-color-pink-9)",
|
||||
grape: "var(--mantine-color-grape-9)",
|
||||
violet: "var(--mantine-color-violet-9)",
|
||||
indigo: "var(--mantine-color-indigo-9)",
|
||||
blue: "var(--mantine-color-blue-9)",
|
||||
cyan: "var(--mantine-color-cyan-9)",
|
||||
teal: "var(--mantine-color-teal-9)",
|
||||
green: "#277c38",
|
||||
lime: "#4e7e0b",
|
||||
yellow: "#ad5900",
|
||||
orange: "#c3410e",
|
||||
};
|
||||
|
||||
export function badgeTextColor(color?: string): string | undefined {
|
||||
if (!color) return undefined;
|
||||
const light = BADGE_TEXT_LIGHT[color];
|
||||
if (!light) return undefined;
|
||||
// Dark scheme keeps Mantine's own light-variant text.
|
||||
return `light-dark(${light}, var(--mantine-color-${color}-light-color))`;
|
||||
}
|
||||
|
||||
export function toBadgeColor(raw?: string): string {
|
||||
if (!raw) return "gray";
|
||||
const hex = raw.toLowerCase().replace("#", "");
|
||||
if (/^[0-9a-f]{6}$/.test(hex)) {
|
||||
const r = parseInt(hex.slice(0, 2), 16);
|
||||
const g = parseInt(hex.slice(2, 4), 16);
|
||||
const b = parseInt(hex.slice(4, 6), 16);
|
||||
const max = Math.max(r, g, b);
|
||||
const min = Math.min(r, g, b);
|
||||
const l = (max + min) / 2 / 255;
|
||||
if (max - min < 30) return l > 0.6 ? "gray" : "dark";
|
||||
if (r > g && r > b) return g > 160 ? "orange" : "red";
|
||||
if (g > r && g > b) return r > 160 ? "lime" : "green";
|
||||
if (b > r && b > g) return r > 100 ? "violet" : "blue";
|
||||
if (r > 200 && g > 200) return "yellow";
|
||||
if (r > 200 && b > 200) return "pink";
|
||||
if (g > 200 && b > 200) return "cyan";
|
||||
return "gray";
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
.card {
|
||||
max-width: 100%;
|
||||
cursor: pointer;
|
||||
transition: background-color 150ms ease;
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
background-color: var(--mantine-color-gray-0);
|
||||
}
|
||||
|
||||
:global([data-mantine-color-scheme="dark"]) .card:hover {
|
||||
background-color: var(--mantine-color-dark-5);
|
||||
}
|
||||
|
||||
.thumbnail {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-height: 320px;
|
||||
object-fit: cover;
|
||||
background-color: var(--mantine-color-gray-0);
|
||||
}
|
||||
|
||||
:global([data-mantine-color-scheme="dark"]) .thumbnail {
|
||||
background-color: var(--mantine-color-dark-6);
|
||||
}
|
||||
|
||||
.mention {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
vertical-align: text-bottom;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
border-radius: var(--mantine-radius-sm);
|
||||
}
|
||||
|
||||
:global(.node-integrationMention) .mention {
|
||||
border-bottom: none !important;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.mention:hover {
|
||||
background-color: var(--mantine-color-gray-0);
|
||||
}
|
||||
|
||||
:global([data-mantine-color-scheme="dark"]) .mention:hover {
|
||||
background-color: var(--mantine-color-dark-5);
|
||||
}
|
||||
|
||||
.mentionText {
|
||||
text-decoration: underline;
|
||||
text-decoration-color: var(--mantine-color-gray-4);
|
||||
text-underline-offset: 3px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 340px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.mentionIcon {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
-525
@@ -1,525 +0,0 @@
|
||||
import { NodeViewWrapper } from "@tiptap/react";
|
||||
import {
|
||||
Card,
|
||||
Group,
|
||||
Text,
|
||||
Badge,
|
||||
Avatar,
|
||||
Skeleton,
|
||||
Anchor,
|
||||
Stack,
|
||||
Button,
|
||||
} from "@mantine/core";
|
||||
import { useCallback, useState, memo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import { describeIntegrationLink } from "@docmost/editor-ext";
|
||||
import { getIntegrationIcon } from "@/features/integration/components/integration-icons";
|
||||
import { getOAuthAuthorizeUrl } from "@/features/integration/services/integration-service";
|
||||
import { timeAgo } from "@/lib/time";
|
||||
import { useUnfurl } from "./use-unfurl";
|
||||
import { badgeTextColor, toBadgeColor } from "./badge-color";
|
||||
import classes from "./integration-link-view.module.css";
|
||||
|
||||
const SLACK_TEXT_CLAMP_LINES = 4;
|
||||
|
||||
function SlackMessageCard({
|
||||
url,
|
||||
unfurlData,
|
||||
}: {
|
||||
url: string;
|
||||
unfurlData: Record<string, any>;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
|
||||
const meta = unfurlData.metadata ?? {};
|
||||
const postedAt = meta.ts ? new Date(parseFloat(meta.ts) * 1000) : null;
|
||||
const text: string = unfurlData.description ?? "";
|
||||
const isLong =
|
||||
text.length > 280 || text.split("\n").length > SLACK_TEXT_CLAMP_LINES;
|
||||
|
||||
const footer = [
|
||||
meta.replyCount
|
||||
? `${meta.replyCount} ${meta.replyCount === 1 ? t("reply") : t("replies")}`
|
||||
: null,
|
||||
unfurlData.status,
|
||||
meta.teamName,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" • ");
|
||||
|
||||
return (
|
||||
<NodeViewWrapper data-drag-handle="">
|
||||
<Card className={classes.card} withBorder padding="sm" radius="sm">
|
||||
<Group gap="sm" wrap="nowrap" align="flex-start">
|
||||
<Avatar
|
||||
src={unfurlData.authorAvatarUrl}
|
||||
size={28}
|
||||
radius="xl"
|
||||
style={{ flexShrink: 0 }}
|
||||
>
|
||||
{(unfurlData.author ?? "?").charAt(0)}
|
||||
</Avatar>
|
||||
|
||||
<Stack gap={4} style={{ flex: 1, minWidth: 0 }}>
|
||||
<Group gap={6} wrap="nowrap">
|
||||
<Text size="sm" fw={600} truncate>
|
||||
{unfurlData.author}
|
||||
</Text>
|
||||
{postedAt && (
|
||||
<Text size="xs" c="dimmed" style={{ flexShrink: 0 }}>
|
||||
{timeAgo(postedAt)}
|
||||
</Text>
|
||||
)}
|
||||
</Group>
|
||||
|
||||
{text && (
|
||||
<Text
|
||||
size="sm"
|
||||
lineClamp={expanded ? undefined : SLACK_TEXT_CLAMP_LINES}
|
||||
style={{ whiteSpace: "pre-wrap" }}
|
||||
>
|
||||
{text}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
{isLong && (
|
||||
<Text
|
||||
size="xs"
|
||||
fw={600}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
aria-expanded={expanded}
|
||||
style={{ cursor: "pointer", width: "fit-content" }}
|
||||
onClick={() => setExpanded((v) => !v)}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
setExpanded((v) => !v);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{expanded ? t("show less") : t("show more")}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
{footer && (
|
||||
<Text size="xs" c="dimmed" truncate>
|
||||
{footer}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
<Anchor
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
aria-label={t("Open in Slack")}
|
||||
style={{ flexShrink: 0, lineHeight: 0 }}
|
||||
>
|
||||
{getIntegrationIcon("slack", 18)}
|
||||
</Anchor>
|
||||
</Group>
|
||||
</Card>
|
||||
</NodeViewWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
function JiraIssueCard({
|
||||
url,
|
||||
unfurlData,
|
||||
}: {
|
||||
url: string;
|
||||
unfurlData: Record<string, any>;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const meta = unfurlData.metadata ?? {};
|
||||
|
||||
const infoLine = [
|
||||
meta.issueKey,
|
||||
unfurlData.author
|
||||
? t("Assigned to {{name}}", { name: unfurlData.author })
|
||||
: t("Unassigned"),
|
||||
meta.updatedAt
|
||||
? t("Updated {{time}}", { time: timeAgo(new Date(meta.updatedAt)) })
|
||||
: null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" • ");
|
||||
|
||||
return (
|
||||
<NodeViewWrapper data-drag-handle="">
|
||||
<Card
|
||||
className={classes.card}
|
||||
withBorder
|
||||
padding="sm"
|
||||
radius="sm"
|
||||
component="a"
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
style={{ textDecoration: "none", color: "inherit" }}
|
||||
>
|
||||
<Group gap="sm" wrap="nowrap">
|
||||
{unfurlData.authorAvatarUrl ? (
|
||||
<Avatar
|
||||
src={unfurlData.authorAvatarUrl}
|
||||
size={28}
|
||||
radius="xl"
|
||||
style={{ flexShrink: 0 }}
|
||||
/>
|
||||
) : (
|
||||
<div style={{ flexShrink: 0 }}>{getIntegrationIcon("jira", 28)}</div>
|
||||
)}
|
||||
|
||||
<Stack gap={2} style={{ flex: 1, minWidth: 0 }}>
|
||||
<Group gap="xs" wrap="nowrap">
|
||||
<Text size="sm" fw={600} truncate>
|
||||
{unfurlData.title}
|
||||
</Text>
|
||||
{unfurlData.status && (
|
||||
<Badge
|
||||
size="xs"
|
||||
variant="light"
|
||||
color={toBadgeColor(unfurlData.statusColor)}
|
||||
c={badgeTextColor(toBadgeColor(unfurlData.statusColor))}
|
||||
style={{ flexShrink: 0 }}
|
||||
>
|
||||
{unfurlData.status}
|
||||
</Badge>
|
||||
)}
|
||||
</Group>
|
||||
|
||||
<Group gap={4} wrap="nowrap">
|
||||
{meta.issueTypeIconUrl && (
|
||||
<img
|
||||
src={meta.issueTypeIconUrl}
|
||||
width={14}
|
||||
height={14}
|
||||
alt=""
|
||||
style={{ flexShrink: 0 }}
|
||||
/>
|
||||
)}
|
||||
<Text size="xs" c="dimmed" truncate>
|
||||
{infoLine}
|
||||
</Text>
|
||||
</Group>
|
||||
</Stack>
|
||||
|
||||
<div style={{ flexShrink: 0, alignSelf: "center" }}>
|
||||
{getIntegrationIcon("jira", 18)}
|
||||
</div>
|
||||
</Group>
|
||||
</Card>
|
||||
</NodeViewWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
function FigmaFileCard({
|
||||
url,
|
||||
unfurlData,
|
||||
}: {
|
||||
url: string;
|
||||
unfurlData: Record<string, any>;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
// Figma thumbnail links are pre-signed and expire; drop the preview rather
|
||||
// than render a broken image.
|
||||
const [thumbnailFailed, setThumbnailFailed] = useState(false);
|
||||
const meta = unfurlData.metadata ?? {};
|
||||
const thumbnailUrl: string | undefined = meta.thumbnailUrl;
|
||||
const showThumbnail = Boolean(thumbnailUrl) && !thumbnailFailed;
|
||||
|
||||
const subtitle = [
|
||||
unfurlData.author
|
||||
? t("Last modified by {{name}}", { name: unfurlData.author })
|
||||
: unfurlData.description,
|
||||
meta.lastModified ? timeAgo(new Date(meta.lastModified)) : null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" • ");
|
||||
|
||||
return (
|
||||
<NodeViewWrapper data-drag-handle="">
|
||||
<Card
|
||||
className={classes.card}
|
||||
withBorder
|
||||
padding="sm"
|
||||
radius="sm"
|
||||
component="a"
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
style={{ textDecoration: "none", color: "inherit" }}
|
||||
>
|
||||
{showThumbnail && (
|
||||
<Card.Section withBorder>
|
||||
<img
|
||||
src={thumbnailUrl}
|
||||
alt=""
|
||||
loading="lazy"
|
||||
className={classes.thumbnail}
|
||||
onError={() => setThumbnailFailed(true)}
|
||||
/>
|
||||
</Card.Section>
|
||||
)}
|
||||
|
||||
<Group gap="sm" wrap="nowrap" mt={showThumbnail ? "sm" : undefined}>
|
||||
<Avatar
|
||||
src={unfurlData.authorAvatarUrl}
|
||||
size={28}
|
||||
radius="xl"
|
||||
style={{ flexShrink: 0 }}
|
||||
>
|
||||
{(unfurlData.author ?? unfurlData.title ?? "F").charAt(0)}
|
||||
</Avatar>
|
||||
|
||||
<Stack gap={2} style={{ flex: 1, minWidth: 0 }}>
|
||||
<Text size="sm" fw={600} truncate>
|
||||
{unfurlData.title}
|
||||
</Text>
|
||||
{subtitle && (
|
||||
<Text size="xs" c="dimmed" truncate>
|
||||
{subtitle}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
<div style={{ flexShrink: 0, alignSelf: "center" }}>
|
||||
{getIntegrationIcon("figma", 18)}
|
||||
</div>
|
||||
</Group>
|
||||
</Card>
|
||||
</NodeViewWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
function IntegrationLinkView(props: any) {
|
||||
const { node } = props;
|
||||
const { url, provider } = node.attrs;
|
||||
const { t } = useTranslation();
|
||||
|
||||
const unfurl = useUnfurl(url);
|
||||
const [connecting, setConnecting] = useState(false);
|
||||
|
||||
const needsConnection =
|
||||
unfurl.state === "needsConnection" ? unfurl.needsConnection : null;
|
||||
|
||||
const handleConnect = useCallback(
|
||||
async (event: React.MouseEvent) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (!needsConnection) return;
|
||||
|
||||
setConnecting(true);
|
||||
try {
|
||||
const result = await getOAuthAuthorizeUrl({
|
||||
integrationId: needsConnection.integrationId,
|
||||
returnPath: window.location.pathname,
|
||||
});
|
||||
window.location.href = result.authorizationUrl;
|
||||
} catch (error) {
|
||||
setConnecting(false);
|
||||
notifications.show({
|
||||
message:
|
||||
error?.["response"]?.data?.message ||
|
||||
t("Failed to start OAuth connection"),
|
||||
color: "red",
|
||||
});
|
||||
}
|
||||
},
|
||||
[needsConnection, t],
|
||||
);
|
||||
|
||||
if (needsConnection) {
|
||||
return (
|
||||
<NodeViewWrapper data-drag-handle="">
|
||||
<Card
|
||||
className={classes.card}
|
||||
withBorder
|
||||
padding="sm"
|
||||
radius="sm"
|
||||
component="a"
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
style={{ textDecoration: "none", color: "inherit" }}
|
||||
>
|
||||
<Group gap="sm" wrap="nowrap">
|
||||
<div style={{ flexShrink: 0 }}>
|
||||
{getIntegrationIcon(provider, 28)}
|
||||
</div>
|
||||
|
||||
<Stack gap={2} style={{ flex: 1, minWidth: 0 }}>
|
||||
<Text size="sm" fw={600} truncate>
|
||||
{needsConnection.title}
|
||||
</Text>
|
||||
{needsConnection.description && (
|
||||
<Text size="xs" c="dimmed" lineClamp={1}>
|
||||
{needsConnection.description}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
{needsConnection.oauthConnect ? (
|
||||
<Button
|
||||
size="xs"
|
||||
variant="filled"
|
||||
color="dark"
|
||||
loading={connecting}
|
||||
onClick={handleConnect}
|
||||
style={{ flexShrink: 0 }}
|
||||
>
|
||||
{t("Connect to {{name}} to preview", {
|
||||
name: needsConnection.integrationName,
|
||||
})}
|
||||
</Button>
|
||||
) : (
|
||||
<Text size="xs" c="dimmed" style={{ flexShrink: 0 }}>
|
||||
{t("Use")} <code>/docmost help</code> {t("in")}{" "}
|
||||
{needsConnection.integrationName} {t("to link your account.")}
|
||||
</Text>
|
||||
)}
|
||||
</Group>
|
||||
</Card>
|
||||
</NodeViewWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
if (unfurl.state === "loading") {
|
||||
return (
|
||||
<NodeViewWrapper data-drag-handle="">
|
||||
<Card className={classes.card} withBorder padding="sm" radius="sm">
|
||||
<Group gap="sm">
|
||||
<Skeleton circle height={24} />
|
||||
<Stack gap={4} style={{ flex: 1 }}>
|
||||
<Skeleton height={14} width="60%" />
|
||||
<Skeleton height={10} width="80%" />
|
||||
</Stack>
|
||||
</Group>
|
||||
</Card>
|
||||
</NodeViewWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
if (unfurl.state !== "loaded") {
|
||||
// anonymous or error: no third-party data, only what the url itself says
|
||||
const described = describeIntegrationLink(url);
|
||||
if (described) {
|
||||
return (
|
||||
<NodeViewWrapper data-drag-handle="">
|
||||
<Card
|
||||
className={classes.card}
|
||||
withBorder
|
||||
padding="sm"
|
||||
radius="sm"
|
||||
component="a"
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
style={{ textDecoration: "none", color: "inherit" }}
|
||||
>
|
||||
<Group gap="sm" wrap="nowrap">
|
||||
<div style={{ flexShrink: 0 }}>
|
||||
{getIntegrationIcon(provider, 28)}
|
||||
</div>
|
||||
<Stack gap={2} style={{ flex: 1, minWidth: 0 }}>
|
||||
<Text size="sm" fw={600} truncate>
|
||||
{described.title}
|
||||
</Text>
|
||||
{described.description && (
|
||||
<Text size="xs" c="dimmed" lineClamp={1}>
|
||||
{described.description}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
</Group>
|
||||
</Card>
|
||||
</NodeViewWrapper>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<NodeViewWrapper data-drag-handle="">
|
||||
<Card className={classes.card} withBorder padding="sm" radius="sm">
|
||||
<Anchor href={url} target="_blank" rel="noopener" size="sm">
|
||||
{url}
|
||||
</Anchor>
|
||||
</Card>
|
||||
</NodeViewWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
const unfurlData = unfurl.data;
|
||||
|
||||
// metadata.ts marks legacy message unfurls stored before metadata.type existed.
|
||||
const slackMeta = provider === "slack" ? unfurlData.metadata : null;
|
||||
if (slackMeta?.type === "message" || (slackMeta && !slackMeta.type && slackMeta.ts)) {
|
||||
return <SlackMessageCard url={url} unfurlData={unfurlData} />;
|
||||
}
|
||||
|
||||
if (provider === "jira" && unfurlData.metadata?.issueKey) {
|
||||
return <JiraIssueCard url={url} unfurlData={unfurlData} />;
|
||||
}
|
||||
|
||||
if (provider === "figma") {
|
||||
return <FigmaFileCard url={url} unfurlData={unfurlData} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<NodeViewWrapper data-drag-handle="">
|
||||
<Card
|
||||
className={classes.card}
|
||||
withBorder
|
||||
padding="sm"
|
||||
radius="sm"
|
||||
component="a"
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
style={{ textDecoration: "none", color: "inherit" }}
|
||||
>
|
||||
<Group gap="sm" wrap="nowrap">
|
||||
{unfurlData.authorAvatarUrl ? (
|
||||
<Avatar src={unfurlData.authorAvatarUrl} size={28} radius="xl" style={{ flexShrink: 0 }} />
|
||||
) : (
|
||||
<div style={{ flexShrink: 0 }}>{getIntegrationIcon(provider, 28)}</div>
|
||||
)}
|
||||
|
||||
<Stack gap={2} style={{ flex: 1, minWidth: 0 }}>
|
||||
<Group gap="xs" wrap="nowrap">
|
||||
<Text size="sm" fw={600} truncate>
|
||||
{unfurlData.title}
|
||||
</Text>
|
||||
{unfurlData.status && (
|
||||
<Badge
|
||||
size="xs"
|
||||
variant="light"
|
||||
color={toBadgeColor(unfurlData.statusColor)}
|
||||
c={badgeTextColor(toBadgeColor(unfurlData.statusColor))}
|
||||
style={{ flexShrink: 0 }}
|
||||
>
|
||||
{unfurlData.status}
|
||||
</Badge>
|
||||
)}
|
||||
</Group>
|
||||
|
||||
{unfurlData.description && (
|
||||
<Text size="xs" c="dimmed" lineClamp={1}>
|
||||
{unfurlData.description}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
{provider && (
|
||||
<div style={{ flexShrink: 0, alignSelf: "center" }}>
|
||||
{getIntegrationIcon(provider, 18)}
|
||||
</div>
|
||||
)}
|
||||
</Group>
|
||||
</Card>
|
||||
</NodeViewWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
export default memo(IntegrationLinkView);
|
||||
-253
@@ -1,253 +0,0 @@
|
||||
import { NodeViewWrapper } from "@tiptap/react";
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
Button,
|
||||
Group,
|
||||
HoverCard,
|
||||
Stack,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import { memo, useCallback, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import { describeIntegrationLink } from "@docmost/editor-ext";
|
||||
import { getIntegrationIcon } from "@/features/integration/components/integration-icons";
|
||||
import { getOAuthAuthorizeUrl } from "@/features/integration/services/integration-service";
|
||||
import { useUnfurl } from "./use-unfurl";
|
||||
import { badgeTextColor, toBadgeColor } from "./badge-color";
|
||||
import classes from "./integration-link-view.module.css";
|
||||
|
||||
function shortUrl(url: string): string {
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
return `${parsed.host}${parsed.pathname}`;
|
||||
} catch {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
function IntegrationMentionView(props: any) {
|
||||
const { node } = props;
|
||||
const { url, provider } = node.attrs;
|
||||
const { t } = useTranslation();
|
||||
|
||||
const unfurl = useUnfurl(url);
|
||||
const data = unfurl.state === "loaded" ? unfurl.data : null;
|
||||
const needsConnection =
|
||||
unfurl.state === "needsConnection" ? unfurl.needsConnection : null;
|
||||
const [connecting, setConnecting] = useState(false);
|
||||
|
||||
const handleConnect = useCallback(
|
||||
async (event: React.MouseEvent) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (!needsConnection) return;
|
||||
|
||||
setConnecting(true);
|
||||
try {
|
||||
const result = await getOAuthAuthorizeUrl({
|
||||
integrationId: needsConnection.integrationId,
|
||||
returnPath: window.location.pathname,
|
||||
});
|
||||
window.location.href = result.authorizationUrl;
|
||||
} catch (error) {
|
||||
setConnecting(false);
|
||||
notifications.show({
|
||||
message:
|
||||
error?.["response"]?.data?.message ||
|
||||
t("Failed to start OAuth connection"),
|
||||
color: "red",
|
||||
});
|
||||
}
|
||||
},
|
||||
[needsConnection, t],
|
||||
);
|
||||
const meta = data?.metadata ?? {};
|
||||
const isSlackMessage =
|
||||
provider === "slack" && (meta.type === "message" || (!meta.type && meta.ts));
|
||||
const issueNumber = meta.iid ?? meta.number;
|
||||
const typeLabel =
|
||||
meta.type === "project"
|
||||
? t("Project")
|
||||
: meta.type === "initiative"
|
||||
? t("Initiative")
|
||||
: null;
|
||||
|
||||
const statusBadge = data?.status ? (
|
||||
<Badge
|
||||
size="xs"
|
||||
variant="light"
|
||||
color={toBadgeColor(data.statusColor)}
|
||||
c={badgeTextColor(toBadgeColor(data.statusColor))}
|
||||
className={classes.mentionIcon}
|
||||
>
|
||||
{data.status}
|
||||
</Badge>
|
||||
) : null;
|
||||
|
||||
let content;
|
||||
if (!data) {
|
||||
// anonymous / loading / error / needs-connection: a compact link chip.
|
||||
// With no unfurl response, fall back to what the url text itself says.
|
||||
content = (
|
||||
<>
|
||||
{getIntegrationIcon(provider, 14)}
|
||||
<span className={classes.mentionText}>
|
||||
{needsConnection?.title ??
|
||||
describeIntegrationLink(url)?.title ??
|
||||
shortUrl(url)}
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
} else if (isSlackMessage) {
|
||||
content = (
|
||||
<>
|
||||
<Avatar
|
||||
src={data.authorAvatarUrl}
|
||||
size={16}
|
||||
radius="xl"
|
||||
className={classes.mentionIcon}
|
||||
>
|
||||
{(data.author ?? "?").charAt(0)}
|
||||
</Avatar>
|
||||
{data.author && (
|
||||
<Text component="span" size="sm" c="dimmed">
|
||||
{data.author}
|
||||
</Text>
|
||||
)}
|
||||
<span className={classes.mentionText}>
|
||||
{(data.description ?? "").split("\n")[0] || shortUrl(url)}
|
||||
</span>
|
||||
{getIntegrationIcon("slack", 14)}
|
||||
{data.status && (
|
||||
<Badge
|
||||
size="xs"
|
||||
variant="light"
|
||||
color="gray"
|
||||
c={badgeTextColor("gray")}
|
||||
tt="none"
|
||||
className={classes.mentionIcon}
|
||||
>
|
||||
{data.status}
|
||||
</Badge>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
} else if (meta.issueKey) {
|
||||
// Jira: type icon leads, provider icon trails.
|
||||
content = (
|
||||
<>
|
||||
{meta.issueTypeIconUrl ? (
|
||||
<img
|
||||
src={meta.issueTypeIconUrl}
|
||||
width={14}
|
||||
height={14}
|
||||
alt=""
|
||||
className={classes.mentionIcon}
|
||||
/>
|
||||
) : (
|
||||
getIntegrationIcon(provider, 14)
|
||||
)}
|
||||
<Text component="span" size="sm" c="dimmed">
|
||||
{meta.issueKey}
|
||||
</Text>
|
||||
<span className={classes.mentionText}>{data.title}</span>
|
||||
{statusBadge}
|
||||
{meta.issueTypeIconUrl && getIntegrationIcon(provider, 14)}
|
||||
</>
|
||||
);
|
||||
} else if (issueNumber) {
|
||||
content = (
|
||||
<>
|
||||
{getIntegrationIcon(provider, 14)}
|
||||
<Text component="span" size="sm" c="dimmed">
|
||||
#{issueNumber}
|
||||
</Text>
|
||||
<span className={classes.mentionText}>{data.title}</span>
|
||||
{statusBadge}
|
||||
</>
|
||||
);
|
||||
} else if (typeLabel) {
|
||||
content = (
|
||||
<>
|
||||
{getIntegrationIcon(provider, 14)}
|
||||
<Text component="span" size="sm" c="dimmed">
|
||||
{typeLabel}
|
||||
</Text>
|
||||
<span className={classes.mentionText}>{data.title}</span>
|
||||
{statusBadge}
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
content = (
|
||||
<>
|
||||
{getIntegrationIcon(provider, 14)}
|
||||
<span className={classes.mentionText}>{data.title || shortUrl(url)}</span>
|
||||
{statusBadge}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const anchor = (
|
||||
<a
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
title={url}
|
||||
className={classes.mention}
|
||||
>
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
|
||||
return (
|
||||
<NodeViewWrapper as="span" style={{ display: "inline" }}>
|
||||
{needsConnection ? (
|
||||
<HoverCard
|
||||
position="bottom-start"
|
||||
shadow="md"
|
||||
radius="md"
|
||||
openDelay={150}
|
||||
closeDelay={150}
|
||||
>
|
||||
<HoverCard.Target>{anchor}</HoverCard.Target>
|
||||
<HoverCard.Dropdown p="sm">
|
||||
<Stack gap="xs">
|
||||
<Group gap={6} wrap="nowrap">
|
||||
{getIntegrationIcon(provider, 16)}
|
||||
<Text size="sm" fw={500}>
|
||||
{needsConnection.integrationName}
|
||||
</Text>
|
||||
</Group>
|
||||
{needsConnection.oauthConnect ? (
|
||||
<Button
|
||||
size="xs"
|
||||
variant="filled"
|
||||
color="dark"
|
||||
leftSection={getIntegrationIcon(provider, 16)}
|
||||
loading={connecting}
|
||||
onClick={handleConnect}
|
||||
>
|
||||
{t("Connect to {{name}} to preview", {
|
||||
name: needsConnection.integrationName,
|
||||
})}
|
||||
</Button>
|
||||
) : (
|
||||
<Text size="xs" c="dimmed">
|
||||
{t("Use")} <code>/docmost help</code> {t("in")}{" "}
|
||||
{needsConnection.integrationName}{" "}
|
||||
{t("to link your account.")}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
</HoverCard.Dropdown>
|
||||
</HoverCard>
|
||||
) : (
|
||||
anchor
|
||||
)}
|
||||
</NodeViewWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
export default memo(IntegrationMentionView);
|
||||
-205
@@ -1,205 +0,0 @@
|
||||
import { BubbleMenu as BaseBubbleMenu } from "@tiptap/react/menus";
|
||||
import { posToDOMRect, useEditorState } from "@tiptap/react";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import {
|
||||
Button,
|
||||
Paper,
|
||||
Stack,
|
||||
Text,
|
||||
VisuallyHidden,
|
||||
} from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { EditorMenuProps } from "@/features/editor/components/table/types/types.ts";
|
||||
import { integrationPasteMenuKey } from "@/features/editor/extensions/integration-paste-menu";
|
||||
|
||||
const INTEGRATION_NODE_TYPES = ["integrationLink", "integrationMention"];
|
||||
|
||||
type PasteTarget = "card" | "mention" | "url";
|
||||
|
||||
const PASTE_OPTIONS: { target: PasteTarget; label: string }[] = [
|
||||
{ target: "card", label: "Card" },
|
||||
{ target: "mention", label: "Mention" },
|
||||
{ target: "url", label: "URL" },
|
||||
];
|
||||
|
||||
export function IntegrationPasteMenu({ editor }: EditorMenuProps) {
|
||||
const { t } = useTranslation();
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
|
||||
const menuState = useEditorState({
|
||||
editor,
|
||||
selector: (ctx) => {
|
||||
if (!ctx.editor) return null;
|
||||
return integrationPasteMenuKey.getState(ctx.editor.state) ?? null;
|
||||
},
|
||||
});
|
||||
|
||||
const findTarget = useCallback(() => {
|
||||
const state = integrationPasteMenuKey.getState(editor.state);
|
||||
if (!state) return null;
|
||||
const node = editor.state.doc.nodeAt(state.pos);
|
||||
if (!node || !INTEGRATION_NODE_TYPES.includes(node.type.name)) return null;
|
||||
return { node, pos: state.pos };
|
||||
}, [editor]);
|
||||
|
||||
const shouldShow = useCallback(() => Boolean(findTarget()), [findTarget]);
|
||||
|
||||
const getReferencedVirtualElement = useCallback(() => {
|
||||
const target = findTarget();
|
||||
if (!target) return undefined;
|
||||
const dom = editor.view.nodeDOM(target.pos) as HTMLElement | null;
|
||||
const domRect =
|
||||
dom?.getBoundingClientRect?.() ??
|
||||
posToDOMRect(
|
||||
editor.view,
|
||||
target.pos,
|
||||
target.pos + target.node.nodeSize,
|
||||
);
|
||||
return {
|
||||
getBoundingClientRect: () => domRect,
|
||||
getClientRects: () => [domRect],
|
||||
};
|
||||
}, [editor, findTarget]);
|
||||
|
||||
const dismiss = useCallback(() => {
|
||||
editor.view.dispatch(
|
||||
editor.state.tr.setMeta(integrationPasteMenuKey, null),
|
||||
);
|
||||
}, [editor]);
|
||||
|
||||
const convert = useCallback(
|
||||
(target: PasteTarget) => {
|
||||
const found = findTarget();
|
||||
if (!found) {
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
const { node, pos } = found;
|
||||
const attrs = { ...node.attrs };
|
||||
const from = pos;
|
||||
const to = pos + node.nodeSize;
|
||||
const isBlock = node.type.name === "integrationLink";
|
||||
|
||||
// Always replace, even when the node is already in the requested form:
|
||||
// the menu closes via the doc change, and BubbleMenu never re-evaluates
|
||||
// on meta-only transactions, so a bare dismiss would leave it stuck.
|
||||
let content: Record<string, any>;
|
||||
if (target === "card") {
|
||||
content = { type: "integrationLink", attrs };
|
||||
} else if (target === "mention") {
|
||||
const mention = { type: "integrationMention", attrs };
|
||||
content = isBlock
|
||||
? {
|
||||
type: "paragraph",
|
||||
content: [mention, { type: "text", text: " " }],
|
||||
}
|
||||
: mention;
|
||||
} else {
|
||||
const linkText = {
|
||||
type: "text",
|
||||
text: attrs.url,
|
||||
marks: [{ type: "link", attrs: { href: attrs.url } }],
|
||||
};
|
||||
content = isBlock
|
||||
? { type: "paragraph", content: [linkText] }
|
||||
: linkText;
|
||||
}
|
||||
|
||||
editor
|
||||
.chain()
|
||||
.focus(undefined, { scrollIntoView: false })
|
||||
.deleteRange({ from, to })
|
||||
.insertContentAt(from, content)
|
||||
.run();
|
||||
},
|
||||
[editor, findTarget, dismiss],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (menuState) setSelectedIndex(0);
|
||||
}, [menuState]);
|
||||
|
||||
// DOM focus stays in the editor (as with the slash menu); keys are handled
|
||||
// here. Capture phase, because ProseMirror itself consumes arrow keys next
|
||||
// to atom nodes (gap cursor / node selection) before they would bubble.
|
||||
useEffect(() => {
|
||||
if (!menuState) return;
|
||||
const onKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === "Escape") {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const delta = event.key === "ArrowDown" ? 1 : -1;
|
||||
setSelectedIndex(
|
||||
(prev) =>
|
||||
(prev + delta + PASTE_OPTIONS.length) % PASTE_OPTIONS.length,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
convert(PASTE_OPTIONS[selectedIndex].target);
|
||||
}
|
||||
};
|
||||
window.addEventListener("keydown", onKeyDown, true);
|
||||
return () => window.removeEventListener("keydown", onKeyDown, true);
|
||||
}, [menuState, dismiss, convert, selectedIndex]);
|
||||
|
||||
return (
|
||||
<BaseBubbleMenu
|
||||
editor={editor}
|
||||
pluginKey="integration-paste-menu"
|
||||
updateDelay={0}
|
||||
getReferencedVirtualElement={getReferencedVirtualElement}
|
||||
options={{ placement: "bottom-start", flip: true }}
|
||||
shouldShow={shouldShow}
|
||||
>
|
||||
{/* Content is gated on the plugin state too: meta-only dismissals
|
||||
(Escape) are invisible to BubbleMenu's update cycle. */}
|
||||
{menuState ? (
|
||||
<Paper
|
||||
shadow="md"
|
||||
radius="md"
|
||||
withBorder
|
||||
p={4}
|
||||
miw={140}
|
||||
role="listbox"
|
||||
aria-label={t("Paste as")}
|
||||
aria-activedescendant={`integration-paste-option-${PASTE_OPTIONS[selectedIndex].target}`}
|
||||
>
|
||||
<VisuallyHidden role="status" aria-live="polite" aria-atomic="true">
|
||||
{t(PASTE_OPTIONS[selectedIndex].label)}
|
||||
</VisuallyHidden>
|
||||
<Text size="xs" c="dimmed" px={8} py={4}>
|
||||
{t("Paste as")}
|
||||
</Text>
|
||||
<Stack gap={2}>
|
||||
{PASTE_OPTIONS.map((option, index) => (
|
||||
<Button
|
||||
key={option.target}
|
||||
id={`integration-paste-option-${option.target}`}
|
||||
role="option"
|
||||
aria-selected={index === selectedIndex}
|
||||
variant={index === selectedIndex ? "light" : "subtle"}
|
||||
color="gray"
|
||||
size="compact-sm"
|
||||
fullWidth
|
||||
justify="flex-start"
|
||||
onMouseEnter={() => setSelectedIndex(index)}
|
||||
onClick={() => convert(option.target)}
|
||||
>
|
||||
{t(option.label)}
|
||||
</Button>
|
||||
))}
|
||||
</Stack>
|
||||
</Paper>
|
||||
) : null}
|
||||
</BaseBubbleMenu>
|
||||
);
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { renderHook, waitFor } from "@testing-library/react";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { createStore, Provider } from "jotai";
|
||||
import { ReactNode } from "react";
|
||||
import { useUnfurl } from "./use-unfurl";
|
||||
import { currentUserAtom } from "@/features/user/atoms/current-user-atom";
|
||||
import { unfurlUrl } from "@/features/integration/services/integration-service";
|
||||
import {
|
||||
UnfurlNeedsConnection,
|
||||
UnfurlResult,
|
||||
} from "@/features/integration/types/integration.types";
|
||||
|
||||
vi.mock("@/features/integration/services/integration-service", () => ({
|
||||
unfurlUrl: vi.fn(),
|
||||
}));
|
||||
|
||||
const mockedUnfurlUrl = vi.mocked(unfurlUrl);
|
||||
|
||||
const ISSUE_URL = "https://github.com/acme/repo/issues/42";
|
||||
|
||||
const loadedResult: UnfurlResult = {
|
||||
title: "Fix race condition in file watcher",
|
||||
url: ISSUE_URL,
|
||||
provider: "github",
|
||||
status: "open",
|
||||
};
|
||||
|
||||
const needsConnectionResult: UnfurlNeedsConnection = {
|
||||
needsConnection: true,
|
||||
integrationId: "int-1",
|
||||
integrationType: "github",
|
||||
integrationName: "GitHub",
|
||||
oauthConnect: true,
|
||||
title: "GitHub link",
|
||||
description: "github.com/acme/repo/issues/42",
|
||||
};
|
||||
|
||||
function createWrapper(loggedIn: boolean) {
|
||||
const store = createStore();
|
||||
if (loggedIn) {
|
||||
store.set(currentUserAtom, { user: { id: "user-1" } } as any);
|
||||
}
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } },
|
||||
});
|
||||
return ({ children }: { children: ReactNode }) => (
|
||||
<Provider store={store}>
|
||||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||
</Provider>
|
||||
);
|
||||
}
|
||||
|
||||
describe("useUnfurl", () => {
|
||||
beforeEach(() => {
|
||||
localStorage.clear();
|
||||
vi.resetAllMocks();
|
||||
});
|
||||
|
||||
it("never fetches for anonymous viewers and reports anonymous", () => {
|
||||
const { result } = renderHook(() => useUnfurl(ISSUE_URL), {
|
||||
wrapper: createWrapper(false),
|
||||
});
|
||||
|
||||
expect(result.current.state).toBe("anonymous");
|
||||
expect(mockedUnfurlUrl).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("starts loading then exposes the unfurl result", async () => {
|
||||
mockedUnfurlUrl.mockResolvedValue(loadedResult);
|
||||
|
||||
const { result } = renderHook(() => useUnfurl(ISSUE_URL), {
|
||||
wrapper: createWrapper(true),
|
||||
});
|
||||
|
||||
expect(result.current.state).toBe("loading");
|
||||
await waitFor(() => expect(result.current.state).toBe("loaded"));
|
||||
expect(
|
||||
result.current.state === "loaded" && result.current.data,
|
||||
).toEqual(loadedResult);
|
||||
expect(mockedUnfurlUrl).toHaveBeenCalledWith({ url: ISSUE_URL });
|
||||
});
|
||||
|
||||
it("maps a needsConnection response without treating it as an error", async () => {
|
||||
mockedUnfurlUrl.mockResolvedValue(needsConnectionResult);
|
||||
|
||||
const { result } = renderHook(() => useUnfurl(ISSUE_URL), {
|
||||
wrapper: createWrapper(true),
|
||||
});
|
||||
|
||||
await waitFor(() =>
|
||||
expect(result.current.state).toBe("needsConnection"),
|
||||
);
|
||||
expect(
|
||||
result.current.state === "needsConnection" &&
|
||||
result.current.needsConnection,
|
||||
).toEqual(needsConnectionResult);
|
||||
});
|
||||
|
||||
it("maps a null result (no matching provider) to error", async () => {
|
||||
mockedUnfurlUrl.mockResolvedValue(null);
|
||||
|
||||
const { result } = renderHook(() => useUnfurl(ISSUE_URL), {
|
||||
wrapper: createWrapper(true),
|
||||
});
|
||||
|
||||
await waitFor(() => expect(result.current.state).toBe("error"));
|
||||
});
|
||||
|
||||
it("maps a rejected request to error", async () => {
|
||||
mockedUnfurlUrl.mockRejectedValue(new Error("boom"));
|
||||
|
||||
const { result } = renderHook(() => useUnfurl(ISSUE_URL), {
|
||||
wrapper: createWrapper(true),
|
||||
});
|
||||
|
||||
await waitFor(() => expect(result.current.state).toBe("error"));
|
||||
});
|
||||
});
|
||||
@@ -1,47 +0,0 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useAtomValue } from "jotai";
|
||||
import { currentUserAtom } from "@/features/user/atoms/current-user-atom";
|
||||
import { unfurlUrl } from "@/features/integration/services/integration-service";
|
||||
import {
|
||||
UnfurlNeedsConnection,
|
||||
UnfurlResult,
|
||||
} from "@/features/integration/types/integration.types";
|
||||
|
||||
const UNFURL_STALE_TIME = 5 * 60 * 1000; // mirrors the server-side Redis TTL
|
||||
|
||||
export type UnfurlState =
|
||||
| { state: "anonymous" }
|
||||
| { state: "loading" }
|
||||
| { state: "error" }
|
||||
| { state: "needsConnection"; needsConnection: UnfurlNeedsConnection }
|
||||
| { state: "loaded"; data: UnfurlResult };
|
||||
|
||||
// Resolves the unfurl per viewer at render time. Nothing is written back into
|
||||
// the document, so third-party permissions are enforced on every view:
|
||||
// unconnected viewers get needsConnection and anonymous viewers never fetch.
|
||||
export function useUnfurl(url: string): UnfurlState {
|
||||
const currentUser = useAtomValue(currentUserAtom);
|
||||
const isAuthenticated = Boolean(currentUser?.user);
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: ["unfurl", url],
|
||||
queryFn: () => unfurlUrl({ url }),
|
||||
enabled: isAuthenticated && Boolean(url),
|
||||
staleTime: UNFURL_STALE_TIME,
|
||||
retry: false,
|
||||
});
|
||||
|
||||
if (!isAuthenticated || !url) {
|
||||
return { state: "anonymous" };
|
||||
}
|
||||
if (query.isPending) {
|
||||
return { state: "loading" };
|
||||
}
|
||||
if (query.isError || !query.data) {
|
||||
return { state: "error" };
|
||||
}
|
||||
if ("needsConnection" in query.data) {
|
||||
return { state: "needsConnection", needsConnection: query.data };
|
||||
}
|
||||
return { state: "loaded", data: query.data };
|
||||
}
|
||||
@@ -57,8 +57,6 @@ import {
|
||||
Indent,
|
||||
UniqueID,
|
||||
SharedStorage,
|
||||
IntegrationLink,
|
||||
IntegrationMention,
|
||||
Columns,
|
||||
Column,
|
||||
Status,
|
||||
@@ -97,9 +95,6 @@ import ExcalidrawView from "@/features/editor/components/excalidraw/excalidraw-v
|
||||
import EmbedView from "@/features/editor/components/embed/embed-view.tsx";
|
||||
import PdfView from "@/features/editor/components/pdf/pdf-view.tsx";
|
||||
import SubpagesView from "@/features/editor/components/subpages/subpages-view.tsx";
|
||||
import IntegrationLinkView from "@/features/editor/components/integration-link/integration-link-view.tsx";
|
||||
import IntegrationMentionView from "@/features/editor/components/integration-link/integration-mention-view.tsx";
|
||||
import { IntegrationPasteMenuExtension } from "@/features/editor/extensions/integration-paste-menu";
|
||||
import TransclusionView from "@/features/editor/components/transclusion/transclusion-view.tsx";
|
||||
import TransclusionReferenceView from "@/features/editor/components/transclusion/transclusion-reference-view.tsx";
|
||||
import { BaseEmbedView } from "@/features/editor/components/base-embed/base-embed-view.tsx";
|
||||
@@ -392,13 +387,6 @@ export const mainExtensions = [
|
||||
Subpages.configure({
|
||||
view: SubpagesView,
|
||||
}),
|
||||
IntegrationLink.configure({
|
||||
view: IntegrationLinkView,
|
||||
}),
|
||||
IntegrationMention.configure({
|
||||
view: IntegrationMentionView,
|
||||
}),
|
||||
IntegrationPasteMenuExtension,
|
||||
Status.configure({
|
||||
view: StatusView,
|
||||
}),
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
import { Extension } from "@tiptap/core";
|
||||
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
||||
|
||||
export type IntegrationPasteMenuState = { pos: number } | null;
|
||||
|
||||
export const integrationPasteMenuKey = new PluginKey<IntegrationPasteMenuState>(
|
||||
"integrationPasteMenu",
|
||||
);
|
||||
|
||||
// Holds the position of a just-pasted integration node so the "Paste as"
|
||||
// menu can anchor to it. Any other edit or selection change dismisses it.
|
||||
export const IntegrationPasteMenuExtension = Extension.create({
|
||||
name: "integrationPasteMenu",
|
||||
|
||||
addProseMirrorPlugins() {
|
||||
return [
|
||||
new Plugin({
|
||||
key: integrationPasteMenuKey,
|
||||
state: {
|
||||
init: (): IntegrationPasteMenuState => null,
|
||||
apply(tr, prev): IntegrationPasteMenuState {
|
||||
const meta = tr.getMeta(integrationPasteMenuKey);
|
||||
if (meta !== undefined) return meta;
|
||||
if (!prev) return null;
|
||||
// Clicking or typing elsewhere dismisses.
|
||||
if (tr.selectionSet) return null;
|
||||
// Structural follow-ups (unique-id assignment, trailing node)
|
||||
// keep the menu anchored: remap and re-validate the position.
|
||||
if (tr.docChanged) {
|
||||
const pos = tr.mapping.map(prev.pos);
|
||||
const node = tr.doc.nodeAt(pos);
|
||||
const isIntegrationNode =
|
||||
node &&
|
||||
(node.type.name === "integrationLink" ||
|
||||
node.type.name === "integrationMention");
|
||||
return isIntegrationNode ? { pos } : null;
|
||||
}
|
||||
return prev;
|
||||
},
|
||||
},
|
||||
}),
|
||||
];
|
||||
},
|
||||
});
|
||||
@@ -79,8 +79,6 @@ import { useEditorScroll } from "./hooks/use-editor-scroll";
|
||||
import { EditorAiMenu } from "@/ee/ai/components/editor/ai-menu/ai-menu";
|
||||
import { EditorLinkMenu } from "@/features/editor/components/link/link-menu";
|
||||
import ColumnsMenu from "@/features/editor/components/columns/columns-menu.tsx";
|
||||
import { IntegrationPasteMenu } from "@/features/editor/components/integration-link/integration-paste-menu.tsx";
|
||||
import { getInstalledIntegrations } from "@/features/integration/services/integration-service";
|
||||
import { TransclusionLookupProvider } from "@/features/editor/components/transclusion/transclusion-lookup-context";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
@@ -360,18 +358,6 @@ function CollabPageEditor({
|
||||
[pageId, editable, extensions],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
// Warm the cache the paste handler reads to decide whether a pasted
|
||||
// integration url becomes a card or stays an ordinary link. gcTime
|
||||
// Infinity: no observer holds this query, and the default 5-minute gc
|
||||
// would evict it mid-session, silently downgrading pastes to plain links.
|
||||
queryClient.prefetchQuery({
|
||||
queryKey: ["installed-integrations"],
|
||||
queryFn: getInstalledIntegrations,
|
||||
gcTime: Infinity,
|
||||
});
|
||||
}, []);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (editor && !editor.isDestroyed) {
|
||||
// @ts-ignore
|
||||
@@ -490,7 +476,6 @@ function CollabPageEditor({
|
||||
<ExcalidrawMenu editor={editor} />
|
||||
<DrawioMenu editor={editor} />
|
||||
<ColumnsMenu editor={editor} />
|
||||
<IntegrationPasteMenu editor={editor} />
|
||||
</div>
|
||||
)}
|
||||
{editor && !editorIsEditable && (editable || canComment) && (
|
||||
|
||||
@@ -38,60 +38,6 @@
|
||||
line-height: var(--mantine-line-height-md);
|
||||
}
|
||||
|
||||
.media-alt-badge {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
bottom: 8px;
|
||||
z-index: 1;
|
||||
padding: 2px 8px;
|
||||
border-radius: 6px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.03em;
|
||||
cursor: default;
|
||||
user-select: none;
|
||||
background-color: var(--mantine-color-body);
|
||||
|
||||
@mixin light {
|
||||
border: 1px solid var(--mantine-color-gray-3);
|
||||
color: var(--mantine-color-gray-7);
|
||||
}
|
||||
|
||||
@mixin dark {
|
||||
border: 1px solid var(--mantine-color-dark-4);
|
||||
color: var(--mantine-color-dark-1);
|
||||
}
|
||||
|
||||
@media print {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: attr(data-alt);
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: calc(100% + 6px);
|
||||
width: max-content;
|
||||
max-width: 320px;
|
||||
padding: 6px 10px;
|
||||
border-radius: var(--mantine-radius-default);
|
||||
font-size: var(--mantine-font-size-sm);
|
||||
font-weight: 400;
|
||||
letter-spacing: normal;
|
||||
line-height: var(--mantine-line-height-sm);
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: break-word;
|
||||
text-align: start;
|
||||
background-color: var(--mantine-color-gray-9);
|
||||
color: var(--mantine-color-white);
|
||||
}
|
||||
|
||||
&:hover::after {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.media-pulse {
|
||||
animation: media-pulse 1.2s ease-in-out infinite;
|
||||
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
import { Group, Text, Button, Box } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { IntegrationDefinition, UserConnection } from "../types/integration.types";
|
||||
import { getIntegrationIcon } from "./integration-icons";
|
||||
|
||||
type ConnectionRowProps = {
|
||||
definition: IntegrationDefinition;
|
||||
connection?: UserConnection;
|
||||
onConnect: (type: string) => void;
|
||||
onDisconnect: (integrationId: string) => void;
|
||||
disconnectingId?: string;
|
||||
};
|
||||
|
||||
export default function ConnectionRow({
|
||||
definition,
|
||||
connection,
|
||||
onConnect,
|
||||
onDisconnect,
|
||||
disconnectingId,
|
||||
}: ConnectionRowProps) {
|
||||
const { t } = useTranslation();
|
||||
const connectedLabel =
|
||||
connection?.providerDisplayName || connection?.providerUserId;
|
||||
|
||||
return (
|
||||
<Box
|
||||
py="sm"
|
||||
px="xs"
|
||||
style={{
|
||||
borderBottom: "1px solid var(--mantine-color-default-border)",
|
||||
}}
|
||||
>
|
||||
<Group justify="space-between" wrap="nowrap">
|
||||
<Group gap="sm" wrap="nowrap">
|
||||
{getIntegrationIcon(definition.type, 28)}
|
||||
<div>
|
||||
<Text size="sm" fw={500}>
|
||||
{definition.name}
|
||||
</Text>
|
||||
<Text size="xs" c="dimmed">
|
||||
{definition.description}
|
||||
</Text>
|
||||
</div>
|
||||
</Group>
|
||||
|
||||
<Group gap="sm" wrap="nowrap" style={{ flexShrink: 0 }}>
|
||||
{connection ? (
|
||||
<>
|
||||
{connection.invalidatedAt ? (
|
||||
<>
|
||||
<Text size="xs" c="orange">
|
||||
{t("Connection expired")}
|
||||
</Text>
|
||||
<Button
|
||||
size="xs"
|
||||
variant="light"
|
||||
color="orange"
|
||||
onClick={() => onConnect(definition.type)}
|
||||
>
|
||||
{t("Reconnect")}
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<Text size="xs" c="green">
|
||||
{connectedLabel
|
||||
? t("Connected as {{label}}", { label: connectedLabel })
|
||||
: t("Connected")}
|
||||
</Text>
|
||||
)}
|
||||
<Button
|
||||
size="xs"
|
||||
variant="subtle"
|
||||
color="red"
|
||||
onClick={() => onDisconnect(connection.integrationId)}
|
||||
loading={disconnectingId === connection.integrationId}
|
||||
>
|
||||
{t("Disconnect")}
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<Button
|
||||
size="xs"
|
||||
variant="light"
|
||||
onClick={() => onConnect(definition.type)}
|
||||
>
|
||||
{t("Connect")}
|
||||
</Button>
|
||||
)}
|
||||
</Group>
|
||||
</Group>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
import { ReactNode } from "react";
|
||||
import {
|
||||
FigmaIcon,
|
||||
GithubIcon,
|
||||
GitlabIcon,
|
||||
GoogleDocsIcon,
|
||||
JiraIcon,
|
||||
LinearIcon,
|
||||
SlackIcon,
|
||||
} from "@/components/icons";
|
||||
import { IconPuzzle } from "@tabler/icons-react";
|
||||
|
||||
const integrationIconMap: Record<string, (size: number) => ReactNode> = {
|
||||
github: (size) => <GithubIcon size={size} />,
|
||||
gitlab: (size) => <GitlabIcon size={size} />,
|
||||
slack: (size) => <SlackIcon size={size} />,
|
||||
linear: (size) => <LinearIcon size={size} />,
|
||||
jira: (size) => <JiraIcon size={size} />,
|
||||
figma: (size) => <FigmaIcon size={size} />,
|
||||
google_docs: (size) => <GoogleDocsIcon size={size} />,
|
||||
};
|
||||
|
||||
export function getIntegrationIcon(
|
||||
type: string,
|
||||
size: number,
|
||||
): ReactNode {
|
||||
const renderIcon = integrationIconMap[type];
|
||||
if (renderIcon) return renderIcon(size);
|
||||
return <IconPuzzle size={size} stroke={1.5} />;
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
import { Box, Group, Skeleton, Stack } from "@mantine/core";
|
||||
|
||||
const TITLE_WIDTHS = [64, 52, 60, 44, 58, 96, 56];
|
||||
const DESCRIPTION_WIDTHS = [300, 250, 320, 180, 290, 270, 260];
|
||||
|
||||
type IntegrationListSkeletonProps = {
|
||||
rows?: number;
|
||||
withBadges?: boolean;
|
||||
};
|
||||
|
||||
export default function IntegrationListSkeleton({
|
||||
rows = 7,
|
||||
withBadges = true,
|
||||
}: IntegrationListSkeletonProps) {
|
||||
return (
|
||||
<Stack gap={0} aria-hidden="true">
|
||||
{Array.from({ length: rows }, (_, index) => (
|
||||
<Box
|
||||
key={index}
|
||||
py="sm"
|
||||
px="xs"
|
||||
style={{
|
||||
borderBottom: "1px solid var(--mantine-color-default-border)",
|
||||
}}
|
||||
>
|
||||
<Group justify="space-between" wrap="nowrap">
|
||||
<Group gap="sm" wrap="nowrap" style={{ flex: 1, minWidth: 0 }}>
|
||||
<Skeleton height={28} circle style={{ flexShrink: 0 }} />
|
||||
<Stack gap={2} style={{ minWidth: 0 }}>
|
||||
<Group gap="xs" wrap="nowrap" h={20}>
|
||||
<Skeleton
|
||||
height={12}
|
||||
width={TITLE_WIDTHS[index % TITLE_WIDTHS.length]}
|
||||
radius="xs"
|
||||
/>
|
||||
{withBadges && (
|
||||
<>
|
||||
<Skeleton height={16} width={52} radius="xl" />
|
||||
<Skeleton height={16} width={52} radius="xl" />
|
||||
</>
|
||||
)}
|
||||
</Group>
|
||||
<Group h={17}>
|
||||
<Skeleton
|
||||
height={10}
|
||||
width={
|
||||
DESCRIPTION_WIDTHS[index % DESCRIPTION_WIDTHS.length]
|
||||
}
|
||||
maw="100%"
|
||||
radius="xs"
|
||||
/>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Group>
|
||||
<Skeleton
|
||||
height={30}
|
||||
width={64}
|
||||
radius="sm"
|
||||
style={{ flexShrink: 0 }}
|
||||
/>
|
||||
</Group>
|
||||
</Box>
|
||||
))}
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
import {
|
||||
Group,
|
||||
Text,
|
||||
Badge,
|
||||
Button,
|
||||
Box,
|
||||
Stack,
|
||||
Tooltip,
|
||||
} from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
IntegrationDefinition,
|
||||
Integration,
|
||||
} from "../types/integration.types";
|
||||
import { getIntegrationIcon } from "./integration-icons";
|
||||
import { useHasFeature } from "@/ee/hooks/use-feature";
|
||||
import { Feature } from "@/ee/features";
|
||||
import { useUpgradeLabel } from "@/ee/hooks/use-upgrade-label";
|
||||
|
||||
type IntegrationRowProps = {
|
||||
definition: IntegrationDefinition;
|
||||
installation?: Integration;
|
||||
onInstall: (type: string) => void;
|
||||
onUninstall: (integrationId: string) => void;
|
||||
};
|
||||
|
||||
export default function IntegrationRow({
|
||||
definition,
|
||||
installation,
|
||||
onInstall,
|
||||
onUninstall,
|
||||
}: IntegrationRowProps) {
|
||||
const { t } = useTranslation();
|
||||
const isInstalled = !!installation;
|
||||
const hasAccess = useHasFeature(Feature.INTEGRATIONS);
|
||||
const locked = !!definition.requiresLicense && !hasAccess;
|
||||
const upgradeLabel = useUpgradeLabel();
|
||||
|
||||
return (
|
||||
<Box
|
||||
py="sm"
|
||||
px="xs"
|
||||
style={{
|
||||
borderBottom: "1px solid var(--mantine-color-default-border)",
|
||||
}}
|
||||
>
|
||||
<Group justify="space-between" wrap="nowrap">
|
||||
<Group gap="sm" wrap="nowrap" style={{ flex: 1, minWidth: 0 }}>
|
||||
{getIntegrationIcon(definition.type, 28)}
|
||||
<Stack gap={2} style={{ minWidth: 0 }}>
|
||||
<Group gap="xs" wrap="nowrap">
|
||||
<Text size="sm" fw={500}>
|
||||
{definition.name}
|
||||
</Text>
|
||||
{locked && (
|
||||
<Badge size="xs" variant="light" color="violet">
|
||||
{t("Paid")}
|
||||
</Badge>
|
||||
)}
|
||||
</Group>
|
||||
<Text size="xs" c="dimmed" truncate>
|
||||
{definition.description}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Group>
|
||||
|
||||
<Group gap="sm" wrap="nowrap" style={{ flexShrink: 0 }}>
|
||||
{isInstalled ? (
|
||||
<Button
|
||||
size="xs"
|
||||
variant="subtle"
|
||||
color="red"
|
||||
onClick={() => onUninstall(installation.id)}
|
||||
>
|
||||
{t("Uninstall")}
|
||||
</Button>
|
||||
) : (
|
||||
<Tooltip label={upgradeLabel} disabled={!locked}>
|
||||
<Button
|
||||
size="xs"
|
||||
variant="light"
|
||||
disabled={locked}
|
||||
onClick={() => onInstall(definition.type)}
|
||||
>
|
||||
{t("Install")}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
</Group>
|
||||
</Group>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
import { Text, Alert, Stack } from "@mantine/core";
|
||||
import { modals } from "@mantine/modals";
|
||||
import { Helmet } from "react-helmet-async";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import { getAppName } from "@/lib/config";
|
||||
import SettingsTitle from "@/components/settings/settings-title";
|
||||
import ConnectionRow from "../components/connection-row";
|
||||
import IntegrationListSkeleton from "../components/integration-list-skeleton";
|
||||
import {
|
||||
useAvailableIntegrations,
|
||||
useInstalledIntegrations,
|
||||
useMyConnections,
|
||||
useDisconnectIntegration,
|
||||
} from "../queries/integration-query";
|
||||
import * as integrationService from "../services/integration-service";
|
||||
|
||||
export default function Connections() {
|
||||
const { t } = useTranslation();
|
||||
const { data: available, isLoading: loadingAvailable } =
|
||||
useAvailableIntegrations();
|
||||
const { data: installed, isLoading: loadingInstalled } =
|
||||
useInstalledIntegrations();
|
||||
const { data: myConnections, isLoading: loadingConnections } =
|
||||
useMyConnections();
|
||||
const disconnectMutation = useDisconnectIntegration();
|
||||
|
||||
const isLoading = loadingAvailable || loadingInstalled || loadingConnections;
|
||||
|
||||
const handleConnect = async (type: string) => {
|
||||
const integration = installed?.find((i) => i.type === type);
|
||||
if (!integration) return;
|
||||
|
||||
try {
|
||||
// Workspace-scoped providers default the OAuth return to the admin
|
||||
// integrations page; members connecting here must come back here.
|
||||
const result = await integrationService.getOAuthAuthorizeUrl({
|
||||
integrationId: integration.id,
|
||||
returnPath: "/settings/account/connections",
|
||||
});
|
||||
window.location.href = result.authorizationUrl;
|
||||
} catch (error) {
|
||||
const errorMessage = error["response"]?.data?.message;
|
||||
notifications.show({
|
||||
message: errorMessage || t("Failed to start OAuth connection"),
|
||||
color: "red",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleDisconnect = (integrationId: string) => {
|
||||
const installation = installed?.find((i) => i.id === integrationId);
|
||||
const name =
|
||||
available?.find((d) => d.type === installation?.type)?.name ??
|
||||
installation?.type ??
|
||||
"";
|
||||
modals.openConfirmModal({
|
||||
title: t("Disconnect {{name}}", { name }),
|
||||
centered: true,
|
||||
children: (
|
||||
<Text size="sm">
|
||||
{t(
|
||||
"This disconnects your {{name}} account. Links are not enriched for you until you reconnect.",
|
||||
{ name },
|
||||
)}
|
||||
</Text>
|
||||
),
|
||||
labels: { confirm: t("Disconnect"), cancel: t("Cancel") },
|
||||
confirmProps: { color: "red" },
|
||||
onConfirm: () => disconnectMutation.mutate({ integrationId }),
|
||||
});
|
||||
};
|
||||
|
||||
// Only the row being disconnected shows a loader; isPending alone is shared by every row.
|
||||
const disconnectingId = disconnectMutation.isPending
|
||||
? disconnectMutation.variables?.integrationId
|
||||
: undefined;
|
||||
|
||||
const error = new URLSearchParams(window.location.search).get("error");
|
||||
|
||||
return (
|
||||
<>
|
||||
<Helmet>
|
||||
<title>
|
||||
{t("Connections")} - {getAppName()}
|
||||
</title>
|
||||
</Helmet>
|
||||
|
||||
<SettingsTitle title={t("Connections")} />
|
||||
|
||||
<Text size="sm" c="dimmed" mb="md">
|
||||
{t("Manage the apps you have connected to your account.")}
|
||||
</Text>
|
||||
|
||||
{error === "oauth_failed" && (
|
||||
<Alert color="red" mb="md">
|
||||
{t("OAuth connection failed. Please try again.")}
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{isLoading ? (
|
||||
<IntegrationListSkeleton rows={3} withBadges={false} />
|
||||
) : !available?.length ? (
|
||||
<Text c="dimmed" size="sm">
|
||||
{t("No integrations available.")}
|
||||
</Text>
|
||||
) : (
|
||||
<Stack gap={0}>
|
||||
{available
|
||||
.filter((def) => {
|
||||
if (!def.capabilities.includes("oauth")) return false;
|
||||
return installed?.some((i) => i.type === def.type);
|
||||
})
|
||||
.map((def) => {
|
||||
const connection = myConnections?.find(
|
||||
(c) => c.type === def.type,
|
||||
);
|
||||
|
||||
return (
|
||||
<ConnectionRow
|
||||
key={def.type}
|
||||
definition={def}
|
||||
connection={connection}
|
||||
onConnect={handleConnect}
|
||||
onDisconnect={handleDisconnect}
|
||||
disconnectingId={disconnectingId}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Stack>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
import { Text, Alert, Stack } from "@mantine/core";
|
||||
import { modals } from "@mantine/modals";
|
||||
import { Helmet } from "react-helmet-async";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useCallback } from "react";
|
||||
import { getAppName } from "@/lib/config";
|
||||
import SettingsTitle from "@/components/settings/settings-title";
|
||||
import IntegrationRow from "../components/integration-row";
|
||||
import IntegrationListSkeleton from "../components/integration-list-skeleton";
|
||||
import {
|
||||
useAvailableIntegrations,
|
||||
useInstalledIntegrations,
|
||||
useInstallIntegration,
|
||||
useUninstallIntegration,
|
||||
} from "../queries/integration-query";
|
||||
import { getOAuthInstallUrl } from "../services/integration-service";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
|
||||
export default function Integrations() {
|
||||
const { t } = useTranslation();
|
||||
const { data: available, isLoading: loadingAvailable } =
|
||||
useAvailableIntegrations();
|
||||
const { data: installed, isLoading: loadingInstalled } =
|
||||
useInstalledIntegrations();
|
||||
const installMutation = useInstallIntegration();
|
||||
const uninstallMutation = useUninstallIntegration();
|
||||
|
||||
const handleInstall = useCallback(
|
||||
async (type: string) => {
|
||||
const definition = available?.find((d) => d.type === type);
|
||||
|
||||
// OAuth providers only become installed once the admin's OAuth
|
||||
// callback succeeds; a cancelled or failed flow persists nothing.
|
||||
if (definition?.capabilities?.includes("oauth")) {
|
||||
try {
|
||||
const { authorizationUrl } = await getOAuthInstallUrl({ type });
|
||||
window.location.href = authorizationUrl;
|
||||
} catch (err: any) {
|
||||
notifications.show({
|
||||
message:
|
||||
err?.response?.data?.message ?? t("Failed to start installation"),
|
||||
color: "red",
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
installMutation.mutate({ type });
|
||||
},
|
||||
[installMutation, available, t],
|
||||
);
|
||||
|
||||
const handleUninstall = useCallback(
|
||||
(integrationId: string) => {
|
||||
const installation = installed?.find((i) => i.id === integrationId);
|
||||
const name =
|
||||
available?.find((d) => d.type === installation?.type)?.name ??
|
||||
installation?.type ??
|
||||
"";
|
||||
modals.openConfirmModal({
|
||||
title: t("Uninstall {{name}}", { name }),
|
||||
centered: true,
|
||||
children: (
|
||||
<Text size="sm">
|
||||
{t(
|
||||
"This disables the {{name}} integration for the entire workspace. Members' connections are removed and links are not enriched.",
|
||||
{ name },
|
||||
)}
|
||||
</Text>
|
||||
),
|
||||
labels: { confirm: t("Uninstall"), cancel: t("Cancel") },
|
||||
confirmProps: { color: "red" },
|
||||
onConfirm: () => uninstallMutation.mutate({ integrationId }),
|
||||
});
|
||||
},
|
||||
[uninstallMutation, installed, available, t],
|
||||
);
|
||||
|
||||
const isLoading = loadingAvailable || loadingInstalled;
|
||||
const error = new URLSearchParams(window.location.search).get("error");
|
||||
|
||||
return (
|
||||
<>
|
||||
<Helmet>
|
||||
<title>
|
||||
{t("Integrations")} - {getAppName()}
|
||||
</title>
|
||||
</Helmet>
|
||||
|
||||
<SettingsTitle title={t("Integrations")} />
|
||||
|
||||
<Text size="sm" c="dimmed" mb="md">
|
||||
{t("Manage workspace integrations.")}
|
||||
</Text>
|
||||
|
||||
{error === "oauth_failed" && (
|
||||
<Alert color="red" mb="md">
|
||||
{t("OAuth connection failed. Please try again.")}
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{isLoading ? (
|
||||
<IntegrationListSkeleton />
|
||||
) : !available?.length ? (
|
||||
<Text c="dimmed" size="sm">
|
||||
{t("No integrations available.")}
|
||||
</Text>
|
||||
) : (
|
||||
<Stack gap={0}>
|
||||
{available.map((def) => {
|
||||
const installation = installed?.find((i) => i.type === def.type);
|
||||
return (
|
||||
<IntegrationRow
|
||||
key={def.type}
|
||||
definition={def}
|
||||
installation={installation}
|
||||
onInstall={handleInstall}
|
||||
onUninstall={handleUninstall}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Stack>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useSearchParams, useNavigate } from "react-router-dom";
|
||||
import { Alert, Button, Card, Group, Loader, Stack, Text } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useAtomValue } from "jotai";
|
||||
import {
|
||||
decodeSlackLinkState,
|
||||
confirmSlackLink,
|
||||
SlackLinkStateInfo,
|
||||
} from "../services/slack-link-service";
|
||||
import { currentUserAtom } from "@/features/user/atoms/current-user-atom";
|
||||
import APP_ROUTE from "@/lib/app-route";
|
||||
|
||||
export default function SlackLinkPage() {
|
||||
const { t } = useTranslation();
|
||||
const [searchParams] = useSearchParams();
|
||||
const navigate = useNavigate();
|
||||
const state = searchParams.get("state");
|
||||
const currentUser = useAtomValue(currentUserAtom);
|
||||
|
||||
const [info, setInfo] = useState<SlackLinkStateInfo | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [done, setDone] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!currentUser) {
|
||||
const redirectPath = window.location.pathname + window.location.search;
|
||||
navigate(`${APP_ROUTE.AUTH.LOGIN}?redirect=${encodeURIComponent(redirectPath)}`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!state) {
|
||||
setError(t("Missing state parameter"));
|
||||
return;
|
||||
}
|
||||
|
||||
decodeSlackLinkState(state)
|
||||
.then(setInfo)
|
||||
.catch((e) => setError(e?.response?.data?.message ?? e.message));
|
||||
}, [state, t, currentUser, navigate]);
|
||||
|
||||
async function onConfirm() {
|
||||
if (!state) return;
|
||||
setSubmitting(true);
|
||||
try {
|
||||
await confirmSlackLink(state);
|
||||
setDone(true);
|
||||
} catch (e: any) {
|
||||
setError(e?.response?.data?.message ?? e.message);
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (done) {
|
||||
return (
|
||||
<Card maw={500} mx="auto" mt={80} p="lg">
|
||||
<Stack>
|
||||
<Text fw={600}>{t("Connected")}</Text>
|
||||
<Text c="dimmed">{t("You can close this tab and return to Slack.")}</Text>
|
||||
</Stack>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Card maw={500} mx="auto" mt={80} p="lg">
|
||||
<Alert color="red" title={t("Could not link account")}>
|
||||
{error}
|
||||
</Alert>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
if (!info || !currentUser) {
|
||||
return (
|
||||
<div style={{ display: "flex", justifyContent: "center", marginTop: 80 }}>
|
||||
<Loader />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Card maw={500} mx="auto" mt={80} p="lg">
|
||||
<Stack>
|
||||
<Text fw={600}>{t("Link your Docmost account to Slack")}</Text>
|
||||
<Text>
|
||||
{t("Connect Docmost account")}{" "}
|
||||
<b>{currentUser.user.email}</b>{" "}
|
||||
{t("to Slack user")} <b>@{info.slackUserName}</b>
|
||||
{info.slackTeamName && (
|
||||
<>
|
||||
{" "}
|
||||
{t("in")} <b>{info.slackTeamName}</b>
|
||||
</>
|
||||
)}
|
||||
?
|
||||
</Text>
|
||||
<Group justify="flex-end">
|
||||
<Button variant="default" onClick={() => window.close()}>
|
||||
{t("Cancel")}
|
||||
</Button>
|
||||
<Button onClick={onConfirm} loading={submitting}>
|
||||
{t("Confirm")}
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import * as integrationService from "../services/integration-service";
|
||||
|
||||
export function useAvailableIntegrations() {
|
||||
return useQuery({
|
||||
queryKey: ["available-integrations"],
|
||||
queryFn: integrationService.getAvailableIntegrations,
|
||||
});
|
||||
}
|
||||
|
||||
export function useInstalledIntegrations() {
|
||||
return useQuery({
|
||||
queryKey: ["installed-integrations"],
|
||||
queryFn: integrationService.getInstalledIntegrations,
|
||||
});
|
||||
}
|
||||
|
||||
export function useInstallIntegration() {
|
||||
const qc = useQueryClient();
|
||||
const { t } = useTranslation();
|
||||
return useMutation({
|
||||
mutationFn: integrationService.installIntegration,
|
||||
onSuccess: () => {
|
||||
notifications.show({ message: t("Integration installed successfully") });
|
||||
qc.invalidateQueries({ queryKey: ["installed-integrations"] });
|
||||
},
|
||||
onError: (error) => {
|
||||
const errorMessage = error["response"]?.data?.message;
|
||||
notifications.show({
|
||||
message: errorMessage || t("Failed to install integration"),
|
||||
color: "red",
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useUninstallIntegration() {
|
||||
const qc = useQueryClient();
|
||||
const { t } = useTranslation();
|
||||
return useMutation({
|
||||
mutationFn: integrationService.uninstallIntegration,
|
||||
onSuccess: () => {
|
||||
notifications.show({
|
||||
message: t("Integration uninstalled successfully"),
|
||||
});
|
||||
qc.invalidateQueries({ queryKey: ["installed-integrations"] });
|
||||
},
|
||||
onError: (error) => {
|
||||
const errorMessage = error["response"]?.data?.message;
|
||||
notifications.show({
|
||||
message: errorMessage || t("Failed to uninstall integration"),
|
||||
color: "red",
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useMyConnections() {
|
||||
return useQuery({
|
||||
queryKey: ["my-connections"],
|
||||
queryFn: integrationService.getMyConnections,
|
||||
});
|
||||
}
|
||||
|
||||
export function useConnectionStatus(integrationId: string | undefined) {
|
||||
return useQuery({
|
||||
queryKey: ["integration-connection", integrationId],
|
||||
queryFn: () =>
|
||||
integrationService.getConnectionStatus({
|
||||
integrationId: integrationId!,
|
||||
}),
|
||||
enabled: !!integrationId,
|
||||
});
|
||||
}
|
||||
|
||||
export function useDisconnectIntegration() {
|
||||
const qc = useQueryClient();
|
||||
const { t } = useTranslation();
|
||||
return useMutation({
|
||||
mutationFn: integrationService.disconnectIntegration,
|
||||
onSuccess: (_data, variables) => {
|
||||
notifications.show({ message: t("Integration disconnected") });
|
||||
qc.invalidateQueries({
|
||||
queryKey: ["integration-connection", variables.integrationId],
|
||||
});
|
||||
qc.invalidateQueries({ queryKey: ["my-connections"] });
|
||||
// removeQueries, not invalidate: refetchOnMount false leaves invalidated inactive queries unrefreshed
|
||||
qc.removeQueries({ queryKey: ["unfurl"] });
|
||||
},
|
||||
onError: (error) => {
|
||||
const errorMessage = error["response"]?.data?.message;
|
||||
notifications.show({
|
||||
message: errorMessage || t("Failed to disconnect integration"),
|
||||
color: "red",
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
import api from "@/lib/api-client";
|
||||
import {
|
||||
IntegrationDefinition,
|
||||
Integration,
|
||||
ConnectionStatus,
|
||||
UserConnection,
|
||||
UnfurlResult,
|
||||
UnfurlNeedsConnection,
|
||||
} from "../types/integration.types";
|
||||
|
||||
export async function getAvailableIntegrations(): Promise<
|
||||
IntegrationDefinition[]
|
||||
> {
|
||||
const req = await api.post<IntegrationDefinition[]>(
|
||||
"/integrations/available",
|
||||
);
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function getInstalledIntegrations(): Promise<Integration[]> {
|
||||
const req = await api.post<Integration[]>("/integrations/list");
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function installIntegration(data: {
|
||||
type: string;
|
||||
}): Promise<Integration> {
|
||||
const req = await api.post<Integration>("/integrations/install", data);
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function uninstallIntegration(data: {
|
||||
integrationId: string;
|
||||
}): Promise<void> {
|
||||
await api.post("/integrations/uninstall", data);
|
||||
}
|
||||
|
||||
export async function getMyConnections(): Promise<UserConnection[]> {
|
||||
const req = await api.post<UserConnection[]>("/integrations/connections/mine");
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function getConnectionStatus(data: {
|
||||
integrationId: string;
|
||||
}): Promise<ConnectionStatus> {
|
||||
const req = await api.post<ConnectionStatus>(
|
||||
"/integrations/connection/status",
|
||||
data,
|
||||
);
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function getOAuthAuthorizeUrl(data: {
|
||||
integrationId: string;
|
||||
returnPath?: string;
|
||||
}): Promise<{ authorizationUrl: string }> {
|
||||
const req = await api.post<{ authorizationUrl: string }>(
|
||||
"/integrations/oauth/authorize",
|
||||
data,
|
||||
);
|
||||
return req.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* For workspace-scoped providers: returns the authorize URL WITHOUT creating
|
||||
* the integration row. The row is created atomically when the OAuth callback
|
||||
* succeeds; a cancelled OAuth leaves no half-installed state.
|
||||
*/
|
||||
export async function getOAuthInstallUrl(data: {
|
||||
type: string;
|
||||
}): Promise<{ authorizationUrl: string }> {
|
||||
const req = await api.post<{ authorizationUrl: string }>(
|
||||
"/integrations/oauth/install",
|
||||
data,
|
||||
);
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function disconnectIntegration(data: {
|
||||
integrationId: string;
|
||||
}): Promise<void> {
|
||||
await api.post("/integrations/oauth/disconnect", data);
|
||||
}
|
||||
|
||||
export async function unfurlUrl(data: {
|
||||
url: string;
|
||||
}): Promise<UnfurlResult | UnfurlNeedsConnection | null> {
|
||||
const req = await api.post<{
|
||||
data: UnfurlResult | UnfurlNeedsConnection | null;
|
||||
}>("/integrations/unfurl", data);
|
||||
return req.data.data;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import api from "@/lib/api-client";
|
||||
|
||||
export type SlackLinkStateInfo = {
|
||||
slackUserName: string;
|
||||
slackUserId: string;
|
||||
slackTeamId: string;
|
||||
slackTeamName: string | null;
|
||||
integrationWorkspaceId: string | undefined;
|
||||
};
|
||||
|
||||
export async function decodeSlackLinkState(
|
||||
state: string,
|
||||
): Promise<SlackLinkStateInfo> {
|
||||
const req = await api.post<SlackLinkStateInfo>(
|
||||
"/integrations/slack/link/state",
|
||||
{ state },
|
||||
);
|
||||
return req.data;
|
||||
}
|
||||
|
||||
export async function confirmSlackLink(state: string): Promise<void> {
|
||||
await api.post("/integrations/slack/link", { state });
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
export type IntegrationCapability = "oauth" | "unfurl" | "actions";
|
||||
|
||||
export type OAuthConfig = {
|
||||
authUrl: string;
|
||||
tokenUrl: string;
|
||||
scopes: string[];
|
||||
connectionScope?: 'workspace' | 'user';
|
||||
};
|
||||
|
||||
export type IntegrationDefinition = {
|
||||
type: string;
|
||||
name: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
capabilities: IntegrationCapability[];
|
||||
oauth?: OAuthConfig;
|
||||
requiresLicense?: boolean;
|
||||
};
|
||||
|
||||
export type Integration = {
|
||||
id: string;
|
||||
workspaceId: string;
|
||||
type: string;
|
||||
settings: Record<string, any> | null;
|
||||
installedById: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type ConnectionStatus = {
|
||||
connected: boolean;
|
||||
providerUserId?: string;
|
||||
};
|
||||
|
||||
export type UserConnection = {
|
||||
integrationId: string;
|
||||
type: string;
|
||||
providerUserId: string | null;
|
||||
providerDisplayName: string | null;
|
||||
connectedAt: string;
|
||||
invalidatedAt: string | null;
|
||||
};
|
||||
|
||||
export type UnfurlResult = {
|
||||
title: string;
|
||||
description?: string;
|
||||
url: string;
|
||||
provider: string;
|
||||
providerIcon?: string;
|
||||
status?: string;
|
||||
statusColor?: string;
|
||||
author?: string;
|
||||
authorAvatarUrl?: string;
|
||||
metadata?: Record<string, any>;
|
||||
};
|
||||
|
||||
// Returned when the link's provider needs a per-user connection the
|
||||
// requesting user has not authorized yet.
|
||||
export type UnfurlNeedsConnection = {
|
||||
needsConnection: true;
|
||||
integrationId: string;
|
||||
integrationType: string;
|
||||
integrationName: string;
|
||||
// false for workspace-scoped providers (Slack): linking happens on the
|
||||
// provider's side, so no Docmost-initiated OAuth button.
|
||||
oauthConnect: boolean;
|
||||
title: string;
|
||||
description?: string;
|
||||
};
|
||||
@@ -27,7 +27,6 @@ export interface IWorkspace {
|
||||
mcpEnabled?: boolean;
|
||||
aiChatReadOnly?: boolean;
|
||||
aiChatWorkspaceKnowledgeOnly?: boolean;
|
||||
enforceMcpOauth?: boolean;
|
||||
trashRetentionDays?: number;
|
||||
restrictApiToAdmins?: boolean;
|
||||
allowMemberTemplates?: boolean;
|
||||
@@ -53,7 +52,6 @@ export interface IWorkspaceAiSettings {
|
||||
search?: boolean;
|
||||
generative?: boolean;
|
||||
mcp?: boolean;
|
||||
enforceMcpOauth?: boolean;
|
||||
chat?: boolean;
|
||||
chatReadOnly?: boolean;
|
||||
chatWorkspaceKnowledgeOnly?: boolean;
|
||||
|
||||
@@ -76,8 +76,6 @@ function redirectToLogin() {
|
||||
APP_ROUTE.AUTH.MFA_CHALLENGE,
|
||||
APP_ROUTE.AUTH.MFA_SETUP_REQUIRED,
|
||||
"/invites",
|
||||
// the oauth consent page redirects to login itself, preserving its query string
|
||||
"/oauth/consent",
|
||||
];
|
||||
if (!exemptPaths.some((path) => window.location.pathname.startsWith(path))) {
|
||||
const redirectTo = window.location.pathname;
|
||||
|
||||
@@ -27,7 +27,6 @@ const APP_ROUTE = {
|
||||
SPACES: "/settings/spaces",
|
||||
BILLING: "/settings/billing",
|
||||
SECURITY: "/settings/security",
|
||||
INTEGRATIONS: "/settings/integrations",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
"@fastify/cookie": "11.1.2",
|
||||
"@fastify/multipart": "10.1.1",
|
||||
"@fastify/static": "10.1.3",
|
||||
"@jmondi/oauth2-server": "^4.3.7",
|
||||
"@keyv/redis": "5.1.6",
|
||||
"@langchain/core": "1.1.46",
|
||||
"@langchain/textsplitters": "1.0.1",
|
||||
|
||||
@@ -63,7 +63,6 @@ export class CollaborationGateway {
|
||||
redis: new RedisClient({
|
||||
host: this.redisConfig.host,
|
||||
port: this.redisConfig.port,
|
||||
username: this.redisConfig.username,
|
||||
password: this.redisConfig.password,
|
||||
db: this.redisConfig.db,
|
||||
family: this.redisConfig.family,
|
||||
|
||||
@@ -49,8 +49,6 @@ import {
|
||||
Footnotes,
|
||||
Footnote,
|
||||
FootnoteReference,
|
||||
IntegrationLink,
|
||||
IntegrationMention,
|
||||
} from '@docmost/editor-ext';
|
||||
import {
|
||||
extensions as coreExtensions,
|
||||
@@ -131,8 +129,6 @@ export const tiptapExtensions = [
|
||||
Footnotes,
|
||||
Footnote,
|
||||
FootnoteReference,
|
||||
IntegrationLink,
|
||||
IntegrationMention
|
||||
] as any;
|
||||
|
||||
export function jsonToHtml(tiptapJson: any) {
|
||||
|
||||
@@ -14,8 +14,7 @@ import { RedisModule } from '@nestjs-labs/nestjs-ioredis';
|
||||
import { RedisConfigService } from '../../integrations/redis/redis-config.service';
|
||||
import { CaslModule } from '../../core/casl/casl.module';
|
||||
import { CacheModule } from '@nestjs/cache-manager';
|
||||
import KeyvRedis, { defaultReconnectStrategy } from '@keyv/redis';
|
||||
import { parseRedisUrl } from '../../common/helpers';
|
||||
import KeyvRedis from '@keyv/redis';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -34,20 +33,10 @@ import { parseRedisUrl } from '../../common/helpers';
|
||||
isGlobal: true,
|
||||
useFactory: async (environmentService: EnvironmentService) => {
|
||||
const redisUrl = environmentService.getRedisUrl();
|
||||
const { family, tls } = parseRedisUrl(redisUrl);
|
||||
|
||||
return {
|
||||
ttl: 5 * 1000,
|
||||
stores: [
|
||||
new KeyvRedis({
|
||||
url: redisUrl,
|
||||
socket: {
|
||||
family,
|
||||
reconnectStrategy: defaultReconnectStrategy,
|
||||
...tls,
|
||||
},
|
||||
}),
|
||||
],
|
||||
stores: [new KeyvRedis(redisUrl)],
|
||||
};
|
||||
},
|
||||
inject: [EnvironmentService],
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
|
||||
export const OAUTH_SCOPE_KEY = 'oauthScope';
|
||||
|
||||
export type OAuthRouteScope = 'read' | 'write';
|
||||
|
||||
export const OAuthScope = (scope: OAuthRouteScope) =>
|
||||
SetMetadata(OAUTH_SCOPE_KEY, scope);
|
||||
@@ -1,6 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
|
||||
export const REQUIRE_SESSION_AUTH_KEY = 'requireSessionAuth';
|
||||
|
||||
export const RequireSessionAuth = () =>
|
||||
SetMetadata(REQUIRE_SESSION_AUTH_KEY, true);
|
||||
@@ -23,11 +23,6 @@ export const AuditEvent = {
|
||||
API_KEY_UPDATED: 'api_key.updated',
|
||||
API_KEY_DELETED: 'api_key.deleted',
|
||||
|
||||
// OAuth
|
||||
OAUTH_CLIENT_REGISTERED: 'oauth_client.registered',
|
||||
OAUTH_GRANT_CREATED: 'oauth_grant.created',
|
||||
OAUTH_GRANT_REVOKED: 'oauth_grant.revoked',
|
||||
|
||||
// SCIM Tokens
|
||||
SCIM_TOKEN_CREATED: 'scim_token.created',
|
||||
SCIM_TOKEN_UPDATED: 'scim_token.updated',
|
||||
@@ -112,6 +107,7 @@ export const EXCLUDED_AUDIT_EVENTS: Set<string> = new Set([
|
||||
AuditEvent.PAGE_CREATED,
|
||||
AuditEvent.PAGE_MOVED_TO_SPACE,
|
||||
AuditEvent.PAGE_DUPLICATED,
|
||||
AuditEvent.COMMENT_CREATED,
|
||||
AuditEvent.COMMENT_UPDATED,
|
||||
AuditEvent.COMMENT_RESOLVED,
|
||||
AuditEvent.COMMENT_REOPENED,
|
||||
@@ -128,8 +124,6 @@ export const AuditResource = {
|
||||
COMMENT: 'comment',
|
||||
SHARE: 'share',
|
||||
API_KEY: 'api_key',
|
||||
OAUTH_CLIENT: 'oauth_client',
|
||||
OAUTH_GRANT: 'oauth_grant',
|
||||
SCIM_TOKEN: 'scim_token',
|
||||
SSO_PROVIDER: 'sso_provider',
|
||||
WORKSPACE_INVITATION: 'workspace_invitation',
|
||||
|
||||
@@ -12,12 +12,9 @@ export enum EventName {
|
||||
SPACE_UPDATED = 'space.updated',
|
||||
SPACE_DELETED = 'space.deleted',
|
||||
|
||||
USER_PASSWORD_RESET = 'user.password.reset',
|
||||
|
||||
WORKSPACE_CREATED = 'workspace.created',
|
||||
WORKSPACE_UPDATED = 'workspace.updated',
|
||||
WORKSPACE_DELETED = 'workspace.deleted',
|
||||
NOTIFICATION_CREATED = 'notification.created',
|
||||
|
||||
BASE_CREATED = 'base.created',
|
||||
BASE_UPDATED = 'base.updated',
|
||||
|
||||
@@ -23,10 +23,7 @@ export const Feature = {
|
||||
PERSONAL_SPACES: 'spaces:personal',
|
||||
DOCX_EXPORT: 'export:docx',
|
||||
BASES: 'bases',
|
||||
INTEGRATIONS: 'integrations',
|
||||
OAUTH: 'oauth',
|
||||
AI_CONTROLS: 'ai:controls',
|
||||
MCP_CONTROLS: 'mcp:controls',
|
||||
} as const;
|
||||
|
||||
export type FeatureKey = (typeof Feature)[keyof typeof Feature];
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
import {
|
||||
ExecutionContext,
|
||||
ForbiddenException,
|
||||
UnauthorizedException,
|
||||
} from '@nestjs/common';
|
||||
import { JwtAuthGuard } from './jwt-auth.guard';
|
||||
import { OAUTH_SCOPE_KEY } from '../decorators/oauth-scope.decorator';
|
||||
import { REQUIRE_SESSION_AUTH_KEY } from '../decorators/require-session-auth.decorator';
|
||||
import { JwtType } from '../../core/auth/dto/jwt-payload';
|
||||
|
||||
const handlerSentinel = () => 'handler';
|
||||
const classSentinel = class Controller {};
|
||||
|
||||
function createCtx(): ExecutionContext {
|
||||
return {
|
||||
getHandler: () => handlerSentinel,
|
||||
getClass: () => classSentinel,
|
||||
} as any;
|
||||
}
|
||||
|
||||
function createGuard(scopeMetadata?: unknown, requireSession?: boolean) {
|
||||
const reflector = {
|
||||
getAllAndOverride: jest.fn((key: string) =>
|
||||
key === REQUIRE_SESSION_AUTH_KEY ? requireSession : scopeMetadata,
|
||||
),
|
||||
} as any;
|
||||
const environmentService = {
|
||||
isCloud: jest.fn().mockReturnValue(false),
|
||||
} as any;
|
||||
const guard = new JwtAuthGuard(reflector, environmentService);
|
||||
return { guard, reflector };
|
||||
}
|
||||
|
||||
function oauthUser(scopes: string[]) {
|
||||
return {
|
||||
user: { id: 'user_1' },
|
||||
workspace: { id: 'ws_1' },
|
||||
oauth: { grantId: 'grant_1', scopes },
|
||||
};
|
||||
}
|
||||
|
||||
describe('JwtAuthGuard.handleRequest', () => {
|
||||
it('rethrows the strategy error', () => {
|
||||
const { guard } = createGuard();
|
||||
const err = new UnauthorizedException('bad token');
|
||||
|
||||
expect(() => guard.handleRequest(err, null, null, createCtx())).toThrow(err);
|
||||
});
|
||||
|
||||
it('throws UnauthorizedException when there is no user', () => {
|
||||
const { guard } = createGuard();
|
||||
|
||||
expect(() => guard.handleRequest(null, null, null, createCtx())).toThrow(
|
||||
UnauthorizedException,
|
||||
);
|
||||
});
|
||||
|
||||
it('returns a non-oauth user untouched without consulting scope metadata', () => {
|
||||
const { guard, reflector } = createGuard();
|
||||
const user = { user: { id: 'user_1' }, workspace: { id: 'ws_1' } };
|
||||
|
||||
expect(guard.handleRequest(null, user, null, createCtx())).toBe(user);
|
||||
expect(reflector.getAllAndOverride).not.toHaveBeenCalledWith(
|
||||
OAUTH_SCOPE_KEY,
|
||||
expect.anything(),
|
||||
);
|
||||
});
|
||||
|
||||
it('forbids an oauth user on a route without scope metadata', () => {
|
||||
const { guard, reflector } = createGuard(undefined);
|
||||
|
||||
expect(() =>
|
||||
guard.handleRequest(null, oauthUser(['read', 'write']), null, createCtx()),
|
||||
).toThrow(ForbiddenException);
|
||||
expect(reflector.getAllAndOverride).toHaveBeenCalledWith(OAUTH_SCOPE_KEY, [
|
||||
handlerSentinel,
|
||||
classSentinel,
|
||||
]);
|
||||
});
|
||||
|
||||
it('passes read scope on a read route', () => {
|
||||
const { guard } = createGuard('read');
|
||||
const user = oauthUser(['read']);
|
||||
|
||||
expect(guard.handleRequest(null, user, null, createCtx())).toBe(user);
|
||||
});
|
||||
|
||||
it('forbids read scope on a write route with insufficient_scope', () => {
|
||||
const { guard } = createGuard('write');
|
||||
|
||||
expect(() =>
|
||||
guard.handleRequest(null, oauthUser(['read']), null, createCtx()),
|
||||
).toThrow('insufficient_scope');
|
||||
});
|
||||
|
||||
it('passes write scope on a read route', () => {
|
||||
const { guard } = createGuard('read');
|
||||
const user = oauthUser(['write']);
|
||||
|
||||
expect(guard.handleRequest(null, user, null, createCtx())).toBe(user);
|
||||
});
|
||||
|
||||
it('passes write scope on a write route', () => {
|
||||
const { guard } = createGuard('write');
|
||||
const user = oauthUser(['write']);
|
||||
|
||||
expect(guard.handleRequest(null, user, null, createCtx())).toBe(user);
|
||||
});
|
||||
|
||||
describe('session-only routes', () => {
|
||||
const sessionUser = {
|
||||
user: { id: 'user_1' },
|
||||
workspace: { id: 'ws_1' },
|
||||
authType: JwtType.ACCESS,
|
||||
};
|
||||
|
||||
it('allows a signed-in session', () => {
|
||||
const { guard } = createGuard(undefined, true);
|
||||
|
||||
expect(guard.handleRequest(null, sessionUser, null, createCtx())).toBe(
|
||||
sessionUser,
|
||||
);
|
||||
});
|
||||
|
||||
it('forbids an api key', () => {
|
||||
const { guard } = createGuard(undefined, true);
|
||||
const apiKeyUser = {
|
||||
user: { id: 'user_1' },
|
||||
workspace: { id: 'ws_1' },
|
||||
authType: JwtType.API_KEY,
|
||||
};
|
||||
|
||||
expect(() =>
|
||||
guard.handleRequest(null, apiKeyUser, null, createCtx()),
|
||||
).toThrow('This action requires an interactive user session');
|
||||
});
|
||||
|
||||
it('forbids an oauth token even when it carries write scope', () => {
|
||||
const { guard } = createGuard('write', true);
|
||||
const user = { ...oauthUser(['write']), authType: JwtType.OAUTH_ACCESS };
|
||||
|
||||
expect(() => guard.handleRequest(null, user, null, createCtx())).toThrow(
|
||||
'This action requires an interactive user session',
|
||||
);
|
||||
});
|
||||
|
||||
it('leaves api keys working on routes without the marker', () => {
|
||||
const { guard } = createGuard(undefined, undefined);
|
||||
const apiKeyUser = {
|
||||
user: { id: 'user_1' },
|
||||
workspace: { id: 'ws_1' },
|
||||
authType: JwtType.API_KEY,
|
||||
};
|
||||
|
||||
expect(guard.handleRequest(null, apiKeyUser, null, createCtx())).toBe(
|
||||
apiKeyUser,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('lets handler metadata override class metadata', () => {
|
||||
const metadataByTarget = new Map<unknown, string>([
|
||||
[handlerSentinel, 'write'],
|
||||
[classSentinel, 'read'],
|
||||
]);
|
||||
const reflector = {
|
||||
getAllAndOverride: jest.fn((key: string, targets: unknown[]) => {
|
||||
if (key === REQUIRE_SESSION_AUTH_KEY) {
|
||||
return undefined;
|
||||
}
|
||||
for (const target of targets) {
|
||||
if (metadataByTarget.has(target)) {
|
||||
return metadataByTarget.get(target);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}),
|
||||
} as any;
|
||||
const environmentService = { isCloud: jest.fn().mockReturnValue(false) } as any;
|
||||
const guard = new JwtAuthGuard(reflector, environmentService);
|
||||
|
||||
expect(() =>
|
||||
guard.handleRequest(null, oauthUser(['read']), null, createCtx()),
|
||||
).toThrow('insufficient_scope');
|
||||
});
|
||||
});
|
||||
@@ -1,26 +1,16 @@
|
||||
import {
|
||||
ExecutionContext,
|
||||
ForbiddenException,
|
||||
Injectable,
|
||||
Logger,
|
||||
UnauthorizedException,
|
||||
} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { IS_PUBLIC_KEY } from '../decorators/public.decorator';
|
||||
import {
|
||||
OAUTH_SCOPE_KEY,
|
||||
OAuthRouteScope,
|
||||
} from '../decorators/oauth-scope.decorator';
|
||||
import { REQUIRE_SESSION_AUTH_KEY } from '../decorators/require-session-auth.decorator';
|
||||
import { JwtType } from '../../core/auth/dto/jwt-payload';
|
||||
import { Reflector } from '@nestjs/core';
|
||||
import { EnvironmentService } from '../../integrations/environment/environment.service';
|
||||
import { addDays } from 'date-fns';
|
||||
|
||||
@Injectable()
|
||||
export class JwtAuthGuard extends AuthGuard('jwt') {
|
||||
private logger = new Logger('JwtAuthGuard');
|
||||
|
||||
constructor(
|
||||
private reflector: Reflector,
|
||||
private environmentService: EnvironmentService,
|
||||
@@ -46,39 +36,6 @@ export class JwtAuthGuard extends AuthGuard('jwt') {
|
||||
throw err || new UnauthorizedException();
|
||||
}
|
||||
|
||||
const requiresSession = this.reflector.getAllAndOverride<boolean>(
|
||||
REQUIRE_SESSION_AUTH_KEY,
|
||||
[ctx.getHandler(), ctx.getClass()],
|
||||
);
|
||||
if (requiresSession && user.authType !== JwtType.ACCESS) {
|
||||
this.logger.debug(
|
||||
`session-only endpoint ${ctx.getClass()?.name}.${ctx.getHandler()?.name} refused authType ${user.authType}`,
|
||||
);
|
||||
throw new ForbiddenException(
|
||||
'This action requires an interactive user session',
|
||||
);
|
||||
}
|
||||
|
||||
if (user.oauth) {
|
||||
const required = this.reflector.getAllAndOverride<
|
||||
OAuthRouteScope | undefined
|
||||
>(OAUTH_SCOPE_KEY, [ctx.getHandler(), ctx.getClass()]);
|
||||
if (!required) {
|
||||
this.logger.warn(
|
||||
`oauth scope check: no @OAuthScope metadata on ${ctx.getClass()?.name}.${ctx.getHandler()?.name}`,
|
||||
);
|
||||
throw new ForbiddenException('OAuth tokens cannot access this endpoint');
|
||||
}
|
||||
const scopes: string[] = user.oauth.scopes ?? [];
|
||||
const satisfied =
|
||||
required === 'read'
|
||||
? scopes.includes('read') || scopes.includes('write')
|
||||
: scopes.includes('write');
|
||||
if (!satisfied) {
|
||||
throw new ForbiddenException('insufficient_scope');
|
||||
}
|
||||
}
|
||||
|
||||
this.setJoinedWorkspacesCookie(user, ctx);
|
||||
return user;
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
import {
|
||||
resolveFrameHeader,
|
||||
resolveFrameHeadersForPath,
|
||||
SecurityHeader,
|
||||
} from './security-headers';
|
||||
|
||||
describe('resolveFrameHeader', () => {
|
||||
it('denies framing with X-Frame-Options when embedding is off', () => {
|
||||
expect(resolveFrameHeader(false, [])).toEqual({
|
||||
name: 'X-Frame-Options',
|
||||
value: 'SAMEORIGIN',
|
||||
});
|
||||
});
|
||||
|
||||
it('returns null when embedding is on but no origins are configured', () => {
|
||||
expect(resolveFrameHeader(true, [])).toBeNull();
|
||||
});
|
||||
|
||||
it('emits a frame-ancestors CSP for the allowed origins', () => {
|
||||
expect(resolveFrameHeader(true, ['https://a.example', 'https://b.example']))
|
||||
.toEqual({
|
||||
name: 'Content-Security-Policy',
|
||||
value: "frame-ancestors 'self' https://a.example https://b.example",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolveFrameHeadersForPath', () => {
|
||||
const configured: SecurityHeader = {
|
||||
name: 'Content-Security-Policy',
|
||||
value: "frame-ancestors 'self' https://a.example",
|
||||
};
|
||||
|
||||
it.each(['/oauth/consent', '/oauth/consent/nested'])(
|
||||
'force-denies %s regardless of configured header',
|
||||
(path) => {
|
||||
expect(resolveFrameHeadersForPath(path, configured)).toEqual([
|
||||
{ name: 'X-Frame-Options', value: 'DENY' },
|
||||
{ name: 'Content-Security-Policy', value: "frame-ancestors 'none'" },
|
||||
]);
|
||||
},
|
||||
);
|
||||
|
||||
it('force-denies consent even when the global header is absent', () => {
|
||||
expect(resolveFrameHeadersForPath('/oauth/consent', null)).toEqual([
|
||||
{ name: 'X-Frame-Options', value: 'DENY' },
|
||||
{ name: 'Content-Security-Policy', value: "frame-ancestors 'none'" },
|
||||
]);
|
||||
});
|
||||
|
||||
it('does not match an unrelated path that merely contains the prefix', () => {
|
||||
expect(
|
||||
resolveFrameHeadersForPath('/oauth/consenting-adults', configured),
|
||||
).toEqual([configured]);
|
||||
});
|
||||
|
||||
it('passes the configured header through for other paths', () => {
|
||||
expect(resolveFrameHeadersForPath('/home', configured)).toEqual([
|
||||
configured,
|
||||
]);
|
||||
});
|
||||
|
||||
it('returns nothing for other paths when no header is configured', () => {
|
||||
expect(resolveFrameHeadersForPath('/home', null)).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -17,19 +17,3 @@ export function resolveFrameHeader(
|
||||
value: `frame-ancestors 'self' ${allowedOrigins.join(' ')}`,
|
||||
};
|
||||
}
|
||||
|
||||
// Deny OAuth consent in iframe
|
||||
export const OAUTH_CONSENT_PATH = '/oauth/consent';
|
||||
|
||||
export function resolveFrameHeadersForPath(
|
||||
path: string,
|
||||
configuredHeader: SecurityHeader | null,
|
||||
): SecurityHeader[] {
|
||||
if (path === OAUTH_CONSENT_PATH || path.startsWith(`${OAUTH_CONSENT_PATH}/`)) {
|
||||
return [
|
||||
{ name: 'X-Frame-Options', value: 'DENY' },
|
||||
{ name: 'Content-Security-Policy', value: "frame-ancestors 'none'" },
|
||||
];
|
||||
}
|
||||
return configuredHeader ? [configuredHeader] : [];
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ export type RedisConfig = {
|
||||
host: string;
|
||||
port: number;
|
||||
db: number;
|
||||
username?: string;
|
||||
password?: string;
|
||||
family?: number;
|
||||
tls?: { rejectUnauthorized?: boolean };
|
||||
@@ -37,15 +36,7 @@ export type RedisConfig = {
|
||||
export function parseRedisUrl(redisUrl: string): RedisConfig {
|
||||
// format - redis[s]://[[username][:password]@][host][:port][/db-number][?family=4|6][&rejectUnauthorized=false]
|
||||
const url = new URL(redisUrl);
|
||||
const {
|
||||
hostname,
|
||||
port,
|
||||
username,
|
||||
password,
|
||||
pathname,
|
||||
protocol,
|
||||
searchParams,
|
||||
} = url;
|
||||
const { hostname, port, password, pathname, protocol, searchParams } = url;
|
||||
const portInt = port ? parseInt(port, 10) : 6379;
|
||||
|
||||
let db: number = 0;
|
||||
@@ -71,15 +62,7 @@ export function parseRedisUrl(redisUrl: string): RedisConfig {
|
||||
: {}
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
host: hostname,
|
||||
port: portInt,
|
||||
username: username ? decodeURIComponent(username) : undefined,
|
||||
password: password ? decodeURIComponent(password) : undefined,
|
||||
db,
|
||||
family,
|
||||
tls,
|
||||
};
|
||||
return { host: hostname, port: portInt, password: password || undefined, db, family, tls };
|
||||
}
|
||||
|
||||
export function createRetryStrategy() {
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
import { getProxyAwareFetch, proxyFetch } from './proxy-fetch';
|
||||
|
||||
describe('getProxyAwareFetch', () => {
|
||||
const originalEnv = { ...process.env };
|
||||
|
||||
afterEach(() => {
|
||||
process.env = { ...originalEnv };
|
||||
});
|
||||
|
||||
it('returns undefined when no proxy env vars are set', () => {
|
||||
delete process.env.HTTP_PROXY;
|
||||
delete process.env.HTTPS_PROXY;
|
||||
delete process.env.http_proxy;
|
||||
delete process.env.https_proxy;
|
||||
|
||||
expect(getProxyAwareFetch()).toBeUndefined();
|
||||
});
|
||||
|
||||
it('returns a fetch function when HTTP_PROXY is set', () => {
|
||||
delete process.env.HTTPS_PROXY;
|
||||
delete process.env.http_proxy;
|
||||
delete process.env.https_proxy;
|
||||
process.env.HTTP_PROXY = 'http://proxy.example.com:8080';
|
||||
|
||||
expect(typeof getProxyAwareFetch()).toBe('function');
|
||||
});
|
||||
|
||||
it('returns a fetch function when HTTPS_PROXY is set', () => {
|
||||
delete process.env.HTTP_PROXY;
|
||||
delete process.env.http_proxy;
|
||||
delete process.env.https_proxy;
|
||||
process.env.HTTPS_PROXY = 'http://proxy.example.com:8080';
|
||||
|
||||
expect(typeof getProxyAwareFetch()).toBe('function');
|
||||
});
|
||||
|
||||
it('returns a fetch function when lowercase http_proxy is set', () => {
|
||||
delete process.env.HTTP_PROXY;
|
||||
delete process.env.HTTPS_PROXY;
|
||||
delete process.env.https_proxy;
|
||||
process.env.http_proxy = 'http://proxy.example.com:8080';
|
||||
|
||||
expect(typeof getProxyAwareFetch()).toBe('function');
|
||||
});
|
||||
|
||||
it('proxyFetch delegates to the platform fetch when no proxy is configured', async () => {
|
||||
delete process.env.HTTP_PROXY;
|
||||
delete process.env.HTTPS_PROXY;
|
||||
delete process.env.http_proxy;
|
||||
delete process.env.https_proxy;
|
||||
|
||||
const original = globalThis.fetch;
|
||||
const response = new Response('ok');
|
||||
const spy = jest.fn().mockResolvedValue(response);
|
||||
globalThis.fetch = spy as unknown as typeof fetch;
|
||||
|
||||
try {
|
||||
await expect(proxyFetch('https://example.com')).resolves.toBe(response);
|
||||
expect(spy).toHaveBeenCalledWith('https://example.com', undefined);
|
||||
} finally {
|
||||
globalThis.fetch = original;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,38 +0,0 @@
|
||||
import { EnvHttpProxyAgent, fetch as undiciFetch } from 'undici';
|
||||
|
||||
const LOOPBACK_BYPASS = ['localhost', '127.0.0.1', '::1'];
|
||||
|
||||
let cachedAgent: EnvHttpProxyAgent | undefined;
|
||||
|
||||
function hasProxyEnv(): boolean {
|
||||
return Boolean(
|
||||
process.env.HTTP_PROXY ||
|
||||
process.env.HTTPS_PROXY ||
|
||||
process.env.http_proxy ||
|
||||
process.env.https_proxy,
|
||||
);
|
||||
}
|
||||
|
||||
function buildAgent(): EnvHttpProxyAgent {
|
||||
const existing = process.env.NO_PROXY || process.env.no_proxy || '';
|
||||
const merged = [existing, ...LOOPBACK_BYPASS]
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean)
|
||||
.join(',');
|
||||
return new EnvHttpProxyAgent({ noProxy: merged });
|
||||
}
|
||||
|
||||
export function getProxyAwareFetch(): typeof fetch | undefined {
|
||||
if (!hasProxyEnv()) return undefined;
|
||||
cachedAgent ??= buildAgent();
|
||||
const agent = cachedAgent;
|
||||
return ((input, init) =>
|
||||
undiciFetch(input as any, {
|
||||
...(init as any),
|
||||
dispatcher: agent,
|
||||
}) as unknown as Promise<Response>) as typeof fetch;
|
||||
}
|
||||
|
||||
// Drop-in replacement for direct fetch calls: proxies when configured, platform fetch otherwise.
|
||||
export const proxyFetch: typeof fetch = (input, init) =>
|
||||
(getProxyAwareFetch() ?? fetch)(input, init);
|
||||
@@ -24,7 +24,6 @@ import * as bytes from 'bytes';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { OAuthScope } from '../../common/decorators/oauth-scope.decorator';
|
||||
import { Attachment, User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import { StorageService } from '../../integrations/storage/storage.service';
|
||||
import {
|
||||
@@ -176,7 +175,6 @@ export class AttachmentController {
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get('/files/:fileId/:fileName')
|
||||
@OAuthScope('read')
|
||||
async getFile(
|
||||
@Req() req: FastifyRequest,
|
||||
@Res() res: FastifyReply,
|
||||
@@ -429,7 +427,6 @@ export class AttachmentController {
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('pages/attachments')
|
||||
@OAuthScope('read')
|
||||
async getPageAttachments(
|
||||
@Body() dto: PageIdDto,
|
||||
@Body() pagination: PaginationOptions,
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { SkipThrottle, ThrottlerGuard } from '@nestjs/throttler';
|
||||
import {
|
||||
ALL_NAMED_THROTTLERS_SKIPPED,
|
||||
AI_CHAT_THROTTLER,
|
||||
AUTH_THROTTLER,
|
||||
} from '../../integrations/throttle/throttler-names';
|
||||
import { LoginDto } from './dto/login.dto';
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
IAuditService,
|
||||
} from '../../integrations/audit/audit.service';
|
||||
|
||||
@SkipThrottle({ ...ALL_NAMED_THROTTLERS_SKIPPED, [AUTH_THROTTLER]: false })
|
||||
@SkipThrottle({ [AI_CHAT_THROTTLER]: true })
|
||||
@UseGuards(ThrottlerGuard)
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
|
||||
@@ -7,7 +7,6 @@ export enum JwtType {
|
||||
API_KEY = 'api_key',
|
||||
PDF_RENDER = 'pdf_render',
|
||||
PDF_EXPORT_DOWNLOAD = 'pdf_export_download',
|
||||
OAUTH_ACCESS = 'oauth_access',
|
||||
}
|
||||
export type JwtPayload = {
|
||||
sub: string;
|
||||
@@ -60,14 +59,3 @@ export type JwtPdfExportDownloadPayload = {
|
||||
workspaceId: string;
|
||||
type: 'pdf_export_download';
|
||||
};
|
||||
|
||||
export type JwtOAuthPayload = {
|
||||
sub: string;
|
||||
workspaceId: string;
|
||||
grantId: string;
|
||||
scope: string;
|
||||
aud: string;
|
||||
iss: string;
|
||||
jti: string;
|
||||
type: JwtType.OAUTH_ACCESS;
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@ import {
|
||||
BadRequestException,
|
||||
Inject,
|
||||
Injectable,
|
||||
Logger,
|
||||
NotFoundException,
|
||||
UnauthorizedException,
|
||||
} from '@nestjs/common';
|
||||
@@ -41,13 +40,9 @@ import {
|
||||
IAuditService,
|
||||
} from '../../../integrations/audit/audit.service';
|
||||
import { EnvironmentService } from '../../../integrations/environment/environment.service';
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||
import { EventName } from '../../../common/events/event.contants';
|
||||
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
private readonly logger = new Logger(AuthService.name);
|
||||
|
||||
constructor(
|
||||
private signupService: SignupService,
|
||||
private tokenService: TokenService,
|
||||
@@ -58,7 +53,6 @@ export class AuthService {
|
||||
private mailService: MailService,
|
||||
private domainService: DomainService,
|
||||
private environmentService: EnvironmentService,
|
||||
private eventEmitter: EventEmitter2,
|
||||
@InjectKysely() private readonly db: KyselyDB,
|
||||
@Inject(AUDIT_SERVICE) private readonly auditService: IAuditService,
|
||||
) {}
|
||||
@@ -267,19 +261,6 @@ export class AuthService {
|
||||
|
||||
await this.userSessionRepo.deleteByUserId(user.id, workspace.id);
|
||||
|
||||
// A failed revocation must not block the reset itself; log loudly instead.
|
||||
try {
|
||||
await this.eventEmitter.emitAsync(EventName.USER_PASSWORD_RESET, {
|
||||
userId: user.id,
|
||||
workspaceId: workspace.id,
|
||||
});
|
||||
} catch (err) {
|
||||
this.logger.error(
|
||||
`failed to revoke oauth grants for user ${user.id} after password reset`,
|
||||
err,
|
||||
);
|
||||
}
|
||||
|
||||
this.auditService.setActorId(user.id);
|
||||
this.auditService.log({
|
||||
event: AuditEvent.USER_PASSWORD_RESET,
|
||||
|
||||
@@ -2,12 +2,7 @@ import { Injectable, Logger, UnauthorizedException } from '@nestjs/common';
|
||||
import { PassportStrategy } from '@nestjs/passport';
|
||||
import { Strategy } from 'passport-jwt';
|
||||
import { EnvironmentService } from '../../../integrations/environment/environment.service';
|
||||
import {
|
||||
JwtApiKeyPayload,
|
||||
JwtOAuthPayload,
|
||||
JwtPayload,
|
||||
JwtType,
|
||||
} from '../dto/jwt-payload';
|
||||
import { JwtApiKeyPayload, JwtPayload, JwtType } from '../dto/jwt-payload';
|
||||
import { WorkspaceRepo } from '@docmost/db/repos/workspace/workspace.repo';
|
||||
import { UserRepo } from '@docmost/db/repos/user/user.repo';
|
||||
import { UserSessionRepo } from '@docmost/db/repos/session/user-session.repo';
|
||||
@@ -38,10 +33,7 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
|
||||
});
|
||||
}
|
||||
|
||||
async validate(
|
||||
req: any,
|
||||
payload: JwtPayload | JwtApiKeyPayload | JwtOAuthPayload,
|
||||
) {
|
||||
async validate(req: any, payload: JwtPayload | JwtApiKeyPayload) {
|
||||
if (!payload.workspaceId) {
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
@@ -50,21 +42,8 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
|
||||
throw new UnauthorizedException('Workspace does not match');
|
||||
}
|
||||
|
||||
// authType lets guards tell an interactive session from a programmatic credential.
|
||||
if (payload.type === JwtType.API_KEY) {
|
||||
const authResult = await this.validateApiKey(
|
||||
req,
|
||||
payload as JwtApiKeyPayload,
|
||||
);
|
||||
return { ...authResult, authType: JwtType.API_KEY };
|
||||
}
|
||||
|
||||
if (payload.type === JwtType.OAUTH_ACCESS) {
|
||||
const authResult = await this.validateOAuthToken(
|
||||
req,
|
||||
payload as JwtOAuthPayload,
|
||||
);
|
||||
return { ...authResult, authType: JwtType.OAUTH_ACCESS };
|
||||
return this.validateApiKey(req, payload as JwtApiKeyPayload);
|
||||
}
|
||||
|
||||
if (payload.type !== JwtType.ACCESS) {
|
||||
@@ -92,7 +71,7 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
|
||||
this.sessionActivityService.trackActivity(sessionId, payload.sub, payload.workspaceId);
|
||||
}
|
||||
|
||||
return { user, workspace, authType: JwtType.ACCESS };
|
||||
return { user, workspace };
|
||||
}
|
||||
|
||||
private async validateApiKey(req: any, payload: JwtApiKeyPayload) {
|
||||
@@ -120,36 +99,4 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
|
||||
|
||||
throw new UnauthorizedException('Enterprise API Key module missing');
|
||||
}
|
||||
|
||||
private async validateOAuthToken(req: any, payload: JwtOAuthPayload) {
|
||||
let OAuthStrategyModule: any;
|
||||
let isOAuthModuleReady = false;
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
OAuthStrategyModule = require('./../../../ee/oauth/services/oauth-strategy.service');
|
||||
isOAuthModuleReady = true;
|
||||
} catch (err) {
|
||||
this.logger.debug(
|
||||
'OAuth module requested but enterprise module not bundled in this build',
|
||||
);
|
||||
isOAuthModuleReady = false;
|
||||
}
|
||||
|
||||
if (isOAuthModuleReady) {
|
||||
const OAuthStrategyService = this.moduleRef.get(
|
||||
OAuthStrategyModule.OAuthStrategyService,
|
||||
{
|
||||
strict: false,
|
||||
},
|
||||
);
|
||||
|
||||
return OAuthStrategyService.validateOAuthToken(payload, {
|
||||
workspaceId: req.raw.workspaceId,
|
||||
host: req.raw.headers?.host ?? req.headers?.host,
|
||||
});
|
||||
}
|
||||
|
||||
throw new UnauthorizedException('Enterprise OAuth module missing');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import { PageIdDto, CommentIdDto } from './dto/comments.input';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { OAuthScope } from '../../common/decorators/oauth-scope.decorator';
|
||||
import { PaginationOptions } from '@docmost/db/pagination/pagination-options';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import SpaceAbilityFactory from '../casl/abilities/space-ability.factory';
|
||||
@@ -49,7 +48,6 @@ export class CommentController {
|
||||
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('create')
|
||||
@OAuthScope('write')
|
||||
async create(
|
||||
@Body() createCommentDto: CreateCommentDto,
|
||||
@AuthUser() user: User,
|
||||
@@ -86,7 +84,6 @@ export class CommentController {
|
||||
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('/')
|
||||
@OAuthScope('read')
|
||||
async findPageComments(
|
||||
@Body() input: PageIdDto,
|
||||
@Body()
|
||||
@@ -128,7 +125,6 @@ export class CommentController {
|
||||
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('update')
|
||||
@OAuthScope('write')
|
||||
async update(@Body() dto: UpdateCommentDto, @AuthUser() user: User, @AuthWorkspace() workspace: Workspace) {
|
||||
const comment = await this.commentRepo.findById(dto.commentId, {
|
||||
includeCreator: true,
|
||||
|
||||
@@ -21,9 +21,6 @@ import { ShareModule } from './share/share.module';
|
||||
import { LabelModule } from './label/label.module';
|
||||
import { NotificationModule } from './notification/notification.module';
|
||||
import { WatcherModule } from './watcher/watcher.module';
|
||||
import { IntegrationModule } from './integration/integration.module';
|
||||
import { GitHubModule } from './integration/providers/github/github.module';
|
||||
import { GitLabModule } from './integration/providers/gitlab/gitlab.module';
|
||||
import { FavoriteModule } from './favorite/favorite.module';
|
||||
import { SessionModule } from './session/session.module';
|
||||
import { ClsMiddleware } from 'nestjs-cls';
|
||||
@@ -46,9 +43,6 @@ import { ClsMiddleware } from 'nestjs-cls';
|
||||
LabelModule,
|
||||
NotificationModule,
|
||||
WatcherModule,
|
||||
IntegrationModule,
|
||||
GitHubModule,
|
||||
GitLabModule,
|
||||
SessionModule,
|
||||
],
|
||||
})
|
||||
@@ -59,7 +53,6 @@ export class CoreModule implements NestModule {
|
||||
{ path: 'health', method: RequestMethod.GET },
|
||||
{ path: 'health/live', method: RequestMethod.GET },
|
||||
{ path: 'billing/stripe/webhook', method: RequestMethod.POST },
|
||||
{ path: 'integrations/oauth/*/callback', method: RequestMethod.GET },
|
||||
];
|
||||
|
||||
consumer
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
export enum IntegrationType {
|
||||
SLACK = 'slack',
|
||||
GITHUB = 'github',
|
||||
GITLAB = 'gitlab',
|
||||
JIRA = 'jira',
|
||||
LINEAR = 'linear',
|
||||
GOOGLE_DOCS = 'google_docs',
|
||||
FIGMA = 'figma',
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
import {
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Matches,
|
||||
MaxLength,
|
||||
} from 'class-validator';
|
||||
|
||||
export class InstallIntegrationDto {
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
type: string;
|
||||
}
|
||||
|
||||
export class UninstallIntegrationDto {
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
integrationId: string;
|
||||
}
|
||||
|
||||
export class IntegrationIdDto {
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
integrationId: string;
|
||||
}
|
||||
|
||||
export class UnfurlDto {
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
url: string;
|
||||
}
|
||||
|
||||
export class OAuthAuthorizeDto {
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
integrationId: string;
|
||||
|
||||
// In-app path to land on after OAuth; single leading slash keeps the
|
||||
// redirect on the workspace origin.
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(512)
|
||||
@Matches(/^\/(?!\/)[^\s\\]*$/)
|
||||
returnPath?: string;
|
||||
}
|
||||
|
||||
export class OAuthDisconnectDto {
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
integrationId: string;
|
||||
}
|
||||
|
||||
export class OAuthInstallDto {
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
type: string;
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { IntegrationConnectionRepo } from './repos/integration-connection.repo';
|
||||
import { IntegrationRepo } from './repos/integration.repo';
|
||||
import { IntegrationConnection } from '@docmost/db/types/entity.types';
|
||||
import { UnfurlService } from './unfurl/unfurl.service';
|
||||
|
||||
@Injectable()
|
||||
export class IntegrationConnectionService {
|
||||
constructor(
|
||||
private readonly connectionRepo: IntegrationConnectionRepo,
|
||||
private readonly integrationRepo: IntegrationRepo,
|
||||
private readonly unfurlService: UnfurlService,
|
||||
) {}
|
||||
|
||||
async getConnectionStatus(
|
||||
integrationId: string,
|
||||
userId: string,
|
||||
workspaceId: string,
|
||||
): Promise<{ connected: boolean; providerUserId?: string }> {
|
||||
const integration = await this.integrationRepo.findById(integrationId);
|
||||
if (!integration || integration.workspaceId !== workspaceId) {
|
||||
throw new NotFoundException('Integration not found');
|
||||
}
|
||||
|
||||
const connection = await this.connectionRepo.findByIntegrationAndUser(
|
||||
integrationId,
|
||||
userId,
|
||||
);
|
||||
|
||||
return {
|
||||
connected: !!connection && !connection.invalidatedAt,
|
||||
providerUserId: connection?.providerUserId ?? undefined,
|
||||
};
|
||||
}
|
||||
|
||||
async findByIntegrationAndUser(
|
||||
integrationId: string,
|
||||
userId: string,
|
||||
): Promise<IntegrationConnection | undefined> {
|
||||
return this.connectionRepo.findByIntegrationAndUser(integrationId, userId);
|
||||
}
|
||||
|
||||
async findByWorkspaceTypeAndUser(
|
||||
workspaceId: string,
|
||||
integrationType: string,
|
||||
userId: string,
|
||||
): Promise<IntegrationConnection | undefined> {
|
||||
return this.connectionRepo.findByWorkspaceTypeAndUser(
|
||||
workspaceId,
|
||||
integrationType,
|
||||
userId,
|
||||
);
|
||||
}
|
||||
|
||||
async getUserConnections(userId: string, workspaceId: string) {
|
||||
const rows = await this.connectionRepo.findByUserAndWorkspace(
|
||||
userId,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
return rows.map((row) => ({
|
||||
integrationId: row.integrationId,
|
||||
type: row.type,
|
||||
providerUserId: row.providerUserId ?? null,
|
||||
providerDisplayName:
|
||||
(row.metadata as { displayName?: string } | null)?.displayName ?? null,
|
||||
connectedAt: row.createdAt,
|
||||
invalidatedAt: row.invalidatedAt ?? null,
|
||||
}));
|
||||
}
|
||||
|
||||
async disconnect(
|
||||
integrationId: string,
|
||||
userId: string,
|
||||
workspaceId: string,
|
||||
): Promise<void> {
|
||||
const integration = await this.integrationRepo.findById(integrationId);
|
||||
if (!integration || integration.workspaceId !== workspaceId) {
|
||||
throw new NotFoundException('Integration not found');
|
||||
}
|
||||
|
||||
await this.connectionRepo.deleteByIntegrationAndUser(
|
||||
integrationId,
|
||||
userId,
|
||||
);
|
||||
|
||||
await this.unfurlService.purgeUserCache(workspaceId, userId);
|
||||
}
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
ForbiddenException,
|
||||
HttpCode,
|
||||
HttpStatus,
|
||||
Post,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import { IntegrationService } from './integration.service';
|
||||
import { IntegrationConnectionService } from './integration-connection.service';
|
||||
import {
|
||||
InstallIntegrationDto,
|
||||
UninstallIntegrationDto,
|
||||
IntegrationIdDto,
|
||||
} from './dto/integration.dto';
|
||||
import { IntegrationRegistry } from './registry/integration-registry';
|
||||
import WorkspaceAbilityFactory from '../casl/abilities/workspace-ability.factory';
|
||||
import {
|
||||
WorkspaceCaslAction,
|
||||
WorkspaceCaslSubject,
|
||||
} from '../casl/interfaces/workspace-ability.type';
|
||||
import { LicenseCheckService } from '../../integrations/environment/license-check.service';
|
||||
import { Feature } from '../../common/features';
|
||||
|
||||
@Controller('integrations')
|
||||
export class IntegrationController {
|
||||
constructor(
|
||||
private readonly integrationService: IntegrationService,
|
||||
private readonly connectionService: IntegrationConnectionService,
|
||||
private readonly workspaceAbility: WorkspaceAbilityFactory,
|
||||
private readonly licenseCheckService: LicenseCheckService,
|
||||
private readonly registry: IntegrationRegistry,
|
||||
) {}
|
||||
|
||||
private assertIntegrationsLicensed(workspace: Workspace) {
|
||||
if (
|
||||
!this.licenseCheckService.hasFeature(
|
||||
workspace.licenseKey,
|
||||
Feature.INTEGRATIONS,
|
||||
workspace.plan,
|
||||
)
|
||||
) {
|
||||
throw new ForbiddenException('This feature requires a valid license');
|
||||
}
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('available')
|
||||
async getAvailableIntegrations() {
|
||||
return this.integrationService.getAvailableIntegrations();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('list')
|
||||
async getInstalledIntegrations(
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
) {
|
||||
return this.integrationService.getInstalledIntegrations(workspace.id);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('install')
|
||||
async install(
|
||||
@Body() dto: InstallIntegrationDto,
|
||||
@AuthUser() user: User,
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
) {
|
||||
const ability = this.workspaceAbility.createForUser(user, workspace);
|
||||
if (
|
||||
ability.cannot(
|
||||
WorkspaceCaslAction.Manage,
|
||||
WorkspaceCaslSubject.Settings,
|
||||
)
|
||||
) {
|
||||
throw new ForbiddenException();
|
||||
}
|
||||
|
||||
if (this.registry.getProvider(dto.type)?.definition.requiresLicense) {
|
||||
this.assertIntegrationsLicensed(workspace);
|
||||
}
|
||||
return this.integrationService.install(dto.type, workspace.id, user.id);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('uninstall')
|
||||
async uninstall(
|
||||
@Body() dto: UninstallIntegrationDto,
|
||||
@AuthUser() user: User,
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
) {
|
||||
const ability = this.workspaceAbility.createForUser(user, workspace);
|
||||
if (
|
||||
ability.cannot(
|
||||
WorkspaceCaslAction.Manage,
|
||||
WorkspaceCaslSubject.Settings,
|
||||
)
|
||||
) {
|
||||
throw new ForbiddenException();
|
||||
}
|
||||
|
||||
await this.integrationService.uninstall(dto.integrationId, workspace.id);
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('connections/mine')
|
||||
async getMyConnections(
|
||||
@AuthUser() user: User,
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
) {
|
||||
return this.connectionService.getUserConnections(user.id, workspace.id);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('connection/status')
|
||||
async getConnectionStatus(
|
||||
@Body() dto: IntegrationIdDto,
|
||||
@AuthUser() user: User,
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
) {
|
||||
return this.connectionService.getConnectionStatus(
|
||||
dto.integrationId,
|
||||
user.id,
|
||||
workspace.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
import { Injectable, Logger, OnApplicationBootstrap } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import { InjectQueue } from '@nestjs/bullmq';
|
||||
import { Queue } from 'bullmq';
|
||||
import { QueueJob, QueueName } from '../../integrations/queue/constants';
|
||||
import { EventName } from '../../common/events/event.contants';
|
||||
|
||||
const TOKEN_REFRESH_SCHEDULER_ID = 'integration-token-refresh-scheduler';
|
||||
const TOKEN_REFRESH_INTERVAL_MS = 10 * 60 * 1000; // 10 minutes
|
||||
|
||||
@Injectable()
|
||||
export class IntegrationListener implements OnApplicationBootstrap {
|
||||
private readonly logger = new Logger(IntegrationListener.name);
|
||||
|
||||
constructor(
|
||||
@InjectQueue(QueueName.INTEGRATION_QUEUE)
|
||||
private readonly integrationQueue: Queue,
|
||||
) {}
|
||||
|
||||
async onApplicationBootstrap() {
|
||||
await this.integrationQueue.upsertJobScheduler(
|
||||
TOKEN_REFRESH_SCHEDULER_ID,
|
||||
{ every: TOKEN_REFRESH_INTERVAL_MS },
|
||||
{
|
||||
name: QueueJob.INTEGRATION_TOKEN_REFRESH,
|
||||
data: {},
|
||||
},
|
||||
);
|
||||
this.logger.debug('Integration token refresh scheduler created');
|
||||
}
|
||||
|
||||
@OnEvent(EventName.PAGE_CREATED)
|
||||
async onPageCreated(payload: any) {
|
||||
await this.integrationQueue.add(QueueJob.INTEGRATION_EVENT, {
|
||||
eventName: EventName.PAGE_CREATED,
|
||||
...payload,
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(EventName.PAGE_UPDATED)
|
||||
async onPageUpdated(payload: any) {
|
||||
await this.integrationQueue.add(QueueJob.INTEGRATION_EVENT, {
|
||||
eventName: EventName.PAGE_UPDATED,
|
||||
...payload,
|
||||
});
|
||||
}
|
||||
|
||||
@OnEvent(EventName.PAGE_DELETED)
|
||||
async onPageDeleted(payload: any) {
|
||||
await this.integrationQueue.add(QueueJob.INTEGRATION_EVENT, {
|
||||
eventName: EventName.PAGE_DELETED,
|
||||
...payload,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { IntegrationRegistry } from './registry/integration-registry';
|
||||
import { IntegrationService } from './integration.service';
|
||||
import { IntegrationConnectionService } from './integration-connection.service';
|
||||
import { IntegrationController } from './integration.controller';
|
||||
import { OAuthController } from './oauth/oauth.controller';
|
||||
import { OAuthService } from './oauth/oauth.service';
|
||||
import { UnfurlController } from './unfurl/unfurl.controller';
|
||||
import { UnfurlService } from './unfurl/unfurl.service';
|
||||
import { IntegrationRepo } from './repos/integration.repo';
|
||||
import { IntegrationConnectionRepo } from './repos/integration-connection.repo';
|
||||
import { IntegrationListener } from './integration.listener';
|
||||
import { IntegrationProcessor } from './integration.processor';
|
||||
|
||||
@Module({
|
||||
controllers: [IntegrationController, OAuthController, UnfurlController],
|
||||
providers: [
|
||||
IntegrationRegistry,
|
||||
IntegrationService,
|
||||
IntegrationConnectionService,
|
||||
OAuthService,
|
||||
UnfurlService,
|
||||
IntegrationRepo,
|
||||
IntegrationConnectionRepo,
|
||||
IntegrationListener,
|
||||
IntegrationProcessor,
|
||||
],
|
||||
exports: [
|
||||
IntegrationRegistry,
|
||||
IntegrationService,
|
||||
IntegrationConnectionService,
|
||||
OAuthService,
|
||||
IntegrationRepo,
|
||||
IntegrationConnectionRepo,
|
||||
],
|
||||
})
|
||||
export class IntegrationModule {}
|
||||
@@ -1,133 +0,0 @@
|
||||
import { OnWorkerEvent, Processor, WorkerHost } from '@nestjs/bullmq';
|
||||
import { Logger, NotFoundException } from '@nestjs/common';
|
||||
import { IntegrationConnection } from '@docmost/db/types/entity.types';
|
||||
import { TokenInvalidError } from './registry/integration-provider.interface';
|
||||
import { Job } from 'bullmq';
|
||||
import { QueueJob, QueueName } from '../../integrations/queue/constants/queue.constants';
|
||||
import { IntegrationRegistry } from './registry/integration-registry';
|
||||
import { IntegrationRepo } from './repos/integration.repo';
|
||||
import { IntegrationConnectionRepo } from './repos/integration-connection.repo';
|
||||
import { OAuthService } from './oauth/oauth.service';
|
||||
|
||||
const TOKEN_REFRESH_WINDOW_MS = 15 * 60 * 1000; // 15 minutes
|
||||
|
||||
@Processor(QueueName.INTEGRATION_QUEUE)
|
||||
export class IntegrationProcessor extends WorkerHost {
|
||||
private readonly logger = new Logger(IntegrationProcessor.name);
|
||||
|
||||
constructor(
|
||||
private readonly registry: IntegrationRegistry,
|
||||
private readonly integrationRepo: IntegrationRepo,
|
||||
private readonly connectionRepo: IntegrationConnectionRepo,
|
||||
private readonly oauthService: OAuthService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
async process(job: Job): Promise<void> {
|
||||
switch (job.name) {
|
||||
case QueueJob.INTEGRATION_EVENT:
|
||||
await this.handleIntegrationEvent(job);
|
||||
break;
|
||||
case QueueJob.INTEGRATION_TOKEN_REFRESH:
|
||||
await this.handleTokenRefresh();
|
||||
break;
|
||||
default:
|
||||
this.logger.warn(`Unknown job: ${job.name}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Route worker-level errors (e.g. lock renewal after laptop sleep) through
|
||||
// the logger instead of bullmq's raw console.error fallback.
|
||||
@OnWorkerEvent('error')
|
||||
onError(err: Error): void {
|
||||
this.logger.error(`Worker error: ${err.message}`);
|
||||
}
|
||||
|
||||
private async handleTokenRefresh(): Promise<void> {
|
||||
const connections = await this.connectionRepo.findExpiringTokens(
|
||||
TOKEN_REFRESH_WINDOW_MS,
|
||||
);
|
||||
|
||||
if (connections.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.logger.log(
|
||||
`Refreshing tokens for ${connections.length} connection(s)`,
|
||||
);
|
||||
|
||||
for (const connection of connections) {
|
||||
try {
|
||||
await this.oauthService.getValidAccessToken(connection);
|
||||
} catch (err) {
|
||||
this.logger.error(
|
||||
`Token refresh failed for connection ${connection.id}: ${(err as Error).message}`,
|
||||
);
|
||||
// Dead credential or orphaned row: retire it so findExpiringTokens stops selecting it.
|
||||
if (
|
||||
err instanceof NotFoundException ||
|
||||
err instanceof TokenInvalidError
|
||||
) {
|
||||
await this.connectionRepo
|
||||
.invalidate(connection.id)
|
||||
.catch(() => undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async handleIntegrationEvent(job: Job): Promise<void> {
|
||||
const { eventName, workspaceId, ...payload } = job.data;
|
||||
|
||||
if (!workspaceId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const integrations =
|
||||
await this.integrationRepo.findAllByWorkspace(workspaceId);
|
||||
|
||||
for (const integration of integrations) {
|
||||
const provider = this.registry.getProvider(integration.type);
|
||||
if (!provider?.handleEvent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let connection: IntegrationConnection | undefined;
|
||||
try {
|
||||
const connections = await this.connectionRepo.findByIntegration(
|
||||
integration.id,
|
||||
);
|
||||
|
||||
connection = connections[0];
|
||||
let accessToken: string | undefined;
|
||||
|
||||
if (connection) {
|
||||
accessToken = await this.oauthService.getValidAccessToken(connection);
|
||||
}
|
||||
|
||||
await provider.handleEvent({
|
||||
eventName,
|
||||
payload,
|
||||
integration: {
|
||||
id: integration.id,
|
||||
type: integration.type,
|
||||
settings: integration.settings as Record<string, any> | null,
|
||||
},
|
||||
connection: connection
|
||||
? { accessToken, userId: connection.userId }
|
||||
: undefined,
|
||||
});
|
||||
} catch (err) {
|
||||
this.logger.error(
|
||||
`Integration event handler failed for ${integration.type}: ${(err as Error).message}`,
|
||||
);
|
||||
if (err instanceof TokenInvalidError && connection) {
|
||||
await this.connectionRepo
|
||||
.invalidate(connection.id)
|
||||
.catch(() => undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
import {
|
||||
BadRequestException,
|
||||
Injectable,
|
||||
NotFoundException,
|
||||
} from '@nestjs/common';
|
||||
import { InjectKysely } from 'nestjs-kysely';
|
||||
import { KyselyDB } from '@docmost/db/types/kysely.types';
|
||||
import { executeTx } from '@docmost/db/utils';
|
||||
import { IntegrationRepo } from './repos/integration.repo';
|
||||
import { IntegrationConnectionRepo } from './repos/integration-connection.repo';
|
||||
import { IntegrationRegistry } from './registry/integration-registry';
|
||||
import { Integration } from '@docmost/db/types/entity.types';
|
||||
|
||||
@Injectable()
|
||||
export class IntegrationService {
|
||||
constructor(
|
||||
@InjectKysely() private readonly db: KyselyDB,
|
||||
private readonly integrationRepo: IntegrationRepo,
|
||||
private readonly connectionRepo: IntegrationConnectionRepo,
|
||||
private readonly registry: IntegrationRegistry,
|
||||
) {}
|
||||
|
||||
async getAvailableIntegrations() {
|
||||
return this.registry.getAvailableIntegrations();
|
||||
}
|
||||
|
||||
async getInstalledIntegrations(workspaceId: string): Promise<Integration[]> {
|
||||
return this.integrationRepo.findAllByWorkspace(workspaceId);
|
||||
}
|
||||
|
||||
async findById(integrationId: string): Promise<Integration | undefined> {
|
||||
return this.integrationRepo.findById(integrationId);
|
||||
}
|
||||
|
||||
async install(
|
||||
type: string,
|
||||
workspaceId: string,
|
||||
userId: string,
|
||||
): Promise<Integration> {
|
||||
const provider = this.registry.getProvider(type);
|
||||
if (!provider || provider.definition.hidden) {
|
||||
throw new BadRequestException(`Unknown integration type: ${type}`);
|
||||
}
|
||||
|
||||
// OAuth providers install via install-and-authorize (see OAuthService).
|
||||
if (provider.definition.oauth) {
|
||||
throw new BadRequestException(
|
||||
'This integration is installed by completing its OAuth flow',
|
||||
);
|
||||
}
|
||||
|
||||
const existing = await this.integrationRepo.findByWorkspaceAndType(
|
||||
workspaceId,
|
||||
type,
|
||||
);
|
||||
if (existing) {
|
||||
throw new BadRequestException(
|
||||
`Integration "${type}" is already installed`,
|
||||
);
|
||||
}
|
||||
|
||||
return this.integrationRepo.insertOrRestore({
|
||||
type,
|
||||
workspaceId,
|
||||
installedById: userId,
|
||||
});
|
||||
}
|
||||
|
||||
async uninstall(integrationId: string, workspaceId: string): Promise<void> {
|
||||
const integration = await this.integrationRepo.findById(integrationId);
|
||||
if (!integration || integration.workspaceId !== workspaceId) {
|
||||
throw new NotFoundException('Integration not found');
|
||||
}
|
||||
// Delete child rows first so no orphan connections keep feeding the token refresh scheduler.
|
||||
await executeTx(this.db, async (trx) => {
|
||||
await this.connectionRepo.deleteByIntegration(integrationId, trx);
|
||||
await this.integrationRepo.softDelete(integrationId, trx);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
import {
|
||||
BadRequestException,
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
HttpCode,
|
||||
HttpStatus,
|
||||
Logger,
|
||||
Param,
|
||||
Post,
|
||||
Query,
|
||||
Res,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { FastifyReply } from 'fastify';
|
||||
import { JwtAuthGuard } from '../../../common/guards/jwt-auth.guard';
|
||||
import { AuthUser } from '../../../common/decorators/auth-user.decorator';
|
||||
import { AuthWorkspace } from '../../../common/decorators/auth-workspace.decorator';
|
||||
import { User, Workspace } from '@docmost/db/types/entity.types';
|
||||
import { OAuthService } from './oauth.service';
|
||||
import {
|
||||
OAuthAuthorizeDto,
|
||||
OAuthDisconnectDto,
|
||||
OAuthInstallDto,
|
||||
} from '../dto/integration.dto';
|
||||
import { IntegrationConnectionService } from '../integration-connection.service';
|
||||
import { IntegrationRegistry } from '../registry/integration-registry';
|
||||
import { LicenseCheckService } from '../../../integrations/environment/license-check.service';
|
||||
import { Feature } from '../../../common/features';
|
||||
import { ForbiddenException } from '@nestjs/common';
|
||||
|
||||
@Controller('integrations/oauth')
|
||||
export class OAuthController {
|
||||
private readonly logger = new Logger(OAuthController.name);
|
||||
|
||||
constructor(
|
||||
private readonly oauthService: OAuthService,
|
||||
private readonly connectionService: IntegrationConnectionService,
|
||||
private readonly licenseCheckService: LicenseCheckService,
|
||||
private readonly registry: IntegrationRegistry,
|
||||
) {}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('authorize')
|
||||
async authorize(
|
||||
@Body() dto: OAuthAuthorizeDto,
|
||||
@AuthUser() user: User,
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
) {
|
||||
const { authorizationUrl } = await this.oauthService.getAuthorizationUrl(
|
||||
dto.integrationId,
|
||||
workspace.id,
|
||||
user.id,
|
||||
dto.returnPath,
|
||||
);
|
||||
|
||||
return { authorizationUrl };
|
||||
}
|
||||
|
||||
/**
|
||||
* Install-and-authorize: the install flow for every OAuth provider. The
|
||||
* integration row is only created on callback after a successful token
|
||||
* exchange; a cancelled or failed flow persists nothing.
|
||||
*/
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('install')
|
||||
async installAndAuthorize(
|
||||
@Body() dto: OAuthInstallDto,
|
||||
@AuthUser() user: User,
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
) {
|
||||
// This flow creates the integration row on callback success; gate it
|
||||
// like a plain install.
|
||||
if (
|
||||
this.registry.getProvider(dto.type)?.definition.requiresLicense &&
|
||||
!this.licenseCheckService.hasFeature(
|
||||
workspace.licenseKey,
|
||||
Feature.INTEGRATIONS,
|
||||
workspace.plan,
|
||||
)
|
||||
) {
|
||||
throw new ForbiddenException('This feature requires a valid license');
|
||||
}
|
||||
|
||||
const { authorizationUrl } = await this.oauthService.getInstallAuthorizationUrl(
|
||||
dto.type,
|
||||
workspace.id,
|
||||
user.id,
|
||||
);
|
||||
|
||||
return { authorizationUrl };
|
||||
}
|
||||
|
||||
@Get(':type/callback')
|
||||
async callback(
|
||||
@Param('type') type: string,
|
||||
@Query('code') code: string,
|
||||
@Query('state') state: string,
|
||||
@Res() res: FastifyReply,
|
||||
) {
|
||||
if (!state) {
|
||||
throw new BadRequestException('Missing state parameter');
|
||||
}
|
||||
|
||||
const statePayload = this.oauthService.verifySignedState(state);
|
||||
if (!statePayload) {
|
||||
throw new BadRequestException('Invalid or expired OAuth state');
|
||||
}
|
||||
|
||||
// returnUrl is derived server-side at authorize time from the workspace's
|
||||
// own hostname/customDomain (canonical DB truth, not user input), then
|
||||
// signed into the state JWT. Tampering would invalidate the signature.
|
||||
const returnUrl = statePayload.returnUrl;
|
||||
// States signed before returnPath existed fall back to the admin page.
|
||||
const returnPath = statePayload.returnPath ?? '/settings/integrations';
|
||||
|
||||
// Consent denied or cancelled at the provider: no code comes back.
|
||||
if (!code) {
|
||||
return res
|
||||
.redirect(`${returnUrl}${returnPath}?error=oauth_failed`, 302)
|
||||
.send();
|
||||
}
|
||||
|
||||
try {
|
||||
await this.oauthService.exchangeCodeForTokens(
|
||||
type,
|
||||
code,
|
||||
statePayload.integrationId,
|
||||
statePayload.userId,
|
||||
statePayload.workspaceId,
|
||||
);
|
||||
|
||||
return res.redirect(`${returnUrl}${returnPath}`, 302).send();
|
||||
} catch (err) {
|
||||
this.logger.error(`OAuth callback error for ${type}: ${(err as Error).message}`);
|
||||
return res
|
||||
.redirect(`${returnUrl}${returnPath}?error=oauth_failed`, 302)
|
||||
.send();
|
||||
}
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('disconnect')
|
||||
async disconnect(
|
||||
@Body() dto: OAuthDisconnectDto,
|
||||
@AuthUser() user: User,
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
) {
|
||||
await this.connectionService.disconnect(
|
||||
dto.integrationId,
|
||||
user.id,
|
||||
workspace.id,
|
||||
);
|
||||
return { success: true };
|
||||
}
|
||||
}
|
||||
@@ -1,473 +0,0 @@
|
||||
import {
|
||||
BadRequestException,
|
||||
Injectable,
|
||||
Logger,
|
||||
NotFoundException,
|
||||
} from '@nestjs/common';
|
||||
import { EnvironmentService } from '../../../integrations/environment/environment.service';
|
||||
import { DomainService } from '../../../integrations/environment/domain.service';
|
||||
import { IntegrationRegistry } from '../registry/integration-registry';
|
||||
import { IntegrationRepo } from '../repos/integration.repo';
|
||||
import { IntegrationConnectionRepo } from '../repos/integration-connection.repo';
|
||||
import { WorkspaceRepo } from '@docmost/db/repos/workspace/workspace.repo';
|
||||
import { EncryptionService } from '../../../integrations/encryption/encryption.service';
|
||||
import { IntegrationConnection } from '@docmost/db/types/entity.types';
|
||||
import {
|
||||
OAuthConfig,
|
||||
TokenInvalidError,
|
||||
} from '../registry/integration-provider.interface';
|
||||
import { proxyFetch } from '../../../common/proxy-fetch';
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
const OAUTH_HTTP_TIMEOUT_MS = 10_000;
|
||||
|
||||
type OAuthTokenResponse = {
|
||||
access_token: string;
|
||||
refresh_token?: string;
|
||||
expires_in?: number;
|
||||
token_type?: string;
|
||||
scope?: string;
|
||||
};
|
||||
|
||||
export type OAuthStatePayload = {
|
||||
// For "authorize-only" flows (per-user OAuth on an already-installed
|
||||
// integration) integrationId is set; for "install-and-authorize" flows
|
||||
// (workspace-scoped providers like Slack) it's null until the callback
|
||||
// resolves-or-creates the row atomically with token exchange success.
|
||||
integrationId: string | null;
|
||||
type: string;
|
||||
userId: string;
|
||||
workspaceId: string;
|
||||
// Workspace's canonical URL at authorize time. Cloud workspaces are routed
|
||||
// through a single central OAuth callback (the only redirect_uri Slack/etc.
|
||||
// accept), and this lets the callback redirect the user back to their own
|
||||
// workspace host (subdomain or custom domain) after token exchange.
|
||||
returnUrl: string;
|
||||
// Settings page (relative to returnUrl) to land on after the callback.
|
||||
// Derived server-side from the flow that started it, never from user input.
|
||||
returnPath?: string;
|
||||
exp: number;
|
||||
};
|
||||
|
||||
@Injectable()
|
||||
export class OAuthService {
|
||||
private readonly logger = new Logger(OAuthService.name);
|
||||
|
||||
constructor(
|
||||
private readonly environmentService: EnvironmentService,
|
||||
private readonly domainService: DomainService,
|
||||
private readonly registry: IntegrationRegistry,
|
||||
private readonly integrationRepo: IntegrationRepo,
|
||||
private readonly connectionRepo: IntegrationConnectionRepo,
|
||||
private readonly workspaceRepo: WorkspaceRepo,
|
||||
private readonly encryptionService: EncryptionService,
|
||||
) {}
|
||||
|
||||
async getAuthorizationUrl(
|
||||
integrationId: string,
|
||||
workspaceId: string,
|
||||
userId: string,
|
||||
returnPathOverride?: string,
|
||||
): Promise<{ authorizationUrl: string }> {
|
||||
const integration = await this.integrationRepo.findById(integrationId);
|
||||
if (!integration || integration.workspaceId !== workspaceId) {
|
||||
throw new NotFoundException('Integration not found');
|
||||
}
|
||||
|
||||
const provider = this.registry.getProvider(integration.type);
|
||||
if (!provider || !provider.definition.oauth) {
|
||||
throw new BadRequestException('Integration does not support OAuth');
|
||||
}
|
||||
|
||||
const oauthConfig = provider.getOAuthConfig
|
||||
? provider.getOAuthConfig((integration.settings as Record<string, any>) ?? {})
|
||||
: provider.definition.oauth;
|
||||
|
||||
const callbackUrl = this.buildCallbackUrl(integration.type);
|
||||
|
||||
const workspace = await this.workspaceRepo.findById(workspaceId);
|
||||
const returnUrl = this.domainService.getWorkspaceUrl(
|
||||
workspace ?? { hostname: null, customDomain: null },
|
||||
);
|
||||
|
||||
// Per-user connects are initiated from the account connections page;
|
||||
// workspace-scoped authorizes from the admin integrations page. A connect
|
||||
// started elsewhere (e.g. an editor connect card) passes its own path.
|
||||
const returnPath =
|
||||
returnPathOverride ??
|
||||
((provider.definition.oauth.connectionScope ?? 'user') === 'workspace'
|
||||
? '/settings/integrations'
|
||||
: '/settings/account/connections');
|
||||
|
||||
const state = this.createSignedState({
|
||||
integrationId,
|
||||
type: integration.type,
|
||||
userId,
|
||||
workspaceId,
|
||||
returnUrl,
|
||||
returnPath,
|
||||
exp: Date.now() + 10 * 60 * 1000,
|
||||
});
|
||||
|
||||
const params = new URLSearchParams({
|
||||
client_id: this.getClientId(integration.type),
|
||||
redirect_uri: callbackUrl,
|
||||
response_type: 'code',
|
||||
state,
|
||||
});
|
||||
|
||||
const scope = oauthConfig.scopes
|
||||
.map((s) => encodeURIComponent(s))
|
||||
.join('%20');
|
||||
|
||||
return {
|
||||
authorizationUrl: `${oauthConfig.authUrl}?${params.toString()}&scope=${scope}`,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Install-and-authorize: the install flow for every OAuth provider.
|
||||
*
|
||||
* Skips creating the integration row up front. The callback persists it
|
||||
* only after a successful token exchange, so a cancelled consent screen or
|
||||
* misconfigured client credentials leave nothing half-installed. Refusing
|
||||
* the already-installed case here keeps the install button idempotent.
|
||||
*/
|
||||
async getInstallAuthorizationUrl(
|
||||
type: string,
|
||||
workspaceId: string,
|
||||
userId: string,
|
||||
): Promise<{ authorizationUrl: string }> {
|
||||
const provider = this.registry.getProvider(type);
|
||||
if (!provider || !provider.definition.oauth) {
|
||||
throw new BadRequestException('Integration does not support OAuth');
|
||||
}
|
||||
|
||||
const existing = await this.integrationRepo.findByWorkspaceAndType(
|
||||
workspaceId,
|
||||
type,
|
||||
);
|
||||
if (existing) {
|
||||
throw new BadRequestException(
|
||||
`Integration "${type}" is already installed`,
|
||||
);
|
||||
}
|
||||
|
||||
const oauthConfig = provider.getOAuthConfig
|
||||
? provider.getOAuthConfig({})
|
||||
: provider.definition.oauth;
|
||||
|
||||
const callbackUrl = this.buildCallbackUrl(type);
|
||||
|
||||
const workspace = await this.workspaceRepo.findById(workspaceId);
|
||||
const returnUrl = this.domainService.getWorkspaceUrl(
|
||||
workspace ?? { hostname: null, customDomain: null },
|
||||
);
|
||||
|
||||
const state = this.createSignedState({
|
||||
integrationId: null,
|
||||
type,
|
||||
userId,
|
||||
workspaceId,
|
||||
returnUrl,
|
||||
returnPath: '/settings/integrations',
|
||||
exp: Date.now() + 10 * 60 * 1000,
|
||||
});
|
||||
|
||||
const params = new URLSearchParams({
|
||||
client_id: this.getClientId(type),
|
||||
redirect_uri: callbackUrl,
|
||||
response_type: 'code',
|
||||
state,
|
||||
});
|
||||
|
||||
const scope = oauthConfig.scopes
|
||||
.map((s) => encodeURIComponent(s))
|
||||
.join('%20');
|
||||
|
||||
return {
|
||||
authorizationUrl: `${oauthConfig.authUrl}?${params.toString()}&scope=${scope}`,
|
||||
};
|
||||
}
|
||||
|
||||
verifySignedState(state: string): OAuthStatePayload | null {
|
||||
const dotIndex = state.lastIndexOf('.');
|
||||
if (dotIndex === -1) return null;
|
||||
|
||||
const data = state.substring(0, dotIndex);
|
||||
const signature = state.substring(dotIndex + 1);
|
||||
|
||||
const secret = this.environmentService.getAppSecret();
|
||||
const expected = crypto
|
||||
.createHmac('sha256', secret)
|
||||
.update(data)
|
||||
.digest('base64url');
|
||||
|
||||
if (signature !== expected) return null;
|
||||
|
||||
try {
|
||||
const payload: OAuthStatePayload = JSON.parse(
|
||||
Buffer.from(data, 'base64url').toString(),
|
||||
);
|
||||
|
||||
if (payload.exp < Date.now()) return null;
|
||||
|
||||
return payload;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async exchangeCodeForTokens(
|
||||
type: string,
|
||||
code: string,
|
||||
integrationId: string | null,
|
||||
userId: string,
|
||||
workspaceId: string,
|
||||
): Promise<IntegrationConnection> {
|
||||
const provider = this.registry.getProvider(type);
|
||||
if (!provider || !provider.definition.oauth) {
|
||||
throw new BadRequestException('Integration does not support OAuth');
|
||||
}
|
||||
|
||||
// Install flow: no row yet; persisted only after the token exchange succeeds.
|
||||
let integration = integrationId
|
||||
? await this.integrationRepo.findById(integrationId)
|
||||
: null;
|
||||
|
||||
const settings = (integration?.settings as Record<string, any>) ?? {};
|
||||
|
||||
const oauthConfig = provider.getOAuthConfig
|
||||
? provider.getOAuthConfig(settings)
|
||||
: provider.definition.oauth;
|
||||
|
||||
const tokenResponse = await this.requestTokens(
|
||||
oauthConfig,
|
||||
type,
|
||||
code,
|
||||
);
|
||||
|
||||
if (!integration) {
|
||||
integration = await this.integrationRepo.insertOrRestore({
|
||||
type,
|
||||
workspaceId,
|
||||
installedById: userId,
|
||||
});
|
||||
integrationId = integration.id;
|
||||
}
|
||||
|
||||
const encryptedAccessToken = this.encryptionService.encrypt(
|
||||
tokenResponse.access_token,
|
||||
);
|
||||
const encryptedRefreshToken = tokenResponse.refresh_token
|
||||
? this.encryptionService.encrypt(tokenResponse.refresh_token)
|
||||
: null;
|
||||
|
||||
const tokenExpiresAt = tokenResponse.expires_in
|
||||
? new Date(Date.now() + tokenResponse.expires_in * 1000)
|
||||
: null;
|
||||
|
||||
const connectionScope =
|
||||
provider.definition.oauth?.connectionScope ?? 'user';
|
||||
|
||||
const connection =
|
||||
connectionScope === 'workspace'
|
||||
? await this.connectionRepo.upsertWorkspaceConnection({
|
||||
integrationId,
|
||||
userId,
|
||||
workspaceId,
|
||||
accessToken: encryptedAccessToken,
|
||||
refreshToken: encryptedRefreshToken,
|
||||
tokenExpiresAt,
|
||||
scopes: tokenResponse.scope ?? null,
|
||||
})
|
||||
: await this.connectionRepo.upsert({
|
||||
integrationId,
|
||||
userId,
|
||||
workspaceId,
|
||||
accessToken: encryptedAccessToken,
|
||||
refreshToken: encryptedRefreshToken,
|
||||
tokenExpiresAt,
|
||||
scopes: tokenResponse.scope ?? null,
|
||||
});
|
||||
|
||||
if (provider.onConnected) {
|
||||
await provider.onConnected({
|
||||
integrationId,
|
||||
workspaceId,
|
||||
accessToken: tokenResponse.access_token,
|
||||
refreshToken: tokenResponse.refresh_token,
|
||||
userId,
|
||||
metadata: tokenResponse,
|
||||
});
|
||||
}
|
||||
|
||||
return connection;
|
||||
}
|
||||
|
||||
async getValidAccessToken(
|
||||
connection: IntegrationConnection,
|
||||
): Promise<string> {
|
||||
if (connection.invalidatedAt) {
|
||||
throw new TokenInvalidError();
|
||||
}
|
||||
const accessToken = this.encryptionService.decrypt(connection.accessToken);
|
||||
|
||||
const needsRefresh =
|
||||
connection.tokenExpiresAt &&
|
||||
connection.refreshToken &&
|
||||
new Date(connection.tokenExpiresAt).getTime() - Date.now() < 5 * 60 * 1000;
|
||||
|
||||
if (!needsRefresh) {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
return this.refreshAccessToken(connection);
|
||||
}
|
||||
|
||||
private async refreshAccessToken(
|
||||
connection: IntegrationConnection,
|
||||
): Promise<string> {
|
||||
const refreshToken = this.encryptionService.decrypt(
|
||||
connection.refreshToken,
|
||||
);
|
||||
|
||||
const integration = await this.integrationRepo.findById(
|
||||
connection.integrationId,
|
||||
);
|
||||
if (!integration) {
|
||||
throw new NotFoundException('Integration not found');
|
||||
}
|
||||
|
||||
const provider = this.registry.getProvider(integration.type);
|
||||
if (!provider || !provider.definition.oauth) {
|
||||
throw new BadRequestException('Integration does not support OAuth');
|
||||
}
|
||||
|
||||
const oauthConfig = provider.getOAuthConfig
|
||||
? provider.getOAuthConfig((integration.settings as Record<string, any>) ?? {})
|
||||
: provider.definition.oauth;
|
||||
|
||||
const params = new URLSearchParams({
|
||||
grant_type: 'refresh_token',
|
||||
client_id: this.getClientId(integration.type),
|
||||
client_secret: this.getClientSecret(integration.type),
|
||||
refresh_token: refreshToken,
|
||||
});
|
||||
|
||||
try {
|
||||
const response = await proxyFetch(oauthConfig.tokenUrl, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' },
|
||||
body: params.toString(),
|
||||
signal: AbortSignal.timeout(OAUTH_HTTP_TIMEOUT_MS),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
this.logger.error(
|
||||
`Token refresh failed for ${integration.type}: ${response.status}`,
|
||||
);
|
||||
// 400/401 from the token endpoint means invalid_grant/invalid_client:
|
||||
// the refresh token is dead, not a transient failure.
|
||||
if (response.status === 400 || response.status === 401) {
|
||||
throw new TokenInvalidError(
|
||||
`Refresh token rejected for ${integration.type}`,
|
||||
);
|
||||
}
|
||||
throw new BadRequestException('Token refresh failed');
|
||||
}
|
||||
|
||||
const data: OAuthTokenResponse = await response.json();
|
||||
const encryptedAccessToken = this.encryptionService.encrypt(
|
||||
data.access_token,
|
||||
);
|
||||
const encryptedRefreshToken = data.refresh_token
|
||||
? this.encryptionService.encrypt(data.refresh_token)
|
||||
: connection.refreshToken;
|
||||
const tokenExpiresAt = data.expires_in
|
||||
? new Date(Date.now() + data.expires_in * 1000)
|
||||
: null;
|
||||
|
||||
await this.connectionRepo.update(connection.id, {
|
||||
accessToken: encryptedAccessToken,
|
||||
refreshToken: encryptedRefreshToken,
|
||||
tokenExpiresAt,
|
||||
invalidatedAt: null,
|
||||
});
|
||||
|
||||
return data.access_token;
|
||||
} catch (err) {
|
||||
if (err instanceof TokenInvalidError) {
|
||||
throw err;
|
||||
}
|
||||
this.logger.error(`Token refresh error: ${(err as Error).message}`);
|
||||
throw new BadRequestException('Failed to refresh token');
|
||||
}
|
||||
}
|
||||
|
||||
private async requestTokens(
|
||||
oauthConfig: OAuthConfig,
|
||||
type: string,
|
||||
code: string,
|
||||
): Promise<OAuthTokenResponse> {
|
||||
const params = new URLSearchParams({
|
||||
grant_type: 'authorization_code',
|
||||
client_id: this.getClientId(type),
|
||||
client_secret: this.getClientSecret(type),
|
||||
code,
|
||||
redirect_uri: this.buildCallbackUrl(type),
|
||||
});
|
||||
|
||||
const response = await proxyFetch(oauthConfig.tokenUrl, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' },
|
||||
body: params.toString(),
|
||||
signal: AbortSignal.timeout(OAUTH_HTTP_TIMEOUT_MS),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const body = await response.text();
|
||||
this.logger.error(`Token exchange failed for ${type}: ${response.status} ${body}`);
|
||||
throw new BadRequestException('OAuth token exchange failed');
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
|
||||
buildCallbackUrl(type: string): string {
|
||||
const appUrl = this.environmentService.getAppUrl();
|
||||
return `${appUrl}/api/integrations/oauth/${type}/callback`;
|
||||
}
|
||||
|
||||
private createSignedState(payload: OAuthStatePayload): string {
|
||||
const data = Buffer.from(JSON.stringify(payload)).toString('base64url');
|
||||
const secret = this.environmentService.getAppSecret();
|
||||
const signature = crypto
|
||||
.createHmac('sha256', secret)
|
||||
.update(data)
|
||||
.digest('base64url');
|
||||
return `${data}.${signature}`;
|
||||
}
|
||||
|
||||
private getClientId(type: string): string {
|
||||
const envKey = `INTEGRATION_${type.toUpperCase()}_CLIENT_ID`;
|
||||
const value = process.env[envKey];
|
||||
if (!value) {
|
||||
throw new BadRequestException(
|
||||
`Missing environment variable: ${envKey}`,
|
||||
);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private getClientSecret(type: string): string {
|
||||
const envKey = `INTEGRATION_${type.toUpperCase()}_CLIENT_SECRET`;
|
||||
const value = process.env[envKey];
|
||||
if (!value) {
|
||||
throw new BadRequestException(
|
||||
`Missing environment variable: ${envKey}`,
|
||||
);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
import { UnfurlPattern } from '../../registry/integration-provider.interface';
|
||||
|
||||
function escapeForRegex(str: string): string {
|
||||
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
|
||||
export function buildGitHubPatterns(baseUrl: string): UnfurlPattern[] {
|
||||
const escaped = escapeForRegex(baseUrl);
|
||||
return [
|
||||
// Commit within a PR: /:owner/:repo/pull/:num/commits/:sha
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/([^\\/]+)\\/([^\\/]+)\\/pull\\/(\\d+)\\/commits\\/([a-f0-9]+)`,
|
||||
),
|
||||
type: 'github-pr-commit',
|
||||
},
|
||||
// PR sub-pages: /:owner/:repo/pull/:num(/checks|/commits|/files)?
|
||||
{
|
||||
regex: new RegExp(`^${escaped}\\/([^\\/]+)\\/([^\\/]+)\\/pull\\/(\\d+)`),
|
||||
type: 'github-pr',
|
||||
},
|
||||
// Single issue: /:owner/:repo/issues/:num
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/([^\\/]+)\\/([^\\/]+)\\/issues\\/(\\d+)`,
|
||||
),
|
||||
type: 'github-issue',
|
||||
},
|
||||
// Commit: /:owner/:repo/commit(s)/:sha
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/([^\\/]+)\\/([^\\/]+)\\/commits?\\/([a-f0-9]+)`,
|
||||
),
|
||||
type: 'github-commit',
|
||||
},
|
||||
// File/blob: /:owner/:repo/blob/:ref/:path(#L:start(-L:end))?
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/([^\\/]+)\\/([^\\/]+)\\/blob\\/([^\\/]+)\\/(.+?)(?:#L(\\d+)(?:-L(\\d+))?)?$`,
|
||||
),
|
||||
type: 'github-file',
|
||||
},
|
||||
// Pulls list: /:owner/:repo/pulls
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/([^\\/]+)\\/([^\\/]+)\\/pulls(?:\\/.*)?(?:\\?.*)?$`,
|
||||
),
|
||||
type: 'github-pulls-list',
|
||||
},
|
||||
// Issues list: /:owner/:repo/issues(/created_by/...|/assigned/...)?
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/([^\\/]+)\\/([^\\/]+)\\/issues(?:\\/(?:created_by|assigned)\\/[\\w.\\/-]+)?\\/?(?:\\?.*)?$`,
|
||||
),
|
||||
type: 'github-issues-list',
|
||||
},
|
||||
// Releases: /:owner/:repo/releases
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/([^\\/]+)\\/([^\\/]+)\\/releases(?:\\/.*)?(?:\\?.*)?$`,
|
||||
),
|
||||
type: 'github-releases-list',
|
||||
},
|
||||
// Repo: /:owner/:repo
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/([a-zA-Z0-9\\-_.]+)\\/([a-zA-Z0-9\\-_.]+)\\/?$`,
|
||||
),
|
||||
type: 'github-repo',
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import { Module, OnModuleInit } from '@nestjs/common';
|
||||
import { GitHubProvider } from './github.provider';
|
||||
import { GitHubService } from './github.service';
|
||||
import { IntegrationRegistry } from '../../registry/integration-registry';
|
||||
import { IntegrationModule } from '../../integration.module';
|
||||
|
||||
@Module({
|
||||
imports: [IntegrationModule],
|
||||
providers: [GitHubProvider, GitHubService],
|
||||
exports: [GitHubProvider],
|
||||
})
|
||||
export class GitHubModule implements OnModuleInit {
|
||||
constructor(
|
||||
private readonly registry: IntegrationRegistry,
|
||||
private readonly githubProvider: GitHubProvider,
|
||||
) {}
|
||||
|
||||
onModuleInit() {
|
||||
this.registry.register(this.githubProvider);
|
||||
}
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import {
|
||||
IntegrationProvider,
|
||||
IntegrationDefinition,
|
||||
LinkDescription,
|
||||
OAuthConfig,
|
||||
UnfurlPattern,
|
||||
UnfurlOpts,
|
||||
UnfurlResult,
|
||||
} from '../../registry/integration-provider.interface';
|
||||
import { GitHubService } from './github.service';
|
||||
import { buildGitHubPatterns } from './github-patterns';
|
||||
|
||||
const DEFAULT_BASE_URL = 'https://github.com';
|
||||
|
||||
@Injectable()
|
||||
export class GitHubProvider extends IntegrationProvider {
|
||||
definition: IntegrationDefinition = {
|
||||
type: 'github',
|
||||
name: 'GitHub',
|
||||
description: 'Link previews for repos, pull requests, issues, commits, and files',
|
||||
icon: 'github',
|
||||
capabilities: ['oauth', 'unfurl'],
|
||||
oauth: {
|
||||
authUrl: 'https://github.com/login/oauth/authorize',
|
||||
tokenUrl: 'https://github.com/login/oauth/access_token',
|
||||
scopes: ['repo', 'read:user'],
|
||||
},
|
||||
unfurlPatterns: buildGitHubPatterns('https://github.com'),
|
||||
};
|
||||
|
||||
constructor(private readonly githubService: GitHubService) {
|
||||
super();
|
||||
}
|
||||
|
||||
getOAuthConfig(settings: Record<string, any>): OAuthConfig {
|
||||
const baseUrl = this.resolveBaseUrl();
|
||||
return {
|
||||
authUrl: `${baseUrl}/login/oauth/authorize`,
|
||||
tokenUrl: `${baseUrl}/login/oauth/access_token`,
|
||||
scopes: ['repo', 'read:user'],
|
||||
};
|
||||
}
|
||||
|
||||
getUnfurlPatterns(settings: Record<string, any>): UnfurlPattern[] {
|
||||
const baseUrl = this.resolveBaseUrl();
|
||||
if (baseUrl === DEFAULT_BASE_URL) return [];
|
||||
return buildGitHubPatterns(baseUrl);
|
||||
}
|
||||
|
||||
async unfurl(opts: UnfurlOpts): Promise<UnfurlResult> {
|
||||
const { match, patternType, accessToken, url } = opts;
|
||||
const apiBaseUrl = this.resolveApiBaseUrl(url);
|
||||
const owner = match[1];
|
||||
const repo = match[2];
|
||||
|
||||
switch (patternType) {
|
||||
case 'github-pr': {
|
||||
const number = parseInt(match[3], 10);
|
||||
return this.githubService.unfurlPullRequest(
|
||||
accessToken, apiBaseUrl, owner, repo, number, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'github-issue': {
|
||||
const number = parseInt(match[3], 10);
|
||||
return this.githubService.unfurlIssue(
|
||||
accessToken, apiBaseUrl, owner, repo, number, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'github-repo':
|
||||
return this.githubService.unfurlRepo(
|
||||
accessToken, apiBaseUrl, owner, repo, url,
|
||||
);
|
||||
|
||||
case 'github-commit': {
|
||||
const sha = match[3];
|
||||
return this.githubService.unfurlCommit(
|
||||
accessToken, apiBaseUrl, owner, repo, sha, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'github-pr-commit': {
|
||||
const sha = match[4];
|
||||
return this.githubService.unfurlCommit(
|
||||
accessToken, apiBaseUrl, owner, repo, sha, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'github-file': {
|
||||
const ref = match[3];
|
||||
const path = match[4];
|
||||
const startLine = match[5] ? parseInt(match[5], 10) : undefined;
|
||||
const endLine = match[6] ? parseInt(match[6], 10) : undefined;
|
||||
return this.githubService.unfurlFile(
|
||||
owner, repo, ref, path, startLine, endLine, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'github-pulls-list':
|
||||
case 'github-issues-list':
|
||||
case 'github-releases-list':
|
||||
return this.githubService.unfurlCollectionPage(
|
||||
accessToken, apiBaseUrl, owner, repo, patternType.replace('github-', ''), url,
|
||||
);
|
||||
|
||||
default:
|
||||
throw new Error(`Unknown GitHub pattern type: ${patternType}`);
|
||||
}
|
||||
}
|
||||
|
||||
describeLink(
|
||||
patternType: string,
|
||||
match: RegExpMatchArray,
|
||||
): LinkDescription | null {
|
||||
const repo = `${match[1]}/${match[2]}`;
|
||||
switch (patternType) {
|
||||
case 'github-pr':
|
||||
return { title: `Pull Request #${match[3]}`, description: repo };
|
||||
case 'github-pr-commit':
|
||||
return { title: `Commit ${match[4].slice(0, 7)}`, description: repo };
|
||||
case 'github-issue':
|
||||
return { title: `Issue #${match[3]}`, description: repo };
|
||||
case 'github-commit':
|
||||
return { title: `Commit ${match[3].slice(0, 7)}`, description: repo };
|
||||
case 'github-file':
|
||||
return { title: match[4], description: repo };
|
||||
case 'github-pulls-list':
|
||||
return { title: 'Pull Requests', description: repo };
|
||||
case 'github-issues-list':
|
||||
return { title: 'Issues', description: repo };
|
||||
case 'github-releases-list':
|
||||
return { title: 'Releases', description: repo };
|
||||
case 'github-repo':
|
||||
return { title: repo };
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private resolveBaseUrl(): string {
|
||||
const baseUrl = process.env.INTEGRATION_GITHUB_BASE_URL;
|
||||
return baseUrl ? baseUrl.replace(/\/+$/, '') : DEFAULT_BASE_URL;
|
||||
}
|
||||
|
||||
private resolveApiBaseUrl(url: string): string {
|
||||
const parsed = new URL(url);
|
||||
if (parsed.hostname === 'github.com') {
|
||||
return 'https://api.github.com';
|
||||
}
|
||||
return `${parsed.origin}/api/v3`;
|
||||
}
|
||||
}
|
||||
@@ -1,267 +0,0 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { UnfurlResult } from '../../registry/integration-provider.interface';
|
||||
import { relativeTime } from '../../utils/relative-time';
|
||||
import { providerApiFetch } from '../../utils/provider-fetch';
|
||||
|
||||
@Injectable()
|
||||
export class GitHubService {
|
||||
private readonly logger = new Logger(GitHubService.name);
|
||||
|
||||
async unfurlPullRequest(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
owner: string,
|
||||
repo: string,
|
||||
number: number,
|
||||
url: string,
|
||||
): Promise<UnfurlResult> {
|
||||
const data = await this.apiGet(
|
||||
accessToken,
|
||||
apiBaseUrl,
|
||||
`/repos/${owner}/${repo}/pulls/${number}`,
|
||||
);
|
||||
|
||||
const prAuthor = data.user?.login;
|
||||
const prDesc = [
|
||||
`#${data.number}`,
|
||||
relativeTime(data.updated_at ?? data.created_at),
|
||||
prAuthor,
|
||||
].filter(Boolean).join(' · ');
|
||||
|
||||
return {
|
||||
title: data.title,
|
||||
description: prDesc,
|
||||
url,
|
||||
provider: 'github',
|
||||
providerIcon: 'github',
|
||||
status: this.formatPrStatus(data),
|
||||
statusColor: this.getPrStatusColor(data),
|
||||
author: prAuthor,
|
||||
authorAvatarUrl: data.user?.avatar_url,
|
||||
metadata: {
|
||||
type: 'pr',
|
||||
number: data.number,
|
||||
repo: `${owner}/${repo}`,
|
||||
labels: data.labels?.map((l: any) => l.name) ?? [],
|
||||
draft: data.draft,
|
||||
additions: data.additions,
|
||||
deletions: data.deletions,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async unfurlIssue(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
owner: string,
|
||||
repo: string,
|
||||
number: number,
|
||||
url: string,
|
||||
): Promise<UnfurlResult> {
|
||||
const data = await this.apiGet(
|
||||
accessToken,
|
||||
apiBaseUrl,
|
||||
`/repos/${owner}/${repo}/issues/${number}`,
|
||||
);
|
||||
|
||||
const issueAuthor = data.user?.login;
|
||||
const issueDesc = [
|
||||
`#${data.number}`,
|
||||
relativeTime(data.updated_at ?? data.created_at),
|
||||
issueAuthor,
|
||||
].filter(Boolean).join(' · ');
|
||||
|
||||
return {
|
||||
title: data.title,
|
||||
description: issueDesc,
|
||||
url,
|
||||
provider: 'github',
|
||||
providerIcon: 'github',
|
||||
status: data.state,
|
||||
statusColor: data.state === 'open' ? 'green' : 'purple',
|
||||
author: issueAuthor,
|
||||
authorAvatarUrl: data.user?.avatar_url,
|
||||
metadata: {
|
||||
type: 'issue',
|
||||
number: data.number,
|
||||
repo: `${owner}/${repo}`,
|
||||
labels: data.labels?.map((l: any) => l.name) ?? [],
|
||||
assignees: data.assignees?.map((a: any) => a.login) ?? [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async unfurlRepo(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
owner: string,
|
||||
repo: string,
|
||||
url: string,
|
||||
): Promise<UnfurlResult> {
|
||||
const data = await this.apiGet(
|
||||
accessToken,
|
||||
apiBaseUrl,
|
||||
`/repos/${owner}/${repo}`,
|
||||
);
|
||||
|
||||
const visibility = data.private ? 'Private' : 'Public';
|
||||
|
||||
return {
|
||||
title: data.full_name,
|
||||
description: data.description?.slice(0, 200) ?? undefined,
|
||||
url,
|
||||
provider: 'github',
|
||||
providerIcon: 'github',
|
||||
status: visibility,
|
||||
statusColor: data.private ? 'gray' : 'green',
|
||||
author: data.owner?.login,
|
||||
authorAvatarUrl: data.owner?.avatar_url,
|
||||
metadata: {
|
||||
type: 'repo',
|
||||
repo: `${owner}/${repo}`,
|
||||
stars: data.stargazers_count,
|
||||
forks: data.forks_count,
|
||||
language: data.language,
|
||||
defaultBranch: data.default_branch,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async unfurlCommit(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
owner: string,
|
||||
repo: string,
|
||||
sha: string,
|
||||
url: string,
|
||||
): Promise<UnfurlResult> {
|
||||
const data = await this.apiGet(
|
||||
accessToken,
|
||||
apiBaseUrl,
|
||||
`/repos/${owner}/${repo}/commits/${sha}`,
|
||||
);
|
||||
|
||||
const shortSha = data.sha?.slice(0, 7);
|
||||
|
||||
const commitAuthor = data.author?.login ?? data.commit?.author?.name;
|
||||
const commitDesc = [
|
||||
shortSha,
|
||||
relativeTime(data.commit?.author?.date ?? data.commit?.committer?.date),
|
||||
commitAuthor,
|
||||
].filter(Boolean).join(' · ');
|
||||
|
||||
return {
|
||||
title: data.commit?.message?.split('\n')[0] ?? shortSha,
|
||||
description: commitDesc,
|
||||
url,
|
||||
provider: 'github',
|
||||
providerIcon: 'github',
|
||||
author: commitAuthor,
|
||||
authorAvatarUrl: data.author?.avatar_url,
|
||||
metadata: {
|
||||
type: 'commit',
|
||||
sha: data.sha,
|
||||
shortSha,
|
||||
repo: `${owner}/${repo}`,
|
||||
stats: data.stats,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
unfurlFile(
|
||||
owner: string,
|
||||
repo: string,
|
||||
ref: string,
|
||||
path: string,
|
||||
startLine: number | undefined,
|
||||
endLine: number | undefined,
|
||||
url: string,
|
||||
): UnfurlResult {
|
||||
const fileName = path.split('/').pop() ?? path;
|
||||
const lineRange = startLine
|
||||
? endLine
|
||||
? `L${startLine}-L${endLine}`
|
||||
: `L${startLine}`
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
title: lineRange ? `${fileName}#${lineRange}` : fileName,
|
||||
description: `${owner}/${repo} · ${ref.slice(0, 7)}`,
|
||||
url,
|
||||
provider: 'github',
|
||||
providerIcon: 'github',
|
||||
metadata: {
|
||||
type: 'file',
|
||||
repo: `${owner}/${repo}`,
|
||||
ref,
|
||||
path,
|
||||
startLine,
|
||||
endLine,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async unfurlCollectionPage(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
owner: string,
|
||||
repo: string,
|
||||
collectionType: string,
|
||||
url: string,
|
||||
): Promise<UnfurlResult> {
|
||||
const data = await this.apiGet(
|
||||
accessToken,
|
||||
apiBaseUrl,
|
||||
`/repos/${owner}/${repo}`,
|
||||
);
|
||||
|
||||
const labels: Record<string, string> = {
|
||||
'pulls-list': 'Pull Requests',
|
||||
'issues-list': 'Issues',
|
||||
'releases-list': 'Releases',
|
||||
};
|
||||
|
||||
return {
|
||||
title: `${labels[collectionType] ?? collectionType} · ${data.full_name}`,
|
||||
description: `${owner}/${repo}`,
|
||||
url,
|
||||
provider: 'github',
|
||||
providerIcon: 'github',
|
||||
author: data.owner?.login,
|
||||
authorAvatarUrl: data.owner?.avatar_url,
|
||||
metadata: {
|
||||
type: collectionType,
|
||||
repo: `${owner}/${repo}`,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private formatPrStatus(pr: any): string {
|
||||
if (pr.merged) return 'merged';
|
||||
if (pr.draft) return 'draft';
|
||||
return pr.state;
|
||||
}
|
||||
|
||||
private getPrStatusColor(pr: any): string {
|
||||
if (pr.merged) return 'purple';
|
||||
if (pr.draft) return 'gray';
|
||||
if (pr.state === 'open') return 'green';
|
||||
return 'red';
|
||||
}
|
||||
|
||||
private async apiGet(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
path: string,
|
||||
): Promise<any> {
|
||||
const response = await providerApiFetch('GitHub', `${apiBaseUrl}${path}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
'User-Agent': 'Docmost',
|
||||
},
|
||||
});
|
||||
|
||||
return response.json();
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
import { UnfurlPattern } from '../../registry/integration-provider.interface';
|
||||
|
||||
function escapeForRegex(str: string): string {
|
||||
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
|
||||
export function buildGitLabPatterns(baseUrl: string): UnfurlPattern[] {
|
||||
const escaped = escapeForRegex(baseUrl);
|
||||
return [
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/(.+)\\/-\\/merge_requests\\/(\\d+)\\/diffs\\?.*commit_id=([a-f0-9]+)`,
|
||||
),
|
||||
type: 'gitlab-commit-in-mr',
|
||||
},
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/(.+)\\/-\\/merge_requests\\/(\\d+)`,
|
||||
),
|
||||
type: 'gitlab-mr',
|
||||
},
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/(.+)\\/-\\/issues\\/(\\d+)`,
|
||||
),
|
||||
type: 'gitlab-issue',
|
||||
},
|
||||
// Issues renamed to work items; same iid, resolved via the issues API.
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/(.+)\\/-\\/work_items\\/(\\d+)`,
|
||||
),
|
||||
type: 'gitlab-issue',
|
||||
},
|
||||
// Work item opened as a drawer over the list; the target is base64 JSON
|
||||
// in the show param, decoded by the provider.
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/(.+)\\/-\\/work_items\\/?\\?(?:.*&)?show=`,
|
||||
),
|
||||
type: 'gitlab-work-item-drawer',
|
||||
},
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/(.+)\\/-\\/commits?\\/([a-f0-9]+)`,
|
||||
),
|
||||
type: 'gitlab-commit',
|
||||
},
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/(.+)\\/-\\/issues(?:\\/)?(?:\\?.*)?$`,
|
||||
),
|
||||
type: 'gitlab-issues-list',
|
||||
},
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/(.+)\\/-\\/merge_requests(?:\\/)?(?:\\?.*)?$`,
|
||||
),
|
||||
type: 'gitlab-merges-list',
|
||||
},
|
||||
{
|
||||
regex: new RegExp(
|
||||
`^${escaped}\\/([a-zA-Z0-9\\-_.]+)\\/([a-zA-Z0-9\\-_]+)\\/?$`,
|
||||
),
|
||||
type: 'gitlab-project',
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import { Module, OnModuleInit } from '@nestjs/common';
|
||||
import { GitLabProvider } from './gitlab.provider';
|
||||
import { GitLabService } from './gitlab.service';
|
||||
import { IntegrationRegistry } from '../../registry/integration-registry';
|
||||
import { IntegrationModule } from '../../integration.module';
|
||||
|
||||
@Module({
|
||||
imports: [IntegrationModule],
|
||||
providers: [GitLabProvider, GitLabService],
|
||||
exports: [GitLabProvider],
|
||||
})
|
||||
export class GitLabModule implements OnModuleInit {
|
||||
constructor(
|
||||
private readonly registry: IntegrationRegistry,
|
||||
private readonly gitlabProvider: GitLabProvider,
|
||||
) {}
|
||||
|
||||
onModuleInit() {
|
||||
this.registry.register(this.gitlabProvider);
|
||||
}
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import {
|
||||
IntegrationProvider,
|
||||
IntegrationDefinition,
|
||||
LinkDescription,
|
||||
OAuthConfig,
|
||||
UnfurlPattern,
|
||||
UnfurlOpts,
|
||||
UnfurlResult,
|
||||
} from '../../registry/integration-provider.interface';
|
||||
import { GitLabService } from './gitlab.service';
|
||||
import { buildGitLabPatterns } from './gitlab-patterns';
|
||||
|
||||
const DEFAULT_BASE_URL = 'https://gitlab.com';
|
||||
|
||||
@Injectable()
|
||||
export class GitLabProvider extends IntegrationProvider {
|
||||
definition: IntegrationDefinition = {
|
||||
type: 'gitlab',
|
||||
name: 'GitLab',
|
||||
description: 'Link previews for projects, merge requests, issues, and commits',
|
||||
icon: 'gitlab',
|
||||
capabilities: ['oauth', 'unfurl'],
|
||||
oauth: {
|
||||
authUrl: 'https://gitlab.com/oauth/authorize',
|
||||
tokenUrl: 'https://gitlab.com/oauth/token',
|
||||
scopes: ['read_api', 'read_user'],
|
||||
},
|
||||
unfurlPatterns: buildGitLabPatterns('https://gitlab.com'),
|
||||
};
|
||||
|
||||
constructor(private readonly gitlabService: GitLabService) {
|
||||
super();
|
||||
}
|
||||
|
||||
getOAuthConfig(settings: Record<string, any>): OAuthConfig {
|
||||
const baseUrl = this.resolveBaseUrl();
|
||||
return {
|
||||
authUrl: `${baseUrl}/oauth/authorize`,
|
||||
tokenUrl: `${baseUrl}/oauth/token`,
|
||||
scopes: ['read_api', 'read_user'],
|
||||
};
|
||||
}
|
||||
|
||||
getUnfurlPatterns(settings: Record<string, any>): UnfurlPattern[] {
|
||||
const baseUrl = this.resolveBaseUrl();
|
||||
if (baseUrl === DEFAULT_BASE_URL) return [];
|
||||
return buildGitLabPatterns(baseUrl);
|
||||
}
|
||||
|
||||
async unfurl(opts: UnfurlOpts): Promise<UnfurlResult> {
|
||||
const { match, patternType, accessToken, url } = opts;
|
||||
const apiBaseUrl = this.resolveApiBaseUrl(url);
|
||||
|
||||
switch (patternType) {
|
||||
case 'gitlab-mr': {
|
||||
const projectPath = match[1];
|
||||
const iid = parseInt(match[2], 10);
|
||||
return this.gitlabService.unfurlMergeRequest(
|
||||
accessToken, apiBaseUrl, projectPath, iid, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'gitlab-issue': {
|
||||
const projectPath = match[1];
|
||||
const iid = parseInt(match[2], 10);
|
||||
return this.gitlabService.unfurlIssue(
|
||||
accessToken, apiBaseUrl, projectPath, iid, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'gitlab-project': {
|
||||
const projectPath = `${match[1]}/${match[2]}`;
|
||||
return this.gitlabService.unfurlProject(
|
||||
accessToken, apiBaseUrl, projectPath, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'gitlab-commit': {
|
||||
const projectPath = match[1];
|
||||
const commitSha = match[2];
|
||||
return this.gitlabService.unfurlCommit(
|
||||
accessToken, apiBaseUrl, projectPath, commitSha, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'gitlab-commit-in-mr': {
|
||||
const projectPath = match[1];
|
||||
const commitSha = match[3];
|
||||
return this.gitlabService.unfurlCommit(
|
||||
accessToken, apiBaseUrl, projectPath, commitSha, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'gitlab-work-item-drawer': {
|
||||
const target = this.decodeWorkItemShowParam(url);
|
||||
if (!target) {
|
||||
throw new Error('Could not decode work item show param');
|
||||
}
|
||||
return this.gitlabService.unfurlIssue(
|
||||
accessToken, apiBaseUrl, target.fullPath, target.iid, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'gitlab-issues-list': {
|
||||
const projectPath = match[1];
|
||||
return this.gitlabService.unfurlIssuesList(
|
||||
accessToken, apiBaseUrl, projectPath, url,
|
||||
);
|
||||
}
|
||||
|
||||
case 'gitlab-merges-list': {
|
||||
const projectPath = match[1];
|
||||
return this.gitlabService.unfurlMergesList(
|
||||
accessToken, apiBaseUrl, projectPath, url,
|
||||
);
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Error(`Unknown GitLab pattern type: ${patternType}`);
|
||||
}
|
||||
}
|
||||
|
||||
describeLink(
|
||||
patternType: string,
|
||||
match: RegExpMatchArray,
|
||||
url: string,
|
||||
): LinkDescription | null {
|
||||
const projectPath = match[1];
|
||||
switch (patternType) {
|
||||
case 'gitlab-mr':
|
||||
return { title: `Merge Request !${match[2]}`, description: projectPath };
|
||||
case 'gitlab-issue':
|
||||
return { title: `Issue #${match[2]}`, description: projectPath };
|
||||
case 'gitlab-work-item-drawer': {
|
||||
const target = this.decodeWorkItemShowParam(url);
|
||||
return target
|
||||
? { title: `Issue #${target.iid}`, description: target.fullPath }
|
||||
: { title: 'Work item', description: projectPath };
|
||||
}
|
||||
case 'gitlab-commit':
|
||||
return { title: `Commit ${match[2].slice(0, 8)}`, description: projectPath };
|
||||
case 'gitlab-commit-in-mr':
|
||||
return { title: `Commit ${match[3].slice(0, 8)}`, description: projectPath };
|
||||
case 'gitlab-issues-list':
|
||||
return { title: 'Issues', description: projectPath };
|
||||
case 'gitlab-merges-list':
|
||||
return { title: 'Merge Requests', description: projectPath };
|
||||
case 'gitlab-project':
|
||||
return { title: `${match[1]}/${match[2]}` };
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// The work items list opens an item as a drawer and encodes it in the URL
|
||||
// as ?show=base64({ iid, full_path, id }). full_path beats the URL path:
|
||||
// a drawer opened from a group-level list still names the actual project.
|
||||
private decodeWorkItemShowParam(
|
||||
url: string,
|
||||
): { fullPath: string; iid: number } | null {
|
||||
try {
|
||||
const show = new URL(url).searchParams.get('show');
|
||||
if (!show) return null;
|
||||
const base64 = show.replace(/-/g, '+').replace(/_/g, '/');
|
||||
const payload = JSON.parse(
|
||||
Buffer.from(base64, 'base64').toString('utf8'),
|
||||
);
|
||||
const iid = parseInt(payload.iid, 10);
|
||||
if (typeof payload.full_path !== 'string' || Number.isNaN(iid)) {
|
||||
return null;
|
||||
}
|
||||
return { fullPath: payload.full_path, iid };
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private resolveBaseUrl(): string {
|
||||
const baseUrl = process.env.INTEGRATION_GITLAB_BASE_URL;
|
||||
return baseUrl ? baseUrl.replace(/\/+$/, '') : DEFAULT_BASE_URL;
|
||||
}
|
||||
|
||||
private resolveApiBaseUrl(url: string): string {
|
||||
const parsed = new URL(url);
|
||||
return `${parsed.origin}/api/v4`;
|
||||
}
|
||||
}
|
||||
@@ -1,253 +0,0 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { UnfurlResult } from '../../registry/integration-provider.interface';
|
||||
import { relativeTime } from '../../utils/relative-time';
|
||||
import { providerApiFetch } from '../../utils/provider-fetch';
|
||||
|
||||
@Injectable()
|
||||
export class GitLabService {
|
||||
private readonly logger = new Logger(GitLabService.name);
|
||||
|
||||
async unfurlMergeRequest(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
projectPath: string,
|
||||
iid: number,
|
||||
url: string,
|
||||
): Promise<UnfurlResult> {
|
||||
const encodedProject = encodeURIComponent(projectPath);
|
||||
const data = await this.apiGet(
|
||||
accessToken,
|
||||
apiBaseUrl,
|
||||
`/projects/${encodedProject}/merge_requests/${iid}`,
|
||||
);
|
||||
|
||||
const authorName = data.author?.name ?? data.author?.username;
|
||||
const desc = [
|
||||
`!${data.iid}`,
|
||||
relativeTime(data.updated_at ?? data.created_at),
|
||||
authorName,
|
||||
].filter(Boolean).join(' · ');
|
||||
|
||||
return {
|
||||
title: data.title,
|
||||
description: desc,
|
||||
url,
|
||||
provider: 'gitlab',
|
||||
providerIcon: 'gitlab',
|
||||
status: this.formatMrStatus(data),
|
||||
statusColor: this.getMrStatusColor(data),
|
||||
author: authorName,
|
||||
authorAvatarUrl: data.author?.avatar_url,
|
||||
metadata: {
|
||||
type: 'mr',
|
||||
iid: data.iid,
|
||||
project: projectPath,
|
||||
labels: data.labels ?? [],
|
||||
draft: data.draft ?? data.work_in_progress,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async unfurlIssue(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
projectPath: string,
|
||||
iid: number,
|
||||
url: string,
|
||||
): Promise<UnfurlResult> {
|
||||
const encodedProject = encodeURIComponent(projectPath);
|
||||
const data = await this.apiGet(
|
||||
accessToken,
|
||||
apiBaseUrl,
|
||||
`/projects/${encodedProject}/issues/${iid}`,
|
||||
);
|
||||
|
||||
const issueAuthor = data.author?.name ?? data.author?.username;
|
||||
const issueDesc = [
|
||||
`#${data.iid}`,
|
||||
relativeTime(data.updated_at ?? data.created_at),
|
||||
issueAuthor,
|
||||
].filter(Boolean).join(' · ');
|
||||
|
||||
return {
|
||||
title: data.title,
|
||||
description: issueDesc,
|
||||
url,
|
||||
provider: 'gitlab',
|
||||
providerIcon: 'gitlab',
|
||||
status: data.state,
|
||||
statusColor: data.state === 'opened' ? 'green' : 'blue',
|
||||
author: issueAuthor,
|
||||
authorAvatarUrl: data.author?.avatar_url,
|
||||
metadata: {
|
||||
type: 'issue',
|
||||
iid: data.iid,
|
||||
project: projectPath,
|
||||
labels: data.labels ?? [],
|
||||
assignees:
|
||||
data.assignees?.map((a: any) => a.name ?? a.username) ?? [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async unfurlProject(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
projectPath: string,
|
||||
url: string,
|
||||
): Promise<UnfurlResult> {
|
||||
const encodedProject = encodeURIComponent(projectPath);
|
||||
const data = await this.apiGet(
|
||||
accessToken,
|
||||
apiBaseUrl,
|
||||
`/projects/${encodedProject}`,
|
||||
);
|
||||
|
||||
const visibility = data.visibility === 'public' ? 'Public' : data.visibility === 'internal' ? 'Internal' : 'Private';
|
||||
|
||||
return {
|
||||
title: data.name,
|
||||
description: data.description?.slice(0, 200) ?? undefined,
|
||||
url,
|
||||
provider: 'gitlab',
|
||||
providerIcon: 'gitlab',
|
||||
status: visibility,
|
||||
statusColor: data.visibility === 'public' ? 'green' : 'gray',
|
||||
author: data.namespace?.name,
|
||||
authorAvatarUrl: data.avatar_url ?? data.namespace?.avatar_url,
|
||||
metadata: {
|
||||
type: 'project',
|
||||
project: projectPath,
|
||||
stars: data.star_count,
|
||||
forks: data.forks_count,
|
||||
defaultBranch: data.default_branch,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async unfurlCommit(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
projectPath: string,
|
||||
commitSha: string,
|
||||
url: string,
|
||||
): Promise<UnfurlResult> {
|
||||
const encodedProject = encodeURIComponent(projectPath);
|
||||
const data = await this.apiGet(
|
||||
accessToken,
|
||||
apiBaseUrl,
|
||||
`/projects/${encodedProject}/repository/commits/${commitSha}`,
|
||||
);
|
||||
|
||||
const shortSha = data.short_id ?? data.id?.slice(0, 8);
|
||||
|
||||
const commitDesc = [
|
||||
shortSha,
|
||||
relativeTime(data.committed_date ?? data.created_at),
|
||||
data.author_name,
|
||||
].filter(Boolean).join(' · ');
|
||||
|
||||
return {
|
||||
title: data.title ?? data.message?.split('\n')[0],
|
||||
description: commitDesc,
|
||||
url,
|
||||
provider: 'gitlab',
|
||||
providerIcon: 'gitlab',
|
||||
author: data.author_name,
|
||||
authorAvatarUrl: undefined,
|
||||
metadata: {
|
||||
type: 'commit',
|
||||
sha: data.id,
|
||||
shortSha,
|
||||
project: projectPath,
|
||||
stats: data.stats,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async unfurlIssuesList(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
projectPath: string,
|
||||
url: string,
|
||||
): Promise<UnfurlResult> {
|
||||
const encodedProject = encodeURIComponent(projectPath);
|
||||
const data = await this.apiGet(
|
||||
accessToken,
|
||||
apiBaseUrl,
|
||||
`/projects/${encodedProject}?statistics=false`,
|
||||
);
|
||||
|
||||
return {
|
||||
title: `Issues · ${data.name}`,
|
||||
description: projectPath,
|
||||
url,
|
||||
provider: 'gitlab',
|
||||
providerIcon: 'gitlab',
|
||||
author: data.namespace?.name,
|
||||
authorAvatarUrl: data.avatar_url ?? data.namespace?.avatar_url,
|
||||
metadata: {
|
||||
type: 'issues-list',
|
||||
project: projectPath,
|
||||
openIssuesCount: data.open_issues_count,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async unfurlMergesList(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
projectPath: string,
|
||||
url: string,
|
||||
): Promise<UnfurlResult> {
|
||||
const encodedProject = encodeURIComponent(projectPath);
|
||||
const data = await this.apiGet(
|
||||
accessToken,
|
||||
apiBaseUrl,
|
||||
`/projects/${encodedProject}?statistics=false`,
|
||||
);
|
||||
|
||||
return {
|
||||
title: `Merge Requests · ${data.name}`,
|
||||
description: projectPath,
|
||||
url,
|
||||
provider: 'gitlab',
|
||||
providerIcon: 'gitlab',
|
||||
author: data.namespace?.name,
|
||||
authorAvatarUrl: data.avatar_url ?? data.namespace?.avatar_url,
|
||||
metadata: {
|
||||
type: 'merges-list',
|
||||
project: projectPath,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private formatMrStatus(mr: any): string {
|
||||
if (mr.state === 'merged') return 'merged';
|
||||
if (mr.draft || mr.work_in_progress) return 'draft';
|
||||
return mr.state;
|
||||
}
|
||||
|
||||
private getMrStatusColor(mr: any): string {
|
||||
if (mr.state === 'merged') return 'purple';
|
||||
if (mr.draft || mr.work_in_progress) return 'gray';
|
||||
if (mr.state === 'opened') return 'green';
|
||||
if (mr.state === 'closed') return 'red';
|
||||
return 'gray';
|
||||
}
|
||||
|
||||
private async apiGet(
|
||||
accessToken: string,
|
||||
apiBaseUrl: string,
|
||||
path: string,
|
||||
): Promise<any> {
|
||||
const response = await providerApiFetch('GitLab', `${apiBaseUrl}${path}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
Accept: 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
return response.json();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user