From ae16e81f8e9babd76b8cf6bf075ed383150533db Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Thu, 26 Sep 2024 17:52:45 -0700 Subject: [PATCH] fix: extra lines removed --- package-lock.json | 4 ++-- package.json | 2 +- workers/mastodon/index.js | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 08555a16..5442aaeb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "24.20.2", + "version": "24.20.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "24.20.2", + "version": "24.20.3", "license": "MIT", "dependencies": { "@cdransf/api-text": "^1.5.0", diff --git a/package.json b/package.json index 9b6ebbf4..e80e6afa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "24.20.2", + "version": "24.20.3", "description": "The source for my personal site. Built using 11ty (and other tools).", "type": "module", "scripts": { diff --git a/workers/mastodon/index.js b/workers/mastodon/index.js index 335eaeff..3d5800b3 100644 --- a/workers/mastodon/index.js +++ b/workers/mastodon/index.js @@ -44,11 +44,13 @@ async function handleMastodonPost(env) { ] }) - const content = truncateContent(title, plainTextDescription, link, maxLength) + const cleanedDescription = plainTextDescription.replace(/\s+/g, ' ').trim() + const content = truncateContent(title, cleanedDescription, link, maxLength) await postToMastodon(mastodonApiUrl, accessToken, content) const timestamp = new Date().toISOString() + await env.RSS_TO_MASTODON_NAMESPACE.put(item.link, timestamp) console.log(`Posted stored URL: ${item.link}`)