webosbrew / webos-homebrew-channel

Unofficial webOS TV homebrew store and root-related tooling
MIT License
810 stars 42 forks source link
enyo webos

webos-homebrew-channel

image

Features

Installation

Updating

If you already have Homebrew Channel installed just launch Homebrew Channel and select "Homebrew Channel" on apps browser view. "Update" button should be clickable if an update is available for your installation.

If you need to reinstall any app for any reason press "5" button on app details screen and "Update" button should change to "Reinstall" (and get enabled if it wasn't before)

Automated (recommended)

Latest Homebrew Channel version is automatically installed when rooting a TV with https://rootmy.tv exploit.

Automated

Execute the following snippet on target TV using SSH or Telnet:

curl -L https://raw.githubusercontent.com/webosbrew/webos-homebrew-channel/main/tools/install.sh | sh -

# Update startup script (assuming running as root)
cp /media/developer/apps/usr/palm/services/org.webosbrew.hbchannel.service/startup.sh /var/lib/webosbrew/startup.sh

Manual

Interfaces

Luna service

This application exposes a Luna service that may be used by other homebrew applications on Rooted devices:

luna://org.webosbrew.hbchannel.service/install

Download, verify and install an application.

Arguments:

Returns:

luna://org.webosbrew.hbchannel.service/exec

Root code execution - this may not execute as root, if a device is not rooted.

Arguments:

Returns:

luna://org.webosbrew.hbchannel.service/spawn

Root code execution, spawn a long-running process - this may not execute as root, if a device is not rooted.

Arguments:

Returns:

luna://org.webosbrew.hbchannel.service/getAppInfo

luna://com.webos.applicationManager/getAppInfo call replicated using devmode-only endpoints.

Repository management

webOS application (or remote device, via SSAP) may request Homebrew Launcher to add an external repository, by launching it with the following launch params:

{
    "launchMode": "addRepository",
    "url": "https://url-to-repository.com"
}

This will automatically jump to Settings view and open up "Add repository" prompt with URL filled in.

This can be tested by using ares-launch as follows:

ares-launch org.webosbrew.hbchannel -p '{"launchMode":"addRepository","url":"https://google.com"}'

Development

Environment

Some libraries used by this project are submodules of this repository. Use following command when cloning:

git clone --recursive https://github.com/webosbrew/webos-homebrew-channel

All required development packages are distributed via npm. In order to install them in a local directory run:

npm install

Technology stack

Frontend is based on last development version of enyo. (dated january 2017) While this definitely is not the cool and jazzy latest technology, it provides us with a sensible UI toolkit for TV-based application that seems to work pretty well with versions of webOS as old as 1.x. We are currently using enyo built-in enyo-dev packager. This requires us to write code that'll be run directly on target platforms (no babel/transpilation of newer ES dialects - no arrow functions, no const, no promises, etc.). In the future we may migrate to some webpack-based solution around that.

Service is packaged using webpack & babel, thus, with enough shims and patches, we can write and use some modern ES features (like Promises, arrow functions, async functions, const, etc.) while targeting NodeJS 0.10 (used on earliest webOS versions)

Development TV setup

Configuring @webosose/ares-cli with Developer Mode App

This is partially based on: https://webostv.developer.lge.com/develop/app-test/using-devmode-app/

Configuring @webosose/ares-cli with rooted TV

Note: @webosose/ares-cli doesn't need to be installed globally - you can use a package installed locally after npm install in this repo by just prefixing above commands with local path, like so: node_modules/.bin/ares-setup-device ...

Frontend development

EnyoJS is able to watch for frontend changes, but does not expose a HTTP server.

npm run build -- --watch

# ...in a separate terminal:
python -m http.server -d dist/

Production build

rm -rf dist && npm run build -- --production && npm run build-service -- --env production && npm run package

Full application testing / deployment

rm -rf dist && npm run build && npm run build-service && npm run package && npm run deploy && npm run launch
ssh root@10.0.0.2 -p 9922 /media/developer/apps/usr/palm/services/org.webosbrew.hbchannel.service/elevate-service

Service testing

npm run build-service && \
    cat dist/services/service.js | ssh root@10.0.0.2 -p 9922 sh -c 'cat > /media/developer/apps/usr/palm/services/org.webosbrew.hbchannel.service/service.js && pkill -f org.webosbrew.hbchannel.service'
ssh root@10.0.0.2 /media/developer/apps/usr/palm/services/org.webosbrew.hbchannel.service/run-js-service -k -n /media/developer/apps/usr/palm/services/org.webosbrew.hbchannel.service

Update startup.sh script

cp /media/developer/apps/usr/palm/services/org.webosbrew.hbchannel.service/startup.sh /var/lib/webosbrew/startup.sh

Release engineering

npm version minor
git push origin main --tags

Testing

Before every release following features should be verified: