rename drafty form response content type to text/x-drafy-fr

This commit is contained in:
or-else
2025-08-10 10:30:47 +03:00
parent a84a5a677a
commit 56790262f3
14 changed files with 85 additions and 83 deletions
+52 -52
View File
@@ -1,12 +1,12 @@
{ {
"name": "tinode-webapp", "name": "tinode-webapp",
"version": "0.24.2", "version": "0.24.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "tinode-webapp", "name": "tinode-webapp",
"version": "0.24.2", "version": "0.24.3",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"firebase": "^11.0.0", "firebase": "^11.0.0",
@@ -15,7 +15,7 @@
"react": "^18.3.0", "react": "^18.3.0",
"react-dom": "^18.3.0", "react-dom": "^18.3.0",
"react-intl": "^7.0.0", "react-intl": "^7.0.0",
"tinode-sdk": "^0.24.2", "tinode-sdk": "^0.24.4",
"webm-duration-fix": "^1.0.4" "webm-duration-fix": "^1.0.4"
}, },
"devDependencies": { "devDependencies": {
@@ -3487,13 +3487,13 @@
} }
}, },
"node_modules/@types/babel__traverse": { "node_modules/@types/babel__traverse": {
"version": "7.20.7", "version": "7.28.0",
"resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.7.tgz", "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz",
"integrity": "sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng==", "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/types": "^7.20.7" "@babel/types": "^7.28.2"
} }
}, },
"node_modules/@types/eslint": { "node_modules/@types/eslint": {
@@ -3579,18 +3579,18 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "22.16.5", "version": "22.17.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.16.5.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.17.1.tgz",
"integrity": "sha512-bJFoMATwIGaxxx8VJPeM8TonI8t579oRvgAuT8zFugJsJZgzqv0Fu8Mhp68iecjzG7cnN3mO2dJQ5uUM2EFrgQ==", "integrity": "sha512-y3tBaz+rjspDTylNjAX37jEC3TETEFGNJL6uQDxwF9/8GLLIjW1rvVHlynyuUKMnMr1Roq8jOv3vkopBjC4/VA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"undici-types": "~6.21.0" "undici-types": "~6.21.0"
} }
}, },
"node_modules/@types/react": { "node_modules/@types/react": {
"version": "19.1.8", "version": "19.1.9",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.8.tgz", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.9.tgz",
"integrity": "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g==", "integrity": "sha512-WmdoynAX8Stew/36uTSVMcLJJ1KRh6L3IZRx1PZ7qJtBqT3dYTgyDTx8H1qoRghErydW7xw9mSJ3wS//tCRpFA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"csstype": "^3.0.2" "csstype": "^3.0.2"
@@ -4394,9 +4394,9 @@
} }
}, },
"node_modules/babel-preset-current-node-syntax": { "node_modules/babel-preset-current-node-syntax": {
"version": "1.1.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz", "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz",
"integrity": "sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==", "integrity": "sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -4417,7 +4417,7 @@
"@babel/plugin-syntax-top-level-await": "^7.14.5" "@babel/plugin-syntax-top-level-await": "^7.14.5"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0" "@babel/core": "^7.0.0 || ^8.0.0-0"
} }
}, },
"node_modules/babel-preset-jest": { "node_modules/babel-preset-jest": {
@@ -4508,9 +4508,9 @@
} }
}, },
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.25.1", "version": "4.25.2",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.1.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.2.tgz",
"integrity": "sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw==", "integrity": "sha512-0si2SJK3ooGzIawRu61ZdPCO1IncZwS8IzuX73sPZsXW6EQ/w/DAfPyKI8l1ETTCr2MnvqWitmlCUxgdul45jA==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -4528,8 +4528,8 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"caniuse-lite": "^1.0.30001726", "caniuse-lite": "^1.0.30001733",
"electron-to-chromium": "^1.5.173", "electron-to-chromium": "^1.5.199",
"node-releases": "^2.0.19", "node-releases": "^2.0.19",
"update-browserslist-db": "^1.1.3" "update-browserslist-db": "^1.1.3"
}, },
@@ -4665,9 +4665,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001727", "version": "1.0.30001733",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001727.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001733.tgz",
"integrity": "sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q==", "integrity": "sha512-e4QKw/O2Kavj2VQTKZWrwzkt3IxOmIlU6ajRb6LP64LHpBo1J67k2Hi4Vu/TgJWsNtynurfS0uK3MaUTCPfu5Q==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -4969,9 +4969,9 @@
} }
}, },
"node_modules/core-js-compat": { "node_modules/core-js-compat": {
"version": "3.44.0", "version": "3.45.0",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.44.0.tgz", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.45.0.tgz",
"integrity": "sha512-JepmAj2zfl6ogy34qfWtcE7nHKAJnKsQFRn++scjVS2bZFllwptzw61BZcZFYBPpUznLfAvh0LGhxKppk04ClA==", "integrity": "sha512-gRoVMBawZg0OnxaVv3zpqLLxaHmsubEGyTnqdpI/CEBvX4JadI1dMSHxagThprYRtSVbuQxvi6iUatdPxohHpA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -5363,9 +5363,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.191", "version": "1.5.199",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.191.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.199.tgz",
"integrity": "sha512-xcwe9ELcuxYLUFqZZxL19Z6HVKcvNkIwhbHUz7L3us6u12yR+7uY89dSl570f/IqNthx8dAw3tojG7i4Ni4tDA==", "integrity": "sha512-3gl0S7zQd88kCAZRO/DnxtBKuhMO4h0EaQIN3YgZfV6+pW+5+bf2AdQeHNESCoaQqo/gjGVYEf2YM4O5HJQqpQ==",
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
@@ -5390,9 +5390,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/enhanced-resolve": { "node_modules/enhanced-resolve": {
"version": "5.18.2", "version": "5.18.3",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.2.tgz", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz",
"integrity": "sha512-6Jw4sE1maoRJo3q8MsSIn2onJFbLTOjY9hlx4DZXmOKvLRd1Ok2kXmAGXaafL2+ijsJZ1ClYbl/pmqr9+k4iUQ==", "integrity": "sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -5818,9 +5818,9 @@
} }
}, },
"node_modules/fs-extra": { "node_modules/fs-extra": {
"version": "11.3.0", "version": "11.3.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.1.tgz",
"integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==", "integrity": "sha512-eXvGGwZ5CL17ZSwHWd3bbgk7UUpF6IFHtP57NYYakPvHOs8GDgDe5KJI36jIJzDkJ6eJjuzRA8eBQb6SkKue0g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -7590,9 +7590,9 @@
} }
}, },
"node_modules/napi-postinstall": { "node_modules/napi-postinstall": {
"version": "0.3.2", "version": "0.3.3",
"resolved": "https://registry.npmjs.org/napi-postinstall/-/napi-postinstall-0.3.2.tgz", "resolved": "https://registry.npmjs.org/napi-postinstall/-/napi-postinstall-0.3.3.tgz",
"integrity": "sha512-tWVJxJHmBWLy69PvO96TZMZDrzmw5KeiZBz3RHmiM2XZ9grBJ2WgMAFVVg25nqp3ZjTFUs2Ftw1JhscL3Teliw==", "integrity": "sha512-uTp172LLXSxuSYHv/kou+f6KW3SMppU9ivthaVTXian9sOt3XM/zHYHpRZiLgQoxeWfYUnslNWQHF1+G71xcow==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"bin": { "bin": {
@@ -9509,9 +9509,9 @@
"license": "Apache-2.0" "license": "Apache-2.0"
}, },
"node_modules/tinode-sdk": { "node_modules/tinode-sdk": {
"version": "0.24.2", "version": "0.24.4",
"resolved": "https://registry.npmjs.org/tinode-sdk/-/tinode-sdk-0.24.2.tgz", "resolved": "https://registry.npmjs.org/tinode-sdk/-/tinode-sdk-0.24.4.tgz",
"integrity": "sha512-PHGJHInjAWZn3Pph7o+68c26hDnHL2XBpO85eeti5v2mpkDBtWKWJJNI/mZ9SeiDdOgZjWmQoAH9w1cfqSD7uQ==", "integrity": "sha512-0hOD1Eh4lQ5lZLuqL1sUThgs0Rlk6M/cZHC7kMAvcJB2snl3TMkW/ZU4Av/L5joLGWnsilOCERCkLa/d+ivtQA==",
"license": "Apache-2.0" "license": "Apache-2.0"
}, },
"node_modules/tinyglobby": { "node_modules/tinyglobby": {
@@ -9609,9 +9609,9 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "5.8.3", "version": "5.9.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz",
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
"devOptional": true, "devOptional": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
@@ -9813,9 +9813,9 @@
} }
}, },
"node_modules/webpack": { "node_modules/webpack": {
"version": "5.100.2", "version": "5.101.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.100.2.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.101.0.tgz",
"integrity": "sha512-QaNKAvGCDRh3wW1dsDjeMdDXwZm2vqq3zn6Pvq4rHOEOGSaUMgOOjG2Y9ZbIGzpfkJk9ZYTHpDqgDfeBDcnLaw==", "integrity": "sha512-B4t+nJqytPeuZlHuIKTbalhljIFXeNRqrUGAQgTGlfOl2lXXKXw+yZu6bicycP+PUlM44CxBjCFD6aciKFT3LQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -10118,9 +10118,9 @@
"license": "ISC" "license": "ISC"
}, },
"node_modules/yaml": { "node_modules/yaml": {
"version": "2.8.0", "version": "2.8.1",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz",
"integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==", "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"bin": { "bin": {
+1 -1
View File
@@ -75,7 +75,7 @@
"react": "^18.3.0", "react": "^18.3.0",
"react-dom": "^18.3.0", "react-dom": "^18.3.0",
"react-intl": "^7.0.0", "react-intl": "^7.0.0",
"tinode-sdk": "^0.24.3", "tinode-sdk": "^0.24.4",
"webm-duration-fix": "^1.0.4" "webm-duration-fix": "^1.0.4"
}, },
"devDependencies": { "devDependencies": {
+3
View File
@@ -148,3 +148,6 @@ export const SELF_AVATAR_URI = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS
// Toast display duration, milliseconds. // Toast display duration, milliseconds.
export const TOAST_DURATION = 3_000; export const TOAST_DURATION = 3_000;
// MIME type for the legacy Drafty form-response data.
export const DRAFTY_FR_MIME_TYPE_LEGACY = 'application/json'; // Remove in 2026.
+4 -7
View File
@@ -10,8 +10,8 @@ import InlineVideo from '../widgets/inline-video.jsx';
import LazyImage from '../widgets/lazy-image.jsx' import LazyImage from '../widgets/lazy-image.jsx'
import UploadingImage from '../widgets/uploading-image.jsx' import UploadingImage from '../widgets/uploading-image.jsx'
import { BROKEN_IMAGE_SIZE, CLICKABLE_URL_SCHEMES, IMAGE_THUMBNAIL_DIM, NO_DIMENSIONS_VIDEO, REM_SIZE, import { BROKEN_IMAGE_SIZE, CLICKABLE_URL_SCHEMES, IMAGE_THUMBNAIL_DIM, NO_DIMENSIONS_VIDEO,
VIDEO_THUMBNAIL_WIDTH } from '../config.js'; REM_SIZE, VIDEO_THUMBNAIL_WIDTH } from '../config.js';
import { base64ToBlob, blobToBase64, fitImageSize, imageScaled } from './blob-helpers.js'; import { base64ToBlob, blobToBase64, fitImageSize, imageScaled } from './blob-helpers.js';
import { idToColorClass, secondsToTime, shortenFileName } from './strformat.js'; import { idToColorClass, secondsToTime, shortenFileName } from './strformat.js';
import { cancelablePromise, sanitizeUrl, sanitizeUrlForMime } from './utils.js'; import { cancelablePromise, sanitizeUrl, sanitizeUrlForMime } from './utils.js';
@@ -44,9 +44,6 @@ const messages = defineMessages({
} }
}); });
const JSON_MIME_TYPE = 'application/json+drafty';
const JSON_MIME_TYPE_LEGACY = 'application/json'; // Remove in 2026.
// The main Drafty formatter: converts Drafty elements into React classes. 'this' is set by the caller. // The main Drafty formatter: converts Drafty elements into React classes. 'this' is set by the caller.
// 'this' must contain: // 'this' must contain:
// viewportWidth: // viewportWidth:
@@ -307,7 +304,7 @@ export function previewFormatter(style, data, values, key) {
break; break;
case 'EX': case 'EX':
if (data) { if (data) {
if (data.mime == JSON_MIME_TYPE || data.mime == JSON_MIME_TYPE_LEGACY) { if (Drafty.isFormResponseType(data.mime)) {
// Ignore JSON attachments: they are form response payloads. // Ignore JSON attachments: they are form response payloads.
return null; return null;
} }
@@ -429,7 +426,7 @@ function quoteFormatter(style, data, values, key) {
case 'EX': case 'EX':
let fname; let fname;
if (data) { if (data) {
if (data.mime == JSON_MIME_TYPE || data.mime == JSON_MIME_TYPE_LEGACY) { if (Drafty.isFormResponseType(data.mime)) {
// Ignore JSON attachments: they are form response payloads. // Ignore JSON attachments: they are form response payloads.
return null; return null;
} }
+3 -3
View File
@@ -22,8 +22,8 @@ import SendMessage from '../widgets/send-message.jsx';
import VideoPreview from '../widgets/video-preview.jsx'; import VideoPreview from '../widgets/video-preview.jsx';
import { DEFAULT_P2P_ACCESS_MODE, EDIT_PREVIEW_LENGTH, IMAGE_PREVIEW_DIM, IMMEDIATE_P2P_SUBSCRIPTION, import { DEFAULT_P2P_ACCESS_MODE, EDIT_PREVIEW_LENGTH, IMAGE_PREVIEW_DIM, IMMEDIATE_P2P_SUBSCRIPTION,
KEYPRESS_DELAY, MESSAGES_PAGE, MAX_EXTERN_ATTACHMENT_SIZE, MAX_IMAGE_DIM, MAX_INBAND_ATTACHMENT_SIZE, DRAFTY_FR_MIME_TYPE_LEGACY, KEYPRESS_DELAY, MESSAGES_PAGE, MAX_EXTERN_ATTACHMENT_SIZE, MAX_IMAGE_DIM,
READ_DELAY, QUOTED_REPLY_LENGTH, VIDEO_PREVIEW_DIM } from '../config.js'; MAX_INBAND_ATTACHMENT_SIZE, READ_DELAY, QUOTED_REPLY_LENGTH, VIDEO_PREVIEW_DIM } from '../config.js';
import { CALL_STATE_OUTGOING_INITATED, CALL_STATE_IN_PROGRESS } from '../constants.js'; import { CALL_STATE_OUTGOING_INITATED, CALL_STATE_IN_PROGRESS } from '../constants.js';
import { blobToBase64, fileToBase64, imageScaled, makeImageUrl } from '../lib/blob-helpers.js'; import { blobToBase64, fileToBase64, imageScaled, makeImageUrl } from '../lib/blob-helpers.js';
import HashNavigation from '../lib/navigation.js'; import HashNavigation from '../lib/navigation.js';
@@ -1025,7 +1025,7 @@ class MessagesView extends React.Component {
// If the attachment is a JSON file, then use 'application/octet-stream' instead of 'application/json'. // If the attachment is a JSON file, then use 'application/octet-stream' instead of 'application/json'.
// This is a temporary workaround for the collision with the 'application/json' MIME type of form responses. // This is a temporary workaround for the collision with the 'application/json' MIME type of form responses.
// Remove this code in 2026 or so. // Remove this code in 2026 or so.
const jsonMimeConverter = (fileType) => fileType == 'application/json' ? 'application/octet-stream' : fileType; const jsonMimeConverter = (fileType) => fileType === DRAFTY_FR_MIME_TYPE_LEGACY ? 'application/octet-stream' : fileType;
if (file.size > maxInbandAttachmentSize) { if (file.size > maxInbandAttachmentSize) {
// Too large to send inband - uploading out of band and sending as a link. // Too large to send inband - uploading out of band and sending as a link.
+1 -2
View File
@@ -162,8 +162,7 @@ class BaseChatMessage extends React.PureComponent {
const attachments = []; const attachments = [];
if (this.props.mimeType == Drafty.getContentType() && Drafty.isValid(content)) { if (this.props.mimeType == Drafty.getContentType() && Drafty.isValid(content)) {
Drafty.attachments(content, (att, i) => { Drafty.attachments(content, (att, i) => {
if (att.mime == 'application/json+drafty' || if (Drafty.isFormResponseType(att.mime)) {
att.mime == 'application/json') {
// Don't show json drafty form response objects as attachments. // Don't show json drafty form response objects as attachments.
// They are not meant for users. // They are not meant for users.
return; return;
+6 -6
View File
@@ -7230,6 +7230,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ CLICKABLE_URL_SCHEMES: function() { return /* binding */ CLICKABLE_URL_SCHEMES; }, /* harmony export */ CLICKABLE_URL_SCHEMES: function() { return /* binding */ CLICKABLE_URL_SCHEMES; },
/* harmony export */ DEFAULT_HOST: function() { return /* binding */ DEFAULT_HOST; }, /* harmony export */ DEFAULT_HOST: function() { return /* binding */ DEFAULT_HOST; },
/* harmony export */ DEFAULT_P2P_ACCESS_MODE: function() { return /* binding */ DEFAULT_P2P_ACCESS_MODE; }, /* harmony export */ DEFAULT_P2P_ACCESS_MODE: function() { return /* binding */ DEFAULT_P2P_ACCESS_MODE; },
/* harmony export */ DRAFTY_FR_MIME_TYPE_LEGACY: function() { return /* binding */ DRAFTY_FR_MIME_TYPE_LEGACY; },
/* harmony export */ EDIT_PREVIEW_LENGTH: function() { return /* binding */ EDIT_PREVIEW_LENGTH; }, /* harmony export */ EDIT_PREVIEW_LENGTH: function() { return /* binding */ EDIT_PREVIEW_LENGTH; },
/* harmony export */ FORWARDED_PREVIEW_LENGTH: function() { return /* binding */ FORWARDED_PREVIEW_LENGTH; }, /* harmony export */ FORWARDED_PREVIEW_LENGTH: function() { return /* binding */ FORWARDED_PREVIEW_LENGTH; },
/* harmony export */ IMAGE_PREVIEW_DIM: function() { return /* binding */ IMAGE_PREVIEW_DIM; }, /* harmony export */ IMAGE_PREVIEW_DIM: function() { return /* binding */ IMAGE_PREVIEW_DIM; },
@@ -7326,6 +7327,7 @@ const WAKE_UP_TICK = 1000;
const MIN_SWIPE_DISTANCE = REM_SIZE * 3; const MIN_SWIPE_DISTANCE = REM_SIZE * 3;
const SELF_AVATAR_URI = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZpZXdCb3g9IjAgMCAxNyAxNyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMy41NjIgMXYxNS40NTlsNC42ODYtMy4yNyA0Ljc1MiAzLjI2di0xNS40NDloLTkuNDM4ek0xMiAxNC41NTFsLTMuNzU2LTIuNTc4LTMuNjgxIDIuNTY4di0xMi41NDFoNy40Mzd2MTIuNTUxeiIgZmlsbD0iIzU1NTU1NSIgLz48L3N2Zz4='; const SELF_AVATAR_URI = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZpZXdCb3g9IjAgMCAxNyAxNyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMy41NjIgMXYxNS40NTlsNC42ODYtMy4yNyA0Ljc1MiAzLjI2di0xNS40NDloLTkuNDM4ek0xMiAxNC41NTFsLTMuNzU2LTIuNTc4LTMuNjgxIDIuNTY4di0xMi41NDFoNy40Mzd2MTIuNTUxeiIgZmlsbD0iIzU1NTU1NSIgLz48L3N2Zz4=';
const TOAST_DURATION = 3_000; const TOAST_DURATION = 3_000;
const DRAFTY_FR_MIME_TYPE_LEGACY = 'application/json';
/***/ }), /***/ }),
@@ -7712,8 +7714,6 @@ const messages = (0,react_intl__WEBPACK_IMPORTED_MODULE_1__.defineMessages)({
}] }]
} }
}); });
const JSON_MIME_TYPE = 'application/json+drafty';
const JSON_MIME_TYPE_LEGACY = 'application/json';
function fullFormatter(style, data, values, key, stack) { function fullFormatter(style, data, values, key, stack) {
if (stack.includes('QQ')) { if (stack.includes('QQ')) {
return quoteFormatter.call(this, style, data, values, key); return quoteFormatter.call(this, style, data, values, key);
@@ -7939,7 +7939,7 @@ function previewFormatter(style, data, values, key) {
break; break;
case 'EX': case 'EX':
if (data) { if (data) {
if (data.mime == JSON_MIME_TYPE || data.mime == JSON_MIME_TYPE_LEGACY) { if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isFormResponseType(data.mime)) {
return null; return null;
} }
delete data.val; delete data.val;
@@ -8058,7 +8058,7 @@ function quoteFormatter(style, data, values, key) {
case 'EX': case 'EX':
let fname; let fname;
if (data) { if (data) {
if (data.mime == JSON_MIME_TYPE || data.mime == JSON_MIME_TYPE_LEGACY) { if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isFormResponseType(data.mime)) {
return null; return null;
} }
fname = data.name; fname = data.name;
@@ -11156,7 +11156,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
} }
sendFileAttachment(file) { sendFileAttachment(file) {
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024 | 0; const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024 | 0;
const jsonMimeConverter = fileType => fileType == 'application/json' ? 'application/octet-stream' : fileType; const jsonMimeConverter = fileType => fileType === _config_js__WEBPACK_IMPORTED_MODULE_18__.DRAFTY_FR_MIME_TYPE_LEGACY ? 'application/octet-stream' : fileType;
if (file.size > maxInbandAttachmentSize) { if (file.size > maxInbandAttachmentSize) {
const uploader = this.props.tinode.getLargeFileHelper(); const uploader = this.props.tinode.getLargeFileHelper();
if (!uploader) { if (!uploader) {
@@ -16517,7 +16517,7 @@ class BaseChatMessage extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
const attachments = []; const attachments = [];
if (this.props.mimeType == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.getContentType() && tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isValid(content)) { if (this.props.mimeType == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.getContentType() && tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isValid(content)) {
tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.attachments(content, (att, i) => { tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.attachments(content, (att, i) => {
if (att.mime == 'application/json+drafty' || att.mime == 'application/json') { if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isFormResponseType(att.mime)) {
return; return;
} }
attachments.push(react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_attachment_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], { attachments.push(react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_attachment_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], {
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+9 -6
View File
@@ -1452,9 +1452,9 @@ class DB {
const MAX_FORM_ELEMENTS = 8; const MAX_FORM_ELEMENTS = 8;
const MAX_PREVIEW_ATTACHMENTS = 3; const MAX_PREVIEW_ATTACHMENTS = 3;
const MAX_PREVIEW_DATA_SIZE = 64; const MAX_PREVIEW_DATA_SIZE = 64;
const JSON_MIME_TYPE = 'application/json+drafty';
const JSON_MIME_TYPE_LEGACY = 'application/json';
const DRAFTY_MIME_TYPE = 'text/x-drafty'; const DRAFTY_MIME_TYPE = 'text/x-drafty';
const DRAFTY_FR_MIME_TYPE = 'text/x-drafty-fr';
const DRAFTY_FR_MIME_TYPE_LEGACY = 'application/json';
const ALLOWED_ENT_FIELDS = ['act', 'height', 'duration', 'incoming', 'mime', 'name', 'premime', 'preref', 'preview', 'ref', 'size', 'state', 'url', 'val', 'width']; const ALLOWED_ENT_FIELDS = ['act', 'height', 'duration', 'incoming', 'mime', 'name', 'premime', 'preref', 'preview', 'ref', 'size', 'state', 'url', 'val', 'width'];
const segmenter = new Intl.Segmenter(); const segmenter = new Intl.Segmenter();
const INLINE_STYLES = [{ const INLINE_STYLES = [{
@@ -2290,7 +2290,7 @@ Drafty.attachJSON = function (content, data) {
content.ent.push({ content.ent.push({
tp: 'EX', tp: 'EX',
data: { data: {
mime: JSON_MIME_TYPE, mime: DRAFTY_FR_MIME_TYPE,
val: data val: data
} }
}); });
@@ -2537,7 +2537,7 @@ Drafty.sanitizeEntities = function (content) {
}; };
Drafty.getDownloadUrl = function (entData) { Drafty.getDownloadUrl = function (entData) {
let url = null; let url = null;
if (entData.mime != JSON_MIME_TYPE && entData.mime != JSON_MIME_TYPE_LEGACY && entData.val) { if (!Drafty.isFormResponseType(entData.mime) && entData.val) {
url = base64toObjectUrl(entData.val, entData.mime, Drafty.logger); url = base64toObjectUrl(entData.val, entData.mime, Drafty.logger);
} else if (typeof entData.ref == 'string') { } else if (typeof entData.ref == 'string') {
url = entData.ref; url = entData.ref;
@@ -2568,6 +2568,9 @@ Drafty.attrValue = function (style, data) {
Drafty.getContentType = function () { Drafty.getContentType = function () {
return DRAFTY_MIME_TYPE; return DRAFTY_MIME_TYPE;
}; };
Drafty.isFormResponseType = function (mimeType) {
return mimeType === DRAFTY_FR_MIME_TYPE || mimeType === DRAFTY_FR_MIME_TYPE_LEGACY;
};
function chunkify(line, start, end, spans) { function chunkify(line, start, end, spans) {
const chunks = []; const chunks = [];
if (spans.length == 0) { if (spans.length == 0) {
@@ -3021,7 +3024,7 @@ function attachmentsToEnd(tree, limit) {
if (attachments.length == limit) { if (attachments.length == limit) {
continue; continue;
} }
if (c.data['mime'] == JSON_MIME_TYPE || c.data['mime'] == JSON_MIME_TYPE_LEGACY) { if (Drafty.isFormResponseType(c.data['mime'])) {
continue; continue;
} }
delete c.att; delete c.att;
@@ -5397,7 +5400,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ PACKAGE_VERSION: () => (/* binding */ PACKAGE_VERSION) /* harmony export */ PACKAGE_VERSION: () => (/* binding */ PACKAGE_VERSION)
/* harmony export */ }); /* harmony export */ });
const PACKAGE_VERSION = "0.24.3"; const PACKAGE_VERSION = "0.24.4";
/***/ }) /***/ })
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long