Skip to content

Commit

Permalink
[Fixes #2, Fixes #3] Code now uses pre-ES6 syntax, Added DIAL startup…
Browse files Browse the repository at this point in the history
… support.
  • Loading branch information
FriedChickenButt committed Apr 10, 2021
1 parent 5b67616 commit 5a03277
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 33 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Youtube App without ADs
## Pre-requisites
* Install webOS SDK - https://webostv.developer.lge.com/sdk/installation/
* Setup webOS app testing to load apps in developer mode - https://webostv.developer.lge.com/develop/app-test
* Uninstall YouTube app.

## Building
* Clone the repository
Expand All @@ -23,5 +24,5 @@ ares-install -d <alias of your TV> <.ipk file>
## Launching
* The app will be available in the TV's app list or launch it using ares-cli.
```
ares-launch -d <alias of your TV> com.youtube.noads
ares-launch -d <alias of your TV> youtube.leanback.v4
```
13 changes: 11 additions & 2 deletions appinfo.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
{
"id": "com.youtube.noads",
"id": "youtube.leanback.v4",
"version": "0.0.1",
"vendor": "My Company",
"type": "web",
"main": "index.html",
"title": "Youtube Without ADs",
"icon": "icon.png",
"largeIcon": "largeIcon.png"
"largeIcon": "largeIcon.png",
"support360Content": true,
"accessibility": {
"supportsAudioGuidance": true
},
"privilegedJail": true,
"supportQuickStart": true,
"dialAppName": "YouTube",
"disableBackHistoryAPI": true,
"noSplashOnLaunch": true
}
28 changes: 1 addition & 27 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,6 @@
<html>

<head>
<style type="text/css">
body {
width: 100%;
height: 100%;
background-color: #202020;
}

div {
position: absolute;
height: 100%;
width: 100%;
display: table;
}

h1 {
display: table-cell;
vertical-align: middle;
text-align: center;
color: #FFFFFF;
}
</style>
<!-- <script src="webOSTVjs-1.2.0/webOSTV.js" charset="utf-8"></script>
<script src="webOSTVjs-1.2.0/webOSTV-dev.js" charset="utf-8"></script> -->
<script type="text/javascript">
window.location = "https://youtube.com/tv";
</script>
<script src="index.js"></script>
</head>

</html>
28 changes: 28 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const CONTENT_TARGET_LAUNCH_PARAMETER = "contentTarget";
const YOUTUBE_TV_URL = "https://www.youtube.com/tv";

function extractLaunchUrlParams(launchParameters) {
if (launchParameters === null || launchParameters === "") {
return null;
}
const launchParamJson = JSON.parse(launchParameters);
return launchParamJson[CONTENT_TARGET_LAUNCH_PARAMETER];
}

function concatenateUrlAndGetParams(ytUrl, path) {
if (path === null) {
return ytUrl;
} else {
return ytUrl + "?" + path;
}
}

function main() {
const launchParameters = window.PalmSystem.launchParams;
const youtubeLaunchUrlPath = extractLaunchUrlParams(launchParameters);

window.location = concatenateUrlAndGetParams(YOUTUBE_TV_URL, youtubeLaunchUrlPath);
}


main();
6 changes: 3 additions & 3 deletions webOSUserScripts/userScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const settings = {
disable_annotations: false,
};

const isRequestBlocked = (requestType, url) => {

function isRequestBlocked(requestType, url) {
console.log(`[${requestType}] URL : ${url}`);

if (settings.disable_ads && YOUTUBE_AD_REGEX.test(url)) {
Expand Down Expand Up @@ -49,7 +49,7 @@ XMLHttpRequest.prototype.open = function (...args) {
* Wrapper over Fetch.
*/
const origFetch = fetch;
fetch = (...args) => {
fetch = function (...args) {
const requestType = "FETCH";
const url = args[0];

Expand Down

0 comments on commit 5a03277

Please sign in to comment.