Skip to content

Commit

Permalink
fix /video/ in tweet links resulting in endless loop
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Sep 24, 2023
1 parent b2be1cf commit 17ed5dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3196,13 +3196,14 @@ async function appendTweet(t, timelineContainer, options = {}) {
}
tweetInteractFavorite.addEventListener('click', () => {
if (t.favorited) {
t.renderFavoritesDown();
API.tweet.unfavorite(t.id_str).catch(e => {
console.error(e);
alert(e);
t.renderFavoritesUp();
});
t.renderFavoritesDown();
} else {
t.renderFavoritesUp();
API.tweet.favorite(t.id_str).catch(e => {
console.error(e);
if(e && e.errors && e.errors[0] && e.errors[0].code === 139) {
Expand All @@ -3211,7 +3212,6 @@ async function appendTweet(t, timelineContainer, options = {}) {
alert(e);
t.renderFavoritesDown();
});
t.renderFavoritesUp();
}
chrome.storage.local.set({tweetReplies: {}, tweetDetails: {}}, () => {});
});
Expand Down
2 changes: 1 addition & 1 deletion scripts/injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ if(/^\/hashtag\/(.*?)/.test(realPath)) {
location.replace(`https://twitter.com/search?q=%23${hashtag}`);
}
if(/^\/[A-z-0-9-_]{1,15}\/status\/\d{5,32}\/(photo|video)\/\d+$/.test(realPath)) {
let path = realPath.split("/photo/")[0];
let path = realPath.split("/photo/")[0].split("/video/")[0];
location.replace(path);
}
if(realPath === '/messages') {
Expand Down

0 comments on commit 17ed5dc

Please sign in to comment.