├── README.md └── webos_ad_remover /README.md: -------------------------------------------------------------------------------- 1 | # WAR - WebOS Ad Removal (Version 1.00) 2 | ### Removes ads from WebOS home screen 3 | 4 | **WARNING!** This script is provided with no warranty, use at your own risk. 5 | I have done the best I can to ensure the changes are safe and that they are not permanent. 6 | To neutralize this script, simply remove the USB and reboot the TV. 7 | 8 | This is the first release of this script, as such it is considered to be a testing release. Currently I am only removing the AI recommendations 9 | and the Trending section. There are more sections beneath the App list that I have had success in removing. 10 | 11 | ## Compatibility 12 | I have tested this on an LG OLED C1 65 inch television with WebOS version: webOS TV 6.2.1 13 | This may work on earlier versions, and it is assumed to be safe to try as the files are checksummed before they are modified. 14 | Let me know if it works on your device. 15 | 16 | ## Installation 17 | 1. You must root your TV following the instructions provided: https://github.com/RootMyTV/RootMyTV.github.io 18 | 2. Setup SSH access using instructions provided by the rootmytv project. I recommend setting up SSH key access. 19 | 3. Plug in a USB storage device. I formatted mine with NTFS via the prompt on the television. This will likely work on a preformatted NTFS drive. 20 | 4. Copy war-webos-ad-remover from this repo onto your USB stick. 21 | 5. SSH into your TV. The script should be located at `/tmp/usb/sda/sda1/`. Execute it in place, this will allow you to test. If the home screen on your TV is already open it will close and your last active task will be shown. If something goes wrong, simply reboot. 22 | 6. If all goes well and ads are removed, copy the script to `/var/lib/webosbrew/init.d/`. The script will remove ads on boot. 23 | 24 | ## Further Notes 25 | There is a lot of potential to customize the home screen further. It looks possible to set back ground images, change colors, and more. 26 | 27 | ## Contribute 28 | Code contributions are welcome, as well as bitcoin donations: 29 | bc1qnpvc8yp7tprewaam4v64ga8v0rhnyt67532tk5 30 | ![Bitcoin](https://i.imgur.com/Ixe1at6.jpg) 31 | -------------------------------------------------------------------------------- /webos_ad_remover: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # WAR - WebOS Ad Removal (Version 1.00) 3 | # WARNING! This script is provided with no warranty, use at your own risk. 4 | # I have done the best I can to ensure the changes are safe and that they are not permanent. 5 | # To neutralize this script, simply remove the USB and reboot the TV. 6 | # If you want this script to autorun on boot, place it in rootmytv user startup hook directory: /var/lib/webosbrew/init.d/ 7 | set -e 8 | 9 | ############ Begin User Customizable ENV Variables 10 | # Set WAR_ENABLED=false to disable this script. 11 | WAR_ENABLED=true 12 | # Modify WAR_USB_LOCATION to point to the mount point for your USB. If you have no other USB storage devices plugged in then leave the default setting. 13 | WAR_USB_LOCATION='/tmp/usb/sda/sda1' 14 | ############ END User Customizable ENV Variables. Advanced users only past this point. 15 | 16 | # This is the directory we will mount override files from. 17 | WAR_WORKDIR="$WAR_USB_LOCATION/webos_ad_removal" 18 | 19 | # These are the source files that we will copy and modify. 20 | WAR_AI_BOARD_SOURCE="/usr/palm/applications/com.webos.app.home/qml/UserInterfaceLayer/Containers/Main/AIBoard.qml" 21 | WAR_RECOMMENDED_SOURCE="/usr/palm/applications/com.webos.app.home/qml/UserInterfaceLayer/Containers/Main/Recommended.qml" 22 | 23 | check_war_enabled() { 24 | # This can be used to disable the script while keeping it in place. Set WAR_ENABLED to false in the env variables above. 25 | if [ $WAR_ENABLED = false ]; then 26 | echo "WAR_ENABLED set to false, exiting." 27 | exit 1 28 | fi 29 | } 30 | 31 | check_target_sums() { 32 | # We check sha512 sum of target files before proceeding. We will be inserting a line of code at a specific line, we do this to ensure 33 | # there are no unexpected results. Old versions of WebOS or updates may cause files to change, which will break this script. 34 | case $1 in 35 | "ai_board") 36 | WAR_AI_BOARD_SUM="986fb371dd6a8edf5a5fa8479076011c2ad0375533c8aed997cf2d50254737d34b524732d745eafff5294c37bbf5b16d57c5f03b88d547d81eb0c18beb9d01e5 /usr/palm/applications/com.webos.app.home/qml/UserInterfaceLayer/Containers/Main/AIBoard.qml" 37 | WAR_AI_BOARD_CHECK=$(sha512sum $WAR_AI_BOARD_SOURCE) 38 | 39 | if [ "$WAR_AI_BOARD_SUM" != "$WAR_AI_BOARD_CHECK" ]; then 40 | echo "Shasum did not match for AIBoard.qml! Script will not proceed!" 41 | exit 1 42 | fi 43 | echo "Checksum matched!" 44 | ;; 45 | "recommended") 46 | WAR_RECOMMENDED_SUM="1f41b67dc3603908c3aece24c9eae6798684f92cbc89ebd4594e0d786a90dddd9aa0c1c84b9a6142f07deb955dbbd5afbe1c6fef6ca29618267caa0920872e16 /usr/palm/applications/com.webos.app.home/qml/UserInterfaceLayer/Containers/Main/Recommended.qml" 47 | WAR_RECOMMENDED_CHECK=$(sha512sum $WAR_RECOMMENDED_SOURCE) 48 | 49 | if [ "$WAR_RECOMMENDED_SUM" != "$WAR_RECOMMENDED_CHECK" ]; then 50 | echo "Shasum did not match for Recommended.qml! Script will not proceed!" 51 | exit 1 52 | fi 53 | echo "Checksum matched!" 54 | ;; 55 | *) 56 | echo "Attempted to check sum with unrecognized argument! Exiting." 57 | exit 1 58 | ;; 59 | esac 60 | } 61 | 62 | check_for_usb() { 63 | # We check to make sure the USB is mounted. 64 | # When you plug in a USB storage device webOS will ask you to format it (if it is not NTFS) and then it will automount. 65 | # This is the procedure we are using to format and mount our storage device. 66 | # If you have a problem then make sure your device is properly formatted or modify $WAR_USB_LOCATION 67 | # Note: This could be done a little better to make sure we are using the right USB storage device. 68 | WAR_CHECK_USB=$(cat /proc/mounts | grep $WAR_USB_LOCATION) 69 | if [ -z "$WAR_CHECK_USB" ]; then 70 | echo "USB not detected." 71 | exit 1 72 | fi 73 | echo "USB Found. Creating WAR work directory if it does not exist." 74 | mkdir -p $WAR_WORKDIR 75 | } 76 | 77 | create_ai_board_override() { 78 | # This runs if the modified file is not found. 79 | # First we do a checksum. 80 | check_target_sums "ai_board" 81 | 82 | # Then we copy the AIBoard.qml file to our workdir. 83 | cp $WAR_AI_BOARD_SOURCE "$WAR_WORKDIR/AIBoard.qml" 84 | 85 | # Finally we modify the file. 86 | sed -i '17 i return' "$WAR_WORKDIR/AIBoard.qml" 87 | } 88 | 89 | remove_ai_board() { 90 | # First we check if the AIBoard.qml file exists on the USB. If it does not we create it. 91 | if [ ! -f "$WAR_WORKDIR/AIBoard.qml" ]; then 92 | echo "AIBoard override file did not exist on USB. Creating one now." 93 | create_ai_board_override 94 | else 95 | echo "AIBoard override file found at $WAR_WORKDIR/AIBoard.qml" 96 | fi 97 | 98 | # Then we mount --bind the AIBoard.qml override file. This is a non destructive action that can be reset with a reboot or umount. 99 | mount --bind "$WAR_WORKDIR/AIBoard.qml" "$WAR_AI_BOARD_SOURCE" 100 | } 101 | 102 | create_recommended_override() { 103 | # This runs if the modified file is not found. 104 | # First we do a checksum. 105 | check_target_sums "recommended" 106 | 107 | # Then we copy the Recommended.qml file to our workdir. 108 | cp $WAR_AI_BOARD_SOURCE "$WAR_WORKDIR/Recommended.qml" 109 | 110 | # Finally we modify the file. 111 | sed -i '17 i return' "$WAR_WORKDIR/Recommended.qml" 112 | } 113 | 114 | remove_recommended() { 115 | # First we check if the Recommended.qml file exists on the USB. 116 | if [ ! -f "$WAR_WORKDIR/Recommended.qml" ]; then 117 | echo "Recommended override file did not exist on USB. Creating one now." 118 | create_recommended_override 119 | else 120 | echo "Recommended override file found at $WAR_WORKDIR/Recommended.qml" 121 | fi 122 | 123 | # Then we mount --bind the Recommended.qml override file. This is a non destructive action that can be reset with a reboot or umount. 124 | mount --bind "$WAR_WORKDIR/Recommended.qml" "$WAR_RECOMMENDED_SOURCE" 125 | } 126 | 127 | init() { 128 | # Make sure WAR_ENABLED is not set to false 129 | check_war_enabled 130 | # This is the entrypoint for the script. 131 | check_for_usb 132 | # Optional. This removes the AI Board (Top bar with 3 boxes. Includes ad, hero banner) 133 | remove_ai_board 134 | # Optional. This removes the trending section 135 | remove_recommended 136 | # When we are done we kill webOS home. This forces it to restart and use our changes. 137 | pkill -f com.webos.app.home 138 | } 139 | 140 | init 141 | --------------------------------------------------------------------------------