Skip to content

Commit

Permalink
add filename to possible download templates
Browse files Browse the repository at this point in the history
  • Loading branch information
frozenpandaman committed Jul 23, 2024
1 parent 260a000 commit 972a533
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@
"custom_downloadtemplate_hintExtension": { "message": "<code>{extension}</code>: Downloaded tweet's file extension." },
"custom_downloadtemplate_hintID": { "message": "<code>{id}</code>: Tweet's ID." },
"custom_downloadtemplate_hintIndex": { "message": "<code>{index}</code>: Index for each file to download. (for posts with multiple media)" },
"custom_downloadtemplate_hintFilename": { "message": "<code>{filename}</code>: Original filename from pbs.twimg.com." },
"nonexistent_user": { "message": "This account doesn't exist" },
"nonexistent_user_desc": { "message": "Try searching for another." },
"suspended_user": { "message": "Account suspended" },
Expand Down
1 change: 1 addition & 0 deletions layouts/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ <h1>__MSG_custom_downloadtemplate__</h1><br>
<br><span>__MSG_custom_downloadtemplate_hintExtension__</span>
<br><span>__MSG_custom_downloadtemplate_hintID__</span>
<br><span>__MSG_custom_downloadtemplate_hintIndex__</span>
<br><span>__MSG_custom_downloadtemplate_hintFilename__</span>
<br><br>
<div class="setting">
<input type="text" style="width: 550px;" id="custom-download" placeholder="{user_screen_name}_{timestamp}_{id}{index}.{extension}"></input>
Expand Down
3 changes: 2 additions & 1 deletion scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3605,7 +3605,8 @@ async function appendTweet(t, timelineContainer, options = {}) {
"extension": extension,
"timestamp": ts,
"id": t.id_str,
"index": _index
"index": _index,
"filename": url.pathname.substring(url.pathname.lastIndexOf('/') + 1, url.pathname.lastIndexOf('.'))
};
filename = filename_template.replace(/\{([\w]+)\}/g, (_, key) => filesave_map[key]);
}
Expand Down

0 comments on commit 972a533

Please sign in to comment.