Remove superfluous function
This commit is contained in:
parent
3c4317504e
commit
66893b5015
|
@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue