@automattic/social-previews 3.2.2 → 3.2.4
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 +13 -0
- package/SECURITY.md +0 -1
- package/dist/index.js +6 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.2.4] - 2026-06-08
|
|
9
|
+
### Changed
|
|
10
|
+
- Update dependencies. [#49354]
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Fix Mastodon share preview showing the post URL twice when the custom message already includes it. [#49338]
|
|
14
|
+
|
|
15
|
+
## [3.2.3] - 2026-05-25
|
|
16
|
+
### Changed
|
|
17
|
+
- Update package dependencies. [#48405] [#49012]
|
|
18
|
+
|
|
8
19
|
## [3.2.2] - 2026-05-19
|
|
9
20
|
### Changed
|
|
10
21
|
- Update dependencies. [#48778]
|
|
@@ -189,6 +200,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
189
200
|
|
|
190
201
|
- Initial release after extracting from Calypso.
|
|
191
202
|
|
|
203
|
+
[3.2.4]: https://github.com/Automattic/social-previews/compare/v3.2.3...v3.2.4
|
|
204
|
+
[3.2.3]: https://github.com/Automattic/social-previews/compare/v3.2.2...v3.2.3
|
|
192
205
|
[3.2.2]: https://github.com/Automattic/social-previews/compare/v3.2.1...v3.2.2
|
|
193
206
|
[3.2.1]: https://github.com/Automattic/social-previews/compare/v3.2.0...v3.2.1
|
|
194
207
|
[3.2.0]: https://github.com/Automattic/social-previews/compare/v3.1.4...v3.2.0
|
package/SECURITY.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1275,8 +1275,6 @@ var DEFAULT_MASTODON_INSTANCE = "mastodon.social";
|
|
|
1275
1275
|
// src/mastodon-preview/helpers.ts
|
|
1276
1276
|
var TITLE_LENGTH4 = 200;
|
|
1277
1277
|
var BODY_LENGTH = 500;
|
|
1278
|
-
var URL_LENGTH2 = 30;
|
|
1279
|
-
var BODY_CHAR_LIMIT = BODY_LENGTH - URL_LENGTH2;
|
|
1280
1278
|
var ADDRESS_PATTERN = /^@([^@]*)@([^@]*)$/i;
|
|
1281
1279
|
var mastodonTitle = (text) => firstValid(
|
|
1282
1280
|
shortEnough(TITLE_LENGTH4),
|
|
@@ -1286,11 +1284,10 @@ var mastodonBody = (text, options) => {
|
|
|
1286
1284
|
const { instance, offset } = options;
|
|
1287
1285
|
return preparePreviewText(text, {
|
|
1288
1286
|
platform: "mastodon",
|
|
1289
|
-
maxChars: BODY_LENGTH -
|
|
1287
|
+
maxChars: BODY_LENGTH - offset,
|
|
1290
1288
|
hashtagDomain: instance
|
|
1291
1289
|
});
|
|
1292
1290
|
};
|
|
1293
|
-
var mastodonUrl = (text) => firstValid(shortEnough(URL_LENGTH2), hardTruncation(URL_LENGTH2))(stripHtmlTags(text)) || "";
|
|
1294
1291
|
var getMastodonAddressDetails = (address) => {
|
|
1295
1292
|
const matches = address.match(ADDRESS_PATTERN);
|
|
1296
1293
|
return {
|
|
@@ -1393,7 +1390,7 @@ var MastodonLinkPreview = (props) => {
|
|
|
1393
1390
|
// src/mastodon-preview/post/body/index.tsx
|
|
1394
1391
|
|
|
1395
1392
|
var MastonPostBody = (props) => {
|
|
1396
|
-
const { title, description, customText,
|
|
1393
|
+
const { title, description, customText, user, children } = props;
|
|
1397
1394
|
const instance = _optionalChain([user, 'optionalAccess', _21 => _21.address]) ? getMastodonAddressDetails(user.address).instance : "";
|
|
1398
1395
|
const options = {
|
|
1399
1396
|
instance,
|
|
@@ -1418,7 +1415,6 @@ var MastonPostBody = (props) => {
|
|
|
1418
1415
|
}
|
|
1419
1416
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mastodon-preview__body", children: [
|
|
1420
1417
|
bodyTxt,
|
|
1421
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href: url, target: "_blank", rel: "noreferrer noopener", children: mastodonUrl(url.replace(/^https?:\/\//, "")) }),
|
|
1422
1418
|
children
|
|
1423
1419
|
] });
|
|
1424
1420
|
};
|
|
@@ -1817,8 +1813,8 @@ var actions_default4 = BlueskyPostActions;
|
|
|
1817
1813
|
// src/bluesky-preview/helpers.ts
|
|
1818
1814
|
var TITLE_LENGTH5 = 200;
|
|
1819
1815
|
var BODY_LENGTH2 = 300;
|
|
1820
|
-
var
|
|
1821
|
-
var
|
|
1816
|
+
var URL_LENGTH2 = 40;
|
|
1817
|
+
var BODY_CHAR_LIMIT = BODY_LENGTH2 - URL_LENGTH2;
|
|
1822
1818
|
var blueskyTitle = (text) => firstValid(
|
|
1823
1819
|
shortEnough(TITLE_LENGTH5),
|
|
1824
1820
|
hardTruncation(TITLE_LENGTH5)
|
|
@@ -1827,10 +1823,10 @@ var blueskyBody = (text, options = {}) => {
|
|
|
1827
1823
|
const { offset = 0, reserveUrlSpace = true } = options;
|
|
1828
1824
|
return preparePreviewText(text, {
|
|
1829
1825
|
platform: "bluesky",
|
|
1830
|
-
maxChars: BODY_LENGTH2 - (reserveUrlSpace ?
|
|
1826
|
+
maxChars: BODY_LENGTH2 - (reserveUrlSpace ? URL_LENGTH2 : 0) - offset
|
|
1831
1827
|
});
|
|
1832
1828
|
};
|
|
1833
|
-
var blueskyUrl = (text) => firstValid(shortEnough(
|
|
1829
|
+
var blueskyUrl = (text) => firstValid(shortEnough(URL_LENGTH2), hardTruncation(URL_LENGTH2))(stripHtmlTags(text)) || "";
|
|
1834
1830
|
|
|
1835
1831
|
// src/bluesky-preview/post/body/index.tsx
|
|
1836
1832
|
|