Skip to content

Commit

Permalink
allow avatar to be downloaded separately from other tweet images
Browse files Browse the repository at this point in the history
  • Loading branch information
kbravh committed Apr 9, 2022
1 parent 30f85d9 commit db0eb50
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
28 changes: 15 additions & 13 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"1.2.1": "0.12.16",
"2.3.0": "0.12.17"
"2.3.1": "0.12.17"
}

0 comments on commit db0eb50

Please sign in to comment.