Remove superfluous function

This commit is contained in:
Ealhad 2018-11-15 00:29:55 +01:00
parent 3c4317504e
commit 66893b5015
1 changed files with 2 additions and 7 deletions

View File

@ -68,7 +68,7 @@ const redirectPeertube = async (r) => {
if (prefs.redirectPeertube == RedirectType.Auto) { if (prefs.redirectPeertube == RedirectType.Auto) {
const id = _.last(_.split('/', r.url)); const id = _.last(_.split('/', r.url));
const video: any = await searchByID(id); const video: any = await PeertubeAPI.getVideo(id);
if (prefs.openInOriginalInstance && video.account.host === hostname) { if (prefs.openInOriginalInstance && video.account.host === hostname) {
return {}; // Don't redirect if original instance return {}; // Don't redirect if original instance
@ -97,17 +97,12 @@ const searchByName = query => new Promise(async (resolve, reject) => {
}); });
}); });
const searchByID = id => new Promise(async (resolve, reject) => {
PeertubeAPI.getVideo(id)
.then(video => resolve(video));
});
browser.runtime.onMessage.addListener(function(message, sender) { browser.runtime.onMessage.addListener(function(message, sender) {
switch (message.kind) { switch (message.kind) {
case MessageKind.SearchByName: case MessageKind.SearchByName:
return searchByName(message.query); return searchByName(message.query);
case MessageKind.SearchByID: case MessageKind.SearchByID:
return searchByID(message.id); return PeertubeAPI.getVideo(message.id);
} }
}); });