From db0eb5078a077d4be3825af3e5d7259941359243 Mon Sep 17 00:00:00 2001 From: Karey Higuera Date: Fri, 8 Apr 2022 20:38:13 -0500 Subject: [PATCH] allow avatar to be downloaded separately from other tweet images --- manifest.json | 2 +- package.json | 2 +- src/util.ts | 28 +++++++++++++++------------- versions.json | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/manifest.json b/manifest.json index 1207290..97ed7d5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-tweet-to-markdown", "name": "Tweet to Markdown", - "version": "2.3.0", + "version": "2.3.1", "minAppVersion": "0.12.17", "description": "Save tweets as Markdown files, along with their images, polls, etc.", "author": "kbravh", diff --git a/package.json b/package.json index 5a74782..20eb77e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-tweet-to-markdown", - "version": "2.3.0", + "version": "2.3.1", "description": "Save tweets as beautiful markdown files in Obsidian (https://obsidian.md)", "main": "main.js", "engines": { diff --git a/src/util.ts b/src/util.ts index 1145bdb..26d7b30 100644 --- a/src/util.ts +++ b/src/util.ts @@ -377,7 +377,7 @@ export const buildMarkdown = async ( } // download images - if (plugin.settings.downloadAssets && plugin.settings.includeImages) { + if (plugin.settings.downloadAssets) { downloadImages(app, downloadManager, tweet, plugin) } @@ -460,18 +460,20 @@ export const downloadImages = ( }) } - tweet.includes?.media?.forEach((medium: Media) => { - switch (medium.type) { - case 'photo': - filesToDownload.push({ - url: medium.url, - title: `${medium.media_key}.jpg`, - }) - break - default: - break - } - }) + if (plugin.settings.includeImages) { + tweet.includes?.media?.forEach((medium: Media) => { + switch (medium.type) { + case 'photo': + filesToDownload.push({ + url: medium.url, + title: `${medium.media_key}.jpg`, + }) + break + default: + break + } + }) + } //Filter out tweet images that already exist locally filesToDownload = filesToDownload.filter( diff --git a/versions.json b/versions.json index 3922734..79cb893 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,4 @@ { "1.2.1": "0.12.16", - "2.3.0": "0.12.17" + "2.3.1": "0.12.17" }