2022-03-28 02:07:03 +00:00
|
|
|
// General utility functions for the renderers
|
|
|
|
class rendererUtils {
|
|
|
|
static getNavigationEndpoints(base) {
|
|
|
|
const navEndpoint = base.navigationEndpoint;
|
|
|
|
if (!navEndpoint) return;
|
|
|
|
if (navEndpoint.webviewEndpoint) {
|
|
|
|
return navEndpoint.webviewEndpoint.url;
|
|
|
|
} else if (navEndpoint.browseEndpoint) {
|
|
|
|
return navEndpoint.browseEndpoint.canonicalBaseUrl;
|
|
|
|
} else if (navEndpoint.watchEndpoint) {
|
|
|
|
return `/watch?v=${navEndpoint.watchEndpoint.videoId}`;
|
|
|
|
} else if (navEndpoint.navigationEndpoint) {
|
|
|
|
return; //for now
|
|
|
|
}
|
2022-03-21 23:47:11 +00:00
|
|
|
}
|
2022-03-20 12:20:13 +00:00
|
|
|
|
2022-03-28 02:07:03 +00:00
|
|
|
static checkInternal(base) {
|
|
|
|
const navEndpoint = base.navigationEndpoint;
|
|
|
|
if (!navEndpoint) return false;
|
|
|
|
if (navEndpoint.browseEndpoint || navEndpoint.watchEndpoint) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2022-03-20 12:20:13 +00:00
|
|
|
}
|
|
|
|
|
2022-03-28 02:07:03 +00:00
|
|
|
export default rendererUtils;
|