@mudlet/mudlet-web 0.5.0 → 1.0.1
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/README.md +1 -1
- package/dist-lib/analytics.d.ts +27 -0
- package/dist-lib/assets/fonts/Vera.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraBI.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraBd.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraIt.woff2 +0 -0
- package/dist-lib/assets/mapParser.worker-DrVZ3wg_.js +9 -0
- package/dist-lib/backupImport-wt8r7JXI.js +233 -0
- package/dist-lib/branding.d.ts +111 -13
- package/dist-lib/db/sqliteClient.d.ts +195 -7
- package/dist-lib/hooks/useAutoReconnect.d.ts +61 -0
- package/dist-lib/hooks/useDocumentFullscreen.d.ts +23 -0
- package/dist-lib/hooks/useKeyboardShortcuts.d.ts +37 -0
- package/dist-lib/hooks/useRecordLastPlayed.d.ts +10 -0
- package/dist-lib/import/applyMudletProfile.d.ts +35 -9
- package/dist-lib/import/backupImport.d.ts +118 -0
- package/dist-lib/import/collectProfileExport.d.ts +33 -2
- package/dist-lib/import/defaultPackages.d.ts +57 -14
- package/dist-lib/import/defaults/CF-loader/CF-loader.mpackage +0 -0
- package/dist-lib/import/defaults/MedBootstrap/MedBootstrap.mpackage +0 -0
- package/dist-lib/import/defaults/deleteOldProfiles/deleteOldProfiles.mpackage +0 -0
- package/dist-lib/import/defaults/echo/echo.mpackage +0 -0
- package/dist-lib/import/defaults/enable-accessibility/enable-accessibility.mpackage +0 -0
- package/dist-lib/import/defaults/generic_mapper/generic_mapper.mpackage +0 -0
- package/dist-lib/import/defaults/gui-drop/gui-drop.mpackage +0 -0
- package/dist-lib/import/defaults/icesus-loader/icesus-loader.mpackage +0 -0
- package/dist-lib/import/defaults/mg-loader/mg-loader.mpackage +0 -0
- package/dist-lib/import/defaults/mudlet-base-ui/mudlet-base-ui.mpackage +0 -0
- package/dist-lib/import/defaults/mudlet-mapper.xml +1215 -389
- package/dist-lib/import/mudletControlChars.d.ts +14 -0
- package/dist-lib/import/mudletHost.d.ts +73 -10
- package/dist-lib/import/mudletLink.d.ts +53 -2
- package/dist-lib/import/mudletProfileExport.d.ts +38 -5
- package/dist-lib/import/mudletProfileImport.d.ts +110 -12
- package/dist-lib/import/mudletVariables.d.ts +4 -3
- package/dist-lib/import/mudletWriteback.d.ts +15 -1
- package/dist-lib/import/mudletXmlImport.d.ts +46 -0
- package/dist-lib/import/packageFonts.d.ts +33 -0
- package/dist-lib/import/packageInstaller.d.ts +111 -7
- package/dist-lib/import/qtProfileData.d.ts +10 -0
- package/dist-lib/import/remotePackageInstall.d.ts +23 -7
- package/dist-lib/import/zipEntries.d.ts +45 -0
- package/dist-lib/index.d.ts +7 -3
- package/dist-lib/index.js +50508 -29836
- package/dist-lib/logging/SessionLogger.d.ts +75 -15
- package/dist-lib/map/MapSelectionOverlay.d.ts +2 -2
- package/dist-lib/map/MapStore.d.ts +387 -60
- package/dist-lib/map/MudletHighlightOverlay.d.ts +2 -2
- package/dist-lib/map/{MudixMapReader.d.ts → MudletMapReader.d.ts} +2 -2
- package/dist-lib/map/areaGraph.d.ts +120 -0
- package/dist-lib/map/environmentKit.d.ts +36 -0
- package/dist-lib/map/labelPixmap.d.ts +90 -0
- package/dist-lib/map/mapImageExport.d.ts +36 -2
- package/dist-lib/map/mapStyle.d.ts +11 -0
- package/dist-lib/map/mapVersion.d.ts +66 -0
- package/dist-lib/map/pathfinding.d.ts +2 -2
- package/dist-lib/mud/CharLoginController.d.ts +230 -0
- package/dist-lib/mud/ItemIdSequence.d.ts +1 -1
- package/dist-lib/mud/MudSession.d.ts +279 -22
- package/dist-lib/mud/PatternEngine.d.ts +153 -14
- package/dist-lib/mud/aliases/AliasEngine.d.ts +55 -9
- package/dist-lib/mud/autoLogin.d.ts +59 -0
- package/dist-lib/mud/commandSplit.d.ts +9 -0
- package/dist-lib/mud/connection/LineAssembler.d.ts +38 -11
- package/dist-lib/mud/connection/MudClient.d.ts +291 -53
- package/dist-lib/mud/connection/SubnegotiationRepair.d.ts +24 -0
- package/dist-lib/mud/connection/TelnetNegotiator.d.ts +208 -68
- package/dist-lib/mud/connection/telnetDebug.d.ts +8 -8
- package/dist-lib/mud/events.d.ts +102 -23
- package/dist-lib/mud/games/bundledGames.d.ts +12 -7
- package/dist-lib/mud/games/gameLinks.d.ts +40 -0
- package/dist-lib/mud/games/icons/3Kingdoms.png +0 -0
- package/dist-lib/mud/games/icons/3Scapes.png +0 -0
- package/dist-lib/mud/games/icons/achaea.png +0 -0
- package/dist-lib/mud/games/icons/aetolia.png +0 -0
- package/dist-lib/mud/games/icons/banner_astaria.png +0 -0
- package/dist-lib/mud/games/icons/banner_darkmists.png +0 -0
- package/dist-lib/mud/games/icons/banner_dreamland.png +0 -0
- package/dist-lib/mud/games/icons/banner_petria.jpg +0 -0
- package/dist-lib/mud/games/icons/banner_ropmud.png +0 -0
- package/dist-lib/mud/games/icons/blackmud.png +0 -0
- package/dist-lib/mud/games/icons/carrionfields.png +0 -0
- package/dist-lib/mud/games/icons/dragonfire_icon.png +0 -0
- package/dist-lib/mud/games/icons/fed2-logo.png +0 -0
- package/dist-lib/mud/games/icons/icesus_480x120.png +0 -0
- package/dist-lib/mud/games/icons/imperian.png +0 -0
- package/dist-lib/mud/games/icons/infinity_480x120.png +0 -0
- package/dist-lib/mud/games/icons/lusternia.png +0 -0
- package/dist-lib/mud/games/icons/morgengrauen_480x120.png +0 -0
- package/dist-lib/mud/games/icons/mudlet-tutorial.png +0 -0
- package/dist-lib/mud/games/icons/phoenixmud_480x120.png +0 -0
- package/dist-lib/mud/games/icons/starmourn.png +0 -0
- package/dist-lib/mud/games/icons/voidmud_icon.png +0 -0
- package/dist-lib/mud/games/icons/wotmudicon.png +0 -0
- package/dist-lib/mud/games/websiteLinks.d.ts +21 -0
- package/dist-lib/mud/keybindings/KeyEngine.d.ts +110 -4
- package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +2 -2
- package/dist-lib/mud/keybindings/keyEventTarget.d.ts +61 -0
- package/dist-lib/mud/keybindings/qtKeys.d.ts +91 -12
- package/dist-lib/mud/protocol/atcp.d.ts +19 -0
- package/dist-lib/mud/protocol/byteString.d.ts +24 -0
- package/dist-lib/mud/protocol/charLoginFlow.d.ts +243 -16
- package/dist-lib/mud/protocol/charset.d.ts +111 -46
- package/dist-lib/mud/protocol/codePages.d.ts +10 -0
- package/dist-lib/mud/protocol/constants.d.ts +17 -10
- package/dist-lib/mud/protocol/echo.d.ts +23 -27
- package/dist-lib/mud/protocol/gmcp.d.ts +36 -6
- package/dist-lib/mud/protocol/index.d.ts +3 -2
- package/dist-lib/mud/protocol/luaLiteral.d.ts +12 -0
- package/dist-lib/mud/protocol/mccp.d.ts +83 -1
- package/dist-lib/mud/protocol/mnes.d.ts +41 -58
- package/dist-lib/mud/protocol/msdp.d.ts +11 -4
- package/dist-lib/mud/protocol/msp.d.ts +3 -2
- package/dist-lib/mud/protocol/mssp.d.ts +9 -4
- package/dist-lib/mud/protocol/multiByte.d.ts +51 -0
- package/dist-lib/mud/protocol/multiByteEncode.d.ts +42 -0
- package/dist-lib/mud/protocol/mxp.d.ts +193 -14
- package/dist-lib/mud/protocol/oauthClientFlow.d.ts +128 -0
- package/dist-lib/mud/protocol/qtCodePages.generated.d.ts +1 -0
- package/dist-lib/mud/protocol/tlsCodes.d.ts +40 -3
- package/dist-lib/mud/replay/ReplayPlayer.d.ts +16 -1
- package/dist-lib/mud/replay/replayFormat.d.ts +29 -2
- package/dist-lib/mud/text/Console.d.ts +255 -49
- package/dist-lib/mud/text/FormatState.d.ts +137 -14
- package/dist-lib/mud/text/ansiEscapes.d.ts +32 -16
- package/dist-lib/mud/text/colorParsers.d.ts +14 -2
- package/dist-lib/mud/text/colorSpaceId.d.ts +2 -0
- package/dist-lib/mud/text/colors.d.ts +17 -10
- package/dist-lib/mud/text/controlCharacterMode.d.ts +1 -1
- package/dist-lib/mud/text/hyperlinkVisibility.d.ts +1 -1
- package/dist-lib/mud/text/lineBreak.d.ts +5 -0
- package/dist-lib/mud/text/serverWrap.d.ts +2 -2
- package/dist-lib/mud/text/textAnalyzer.d.ts +79 -0
- package/dist-lib/mud/text/unicodeRuns.d.ts +11 -0
- package/dist-lib/mud/text/unicodeTables.generated.d.ts +3 -0
- package/dist-lib/mud/text/wcwidth.d.ts +27 -22
- package/dist-lib/mud/timers/TimerEngine.d.ts +163 -11
- package/dist-lib/mud/timers/workerClock.d.ts +67 -0
- package/dist-lib/mud/triggers/TriggerEngine.d.ts +449 -47
- package/dist-lib/mud/triggers/legacyColorPatterns.d.ts +58 -0
- package/dist-lib/mud/triggers/pcre/Pcre2.d.ts +83 -1
- package/dist-lib/oauth-callback.html +94 -0
- package/dist-lib/pcre2Wasm.d.ts +54 -0
- package/dist-lib/pcre2Wasm.js +241 -0
- package/dist-lib/scripting/EngineHost.d.ts +45 -21
- package/dist-lib/scripting/IScriptingRuntime.d.ts +103 -27
- package/dist-lib/scripting/MxpFrameManager.d.ts +10 -1
- package/dist-lib/scripting/ScriptingAPI.d.ts +1030 -213
- package/dist-lib/scripting/ScriptingEngine.d.ts +727 -106
- package/dist-lib/scripting/StopwatchManager.d.ts +97 -36
- package/dist-lib/scripting/http/HttpService.d.ts +9 -1
- package/dist-lib/scripting/http/userUrl.d.ts +41 -0
- package/dist-lib/scripting/lua/LuaRuntime.d.ts +352 -77
- package/dist-lib/scripting/lua/argContracts.d.ts +71 -0
- package/dist-lib/scripting/lua/bindings/automation.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/commands.d.ts +13 -0
- package/dist-lib/scripting/lua/bindings/context.d.ts +20 -2
- package/dist-lib/scripting/lua/bindings/diagnostics.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/map.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/media.d.ts +2 -2
- package/dist-lib/scripting/lua/bindings/output.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/session.d.ts +2 -2
- package/dist-lib/scripting/lua/bindings/textEdit.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/userWindows.d.ts +1 -1
- package/dist-lib/scripting/lua/byteArmor.d.ts +36 -0
- package/dist-lib/scripting/lua/imageSize.d.ts +7 -0
- package/dist-lib/scripting/lua/rex.d.ts +4 -2
- package/dist-lib/scripting/lua/sqlRowEncoder.d.ts +6 -1
- package/dist-lib/scripting/lua/utf8CaseMap.d.ts +1 -0
- package/dist-lib/scripting/lua/utf8Patterns.d.ts +21 -1
- package/dist-lib/scripting/lua/wellFormedStrings.d.ts +40 -0
- package/dist-lib/scripting/lua/yajl.d.ts +43 -5
- package/dist-lib/scripting/profilesPresence.d.ts +20 -2
- package/dist-lib/scripting/vfs/ProfileVFS.d.ts +164 -10
- package/dist-lib/scripting/vfs/fsErrors.d.ts +28 -0
- package/dist-lib/scripting/vfs/idbCommit.d.ts +20 -0
- package/dist-lib/storage/appStore.d.ts +24 -9
- package/dist-lib/storage/hooks.d.ts +5 -1
- package/dist-lib/storage/index.d.ts +2 -2
- package/dist-lib/storage/mapStorage.d.ts +2 -0
- package/dist-lib/storage/persistentStorage.d.ts +3 -1
- package/dist-lib/storage/profileStorage.d.ts +15 -0
- package/dist-lib/storage/profileVfsData.d.ts +3 -3
- package/dist-lib/storage/schema.d.ts +512 -40
- package/dist-lib/storage/storageMigration.d.ts +82 -0
- package/dist-lib/storage-g5V1b-c1.js +2039 -0
- package/dist-lib/styles.css +1 -1
- package/dist-lib/ui/AboutModal.d.ts +1 -1
- package/dist-lib/ui/BrandLoginFields.d.ts +1 -1
- package/dist-lib/ui/BrowserSignInModal.d.ts +23 -0
- package/dist-lib/ui/CmdLineMenuRegistry.d.ts +14 -5
- package/dist-lib/ui/CommandBar.d.ts +8 -8
- package/dist-lib/ui/ConnectionFormModal.d.ts +20 -1
- package/dist-lib/ui/ConnectionScreen.d.ts +9 -1
- package/dist-lib/ui/GameLinkPrompt.d.ts +28 -0
- package/dist-lib/ui/HelpModal.d.ts +5 -1
- package/dist-lib/ui/MapSymbolUsageModal.d.ts +32 -0
- package/dist-lib/ui/MouseEventRegistry.d.ts +31 -4
- package/dist-lib/ui/NotepadModal.d.ts +22 -0
- package/dist-lib/ui/ResizableModal.d.ts +16 -1
- package/dist-lib/ui/SettingsModal.d.ts +10 -1
- package/dist-lib/ui/TlsAlertBanner.d.ts +3 -1
- package/dist-lib/ui/Toolbar.d.ts +22 -1
- package/dist-lib/ui/VaultManageButton.d.ts +10 -5
- package/dist-lib/ui/VaultModal.d.ts +3 -0
- package/dist-lib/ui/buttons/ButtonsBar.d.ts +3 -1
- package/dist-lib/ui/buttons/inactiveButtons.d.ts +25 -0
- package/dist-lib/ui/cmdline/CommandLineManager.d.ts +19 -0
- package/dist-lib/ui/cmdline/plainText.d.ts +16 -0
- package/dist-lib/ui/cmdline/subCommandLine.d.ts +78 -0
- package/dist-lib/ui/cmdline/useCmdLineSelection.d.ts +26 -0
- package/dist-lib/ui/cmdline/useSubCommandLineKeys.d.ts +33 -0
- package/dist-lib/ui/codemirror/lineParagraphMarks.d.ts +19 -0
- package/dist-lib/ui/codemirror/luaHover.d.ts +7 -0
- package/dist-lib/ui/codemirror/options.d.ts +33 -0
- package/dist-lib/ui/codemirror/theme.d.ts +29 -5
- package/dist-lib/ui/commands/addonCommands.d.ts +134 -0
- package/dist-lib/ui/commands/appShortcuts.d.ts +86 -0
- package/dist-lib/ui/commands/hostCommands.d.ts +88 -0
- package/dist-lib/ui/commands/keyMatch.d.ts +20 -0
- package/dist-lib/ui/commands/keySequence.d.ts +57 -0
- package/dist-lib/ui/components/ContextMenu.d.ts +21 -1
- package/dist-lib/ui/components/FontPicker.d.ts +5 -1
- package/dist-lib/ui/components/useModalFocus.d.ts +13 -1
- package/dist-lib/ui/helpTopics.d.ts +15 -0
- package/dist-lib/ui/labels/LabelManager.d.ts +172 -9
- package/dist-lib/ui/labels/LabelOverlay.d.ts +19 -0
- package/dist-lib/ui/labels/backgroundImageSize.d.ts +19 -0
- package/dist-lib/ui/labels/labelModel.d.ts +64 -0
- package/dist-lib/ui/labels/qColor.d.ts +13 -0
- package/dist-lib/ui/labels/qtCss.d.ts +12 -4
- package/dist-lib/ui/landmarks.d.ts +9 -0
- package/dist-lib/ui/launcher/ActionMenu.d.ts +19 -0
- package/dist-lib/ui/launcher/GameDetails.d.ts +21 -0
- package/dist-lib/ui/launcher/GameSection.d.ts +18 -0
- package/dist-lib/ui/launcher/LauncherSearch.d.ts +23 -0
- package/dist-lib/ui/launcher/ProfileArt.d.ts +20 -0
- package/dist-lib/ui/launcher/ProfileSection.d.ts +43 -0
- package/dist-lib/ui/launcher/launcherModel.d.ts +72 -0
- package/dist-lib/ui/layout/overlayLayerOrder.d.ts +2 -2
- package/dist-lib/ui/menu/MenuBar.d.ts +31 -0
- package/dist-lib/ui/menu/SplitButton.d.ts +39 -0
- package/dist-lib/ui/menu/anchoredPopup.d.ts +74 -0
- package/dist-lib/ui/menu/appMenus.d.ts +65 -0
- package/dist-lib/ui/menu/menuModel.d.ts +88 -0
- package/dist-lib/ui/menu/toolbarModel.d.ts +56 -0
- package/dist-lib/ui/notepad.d.ts +76 -0
- package/dist-lib/ui/openSignInPage.d.ts +14 -0
- package/dist-lib/ui/output/OutputContextMenu.d.ts +14 -1
- package/dist-lib/ui/output/OutputRenderer.d.ts +5 -0
- package/dist-lib/ui/output/OutputSearchBar.d.ts +5 -1
- package/dist-lib/ui/output/StickyOutputPanel.d.ts +17 -3
- package/dist-lib/ui/output/TextAnalyzerModal.d.ts +25 -0
- package/dist-lib/ui/output/caretMode.d.ts +3 -2
- package/dist-lib/ui/output/clearSplit.d.ts +11 -0
- package/dist-lib/ui/output/outputCopy.d.ts +41 -2
- package/dist-lib/ui/output/outputRows.d.ts +43 -0
- package/dist-lib/ui/output/selectionGesture.d.ts +35 -0
- package/dist-lib/ui/output/wordSelection.d.ts +33 -0
- package/dist-lib/ui/search/matcher.d.ts +14 -4
- package/dist-lib/ui/settings/SettingsShell.d.ts +91 -0
- package/dist-lib/ui/settings/ShortcutEditor.d.ts +13 -0
- package/dist-lib/ui/sound/SoundManager.d.ts +210 -44
- package/dist-lib/ui/sound/closedCaption.d.ts +4 -1
- package/dist-lib/ui/sound/mediaDirection.d.ts +35 -0
- package/dist-lib/ui/tabCompletion.d.ts +53 -0
- package/dist-lib/ui/textedit/TextEditManager.d.ts +11 -2
- package/dist-lib/ui/useOpenProfiles.d.ts +1 -1
- package/dist-lib/ui/video/VideoManager.d.ts +7 -0
- package/dist-lib/ui/windows/WindowManager.d.ts +452 -37
- package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +14 -0
- package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +6 -1
- package/dist-lib/ui/windows/panels/TextPanel.d.ts +4 -1
- package/dist-lib/ui/windows/panels/VariablesView.d.ts +37 -7
- package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +4 -2
- package/dist-lib/ui/windows/panels/aliasLoop.d.ts +24 -0
- package/dist-lib/ui/windows/panels/editorClipboard.d.ts +45 -0
- package/dist-lib/ui/windows/panels/editorUndo.d.ts +79 -0
- package/dist-lib/ui/windows/panels/mapAreaChange.d.ts +10 -0
- package/dist-lib/utils/appShellCache.d.ts +25 -0
- package/dist-lib/utils/fontFamilyName.d.ts +13 -0
- package/dist-lib/utils/fontLoader.d.ts +31 -0
- package/dist-lib/utils/formatBytes.d.ts +4 -0
- package/dist-lib/utils/mustBeOneOf.d.ts +9 -0
- package/dist-lib/utils/profileLock.d.ts +1 -1
- package/dist-lib/utils/systemTheme.d.ts +24 -0
- package/dist-lib/utils/timeZone.d.ts +10 -0
- package/dist-lib/vault/CredentialVault.d.ts +51 -5
- package/dist-lib/vault/deviceUnlock.d.ts +47 -0
- package/dist-lib/vault/vaultAccess.d.ts +24 -2
- package/dist-lib/vault/vaultHelpTopic.d.ts +9 -0
- package/dist-lib/vault/vaultRecord.d.ts +33 -1
- package/dist-lib/vfs-sw.js +220 -11
- package/dist-lib/vite.d.ts +1 -1
- package/dist-lib/vite.js +66 -43
- package/package.json +23 -15
- package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +0 -9
- package/dist-lib/mud/connection/PingTracker.d.ts +0 -41
- package/dist-lib/ui/BundledGameGrid.d.ts +0 -21
- package/dist-lib/ui/ConnectionGrid.d.ts +0 -21
- package/dist-lib/ui/bufferWords.d.ts +0 -38
|
@@ -7,26 +7,33 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* Map a wire-format charset name (case-insensitive, with various dash/underscore
|
|
10
|
-
* spellings) onto
|
|
11
|
-
*
|
|
12
|
-
* the browser TextDecoder API and would need a polyfill not worth shipping.
|
|
10
|
+
* spellings) onto the label Mudlet Web decodes it with, or null when it is not an
|
|
11
|
+
* encoding this client speaks.
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* The label is not always an IANA one, because not every encoding here is the
|
|
14
|
+
* browser's to decode. Three kinds come out:
|
|
15
|
+
*
|
|
16
|
+
* - a lowercase TextDecoder label (`utf-8`, `iso-8859-2`, `windows-1250`,
|
|
17
|
+
* `gbk`) for the encodings the browser knows;
|
|
18
|
+
* - an uppercase code-page name (`CP437`, `MEDIEVIA`) for the ones it does not,
|
|
19
|
+
* which are decoded from the tables in codePages.ts;
|
|
20
|
+
* - `ascii`, which is neither — it is a decoder of its own, since the browser
|
|
21
|
+
* reads that label as windows-1252.
|
|
22
|
+
*
|
|
23
|
+
* Downstream tells them apart by the label, so the casing carries meaning.
|
|
17
24
|
*/
|
|
18
25
|
export declare function normalizeCharsetName(raw: string): string | null;
|
|
19
|
-
/** Wire-format names of every charset mudix can decode, surfaced to Lua scripts
|
|
20
|
-
* via `getServerEncodingsList()`. Every entry round-trips through
|
|
21
|
-
* {@link normalizeCharsetName}, so any name here is a valid `setServerEncoding`
|
|
22
|
-
* argument. ("ASCII" maps to the UTF-8 decoder, which handles it byte-for-byte.) */
|
|
23
26
|
/** What `getServerEncoding()` reports before anything has changed it. UTF-8
|
|
24
|
-
* rather than Mudlet's ASCII:
|
|
25
|
-
*
|
|
27
|
+
* rather than Mudlet's ASCII: a browser stream is far more likely to be UTF-8
|
|
28
|
+
* than not, and ASCII text reads identically either way. */
|
|
26
29
|
export declare const DEFAULT_SERVER_ENCODING = "UTF-8";
|
|
27
30
|
export declare const SUPPORTED_SERVER_ENCODINGS: readonly string[];
|
|
31
|
+
/** A profile's saved `serverEncoding`, with any name only an older Mudlet Web
|
|
32
|
+
* wrote brought up to the one it meant. */
|
|
33
|
+
export declare function savedServerEncoding(saved: string): string;
|
|
34
|
+
export declare function savedServerEncoding(saved: string | undefined): string | undefined;
|
|
28
35
|
/** The {@link SUPPORTED_SERVER_ENCODINGS} entry a caller's spelling means, or
|
|
29
|
-
* null when
|
|
36
|
+
* null when Mudlet Web cannot decode it. Dash/space/case differences are all the
|
|
30
37
|
* same encoding — the profile XML, the wire, and Mudlet's own list disagree
|
|
31
38
|
* about which to use — so the answer is always the list's own spelling and
|
|
32
39
|
* `getServerEncoding()` reports one canonical name whatever was set. */
|
|
@@ -36,65 +43,129 @@ export declare function canonicalServerEncoding(raw: string): string | null;
|
|
|
36
43
|
* `serverEncoding` — Mudlet's TEncodingHelper::canEncode, which is what decides
|
|
37
44
|
* whether a send gets the "unlikely to understand it" warning.
|
|
38
45
|
*
|
|
39
|
-
* Anything
|
|
46
|
+
* Anything Mudlet Web cannot judge (an unknown label) is called encodable: the point
|
|
40
47
|
* is to warn about a loss that will certainly happen, not to guess.
|
|
41
48
|
*/
|
|
42
49
|
export declare function canEncodeForServer(text: string, serverEncoding: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Decode a byte-string that is already in the game's encoding into text, the
|
|
52
|
+
* way the inbound stream would have decoded it. This is the one-shot form of
|
|
53
|
+
* {@link SessionCodec.decode} for callers holding a complete payload rather
|
|
54
|
+
* than a socket frame — `feedTriggers(data, false)`, where the caller says the
|
|
55
|
+
* bytes are pre-encoded and Mudlet must pass them through untouched rather than
|
|
56
|
+
* reading them as UTF-8.
|
|
57
|
+
*
|
|
58
|
+
* An encoding Mudlet Web cannot name falls back to UTF-8, which is what the session
|
|
59
|
+
* starts on; a label the browser refuses hands the bytes back unchanged rather
|
|
60
|
+
* than losing them.
|
|
61
|
+
*/
|
|
62
|
+
export declare function decodeForServer(byteString: string, serverEncoding: string): string;
|
|
43
63
|
/**
|
|
44
64
|
* Parse an `IAC SB CHARSET REQUEST ...` subnegotiation body (leading byte is
|
|
45
|
-
* the option code 42, then subcommand byte 1, then
|
|
46
|
-
*
|
|
47
|
-
* the
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* name is
|
|
65
|
+
* the option code 42, then subcommand byte 1, then a separator byte, then
|
|
66
|
+
* separator-delimited IANA names). Returns
|
|
67
|
+
* the one to switch to with both the original wire spelling (echoed back in
|
|
68
|
+
* the ACCEPTED reply per RFC 2066) and this client's canonical name for it,
|
|
69
|
+
* which is what `getServerEncoding()` then reports. Returns null if no offered
|
|
70
|
+
* name is one we can decode.
|
|
51
71
|
*/
|
|
52
|
-
export declare function pickCharsetFromRequest(subneg: string): {
|
|
72
|
+
export declare function pickCharsetFromRequest(subneg: string, current?: string): {
|
|
53
73
|
original: string;
|
|
54
|
-
|
|
74
|
+
canonical: string;
|
|
55
75
|
} | null;
|
|
56
76
|
/**
|
|
57
|
-
* The session's byte→char codec. Owns the streaming inbound
|
|
58
|
-
*
|
|
77
|
+
* The session's byte→char codec. Owns the streaming inbound decoder (holding
|
|
78
|
+
* trailing partial multi-byte chars across WebSocket frames) and the
|
|
59
79
|
* matching outgoing encoding. Starts at UTF-8 — correct for ASCII and modern
|
|
60
80
|
* MUDs — and switches when a CHARSET exchange (or an explicit
|
|
61
81
|
* `setServerEncoding`) agrees on something else.
|
|
62
82
|
*/
|
|
63
83
|
export declare class SessionCodec {
|
|
84
|
+
/** The browser's decoder, for a label none of the paths below covers.
|
|
85
|
+
* Null for UTF-8, which is decoded by TBuffer's rule (decodeUtf8Stream). */
|
|
64
86
|
private decoder;
|
|
87
|
+
/** Set instead of {@link decoder} while a single-byte encoding is in use. */
|
|
88
|
+
private table;
|
|
89
|
+
/** Set instead of both while an encoding Mudlet Web frames itself is in use. */
|
|
90
|
+
private framed;
|
|
91
|
+
/** Bytes of a UTF-8 or framed sequence cut short by the end of a frame,
|
|
92
|
+
* waiting for the rest of it. */
|
|
93
|
+
private pendingBytes;
|
|
65
94
|
private currentEncoding;
|
|
95
|
+
/** The encoder for outgoing text while a multi-byte encoding is in use. */
|
|
96
|
+
private outgoingMultiByte;
|
|
97
|
+
/** What the next decode starts with: the replacement mark for a sequence
|
|
98
|
+
* an encoding change cut short (see {@link trySetEncoding}). */
|
|
99
|
+
private owed;
|
|
100
|
+
/** Called just before the encoding actually changes, while the old one is
|
|
101
|
+
* still in place — cTelnet's postHeldDataBeforeEncodingChange, which
|
|
102
|
+
* posts the text ahead of the change in the same read under the encoding
|
|
103
|
+
* it was sent in. */
|
|
104
|
+
onBeforeEncodingChange: (() => void) | null;
|
|
66
105
|
/** The IANA name of the decoder currently applied to the inbound stream. */
|
|
67
106
|
get encoding(): string;
|
|
68
107
|
/** Back to the UTF-8 baseline with a fresh decoder (call on connect). */
|
|
69
108
|
reset(): void;
|
|
109
|
+
/** About to decode with `encoding`. When that is a change, the text ahead
|
|
110
|
+
* of it is posted first, and the bytes of a sequence still waiting for
|
|
111
|
+
* the rest of it are dropped for one replacement mark at the head of the
|
|
112
|
+
* next text: they were sent in the old encoding and cannot be paired with
|
|
113
|
+
* a byte read in the new one (TBuffer::translateToPlainText, on seeing
|
|
114
|
+
* the encoding differ). A colour change held behind a lead byte is not
|
|
115
|
+
* part of the character and is kept. */
|
|
116
|
+
private beforeSwitch;
|
|
70
117
|
/** Swap the streaming decoder to a new encoding label (an IANA name the
|
|
71
|
-
* TextDecoder constructor accepts: 'utf-8', 'iso-8859-2', ...).
|
|
72
|
-
* multi-byte sequence buffered
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
|
|
118
|
+
* TextDecoder constructor accepts: 'utf-8', 'iso-8859-2', ...). A partial
|
|
119
|
+
* multi-byte sequence buffered under the previous encoding becomes one
|
|
120
|
+
* replacement mark (see {@link beforeSwitch}). Returns false (leaving the
|
|
121
|
+
* current decoder untouched) when the browser refuses the label. `name` is the encoding's own name where it
|
|
122
|
+
* says more than the label does — BIG5-HKSCS, which decodes as big5 but
|
|
123
|
+
* encodes differently. */
|
|
124
|
+
trySetEncoding(encoding: string, name?: string): boolean;
|
|
77
125
|
/** Converts a Latin-1 byte-string into decoded text under the current
|
|
78
126
|
* encoding, buffering any trailing partial multi-byte sequence for the
|
|
79
|
-
* next frame
|
|
80
|
-
|
|
127
|
+
* next frame — unless `final`, for text that ends a prompt: Mudlet's
|
|
128
|
+
* cTelnet::gotPrompt ends a prompt with a byte of its own, which cannot
|
|
129
|
+
* continue a sequence either, so a sequence the prompt cut short earns its
|
|
130
|
+
* replacement mark there and the next line starts afresh. */
|
|
131
|
+
decode(byteString: string, final?: boolean): string;
|
|
132
|
+
private decodeStream;
|
|
133
|
+
/** Decode an out-of-band body (an MSSP or MSDP subnegotiation payload)
|
|
134
|
+
* under the current encoding. Separate from {@link decode} because that
|
|
135
|
+
* one streams: it holds a trailing partial sequence back for the next
|
|
136
|
+
* frame, and a subnegotiation is a whole message that must neither leave
|
|
137
|
+
* bytes behind in the display path nor take any from it. Mudlet decodes
|
|
138
|
+
* these through the same encoding tables (`decodeBytes`), which is what
|
|
139
|
+
* makes an MSSP value readable on a game running CP437. Under ASCII, which
|
|
140
|
+
* Mudlet holds as no encoding at all, it reads them as UTF-8 instead
|
|
141
|
+
* (cTelnet::setMSSPVariables' "though this can handle Utf-8" branch), so a
|
|
142
|
+
* game that sends UTF-8 there anyway still gets its text through. */
|
|
143
|
+
decodeOutOfBand(byteString: string): string;
|
|
144
|
+
/** Encode an out-of-band value (`sendMSDP`'s names and values) under the
|
|
145
|
+
* current encoding — the outgoing half of {@link decodeOutOfBand}, and like
|
|
146
|
+
* it UTF-8 under ASCII. Desktop encodes these through the game's encoding
|
|
147
|
+
* as it does a `send`, so a GBK game gets GBK bytes rather than UTF-8. */
|
|
148
|
+
encodeOutOfBand(text: string): string;
|
|
81
149
|
/** Convert a user-typed JS string (UTF-16) into the Latin-1 byte-string the
|
|
82
150
|
* socket layer expects, using the currently negotiated outgoing encoding.
|
|
83
|
-
* UTF-8 goes through TextEncoder so multi-byte chars survive;
|
|
84
|
-
*
|
|
85
|
-
*
|
|
151
|
+
* UTF-8 goes through TextEncoder so multi-byte chars survive; the East
|
|
152
|
+
* Asian multi-byte encodings go through the tables in multiByteEncode.ts;
|
|
153
|
+
* every other encoding here is single-byte and goes through the inverted
|
|
154
|
+
* decode table, which puts the codepage's own byte on the wire. (A plain `& 0xff`
|
|
86
155
|
* truncation used to stand in for that, and was right only for the
|
|
87
156
|
* Latin-1 range — every Polish, Cyrillic, or Greek character above it went
|
|
88
157
|
* out as a byte meaning something else entirely.) A character the codepage
|
|
89
|
-
* has no byte for becomes
|
|
90
|
-
* warns before it comes to that. */
|
|
158
|
+
* has no byte for becomes what desktop writes for one ({@link substitute})
|
|
159
|
+
* — and the send path warns before it comes to that. */
|
|
91
160
|
encodeOutgoing(text: string): string;
|
|
92
161
|
}
|
|
93
162
|
export interface CharsetHandlerHooks {
|
|
94
163
|
sendRaw(data: string): void;
|
|
95
164
|
/** Fired when an encoding switch takes effect. The argument is the
|
|
96
|
-
* wire-spelling name (e.g. "UTF-8") so listeners can surface it
|
|
97
|
-
|
|
165
|
+
* wire-spelling name (e.g. "UTF-8") so listeners can surface it;
|
|
166
|
+
* `acceptedRequest` says the switch is this client ACCEPTing a server's
|
|
167
|
+
* REQUEST rather than anything else. */
|
|
168
|
+
onNegotiated(displayName: string, acceptedRequest: boolean): void;
|
|
98
169
|
}
|
|
99
170
|
/**
|
|
100
171
|
* Drives the CHARSET REQUEST/ACCEPTED/REJECTED exchange against a
|
|
@@ -107,17 +178,11 @@ export declare class CharsetHandler {
|
|
|
107
178
|
private readonly enabled;
|
|
108
179
|
private readonly hooks;
|
|
109
180
|
constructor(codec: SessionCodec, enabled: boolean, hooks: CharsetHandlerHooks);
|
|
110
|
-
/** Send `IAC SB CHARSET REQUEST ;UTF-8;ISO-8859-2;ISO-8859-1 IAC SE` —
|
|
111
|
-
* advertising the encodings we can decode, in preference order. Each name
|
|
112
|
-
* is prefixed by the separator (`;`) per RFC 2066 (the separator comes
|
|
113
|
-
* before each charset, not between them). The server replies ACCEPTED
|
|
114
|
-
* <name> or REJECTED; handleSubneg() processes either. */
|
|
115
|
-
sendRequest(): void;
|
|
116
181
|
/** Route an `IAC SB CHARSET ... IAC SE` subnegotiation body (leading byte
|
|
117
182
|
* is the option code, 42). Handles REQUEST (server lists charsets, we
|
|
118
183
|
* ACCEPT one or REJECT), ACCEPTED (server picked one of ours — switch
|
|
119
184
|
* codec), and REJECTED (server didn't like any of ours — stay put).
|
|
120
|
-
* TTABLE
|
|
185
|
+
* TTABLE-IS (a translation table) gets TTABLE-REJECTED, as in Mudlet. */
|
|
121
186
|
handleSubneg(subneg: string): void;
|
|
122
187
|
/** Mudlet `setServerEncoding(name)`. Switch the inbound decoder to `name`
|
|
123
188
|
* (any value from getServerEncodingsList()). Returns false — leaving the
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 0x80-0xFF half of `name` as characters, or null when it is not one of the
|
|
3
|
+
* pages carried here. Names are matched exactly as {@link CODE_PAGES} spells
|
|
4
|
+
* them (upper case), or as the decoder labels {@link QT_CODE_PAGES} is keyed by
|
|
5
|
+
* (lower case) for the pages desktop reads through Qt rather than its own
|
|
6
|
+
* tables — every other single-byte encoding Mudlet Web speaks.
|
|
7
|
+
*/
|
|
8
|
+
export declare function codePageUpperHalf(name: string): readonly string[] | null;
|
|
9
|
+
/** Every code page this module carries, in the spelling Mudlet uses. */
|
|
10
|
+
export declare const VENDORED_CODE_PAGES: readonly string[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const TELNET_OPTION_REGEX: RegExp;
|
|
2
|
-
export declare const TELNET_OPTION_REGEX_NO_SB: RegExp;
|
|
3
2
|
export declare const TELNET_GA = "\u00FF\u00F9";
|
|
4
3
|
export declare const TELNET_EOR = "\u00FF\u00EF";
|
|
5
4
|
export declare const TELOPT_EOR = "\u0019";
|
|
@@ -84,23 +83,29 @@ export declare const MTTS_MNES = 512;
|
|
|
84
83
|
export declare const MTTS_MSLP = 1024;
|
|
85
84
|
export declare const MTTS_SSL = 2048;
|
|
86
85
|
/** Live capabilities that toggle the dynamic MTTS bits. The static bits (ANSI,
|
|
87
|
-
* 256 colours, OSC colour palette, truecolour) are always on. */
|
|
86
|
+
* 256 colours, OSC colour palette, truecolour, SSL) are always on. */
|
|
88
87
|
export interface MttsCapabilities {
|
|
89
88
|
/** UTF-8 is the active encoding (sets the UTF-8 bit). */
|
|
90
89
|
utf8?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
|
|
93
|
-
/** MNES is negotiated (sets the MNES bit). */
|
|
90
|
+
/** MNES is on — Mudlet sets the bit when the profile has both MNES and
|
|
91
|
+
* NEW-ENVIRON enabled, negotiated or not (sets the MNES bit). */
|
|
94
92
|
mnes?: boolean;
|
|
95
93
|
/** A screen reader is being advertised (sets the SCREEN READER bit). */
|
|
96
94
|
screenReader?: boolean;
|
|
97
95
|
}
|
|
98
96
|
/**
|
|
99
|
-
* Compose the MTTS bitvector
|
|
100
|
-
* `getNewEnvironMTTS`: ANSI + 256 COLORS + OSC COLOR PALETTE + TRUECOLOR
|
|
101
|
-
* always present
|
|
102
|
-
*
|
|
103
|
-
*
|
|
97
|
+
* Compose the MTTS bitvector Mudlet Web advertises. Mirrors Mudlet's
|
|
98
|
+
* `getNewEnvironMTTS`: ANSI + 256 COLORS + OSC COLOR PALETTE + TRUECOLOR + SSL
|
|
99
|
+
* are always present; UTF-8, MNES and SCREEN READER are added from live state.
|
|
100
|
+
* With UTF-8 this yields 2349, matching a default Mudlet connection.
|
|
101
|
+
*
|
|
102
|
+
* SSL is a capability ("client supports SSL for data transmission"), not a
|
|
103
|
+
* report on the current link: Mudlet sets it whenever it was built with SSL,
|
|
104
|
+
* encrypted connection or not, and a server reads it as "this client could use
|
|
105
|
+
* the TLS port". Mudlet Web can — over `wss://` in websocket mode, and through
|
|
106
|
+
* the proxy's TLS leg to the game (`&tls=1`) in proxy mode — so it is always
|
|
107
|
+
* set. Whether the browser↔proxy hop happens to be `wss://` says nothing about
|
|
108
|
+
* the game link either way, and is deliberately not consulted.
|
|
104
109
|
*/
|
|
105
110
|
export declare function computeMtts(caps?: MttsCapabilities): number;
|
|
106
111
|
export declare const NAWS_COMMAND_CODE = 31;
|
|
@@ -113,5 +118,7 @@ export declare const OPT_CHARSET = "*";
|
|
|
113
118
|
export declare const CHARSET_REQUEST = "\u0001";
|
|
114
119
|
export declare const CHARSET_ACCEPTED = "\u0002";
|
|
115
120
|
export declare const CHARSET_REJECTED = "\u0003";
|
|
121
|
+
export declare const CHARSET_TTABLE_IS = "\u0004";
|
|
122
|
+
export declare const CHARSET_TTABLE_REJECTED = "\u0005";
|
|
116
123
|
export declare const CHARSET_WILL = "\u00FF\u00FB*";
|
|
117
124
|
export declare const CHARSET_DO = "\u00FF\u00FD*";
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
export declare class EchoHandler {
|
|
2
|
-
/**
|
|
3
|
-
* whenever the server is echoing for us, which
|
|
4
|
-
* own local command echo to avoid showing every
|
|
5
|
-
*
|
|
2
|
+
/** State exposed to UI / send-echo logic, committed on the negotiation
|
|
3
|
+
* itself as cTelnet does. True whenever the server is echoing for us, which
|
|
4
|
+
* means we must suppress our own local command echo to avoid showing every
|
|
5
|
+
* line twice — and, since a server that echoes for us is a server we must
|
|
6
|
+
* not echo a password for, it is also when the input is masked. */
|
|
6
7
|
private _serverEchoing;
|
|
7
|
-
/** Latest raw on-the-wire state. Used to gate ack dedup and decide whether
|
|
8
|
-
* to schedule a commit. */
|
|
9
|
-
private _rawEchoing;
|
|
10
|
-
/** Whether the *current* ECHO engagement should mask the input line. A
|
|
11
|
-
* server that enables ECHO during the opening negotiation burst — before
|
|
12
|
-
* it has printed any output — is doing session-wide remote echo (it will
|
|
13
|
-
* echo your name, commands, everything), not requesting a password. The
|
|
14
|
-
* classic Diku/ROM password pattern instead toggles `IAC WILL ECHO` on
|
|
15
|
-
* *after* the name prompt, right before "Password:". So we only treat an
|
|
16
|
-
* ECHO that engages after the server has already sent output as a password
|
|
17
|
-
* prompt. Captured at each OFF→ON transition. Mudlet masks on every ECHO;
|
|
18
|
-
* doing so here would hide the name on full-server-echo MUDs, which is the
|
|
19
|
-
* bug this distinction fixes. */
|
|
20
|
-
private _passwordStyle;
|
|
21
|
-
/** Set once the server has emitted any non-telnet output. Distinguishes a
|
|
22
|
-
* connect-time (server-wide) ECHO from a later (password) ECHO. */
|
|
23
|
-
private sawAppData;
|
|
24
|
-
private stabilityTimer;
|
|
25
8
|
private passwordSafetyTimer;
|
|
26
9
|
private connectionStartAt;
|
|
27
10
|
private toggleCount;
|
|
@@ -32,10 +15,23 @@ export declare class EchoHandler {
|
|
|
32
15
|
private readonly onAnomalyDetected;
|
|
33
16
|
constructor(sendRaw: (data: string) => void, onEchoChange: (maskInput: boolean) => void, onAnomalyDetected?: () => void);
|
|
34
17
|
get serverEchoing(): boolean;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
18
|
+
/**
|
|
19
|
+
* Whether the command input should be masked. Any ECHO the server takes,
|
|
20
|
+
* which is what cTelnet does — setRemoteEchoingActive(true) on WILL ECHO,
|
|
21
|
+
* with nothing else consulted.
|
|
22
|
+
*
|
|
23
|
+
* Mudlet Web used to mask only for an ECHO that engaged AFTER the server had
|
|
24
|
+
* printed something, on the reading that a connect-time one is session-wide
|
|
25
|
+
* remote echo rather than a password prompt, and that masking it would hide
|
|
26
|
+
* the player's name as they typed it. Nothing was ever recorded as running
|
|
27
|
+
* into that: the commit carrying the distinction does not mention echo at
|
|
28
|
+
* all, and the one MUD named anywhere near this file is cited for two other
|
|
29
|
+
* problems. Meanwhile the reading has a worse failure of its own — a server
|
|
30
|
+
* that negotiates ECHO in its opening burst and then asks for a password
|
|
31
|
+
* gets no masking at all, which is the error that matters. So: Mudlet's
|
|
32
|
+
* rule, and if a MUD does turn up that needs the distinction it comes back
|
|
33
|
+
* with a name attached.
|
|
34
|
+
*/
|
|
39
35
|
get passwordMode(): boolean;
|
|
40
36
|
get anomalyDetected(): boolean;
|
|
41
37
|
/** Scan the post-MCCP byte stream for true `IAC WILL/WONT ECHO`. Substring
|
|
@@ -56,7 +52,7 @@ export declare class EchoHandler {
|
|
|
56
52
|
* this call (the caller should bail out). */
|
|
57
53
|
private trackToggleAndDetectAnomaly;
|
|
58
54
|
/** Refuse ECHO for the rest of the session: send `IAC DONT ECHO`, drop any
|
|
59
|
-
*
|
|
55
|
+
* the safety timer, force the UI back to normal, and notify
|
|
60
56
|
* the engine so a `sysEchoAnomalyDetected` Lua event can fire. */
|
|
61
57
|
private tripAnomaly;
|
|
62
58
|
reset(): void;
|
|
@@ -13,7 +13,38 @@ export declare const createTelnetOptionParser: (onSubnegotiation: (data: string)
|
|
|
13
13
|
* subnegotiation payload is never mistaken for one. */
|
|
14
14
|
promptMarkerAsNewline?: boolean;
|
|
15
15
|
}) => TelnetOptionHandler;
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Consume every complete telnet sequence in `data`, replacing each with what
|
|
18
|
+
* `handler` returns, and return the text that is left.
|
|
19
|
+
*
|
|
20
|
+
* A single forward scan with the same semantics as TELNET_OPTION_REGEX
|
|
21
|
+
* (`IAC SB … IAC SE` up to the first IAC SE, else `IAC WILL/WONT/DO/DONT x`,
|
|
22
|
+
* else `IAC x`), so `handler` sees exactly the sequences the regex matched.
|
|
23
|
+
* It replaced the regex because the lazy SB branch rescans to end-of-buffer
|
|
24
|
+
* from every IAC SB whose terminator never comes — quadratic on a run of
|
|
25
|
+
* IAC SB from a hostile server. Here the terminator search runs once: when it
|
|
26
|
+
* fails, no later IAC SB can find one either, so it is not repeated; when it
|
|
27
|
+
* succeeds, the scan resumes past it.
|
|
28
|
+
*
|
|
29
|
+
* Unfinished sequences, as the regex left them: a lone trailing IAC is
|
|
30
|
+
* dropped, `IAC WILL` at the very end is consumed as a two-byte command, and
|
|
31
|
+
* so is an `IAC SB` with no IAC SE after it. (MudClient holds a sequence split
|
|
32
|
+
* across frames back for the next one before calling this — `scanTelnetFrame`.)
|
|
33
|
+
*
|
|
34
|
+
* A NUL goes too. cTelnet::processSocketData drops `\0` from the text stream
|
|
35
|
+
* outside a subnegotiation (it is the padding half of telnet's `CR NUL`), so
|
|
36
|
+
* it never reaches the buffer; kept, it cut `line`, getCurrentLine() and
|
|
37
|
+
* getLines() short at the NUL and shifted every position after it
|
|
38
|
+
* (mudlet-web#272). Subnegotiation payloads go to `handler` intact, so a NUL
|
|
39
|
+
* inside one is untouched.
|
|
40
|
+
*/
|
|
41
|
+
export interface TextAheadSlot {
|
|
42
|
+
/** While `handler` runs, hands over the text stripped so far — the text
|
|
43
|
+
* ahead of the sequence being handled — and drops it from what the strip
|
|
44
|
+
* returns; null otherwise. */
|
|
45
|
+
take: (() => string) | null;
|
|
46
|
+
}
|
|
47
|
+
export declare const stripTelnetSequences: (data: string, handler: TelnetOptionHandler, textAhead?: TextAheadSlot) => string;
|
|
17
48
|
export declare const encodeGmcp: (path: string, payload: unknown) => string;
|
|
18
49
|
/** Encode a GMCP frame from a single pre-formatted body (e.g. `"Module.Sub args"`).
|
|
19
50
|
* Mudlet's `sendGMCP` semantics — the caller controls the body between IAC SB
|
|
@@ -32,9 +63,10 @@ export declare const encodeGmcp: (path: string, payload: unknown) => string;
|
|
|
32
63
|
* `%XX` armoring the VFS io path uses. */
|
|
33
64
|
export declare const encodeGmcpRaw: (message: string) => string;
|
|
34
65
|
export interface GmcpStreamOptions {
|
|
66
|
+
/** Every message that reaches the `gmcp` table — `gmcp_msgs` included,
|
|
67
|
+
* which Mudlet treats as an ordinary package rather than decoding and
|
|
68
|
+
* printing its base64 `text` (mudlet-web#362). */
|
|
35
69
|
onEnvelope: (payload: GmcpEnvelope) => void;
|
|
36
|
-
/** Called for gmcp_msgs subnegotiations (base64-encoded text with a type field). */
|
|
37
|
-
onMessage?: (text: string, type: string) => void;
|
|
38
70
|
/** Called for every `Client.GUI` request, in whichever wire format it
|
|
39
71
|
* arrived: the parsed `{url, version}` object, or the legacy raw
|
|
40
72
|
* `<version>\n<url>` string. Split out from `onEnvelope` so the install has
|
|
@@ -43,7 +75,5 @@ export interface GmcpStreamOptions {
|
|
|
43
75
|
* table-populating path. The JSON form still emits its envelope as well,
|
|
44
76
|
* and does so first, so scripts observe it before the install runs. */
|
|
45
77
|
onClientGui?: (payload: unknown) => void;
|
|
46
|
-
/** Text decoder used for gmcp_msgs payloads. Defaults to UTF-8. */
|
|
47
|
-
textEncoding?: string;
|
|
48
78
|
}
|
|
49
|
-
export declare const createGmcpStream: ({ onEnvelope,
|
|
79
|
+
export declare const createGmcpStream: ({ onEnvelope, onClientGui, }: GmcpStreamOptions) => (data: string) => void;
|
|
@@ -4,9 +4,10 @@ export * from "./msdp";
|
|
|
4
4
|
export * from "./mssp";
|
|
5
5
|
export { toByteString } from "./byteString";
|
|
6
6
|
export { MccpHandler } from "./mccp";
|
|
7
|
+
export { parseAtcpMessage, type AtcpMessage } from "./atcp";
|
|
7
8
|
export { EchoHandler } from "./echo";
|
|
8
9
|
export { MspParser, type MspCommand, type MspKind } from "./msp";
|
|
9
10
|
export { MxpParser, splitMxpResultLines, type MxpLink, type MxpLineResult } from "./mxp";
|
|
10
|
-
export {
|
|
11
|
+
export { encodeMnesIs, newEnvironIsReply, mnesIsReplies, MNES_VARIABLES, buildNewEnvironVars, CLIENT_NAME, CLIENT_VERSION, TERMINAL_TYPE, type MnesVar, type NewEnvironState } from "./mnes";
|
|
11
12
|
export { encodeNaws } from "./naws";
|
|
12
|
-
export { SessionCodec, CharsetHandler, normalizeCharsetName, pickCharsetFromRequest, SUPPORTED_SERVER_ENCODINGS, DEFAULT_SERVER_ENCODING, canonicalServerEncoding, canEncodeForServer, type CharsetHandlerHooks } from "./charset";
|
|
13
|
+
export { SessionCodec, CharsetHandler, normalizeCharsetName, pickCharsetFromRequest, SUPPORTED_SERVER_ENCODINGS, DEFAULT_SERVER_ENCODING, canonicalServerEncoding, savedServerEncoding, canEncodeForServer, type CharsetHandlerHooks } from "./charset";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escalate the bracket level until the text can do none of three things:
|
|
3
|
+
* close the literal outright; reopen it, which Lua 5.1 rejects under its
|
|
4
|
+
* deprecated-nesting rule; or merge with the closing bracket appended after it
|
|
5
|
+
* (text ending in `]` plus this level's `=` run is completed into a closer by
|
|
6
|
+
* the first character of the real one). Terminates because none of the three
|
|
7
|
+
* fits in text shorter than the `=` run it needs.
|
|
8
|
+
*
|
|
9
|
+
* Lua drops a newline straight after the opening bracket, so the one added
|
|
10
|
+
* costs nothing and lets text that starts with a newline survive.
|
|
11
|
+
*/
|
|
12
|
+
export declare function quoteLuaLiteral(text: string): string;
|
|
@@ -1,9 +1,44 @@
|
|
|
1
|
+
/** A desktop `postMessage()` the handler asks its owner to show, in desktop's
|
|
2
|
+
* words. `text` may hold a `\n`: the lines after it are the notice's
|
|
3
|
+
* indented continuation. */
|
|
4
|
+
export interface MccpNotice {
|
|
5
|
+
notice: string;
|
|
6
|
+
}
|
|
7
|
+
/** One piece of a read, in stream order: text for the telnet pipeline, or a
|
|
8
|
+
* notice to post where it falls between the texts. */
|
|
9
|
+
export type MccpPiece = string | MccpNotice;
|
|
1
10
|
export declare class MccpHandler {
|
|
2
11
|
private compressing;
|
|
12
|
+
/** We answered the server's `WILL COMPRESS` with DO — Mudlet's
|
|
13
|
+
* `mMCCP_version_1`. Only then is a v1 start sequence honoured. */
|
|
14
|
+
private v1Accepted;
|
|
15
|
+
/** We answered `WILL COMPRESS2` with DO — Mudlet's `mMCCP_version_2`. Only
|
|
16
|
+
* then is a v2 start sequence honoured, and after it Mudlet turns a v1
|
|
17
|
+
* offer down, as the MCCP spec asks. */
|
|
18
|
+
private v2Accepted;
|
|
19
|
+
/** The option of the stream in progress — Mudlet's `mCompressionOption`. */
|
|
20
|
+
private streamOption;
|
|
3
21
|
private inflator;
|
|
22
|
+
private phase;
|
|
23
|
+
/** The zlib header (CMF, FLG and an optional DICTID) read so far. */
|
|
24
|
+
private header;
|
|
25
|
+
/** The Adler-32 trailer read so far. */
|
|
26
|
+
private trailer;
|
|
27
|
+
/** Running Adler-32 of the inflated output, checked against the trailer. */
|
|
28
|
+
private adlerA;
|
|
29
|
+
private adlerB;
|
|
30
|
+
/** Bytes the stream has inflated to — zlib's `total_out`. */
|
|
31
|
+
private totalOut;
|
|
32
|
+
/** cTelnet's `mUninflatedInput` / `mUninflatedInputComplete`: every byte
|
|
33
|
+
* the stream took while it had produced nothing, from earlier reads. */
|
|
34
|
+
private uninflated;
|
|
35
|
+
private uninflatedComplete;
|
|
4
36
|
private readonly sendRaw;
|
|
37
|
+
private readonly onStreamEnd;
|
|
5
38
|
private _enabled;
|
|
6
|
-
|
|
39
|
+
/** `onStreamEnd` runs when a stream finishes (Z_STREAM_END), where desktop
|
|
40
|
+
* resets `hisOptionState` for both compression options. */
|
|
41
|
+
constructor(sendRaw: (data: string) => void, onStreamEnd?: () => void);
|
|
7
42
|
isActive(): boolean;
|
|
8
43
|
get enabled(): boolean;
|
|
9
44
|
set enabled(value: boolean);
|
|
@@ -12,7 +47,54 @@ export declare class MccpHandler {
|
|
|
12
47
|
* Must be called BEFORE stripTelnetSequences.
|
|
13
48
|
*/
|
|
14
49
|
processData(data: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* {@link processData}, but cut where compression starts and where it ends:
|
|
52
|
+
* the plain text before an MCCP start, the inflated text, and the plain
|
|
53
|
+
* text after the end of the stream come back as separate pieces, in order.
|
|
54
|
+
* Desktop processes each of them as a unit of its own (cTelnet calls
|
|
55
|
+
* gotRest on the plain part before it inflates the rest), so a caller that
|
|
56
|
+
* runs the pieces through the pipeline one at a time keeps a trigger on the
|
|
57
|
+
* last line of one part from seeing out-of-band data from the next. Never
|
|
58
|
+
* empty: a frame that yields no bytes still comes back as one empty piece.
|
|
59
|
+
* Notices are left out; {@link processPieces} keeps them.
|
|
60
|
+
*/
|
|
61
|
+
processChunks(data: string): string[];
|
|
62
|
+
/** {@link processChunks} with desktop's MCCP warnings in their place
|
|
63
|
+
* among the texts. Empty pieces are dropped, so this can be empty. */
|
|
64
|
+
processPieces(data: string): MccpPiece[];
|
|
65
|
+
private pieces;
|
|
66
|
+
/** Forget the connection: the stream and what was agreed for it. */
|
|
15
67
|
reset(): void;
|
|
68
|
+
/** Act on the compression offers in `data`, in stream order, up to the
|
|
69
|
+
* first start sequence of a version that is agreed to; return where that
|
|
70
|
+
* starts, or -1.
|
|
71
|
+
*
|
|
72
|
+
* Mudlet's answer to `WILL COMPRESS2` is DO; to `WILL COMPRESS` it is DO
|
|
73
|
+
* too, unless v2 was taken up first (then DONT), and nothing for a repeat
|
|
74
|
+
* of a v1 offer already accepted. `WONT` withdraws either. The negotiator
|
|
75
|
+
* answers both for a profile with compression forced off; this never runs
|
|
76
|
+
* then. */
|
|
77
|
+
private negotiate;
|
|
78
|
+
private endStream;
|
|
16
79
|
private startCompression;
|
|
80
|
+
/** cTelnet::refuseCompressedStream: tell the game DONT for the version the
|
|
81
|
+
* stream was using and stop taking its start sequence as one until it
|
|
82
|
+
* offers that version again. */
|
|
83
|
+
private refuseStream;
|
|
84
|
+
/** cTelnet::decompressBuffer over one read, followed through to the plain
|
|
85
|
+
* text after the end of the stream (or after a broken one). */
|
|
17
86
|
private decompress;
|
|
87
|
+
/** cTelnet::processSocketData scans the output of a stream that ended in
|
|
88
|
+
* this read (out_buffer, with mNeedDecompression already cleared) and
|
|
89
|
+
* skips any start sequence it finds there whole rather than inflating
|
|
90
|
+
* out_buffer back into itself (#10662): a server has no reason to nest a
|
|
91
|
+
* stream in its own output. It has to go here, not to the telnet parser
|
|
92
|
+
* downstream — MCCP1's start has no IAC before its SE, and would leave
|
|
93
|
+
* that parser inside a subnegotiation swallowing the text after it. Only
|
|
94
|
+
* the versions agreed to are recognised, as desktop's look-ahead is. */
|
|
95
|
+
private skipNestedStarts;
|
|
96
|
+
/** Feed deflate data to the inflater; report how much of it was used, and
|
|
97
|
+
* whether the deflate stream ended or broke. Output goes to `output`. */
|
|
98
|
+
private inflateBody;
|
|
99
|
+
private updateAdler;
|
|
18
100
|
}
|