@alexsun-top/opencode-chat-room 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/LICENSE +2 -2
- package/README.md +40 -8
- package/README.zh-CN.md +40 -8
- package/cli.ts +27 -1
- package/dist/cli.js +5406 -3088
- package/package.json +25 -5
- package/packages/chat-room-channeld/README.md +111 -33
- package/packages/chat-room-channeld/src/adapter.ts +179 -7
- package/packages/chat-room-channeld/src/config.ts +63 -1
- package/packages/chat-room-channeld/src/delivery.ts +6 -1
- package/packages/chat-room-channeld/src/host-helpers.ts +11 -0
- package/packages/chat-room-channeld/src/host.ts +142 -9
- package/packages/chat-room-channeld/src/inbound.ts +35 -0
- package/packages/chat-room-channeld/src/protocol.ts +52 -1
- package/packages/chat-room-channeld/src/rules.ts +7 -2
- package/packages/chat-room-channeld/src/state.ts +17 -0
- package/packages/chat-room-channeld/src/stats.ts +43 -1
- package/plugin.ts +1 -1
- package/server/admin-state.ts +13 -13
- package/server/app.ts +95 -0
- package/server/assets/NOTICE.txt +2 -1
- package/server/assets/base.css +21 -9
- package/server/assets/chat/admin.js +0 -2
- package/server/assets/chat/announcements.js +69 -8
- package/server/assets/chat/chat-background.js +177 -0
- package/server/assets/chat/confirm-dialog.js +0 -1
- package/server/assets/chat/create-room-dialog.js +0 -1
- package/server/assets/chat/diagram-viewer.js +7 -1
- package/server/assets/chat/doc-preview.js +251 -46
- package/server/assets/chat/events.js +16 -5
- package/server/assets/chat/files.js +53 -7
- package/server/assets/chat/image-zoom.js +8 -1
- package/server/assets/chat/index.js +6 -2
- package/server/assets/chat/integration-account-schema.js +99 -0
- package/server/assets/chat/integration-editor.js +163 -0
- package/server/assets/chat/integration-values.js +124 -0
- package/server/assets/chat/integrations.js +648 -0
- package/server/assets/chat/locales/de.js +40 -4
- package/server/assets/chat/locales/es.js +40 -4
- package/server/assets/chat/locales/fr.js +40 -4
- package/server/assets/chat/locales/it.js +40 -4
- package/server/assets/chat/locales/ja.js +40 -4
- package/server/assets/chat/locales/ko.js +40 -4
- package/server/assets/chat/markdown-footnotes.js +1 -1
- package/server/assets/chat/markdown.js +45 -8
- package/server/assets/chat/messages.js +6 -5
- package/server/assets/chat/office-preview.js +69 -0
- package/server/assets/chat/palette.js +6 -1
- package/server/assets/chat/panels.js +56 -0
- package/server/assets/chat/recall.js +58 -7
- package/server/assets/chat/receipts.js +17 -6
- package/server/assets/chat/reminders.js +68 -9
- package/server/assets/chat/replies.js +0 -6
- package/server/assets/chat/resource-format.js +11 -0
- package/server/assets/chat/rooms.js +1 -6
- package/server/assets/chat/settings.js +98 -4
- package/server/assets/chat/shortcuts.js +0 -3
- package/server/assets/chat/side-pane.js +34 -10
- package/server/assets/chat/state.js +125 -12
- package/server/assets/chat/system-events.js +58 -0
- package/server/assets/chat/system-messages.js +32 -14
- package/server/assets/chat/task-row.js +0 -6
- package/server/assets/chat/tasks.js +119 -37
- package/server/assets/chat/window-controls.js +37 -0
- package/server/assets/code-highlight.css +71 -32
- package/server/assets/conversation.css +174 -31
- package/server/assets/doc-preview.css +40 -3
- package/server/assets/files.css +8 -0
- package/server/assets/fluent-icons.svg +2 -0
- package/server/assets/monaco/LICENSE +21 -0
- package/server/assets/monaco/ThirdPartyNotices.txt +448 -0
- package/server/assets/monaco/codicon-jdswhhtn.ttf +0 -0
- package/server/assets/monaco/editor.worker.js +45 -0
- package/server/assets/monaco/integration-rules.css +1 -0
- package/server/assets/monaco/integration-rules.js +1605 -0
- package/server/assets/monaco/json.worker.js +77 -0
- package/server/assets/office/THIRD-PARTY-NOTICES.txt +11 -0
- package/server/assets/office/docx.bundle.js +33 -0
- package/server/assets/office/licenses/docx-preview-LICENSE.txt +201 -0
- package/server/assets/office/licenses/echarts-LICENSE.txt +222 -0
- package/server/assets/office/licenses/jszip-LICENSE.txt +651 -0
- package/server/assets/office/licenses/lodash-LICENSE.txt +47 -0
- package/server/assets/office/licenses/pptx-preview-LICENSE.txt +8 -0
- package/server/assets/office/licenses/tslib-LICENSE.txt +12 -0
- package/server/assets/office/licenses/uuid-LICENSE.txt +9 -0
- package/server/assets/office/licenses/xlsx-LICENSE.txt +201 -0
- package/server/assets/office/licenses/zrender-LICENSE.txt +29 -0
- package/server/assets/office/pptx.bundle.js +104 -0
- package/server/assets/office/xlsx.bundle.js +141 -0
- package/server/assets/recall.css +5 -4
- package/server/assets/responsive.css +80 -11
- package/server/assets/settings.css +185 -9
- package/server/assets/tasks.css +57 -7
- package/server/assets/window-controls.css +36 -0
- package/server/channel-attachments.ts +133 -0
- package/server/channel-integration.ts +572 -0
- package/server/channel-settings.ts +77 -0
- package/server/channels.ts +274 -21
- package/server/chat-server.ts +32 -580
- package/server/chat.html +234 -34
- package/server/http-server.ts +3 -182
- package/server/manifest.webmanifest +1 -0
- package/server/resource-routes.ts +16 -16
- package/server/routes/inbox.ts +100 -0
- package/server/routes/pages.ts +83 -0
- package/server/routes/questions.ts +39 -0
- package/server/routes/room-actions.ts +162 -0
- package/server/routes/rooms.ts +160 -0
- package/server/startup.ts +84 -0
- package/server/sw.js +5 -0
- package/server/task-routes.ts +1 -1
- package/src/center/center-client.ts +3 -11
- package/src/config/file-config.ts +7 -54
- package/src/platform/http-server.ts +182 -0
- package/src/protocol/addressing.ts +21 -0
- package/src/protocol/config.ts +58 -0
- package/src/protocol/room.ts +51 -0
- package/src/rooms/resources.ts +26 -16
- package/src/rooms/room-service.ts +2 -48
- package/src/rooms/storage.ts +329 -0
- package/src/rooms/tasks.ts +21 -5
- package/src/runtime/watch.ts +1 -1
- package/src/state/pg-database.ts +183 -0
- package/src/state/pg-migrate.ts +175 -0
- package/src/state/pg-sql.mjs +175 -0
- package/src/state/pg-worker.mjs +133 -0
- package/src/state/sqlite-announcements.ts +25 -0
- package/src/state/sqlite-database.ts +130 -0
- package/src/state/sqlite-legacy.ts +90 -0
- package/src/state/sqlite-members.ts +155 -0
- package/src/state/sqlite-messages.ts +288 -0
- package/src/state/sqlite-resources.ts +39 -0
- package/src/state/sqlite-rooms.ts +194 -0
- package/src/state/sqlite-schema.ts +80 -0
- package/src/state/sqlite-state-store.ts +34 -0
- package/src/state/sqlite-state.ts +15 -897
- package/src/state/sqlite-tasks.ts +65 -0
- package/src/state/sqlite-transaction.ts +13 -0
- package/src/state/sqlite.ts +21 -1
- package/src/state/store.ts +5 -1
- package/src/tui/app.mjs +32 -19
- package/src/tui/config.mjs +12 -4
- package/src/tui/i18n.mjs +38 -0
- package/src/tui/info-app.mjs +50 -51
- package/src/tui/info-content.mjs +79 -44
- package/src/tui/join-app.mjs +9 -9
- package/src/tui/locales/en.mjs +349 -0
- package/src/tui/locales/zh-CN.mjs +349 -0
- package/src/tui/main.mjs +85 -37
- package/src/tui/markdown.mjs +3 -2
- package/src/tui/mentions.mjs +3 -1
- package/src/tui/message-app.mjs +22 -21
- package/src/tui/message-view.mjs +2 -1
- package/src/tui/palette-app.mjs +9 -8
- package/src/tui/palette.mjs +30 -24
- package/src/tui/prefs.mjs +92 -0
- package/src/tui/reminder-app.mjs +18 -17
- package/src/tui/room-settings-app.mjs +30 -28
- package/src/tui/settings-app.mjs +153 -0
- package/src/tui/ui-content.mjs +65 -86
- package/src/tui/ui-help.mjs +73 -0
- package/src/tui/ui-overlay-view.mjs +23 -7
- package/src/tui/ui-suggest.mjs +6 -5
- package/src/tui/ui-theme.mjs +37 -33
- package/src/tui/ui-view.mjs +22 -7
- package/src/tui/ui.mjs +15 -3
- package/src/web/editor.worker.ts +1 -0
- package/src/web/integration-rules-editor.ts +573 -0
- package/src/web/integration-rules.ts +26 -0
- package/src/web/integration-schema.ts +229 -0
- package/src/web/json.worker.ts +1 -0
- package/src/web/office-viewer.ts +221 -0
- package/packages/chat-room-channeld/dist/feishu-adapter.js +0 -499
- package/packages/chat-room-channeld/src/feishu-adapter.ts +0 -473
- package/server/assets/chat/forward.js +0 -69
package/server/chat.html
CHANGED
|
@@ -10,11 +10,27 @@
|
|
|
10
10
|
<link rel="apple-touch-icon" href="/assets/icons/apple-touch-icon.png">
|
|
11
11
|
<meta name="theme-color" content="#f3f1ea">
|
|
12
12
|
<script>
|
|
13
|
-
// Resolve the saved theme before the first paint
|
|
13
|
+
// Resolve the saved theme and outer window frame before the first paint.
|
|
14
14
|
try {
|
|
15
15
|
var savedTheme = localStorage.getItem("chat.theme");
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
var savedCustom = localStorage.getItem("chat.customTheme");
|
|
17
|
+
var customColor = /^#[0-9a-f]{6}$/i.test(savedCustom) ? savedCustom : "#22695c";
|
|
18
|
+
var customChannels = customColor.slice(1).match(/../g).map(function (part) {
|
|
19
|
+
var value = parseInt(part, 16) / 255;
|
|
20
|
+
return value <= 0.03928 ? value / 12.92 : Math.pow((value + 0.055) / 1.055, 2.4);
|
|
21
|
+
});
|
|
22
|
+
document.documentElement.style.setProperty("--custom-bg", customColor);
|
|
23
|
+
document.documentElement.dataset.customDark = (0.2126 * customChannels[0] + 0.7152 * customChannels[1] + 0.0722 * customChannels[2]) < 0.4 ? "true" : "false";
|
|
24
|
+
document.documentElement.dataset.theme = ["light", "dark", "forest", "sand", "custom"].includes(savedTheme) ? savedTheme : "system";
|
|
25
|
+
} catch {
|
|
26
|
+
document.documentElement.dataset.theme = "system";
|
|
27
|
+
document.documentElement.style.setProperty("--custom-bg", "#22695c");
|
|
28
|
+
document.documentElement.dataset.customDark = "true";
|
|
29
|
+
}
|
|
30
|
+
document.documentElement.dataset.windowFrame = "framed";
|
|
31
|
+
try {
|
|
32
|
+
if (localStorage.getItem("chat.windowFrame") === "borderless") document.documentElement.dataset.windowFrame = "borderless";
|
|
33
|
+
} catch { /* A blocked localStorage keeps the framed default. */ }
|
|
18
34
|
</script>
|
|
19
35
|
<meta name="mobile-web-app-capable" content="yes">
|
|
20
36
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
@@ -26,6 +42,7 @@
|
|
|
26
42
|
<link rel="stylesheet" href="/assets/recall.css?v={{version}}">
|
|
27
43
|
<link rel="stylesheet" href="/assets/attachments.css?v={{version}}">
|
|
28
44
|
<link rel="stylesheet" href="/assets/responsive.css?v={{version}}">
|
|
45
|
+
<link rel="stylesheet" href="/assets/window-controls.css?v={{version}}">
|
|
29
46
|
<link rel="stylesheet" href="/assets/code-highlight.css?v={{version}}">
|
|
30
47
|
<link rel="stylesheet" href="/assets/room-create.css?v={{version}}">
|
|
31
48
|
<link rel="stylesheet" href="/assets/edit-room.css?v={{version}}">
|
|
@@ -35,7 +52,7 @@
|
|
|
35
52
|
<link rel="stylesheet" href="/assets/doc-preview.css?v={{version}}">
|
|
36
53
|
<link rel="stylesheet" href="/assets/diagram-viewer.css?v={{version}}">
|
|
37
54
|
</head>
|
|
38
|
-
<body data-channeld="{{channeld}}">
|
|
55
|
+
<body data-channeld="{{channeld}}" data-integrations-admin="{{integrationsAdmin}}">
|
|
39
56
|
|
|
40
57
|
<main id="app">
|
|
41
58
|
<section id="restoreView" class="restore-view" role="status" aria-live="polite">
|
|
@@ -152,8 +169,12 @@
|
|
|
152
169
|
<svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-circle_half_fill-24"></use></svg>
|
|
153
170
|
<span data-i18n="settingsAppearance">Appearance</span>
|
|
154
171
|
</button>
|
|
155
|
-
<button id="
|
|
172
|
+
<button id="settingsTabIntegrations" class="settings-tab" type="button" role="tab" aria-selected="false" aria-controls="settingsPanelIntegrations" tabindex="-1" data-settings-tab="integrations">
|
|
156
173
|
<svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-plug_connected-24"></use></svg>
|
|
174
|
+
<span data-i18n="settingsIntegrations">Integrations</span>
|
|
175
|
+
</button>
|
|
176
|
+
<button id="settingsTabConnection" class="settings-tab" type="button" role="tab" aria-selected="false" aria-controls="settingsPanelConnection" tabindex="-1" data-settings-tab="connection">
|
|
177
|
+
<svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-shield_checkmark-24"></use></svg>
|
|
157
178
|
<span data-i18n="settingsConnection">Connection</span>
|
|
158
179
|
</button>
|
|
159
180
|
</nav>
|
|
@@ -223,8 +244,126 @@
|
|
|
223
244
|
<span class="theme-preview" aria-hidden="true"></span>
|
|
224
245
|
<span class="theme-name" data-i18n="themeSand">Sand</span>
|
|
225
246
|
</label>
|
|
247
|
+
<label class="theme-option" data-theme-choice="custom">
|
|
248
|
+
<input type="radio" name="theme" value="custom">
|
|
249
|
+
<span class="theme-preview" aria-hidden="true"></span>
|
|
250
|
+
<span class="theme-name" data-i18n="themeCustom">Custom</span>
|
|
251
|
+
<input id="inCustomThemeColor" class="input theme-color-input" type="color" aria-label="Custom theme color" data-i18n-aria-label="themeCustomColor">
|
|
252
|
+
</label>
|
|
253
|
+
</div>
|
|
254
|
+
</fieldset>
|
|
255
|
+
<fieldset class="settings-block chat-background-block">
|
|
256
|
+
<legend class="settings-label"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-image-24"></use></svg><span data-i18n="chatBackgroundLabel">Chat background</span></legend>
|
|
257
|
+
<p class="settings-hint" data-i18n="chatBackgroundHint">Fills the browser window behind the app in this browser only. A lower opacity keeps text readable.</p>
|
|
258
|
+
<div class="chat-background-controls">
|
|
259
|
+
<label class="chat-background-field">
|
|
260
|
+
<span class="field-label" data-i18n="chatBackgroundMode">Mode</span>
|
|
261
|
+
<select id="inChatBackgroundMode" class="input settings-select">
|
|
262
|
+
<option value="default" data-i18n="chatBackgroundDefault">Default</option>
|
|
263
|
+
<option value="image" data-i18n="chatBackgroundImage">Image</option>
|
|
264
|
+
</select>
|
|
265
|
+
</label>
|
|
266
|
+
<label id="chatBackgroundOpacityField" class="chat-background-field" hidden>
|
|
267
|
+
<span class="field-label" data-i18n="chatBackgroundOpacity">Opacity</span>
|
|
268
|
+
<span class="settings-range chat-background-opacity"><input id="inChatBackgroundOpacity" type="range" min="0" max="100" step="5" value="35" aria-describedby="chatBackgroundHint"><output id="chatBackgroundOpacityValue" class="settings-range-value" for="inChatBackgroundOpacity">35%</output></span>
|
|
269
|
+
</label>
|
|
270
|
+
<label id="chatBackgroundImageField" class="chat-background-field chat-background-image-field" hidden>
|
|
271
|
+
<span class="field-label" data-i18n="chatBackgroundImage">Image</span>
|
|
272
|
+
<input id="inChatBackgroundImage" class="input" type="file" accept="image/*">
|
|
273
|
+
<img id="chatBackgroundPreview" class="chat-background-preview" alt="" hidden>
|
|
274
|
+
<span id="chatBackgroundFileName" class="chat-background-file-name" hidden></span>
|
|
275
|
+
</label>
|
|
226
276
|
</div>
|
|
277
|
+
<p id="chatBackgroundStatus" class="settings-hint chat-background-status" role="status" aria-live="polite" hidden></p>
|
|
227
278
|
</fieldset>
|
|
279
|
+
<div class="settings-row">
|
|
280
|
+
<div class="settings-copy">
|
|
281
|
+
<label class="settings-label" for="inWindowFrame"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-options-24"></use></svg><span data-i18n="windowFrameLabel">Display mode</span></label>
|
|
282
|
+
<p id="windowFrameHint" class="settings-hint" data-i18n="windowFrameHint">Fill window uses the entire window; Window mode keeps the inset card border.</p>
|
|
283
|
+
</div>
|
|
284
|
+
<select id="inWindowFrame" class="input settings-select" aria-describedby="windowFrameHint">
|
|
285
|
+
<option value="framed" data-i18n="windowFrameFramed" selected>Window mode</option>
|
|
286
|
+
<option value="borderless" data-i18n="windowFrameBorderless">Fill window</option>
|
|
287
|
+
</select>
|
|
288
|
+
</div>
|
|
289
|
+
<fieldset class="settings-block panel-mode-block">
|
|
290
|
+
<legend class="settings-label"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-options-24"></use></svg><span data-i18n="settingsPanelMode">Tool windows</span></legend>
|
|
291
|
+
<p class="settings-hint" data-i18n="settingsPanelModeHint">Choose how each room tool opens on wide screens. Narrow or short windows always use a dialog.</p>
|
|
292
|
+
<div class="panel-mode-grid">
|
|
293
|
+
<label class="panel-mode-row"><span data-i18n="announcements">Announcements</span><select class="input settings-select" data-panel-mode="announcements"><option value="dialog" data-i18n="panelModeDialog">Dialog</option><option value="pane" data-i18n="panelModePane">Side pane</option></select></label>
|
|
294
|
+
<label class="panel-mode-row"><span data-i18n="filesTitle">Files</span><select class="input settings-select" data-panel-mode="files"><option value="dialog" data-i18n="panelModeDialog">Dialog</option><option value="pane" data-i18n="panelModePane">Side pane</option></select></label>
|
|
295
|
+
<label class="panel-mode-row"><span data-i18n="tasksTitle">Tasks</span><select class="input settings-select" data-panel-mode="tasks"><option value="dialog" data-i18n="panelModeDialog">Dialog</option><option value="pane" data-i18n="panelModePane">Side pane</option></select></label>
|
|
296
|
+
<label class="panel-mode-row"><span data-i18n="reminders">Reminders</span><select class="input settings-select" data-panel-mode="reminders"><option value="dialog" data-i18n="panelModeDialog">Dialog</option><option value="pane" data-i18n="panelModePane">Side pane</option></select></label>
|
|
297
|
+
</div>
|
|
298
|
+
</fieldset>
|
|
299
|
+
</section>
|
|
300
|
+
<section id="settingsPanelIntegrations" class="settings-panel integration-panel" role="tabpanel" aria-labelledby="settingsTabIntegrations" hidden>
|
|
301
|
+
<div class="integration-lead">
|
|
302
|
+
<p class="settings-hint" data-i18n="integrationsHint">Connect rooms with external platforms through uploaded plugins. Secret values stay on the server.</p>
|
|
303
|
+
<button id="btnRefreshIntegrations" class="btn ghost small" type="button" data-i18n="refreshQuestions">Refresh</button>
|
|
304
|
+
</div>
|
|
305
|
+
<p id="integrationStatus" class="hint" role="status" aria-live="polite"></p>
|
|
306
|
+
<p id="integrationError" class="alert integration-error" role="alert" hidden></p>
|
|
307
|
+
<p id="integrationExternalNotice" class="integration-external-notice" data-i18n="integrationsExternalConfig" role="status" hidden>This integration uses an external configuration file. Edit that file, or disable it before saving managed settings.</p>
|
|
308
|
+
<div class="settings-row integration-enable-row">
|
|
309
|
+
<div class="settings-copy">
|
|
310
|
+
<label class="settings-label" for="inIntegrationsEnabled"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-plug_connected-24"></use></svg><span data-i18n="integrationsEnable">Enable integrations</span></label>
|
|
311
|
+
<p class="settings-hint" data-i18n="integrationsEnableHint">Changes apply when you save.</p>
|
|
312
|
+
</div>
|
|
313
|
+
<input id="inIntegrationsEnabled" class="settings-switch" type="checkbox" role="switch">
|
|
314
|
+
</div>
|
|
315
|
+
<p id="integrationDisabledHint" class="settings-hint" data-i18n="integrationsDisabledHint" hidden>Enable integrations and save to edit accounts, plugins, and rules.</p>
|
|
316
|
+
<div id="integrationBody" class="integration-body" hidden>
|
|
317
|
+
<section class="integration-section" aria-labelledby="integrationAccountsHeading">
|
|
318
|
+
<header class="integration-section-head">
|
|
319
|
+
<h3 id="integrationAccountsHeading" data-i18n="integrationsAccounts">Accounts</h3>
|
|
320
|
+
<button id="btnAddIntegrationAccount" class="btn ghost small" type="button" data-i18n="integrationsAddAccount">Add account</button>
|
|
321
|
+
</header>
|
|
322
|
+
<ul id="integrationAccounts" class="integration-accounts"></ul>
|
|
323
|
+
<p id="integrationAccountsEmpty" class="hint" data-i18n="integrationsEmptyAccounts" hidden>No accounts yet.</p>
|
|
324
|
+
</section>
|
|
325
|
+
<section class="integration-section" aria-labelledby="integrationPluginsHeading">
|
|
326
|
+
<header class="integration-section-head">
|
|
327
|
+
<h3 id="integrationPluginsHeading" data-i18n="integrationsPlugins">Plugins</h3>
|
|
328
|
+
<button id="btnUploadPlugin" class="btn ghost small" type="button" data-i18n="integrationsUploadPlugin">Upload plugin</button>
|
|
329
|
+
</header>
|
|
330
|
+
<ul id="integrationPlugins" class="integration-plugins"></ul>
|
|
331
|
+
<p id="integrationPluginsEmpty" class="hint" data-i18n="integrationsEmptyPlugins" hidden>No plugins uploaded yet.</p>
|
|
332
|
+
</section>
|
|
333
|
+
<section class="integration-section integration-rules-section" aria-labelledby="integrationRulesHeading">
|
|
334
|
+
<header class="integration-section-head">
|
|
335
|
+
<h3 id="integrationRulesHeading" data-i18n="integrationsRules">Outbound rules</h3>
|
|
336
|
+
<div id="integrationRulesFormat" class="integration-format-toggle" role="group" aria-label="Rules format" data-i18n-aria-label="integrationsRulesFormat" hidden>
|
|
337
|
+
<button id="integrationRulesFormatYaml" class="integration-format-btn" type="button" data-format="yaml" aria-pressed="true">YAML</button>
|
|
338
|
+
<button id="integrationRulesFormatJson" class="integration-format-btn" type="button" data-format="json" aria-pressed="false">JSON</button>
|
|
339
|
+
</div>
|
|
340
|
+
</header>
|
|
341
|
+
<p class="settings-hint" data-i18n="integrationsRulesHint">Outbound rules forward room events to connected accounts. Use JSON or YAML; each target must use an existing account.</p>
|
|
342
|
+
<div id="integrationRulesEditor" class="integration-rules-editor" aria-label="Outbound rules editor" data-i18n-aria-label="integrationsRules" hidden></div>
|
|
343
|
+
<textarea id="integrationRules" class="input integration-rules" rows="8" spellcheck="false" aria-describedby="integrationRulesError"></textarea>
|
|
344
|
+
<p id="integrationRulesFallback" class="settings-hint" data-i18n="integrationsEditorUnavailable" hidden></p>
|
|
345
|
+
<p id="integrationRulesError" class="hint integration-field-error" role="alert" hidden></p>
|
|
346
|
+
<ul id="integrationRulesErrorList" class="integration-rule-errors" aria-label="Outbound rule errors" hidden></ul>
|
|
347
|
+
</section>
|
|
348
|
+
<section class="integration-section integration-rules-section" aria-labelledby="integrationInboundHeading">
|
|
349
|
+
<header class="integration-section-head">
|
|
350
|
+
<h3 id="integrationInboundHeading" data-i18n="integrationsInboundRules">Inbound routes</h3>
|
|
351
|
+
<div id="integrationInboundFormat" class="integration-format-toggle" role="group" aria-label="Rules format" data-i18n-aria-label="integrationsRulesFormat" hidden>
|
|
352
|
+
<button id="integrationInboundFormatYaml" class="integration-format-btn" type="button" data-format="yaml" aria-pressed="true">YAML</button>
|
|
353
|
+
<button id="integrationInboundFormatJson" class="integration-format-btn" type="button" data-format="json" aria-pressed="false">JSON</button>
|
|
354
|
+
</div>
|
|
355
|
+
</header>
|
|
356
|
+
<p class="settings-hint" data-i18n="integrationsInboundHint">Inbound routes bring external messages into a room. Each route needs a configured account and a room.</p>
|
|
357
|
+
<div id="integrationInboundEditor" class="integration-rules-editor" aria-label="Inbound routes editor" data-i18n-aria-label="integrationsInboundRules" hidden></div>
|
|
358
|
+
<textarea id="integrationInbound" class="input integration-rules" rows="6" spellcheck="false" aria-describedby="integrationInboundError"></textarea>
|
|
359
|
+
<p id="integrationInboundFallback" class="settings-hint" data-i18n="integrationsEditorUnavailable" hidden></p>
|
|
360
|
+
<p id="integrationInboundError" class="hint integration-field-error" role="alert" hidden></p>
|
|
361
|
+
<ul id="integrationInboundErrorList" class="integration-rule-errors" aria-label="Inbound route errors" hidden></ul>
|
|
362
|
+
</section>
|
|
363
|
+
</div>
|
|
364
|
+
<div class="integration-actions">
|
|
365
|
+
<button id="btnSaveIntegrations" class="btn primary small" type="button" data-i18n="integrationsSave">Save integrations</button>
|
|
366
|
+
</div>
|
|
228
367
|
</section>
|
|
229
368
|
<section id="settingsPanelConnection" class="settings-panel" role="tabpanel" aria-labelledby="settingsTabConnection" hidden>
|
|
230
369
|
<div class="settings-row settings-row-stack">
|
|
@@ -243,6 +382,44 @@
|
|
|
243
382
|
</div>
|
|
244
383
|
</div>
|
|
245
384
|
</dialog>
|
|
385
|
+
<dialog id="integrationAccountDialog" class="admin-dialog integration-dialog" aria-labelledby="integrationAccountHeading">
|
|
386
|
+
<header class="admin-dialog-head"><h2 id="integrationAccountHeading" data-i18n="integrationsAccountTitle">Integration account</h2><button id="btnCloseIntegrationAccount" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="fluent-icon close-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-dismiss-24"></use></svg></button></header>
|
|
387
|
+
<form id="integrationAccountForm" class="integration-form" novalidate>
|
|
388
|
+
<p id="integrationAccountError" class="alert integration-error" role="alert" hidden></p>
|
|
389
|
+
<label class="field"><span class="field-label" data-i18n="integrationsAccountId">Account ID</span><input id="integrationAccountId" class="input" maxlength="128" autocomplete="off" placeholder="Leave blank to generate" data-i18n-placeholder="integrationsAccountIdHint"></label>
|
|
390
|
+
<label class="field"><span class="field-label" data-i18n="integrationsPlugin">Plugin</span><select id="integrationAccountPlugin" class="input" required></select></label>
|
|
391
|
+
<fieldset id="integrationAccountSchemaField" class="field integration-schema">
|
|
392
|
+
<legend class="field-label" data-i18n="integrationsAccountDetails">Account details</legend>
|
|
393
|
+
<div id="integrationAccountSchema"></div>
|
|
394
|
+
</fieldset>
|
|
395
|
+
<details id="integrationAccountAdvanced" class="field integration-advanced">
|
|
396
|
+
<summary class="field-label"><svg class="fluent-icon integration-advanced-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-chevron_down-24"></use></svg><span data-i18n="integrationsAdvanced">Advanced settings</span></summary>
|
|
397
|
+
<div id="integrationAccountEnv" class="integration-env-rows"></div>
|
|
398
|
+
<div class="integration-env-actions">
|
|
399
|
+
<button id="btnAddAccountEnv" class="btn ghost small integration-env-add" type="button" aria-label="Add variable" data-i18n-aria-label="integrationsAddEnv"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-add-24"></use></svg></button>
|
|
400
|
+
<button id="btnClearAccountEnv" class="btn ghost small" type="button" data-i18n="integrationsClearEnv">Clear stored values</button>
|
|
401
|
+
</div>
|
|
402
|
+
<p id="integrationAccountEnvNote" class="hint integration-env-note" hidden></p>
|
|
403
|
+
<p class="hint" data-i18n="integrationsEnvHint">Leave all values blank to keep the stored set. Entering a value replaces it.</p>
|
|
404
|
+
</details>
|
|
405
|
+
<div class="announcement-actions">
|
|
406
|
+
<button id="btnSaveIntegrationAccount" class="btn primary small" type="submit" data-i18n="save">Save</button>
|
|
407
|
+
<button id="btnCancelIntegrationAccount" class="btn ghost small" type="button" data-i18n="cancel">Cancel</button>
|
|
408
|
+
</div>
|
|
409
|
+
</form>
|
|
410
|
+
</dialog>
|
|
411
|
+
<dialog id="integrationPluginDialog" class="admin-dialog integration-dialog integration-plugin-dialog" aria-labelledby="integrationPluginHeading">
|
|
412
|
+
<header class="admin-dialog-head"><h2 id="integrationPluginHeading" data-i18n="integrationsUploadPlugin">Upload plugin</h2><button id="btnCloseIntegrationPlugin" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="fluent-icon close-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-dismiss-24"></use></svg></button></header>
|
|
413
|
+
<form id="integrationPluginForm" class="integration-form" novalidate>
|
|
414
|
+
<p id="integrationPluginError" class="alert integration-error" role="alert" hidden></p>
|
|
415
|
+
<label class="field"><span class="field-label" data-i18n="integrationsPluginFile">Choose an adapter file</span><input id="integrationPluginFile" class="input" type="file" accept=".js,.mjs,.cjs,.ts"></label>
|
|
416
|
+
<p class="hint" data-i18n="integrationsPluginHint">A valid adapter declares its platform and account fields from the initialize handshake. Upload does not start the account or require credentials.</p>
|
|
417
|
+
<div class="announcement-actions">
|
|
418
|
+
<button id="btnSaveIntegrationPlugin" class="btn primary small" type="submit" data-i18n="integrationsUpload">Upload plugin</button>
|
|
419
|
+
<button id="btnCancelIntegrationPlugin" class="btn ghost small" type="button" data-i18n="cancel">Cancel</button>
|
|
420
|
+
</div>
|
|
421
|
+
</form>
|
|
422
|
+
</dialog>
|
|
246
423
|
|
|
247
424
|
<!-- Shared room workspace. -->
|
|
248
425
|
<section id="chatView" class="view" hidden>
|
|
@@ -355,7 +532,7 @@
|
|
|
355
532
|
</footer>
|
|
356
533
|
</form>
|
|
357
534
|
</dialog>
|
|
358
|
-
<dialog id="filesDialog" class="admin-dialog files-dialog" aria-labelledby="filesHeading">
|
|
535
|
+
<dialog id="filesDialog" class="admin-dialog files-dialog pane-surface" aria-labelledby="filesHeading">
|
|
359
536
|
<header class="files-head">
|
|
360
537
|
<div class="files-heading">
|
|
361
538
|
<p class="files-eyebrow" data-i18n="filesEyebrow">Room files</p>
|
|
@@ -383,7 +560,7 @@
|
|
|
383
560
|
<p class="hint files-hint" data-i18n="filesHint">Preview images, audio, and video. Download any file.</p>
|
|
384
561
|
</footer>
|
|
385
562
|
</dialog>
|
|
386
|
-
<dialog id="tasksDialog" class="admin-dialog tasks-dialog" aria-labelledby="tasksHeading">
|
|
563
|
+
<dialog id="tasksDialog" class="admin-dialog tasks-dialog pane-surface" aria-labelledby="tasksHeading">
|
|
387
564
|
<header class="tasks-head">
|
|
388
565
|
<div class="tasks-heading">
|
|
389
566
|
<p class="tasks-eyebrow"><span data-i18n="tasksEyebrow">Room tasks</span><span id="tasksRoomName" class="tasks-room-name"></span></p>
|
|
@@ -417,6 +594,7 @@
|
|
|
417
594
|
<button id="btnRetryTasks" class="btn ghost small" type="button" data-i18n="retry">Retry</button>
|
|
418
595
|
</div>
|
|
419
596
|
<div class="tasks-scroll">
|
|
597
|
+
<p id="tasksLimitNotice" class="tasks-limit-notice" role="status" hidden></p>
|
|
420
598
|
<details id="taskCreateDetails" class="task-create">
|
|
421
599
|
<summary class="task-create-summary"><span data-i18n="tasksCreate">Add task</span></summary>
|
|
422
600
|
<form id="taskCreateForm" class="task-create-form" novalidate>
|
|
@@ -459,6 +637,46 @@
|
|
|
459
637
|
<p id="tasksEmpty" class="hint tasks-empty" hidden></p>
|
|
460
638
|
</div>
|
|
461
639
|
</dialog>
|
|
640
|
+
<dialog id="announcementsDialog" class="admin-dialog announcements-dialog pane-surface" aria-labelledby="announcementHeading">
|
|
641
|
+
<header class="admin-dialog-head announcements-dialog-head">
|
|
642
|
+
<h2 id="announcementHeading" tabindex="-1" data-i18n="announcements">Announcements</h2>
|
|
643
|
+
<div class="admin-dialog-actions">
|
|
644
|
+
<button type="button" id="btnNewAnnouncement" class="btn primary small" aria-haspopup="dialog" data-i18n="announcementNew">New announcement</button>
|
|
645
|
+
<button type="button" id="btnRefreshAnnouncements" class="question-refresh" data-i18n="refreshQuestions">Refresh</button>
|
|
646
|
+
<button id="btnCloseAnnouncements" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="fluent-icon close-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-dismiss-24"></use></svg></button>
|
|
647
|
+
</div>
|
|
648
|
+
</header>
|
|
649
|
+
<div class="announcements-body">
|
|
650
|
+
<p id="announcementStatus" class="hint" role="status" aria-live="polite"></p>
|
|
651
|
+
<ul id="announcementList" class="announcement-list" aria-label="Announcements" data-i18n-aria-label="announcements"></ul>
|
|
652
|
+
</div>
|
|
653
|
+
</dialog>
|
|
654
|
+
<dialog id="remindersDialog" class="admin-dialog reminders-dialog pane-surface" aria-labelledby="reminderHeading">
|
|
655
|
+
<header class="admin-dialog-head reminders-dialog-head">
|
|
656
|
+
<h2 id="reminderHeading" tabindex="-1" data-i18n="reminders">Reminders</h2>
|
|
657
|
+
<div class="admin-dialog-actions">
|
|
658
|
+
<button type="button" id="btnNewReminder" class="btn primary small" data-i18n="reminderCreate">Create reminder</button>
|
|
659
|
+
<button type="button" id="btnRefreshReminders" class="question-refresh" data-i18n="refreshQuestions">Refresh</button>
|
|
660
|
+
<button id="btnCloseReminders" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="fluent-icon close-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-dismiss-24"></use></svg></button>
|
|
661
|
+
</div>
|
|
662
|
+
</header>
|
|
663
|
+
<div class="reminders-body">
|
|
664
|
+
<p id="reminderStatus" class="hint" role="status" aria-live="polite"></p>
|
|
665
|
+
<ul id="reminderList" class="reminder-list"></ul>
|
|
666
|
+
</div>
|
|
667
|
+
</dialog>
|
|
668
|
+
<dialog id="taskEditDialog" class="admin-dialog task-edit-dialog" aria-labelledby="taskEditHeading">
|
|
669
|
+
<header class="admin-dialog-head">
|
|
670
|
+
<h2 id="taskEditHeading" data-i18n="tasksEditHeading">Edit task</h2>
|
|
671
|
+
<div class="admin-dialog-actions">
|
|
672
|
+
<button id="btnCloseTaskEdit" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="fluent-icon close-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-dismiss-24"></use></svg></button>
|
|
673
|
+
</div>
|
|
674
|
+
</header>
|
|
675
|
+
<div class="task-edit-body">
|
|
676
|
+
<p id="taskEditError" class="alert task-edit-error" role="alert" hidden><span id="taskEditErrorText"></span></p>
|
|
677
|
+
<div id="taskEditFormHost"></div>
|
|
678
|
+
</div>
|
|
679
|
+
</dialog>
|
|
462
680
|
<dialog id="reminderDialog" class="admin-dialog reminder-dialog" aria-labelledby="reminderDialogHeading">
|
|
463
681
|
<header class="admin-dialog-head"><h2 id="reminderDialogHeading" data-i18n="reminderCreate">Create reminder</h2><div class="admin-dialog-actions"><button id="btnCloseReminder" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="fluent-icon close-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-dismiss-24"></use></svg></button></div></header>
|
|
464
682
|
<form id="reminderForm" class="admin-guide reminder-form">
|
|
@@ -508,13 +726,6 @@
|
|
|
508
726
|
<div id="questionReply" class="question-reply" hidden></div>
|
|
509
727
|
</section>
|
|
510
728
|
</div>
|
|
511
|
-
<div class="anchor">
|
|
512
|
-
<button class="chip" type="button" id="btnReminders" aria-haspopup="true" aria-expanded="false" aria-controls="reminderPanel"><svg class="fluent-icon action-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-alert-24"></use></svg><span class="action-label" data-i18n="reminders">Reminders</span></button>
|
|
513
|
-
<section class="panel reminder-panel" id="reminderPanel" aria-labelledby="reminderHeading" hidden>
|
|
514
|
-
<div class="announcement-head"><h3 id="reminderHeading" tabindex="-1" data-i18n="reminders">Reminders</h3><div class="reminder-tools"><button type="button" id="btnNewReminder" class="btn primary small" data-i18n="reminderCreate">Create reminder</button><button type="button" id="btnRefreshReminders" class="question-refresh" data-i18n="refreshQuestions">Refresh</button></div></div>
|
|
515
|
-
<p id="reminderStatus" class="hint" role="status" aria-live="polite"></p><ul id="reminderList" class="reminder-list"></ul>
|
|
516
|
-
</section>
|
|
517
|
-
</div>
|
|
518
729
|
<div class="anchor">
|
|
519
730
|
<button class="chip" type="button" id="btnMembers" aria-label="Members" data-i18n-aria-label="members" aria-haspopup="true" aria-expanded="false"><svg class="fluent-icon action-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-people-24"></use></svg><span class="action-label" data-i18n="members">Members</span><span id="joinRequestBadge" class="question-badge join-request-badge" aria-hidden="true" hidden><span id="joinRequestBadgeCount"></span></span></button>
|
|
520
731
|
<div class="panel" id="memberPanel" hidden>
|
|
@@ -536,18 +747,14 @@
|
|
|
536
747
|
<div class="anchor room-options-anchor">
|
|
537
748
|
<button class="chip" type="button" id="btnRoomOptions" aria-haspopup="true" aria-expanded="false" aria-controls="roomOptions"><svg class="fluent-icon action-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-more_horizontal-24"></use></svg><span class="action-label" data-i18n="roomOptions">Options</span></button>
|
|
538
749
|
<div class="panel room-options-panel" id="roomOptions" hidden>
|
|
539
|
-
<button class="menu-action" type="button" id="btnAnnouncements" aria-controls="
|
|
540
|
-
<button class="menu-action files-menu-action" type="button" id="btnFiles"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-folder-24"></use></svg><span data-i18n="filesTitle">Files</span></button>
|
|
541
|
-
<button class="menu-action" type="button" id="btnTasks"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-checkmark-24"></use></svg><span data-i18n="tasksTitle">Tasks</span></button>
|
|
750
|
+
<button class="menu-action" type="button" id="btnAnnouncements" aria-haspopup="dialog" aria-controls="announcementsDialog"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-megaphone-24"></use></svg><span data-i18n="announcements">Announcements</span></button>
|
|
751
|
+
<button class="menu-action files-menu-action" type="button" id="btnFiles" aria-haspopup="dialog" aria-controls="filesDialog"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-folder-24"></use></svg><span data-i18n="filesTitle">Files</span></button>
|
|
752
|
+
<button class="menu-action" type="button" id="btnTasks" aria-haspopup="dialog" aria-controls="tasksDialog"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-checkmark-24"></use></svg><span data-i18n="tasksTitle">Tasks</span></button>
|
|
753
|
+
<button class="menu-action" type="button" id="btnReminders" aria-haspopup="dialog" aria-controls="remindersDialog"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-alert-24"></use></svg><span data-i18n="reminders">Reminders</span></button>
|
|
542
754
|
<button class="menu-action" type="button" id="btnEditRoom"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-edit-24"></use></svg><span data-i18n="editRoom">Edit room</span></button>
|
|
543
755
|
<button class="menu-action" type="button" id="btnLeave"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-arrow_exit-24"></use></svg><span data-i18n="leave">Leave room</span></button>
|
|
544
756
|
<button class="menu-action danger-text" type="button" id="btnDeleteRoom"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-delete-24"></use></svg><span data-i18n="deleteRoom">Delete room</span></button>
|
|
545
757
|
</div>
|
|
546
|
-
<section class="panel announcement-panel" id="announcementPanel" aria-labelledby="announcementHeading" hidden>
|
|
547
|
-
<div class="announcement-head"><h3 id="announcementHeading" tabindex="-1" data-i18n="announcements">Announcements</h3><div class="announcement-tools"><button type="button" id="btnNewAnnouncement" class="btn primary small" aria-haspopup="dialog" data-i18n="announcementNew">New announcement</button><button type="button" id="btnRefreshAnnouncements" class="question-refresh" data-i18n="refreshQuestions">Refresh</button></div></div>
|
|
548
|
-
<p id="announcementStatus" class="hint" role="status" aria-live="polite"></p>
|
|
549
|
-
<ul id="announcementList" class="announcement-list" aria-label="Announcements" data-i18n-aria-label="announcements"></ul>
|
|
550
|
-
</section>
|
|
551
758
|
</div>
|
|
552
759
|
</div>
|
|
553
760
|
</header>
|
|
@@ -567,9 +774,9 @@
|
|
|
567
774
|
</button>
|
|
568
775
|
</div>
|
|
569
776
|
|
|
570
|
-
<aside id="readerPanel" class="reader-panel" role="dialog" aria-modal="false" aria-
|
|
777
|
+
<aside id="readerPanel" class="reader-panel" role="dialog" aria-modal="false" aria-label="Message readers" data-i18n-aria-label="readerPanelTitle" tabindex="-1" hidden>
|
|
571
778
|
<div class="reader-panel-head">
|
|
572
|
-
<
|
|
779
|
+
<p id="readerCount" class="hint"></p>
|
|
573
780
|
<button type="button" id="btnCloseReaders" class="reader-close" data-i18n-aria-label="close" aria-label="Close"><svg class="fluent-icon close-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-dismiss-24"></use></svg></button>
|
|
574
781
|
</div>
|
|
575
782
|
<ul id="readerList" class="receipt-reader-list" aria-label="Message readers" data-i18n-aria-label="readerPanelTitle"></ul>
|
|
@@ -615,7 +822,8 @@
|
|
|
615
822
|
<p class="doc-preview-meta"><span id="docPreviewSize"></span><span id="docPreviewLanguage" class="doc-preview-language" hidden></span><span id="docPreviewStatus" role="status" aria-live="polite"></span></p>
|
|
616
823
|
</div>
|
|
617
824
|
<div class="doc-preview-actions">
|
|
618
|
-
<button id="
|
|
825
|
+
<button id="btnDocPreviewFullscreen" class="btn ghost small doc-preview-fullscreen-toggle" type="button" aria-label="Full screen" title="Full screen" data-i18n-aria-label="docPreviewFullscreen" data-i18n-title="docPreviewFullscreen"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-arrow_maximize-24"></use></svg></button>
|
|
826
|
+
<button id="btnDocPreviewDownload" class="btn ghost small doc-preview-download" type="button" aria-label="Download" data-i18n-aria-label="resourceDownload"><svg class="fluent-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-arrow_download-24"></use></svg></button>
|
|
619
827
|
<button id="btnCloseDocPreview" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="fluent-icon close-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-dismiss-24"></use></svg></button>
|
|
620
828
|
</div>
|
|
621
829
|
</header>
|
|
@@ -672,14 +880,6 @@
|
|
|
672
880
|
</div>
|
|
673
881
|
</dialog>
|
|
674
882
|
|
|
675
|
-
<dialog id="forwardDialog" class="admin-dialog" aria-labelledby="forwardHeading">
|
|
676
|
-
<header class="admin-dialog-head"><h2 id="forwardHeading" data-i18n="forwardTitle">Forward message</h2><div class="admin-dialog-actions"><button id="btnCloseForward" class="reader-close" type="button" aria-label="Close" data-i18n-aria-label="close"><svg class="fluent-icon close-icon" aria-hidden="true" viewBox="0 0 24 24"><use href="/assets/fluent-icons.svg#fluent-dismiss-24"></use></svg></button></div></header>
|
|
677
|
-
<p class="hint" data-i18n="forwardHint">Choose where to forward this message.</p>
|
|
678
|
-
<div id="forwardTargets" class="forward-targets"></div>
|
|
679
|
-
<p id="forwardStatus" class="hint" role="status" aria-live="polite"></p>
|
|
680
|
-
<div class="announcement-actions"><button id="btnCancelForward" class="btn ghost small" type="button" data-i18n="cancel">Cancel</button></div>
|
|
681
|
-
</dialog>
|
|
682
|
-
|
|
683
883
|
<!-- Alt+Space: message search and common commands in one keyboard-first surface. -->
|
|
684
884
|
<dialog id="paletteDialog" class="admin-dialog palette-dialog" aria-labelledby="paletteHeading" aria-describedby="paletteHint">
|
|
685
885
|
<header class="palette-head">
|
|
@@ -727,7 +927,7 @@
|
|
|
727
927
|
<section class="keys-section">
|
|
728
928
|
<h3 data-i18n="shortcutsSearch">Search and commands</h3>
|
|
729
929
|
<ul class="keys-list">
|
|
730
|
-
<li><span class="keys-combo"><kbd class="keys-key shortcut-mod">Alt</kbd><span class="keys-sep">+</span><kbd class="keys-key">Space</kbd></span><span class="keys-sep">/</span><span class="keys-combo"><kbd class="keys-key">Ctrl</kbd><span class="keys-sep">+</span><kbd class="keys-key">P</kbd></span><span data-i18n="shortcutsOpenPalette">Open search and commands</span></li>
|
|
930
|
+
<li><span class="keys-group"><span class="keys-combo"><kbd class="keys-key shortcut-mod">Alt</kbd><span class="keys-sep">+</span><kbd class="keys-key">Space</kbd></span><span class="keys-sep">/</span><span class="keys-combo"><kbd class="keys-key">Ctrl</kbd><span class="keys-sep">+</span><kbd class="keys-key">P</kbd></span></span><span data-i18n="shortcutsOpenPalette">Open search and commands</span></li>
|
|
731
931
|
</ul>
|
|
732
932
|
</section>
|
|
733
933
|
<section class="keys-section">
|
package/server/http-server.ts
CHANGED
|
@@ -1,182 +1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
import { Buffer } from "node:buffer";
|
|
5
|
-
import { Readable } from "node:stream";
|
|
6
|
-
import { pipeline } from "node:stream/promises";
|
|
7
|
-
|
|
8
|
-
export type ServerOptions = {
|
|
9
|
-
hostname: string;
|
|
10
|
-
port: number;
|
|
11
|
-
fetch(request: Request): Response | Promise<Response>;
|
|
12
|
-
maxRequestBodySize?: number;
|
|
13
|
-
idleTimeout?: number;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type StartedServer = {
|
|
17
|
-
port: number;
|
|
18
|
-
close(): Promise<void>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const hopByHop = new Set(["connection", "keep-alive", "proxy-connection", "te", "trailer", "transfer-encoding", "upgrade"]);
|
|
22
|
-
|
|
23
|
-
function requestURL(req: IncomingMessage, hostname: string, port: number): string {
|
|
24
|
-
const path = req.url ?? "/";
|
|
25
|
-
if (/^https?:\/\//i.test(path)) return path;
|
|
26
|
-
const host = req.headers.host ?? (hostname.includes(":") ? `[${hostname}]:${port}` : `${hostname}:${port}`);
|
|
27
|
-
return `http://${host}${path}`;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function requestHeaders(req: IncomingMessage): Headers {
|
|
31
|
-
const headers = new Headers();
|
|
32
|
-
const raw = req.rawHeaders;
|
|
33
|
-
for (let i = 0; i + 1 < raw.length; i += 2) {
|
|
34
|
-
const name = raw[i]!.toLowerCase();
|
|
35
|
-
if (!hopByHop.has(name)) headers.append(name, raw[i + 1]!);
|
|
36
|
-
}
|
|
37
|
-
return headers;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function sendJson(res: ServerResponse, status: number, message: string): void {
|
|
41
|
-
if (res.headersSent || res.destroyed) {
|
|
42
|
-
res.destroy();
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const body = JSON.stringify({ error: message });
|
|
46
|
-
res.writeHead(status, { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(body) });
|
|
47
|
-
res.end(body);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// The response must reach the client before the unread request body is
|
|
51
|
-
// discarded, so destroy only after the 413 has been flushed to the socket.
|
|
52
|
-
function rejectTooLarge(req: IncomingMessage, res: ServerResponse): void {
|
|
53
|
-
res.setHeader("Connection", "close");
|
|
54
|
-
res.once("finish", () => req.destroy());
|
|
55
|
-
sendJson(res, 413, "request body too large");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async function discardBody(response: Response): Promise<void> {
|
|
59
|
-
try { await response.body?.cancel(); } catch { /* A locked or already-consumed body needs no cleanup. */ }
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async function writeResponse(res: ServerResponse, response: Response, method: string): Promise<void> {
|
|
63
|
-
const headers: Record<string, string | string[]> = {};
|
|
64
|
-
response.headers.forEach((value, name) => {
|
|
65
|
-
if (name !== "set-cookie") headers[name] = value;
|
|
66
|
-
});
|
|
67
|
-
const cookies = response.headers.getSetCookie?.() ?? [];
|
|
68
|
-
if (cookies.length) headers["set-cookie"] = cookies;
|
|
69
|
-
res.writeHead(response.status, headers);
|
|
70
|
-
if (method === "HEAD" || response.status === 204 || response.status === 304 || !response.body) {
|
|
71
|
-
await discardBody(response);
|
|
72
|
-
res.end();
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
// pipeline destroys the web stream (and so cancels the source) when the
|
|
76
|
-
// client disconnects, which is the abort propagation we need here.
|
|
77
|
-
await pipeline(Readable.fromWeb(response.body as unknown as import("node:stream/web").ReadableStream), res);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async function serve(
|
|
81
|
-
req: IncomingMessage,
|
|
82
|
-
res: ServerResponse,
|
|
83
|
-
hostname: string,
|
|
84
|
-
port: number,
|
|
85
|
-
handler: ServerOptions["fetch"],
|
|
86
|
-
maxBody: number,
|
|
87
|
-
): Promise<void> {
|
|
88
|
-
const abort = new AbortController();
|
|
89
|
-
const onAborted = () => abort.abort();
|
|
90
|
-
req.once("aborted", onAborted);
|
|
91
|
-
req.once("error", onAborted);
|
|
92
|
-
const method = req.method ?? "GET";
|
|
93
|
-
let tooLarge = false;
|
|
94
|
-
let body: ReadableStream<Uint8Array> | undefined;
|
|
95
|
-
try {
|
|
96
|
-
const declared = Number(req.headers["content-length"]);
|
|
97
|
-
if (Number.isFinite(declared) && declared > maxBody) {
|
|
98
|
-
rejectTooLarge(req, res);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (method !== "GET" && method !== "HEAD") {
|
|
102
|
-
let received = 0;
|
|
103
|
-
body = (Readable.toWeb(req) as unknown as ReadableStream<Uint8Array>).pipeThrough(new TransformStream<Uint8Array, Uint8Array>({
|
|
104
|
-
transform(chunk, controller) {
|
|
105
|
-
received += chunk.byteLength;
|
|
106
|
-
if (received > maxBody) {
|
|
107
|
-
tooLarge = true;
|
|
108
|
-
controller.error(new Error("request body too large"));
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
controller.enqueue(chunk);
|
|
112
|
-
},
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
115
|
-
const request = new Request(requestURL(req, hostname, port), {
|
|
116
|
-
method,
|
|
117
|
-
headers: requestHeaders(req),
|
|
118
|
-
body,
|
|
119
|
-
signal: abort.signal,
|
|
120
|
-
...(body ? { duplex: "half" } : {}),
|
|
121
|
-
} as RequestInit);
|
|
122
|
-
const response = await handler(request);
|
|
123
|
-
if (tooLarge) {
|
|
124
|
-
await discardBody(response);
|
|
125
|
-
rejectTooLarge(req, res);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
await writeResponse(res, response, method);
|
|
129
|
-
} catch {
|
|
130
|
-
if (tooLarge) {
|
|
131
|
-
rejectTooLarge(req, res);
|
|
132
|
-
} else if (!abort.signal.aborted && !res.headersSent) {
|
|
133
|
-
sendJson(res, 500, "internal server error");
|
|
134
|
-
} else if (!res.destroyed) {
|
|
135
|
-
res.destroy();
|
|
136
|
-
}
|
|
137
|
-
} finally {
|
|
138
|
-
req.off("aborted", onAborted);
|
|
139
|
-
req.off("error", onAborted);
|
|
140
|
-
// A handler may answer without reading the request (for example a 401);
|
|
141
|
-
// cancel the stream so the remaining body is not buffered in memory.
|
|
142
|
-
if (body) void body.cancel().catch(() => {});
|
|
143
|
-
else if (!req.readableEnded) req.resume();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export async function startServer(options: ServerOptions): Promise<StartedServer> {
|
|
148
|
-
const maxBody = options.maxRequestBodySize ?? Infinity;
|
|
149
|
-
const server = createServer((req, res) => {
|
|
150
|
-
void serve(req, res, options.hostname, options.port, options.fetch, maxBody);
|
|
151
|
-
});
|
|
152
|
-
// Bun's idleTimeout is socket inactivity, not a total request deadline: a
|
|
153
|
-
// slow upload must not be cut by either Node timer.
|
|
154
|
-
if (options.idleTimeout && options.idleTimeout > 0) server.timeout = options.idleTimeout * 1000;
|
|
155
|
-
server.requestTimeout = 0;
|
|
156
|
-
await new Promise<void>((resolve, reject) => {
|
|
157
|
-
const onError = (error: Error) => reject(error);
|
|
158
|
-
server.once("error", onError);
|
|
159
|
-
server.listen(options.port, options.hostname, () => {
|
|
160
|
-
server.off("error", onError);
|
|
161
|
-
resolve();
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
const address = server.address();
|
|
165
|
-
const port = typeof address === "object" && address ? address.port : options.port;
|
|
166
|
-
let closing: Promise<void> | undefined;
|
|
167
|
-
return {
|
|
168
|
-
port,
|
|
169
|
-
close() {
|
|
170
|
-
closing ??= new Promise<void>((resolve) => {
|
|
171
|
-
if (!server.listening) {
|
|
172
|
-
resolve();
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
server.close(() => resolve());
|
|
176
|
-
server.closeIdleConnections();
|
|
177
|
-
server.closeAllConnections();
|
|
178
|
-
});
|
|
179
|
-
return closing;
|
|
180
|
-
},
|
|
181
|
-
};
|
|
182
|
-
}
|
|
1
|
+
// Compatibility shim: the HTTP adapter lives in src/platform so src code never
|
|
2
|
+
// imports from server/. Existing server-side imports may keep this path.
|
|
3
|
+
export * from "../src/platform/http-server.ts";
|