Skip to content

Commit

Permalink
feat: service modules, gh module support, more
Browse files Browse the repository at this point in the history
This commit implements service modules, GitHub Module Support for fast development, moddable Tizen Application support, HTTP Proxy for application modules and a new Updater application.
  • Loading branch information
reisxd committed Jun 27, 2024
1 parent 67cb014 commit 341c3d8
Show file tree
Hide file tree
Showing 33 changed files with 1,947 additions and 169 deletions.
13 changes: 13 additions & 0 deletions .github/assets/profiles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles active="TizenBrew-New" version="3.1">
<profile name="TizenBrew-Old">
<profileitem ca="$GITHUB_WORKSPACE/tizen-studio/tools/certificate-generator/certificates/developer/tizen-developer-ca.cer" distributor="0" key="$GITHUB_WORKSPACE/tizen-studio-data/keystore/author/tizenbrew-author.p12" password="$KEY_PW" rootca=""/>
<profileitem ca="$GITHUB_WORKSPACE/tizen-studio/tools/certificate-generator/certificates/distributor/sdk-partner/tizen-distributor-ca.cer" distributor="1" key="$GITHUB_WORKSPACE/tizen-studio/tools/certificate-generator/certificates/distributor/sdk-partner/tizen-distributor-signer.p12" password="tizenpkcs12passfordsigner" rootca=""/>
<profileitem ca="" distributor="2" key="" password="" rootca=""/>
</profile>
<profile name="TizenBrew-New">
<profileitem ca="$GITHUB_WORKSPACE/tizen-studio/tools/certificate-generator/certificates/developer/tizen-developer-ca.cer" distributor="0" key="$GITHUB_WORKSPACE/tizen-studio-data/keystore/author/tizenbrew-author.p12" password="$KEY_PW" rootca=""/>
<profileitem ca="$GITHUB_WORKSPACE/tizen-studio/tools/certificate-generator/certificates/distributor/sdk-partner/tizen-distributor-ca-new.cer" distributor="1" key="$GITHUB_WORKSPACE/tizen-studio/tools/certificate-generator/certificates/distributor/sdk-partner/tizen-distributor-signer-new.p12" password="tizenpkcs12passfordsigner" rootca=""/>
<profileitem ca="" distributor="2" key="" password="" rootca=""/>
</profile>
</profiles>
112 changes: 88 additions & 24 deletions .github/workflows/build-new-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'v*.*.*'

env:
TIZEN_STUDIO_VER: 4.5.1
TIZEN_STUDIO_VER: 5.6

jobs:
build:
Expand All @@ -18,7 +18,7 @@ jobs:
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Install modules and build service
- name: Install modules and build standalone service
working-directory: tizenbrew-app/TizenBrew/service
run: |
sudo apt install -y expect zip
Expand All @@ -28,6 +28,13 @@ jobs:
ncc build service.js
rm -r node_modules
- name: Install modules and build updater service
working-directory: tizenbrew-updater/TizenBrewUpdater/service
run: |
npm install
ncc build service.js
rm -r node_modules
- name: Download Tizen-Studio
run: |
curl -o tizen-installer "https://download.tizen.org/sdk/Installer/tizen-studio_${TIZEN_STUDIO_VER}/web-cli_Tizen_Studio_${TIZEN_STUDIO_VER}_ubuntu-64.bin"
Expand All @@ -41,50 +48,107 @@ jobs:
- name: Prepare Tizen Certificate
run: |
./tizen-studio/tools/ide/bin/tizen certificate -a TizenBrew -p 1234 -c NZ -s Aukland -ct Aukland -o Tizen -n TizenBrew -e [email protected] -f tizencert
./tizen-studio/tools/ide/bin/tizen security-profiles add -n TizenBrew -a "${GITHUB_WORKSPACE}/tizen-studio-data/keystore/author/tizencert.p12" -p 1234
${{ secrets.TIZEN_AUTHOR_KEY }} | base64 -d > "${GITHUB_WORKSPACE}/tizen-studio-data/keystore/author/tizenbrew-author.p12"
./tizen-studio/tools/ide/bin/tizen cli-config "profiles.path=${GITHUB_WORKSPACE}/tizen-studio-data/profile/profiles.xml"
cp .github/assets/profiles.xml "${GITHUB_WORKSPACE}/tizen-studio-data/profile/profiles.xml"
sed -i "s|\$GITHUB_WORKSPACE|${GITHUB_WORKSPACE}|g" "${GITHUB_WORKSPACE}/tizen-studio-data/profile/profiles.xml"
sed -i "s|\$KEY_PW|${{ secrets.TIZEN_AUTHOR_KEY_PW }}|g" "${GITHUB_WORKSPACE}/tizen-studio-data/profile/profiles.xml"
chmod 755 "./tizen-studio-data/profile/profiles.xml"
- name: Build
- name: Build TizenBrew
working-directory: tizenbrew-app/TizenBrew
run: |
${GITHUB_WORKSPACE}/tizen-studio/tools/ide/bin/tizen build-web -e ".*" -e "node_modules/*" -e "package*.json" -e "yarn.lock"
- name: Prepare for password prompt
- name: Build TizenBrew Updater
working-directory: tizenbrew-updater/TizenBrewUpdater
run: |
sed -i "s|${GITHUB_WORKSPACE}/tizen-studio-data/keystore/author/tizencert.pwd|1234|g" ${GITHUB_WORKSPACE}/tizen-studio-data/profile/profiles.xml
sed -i "s|${GITHUB_WORKSPACE}/tizen-studio-data/tools/certificate-generator/certificates/distributor/tizen-distributor-signer.pwd|tizenpkcs12passfordsigner|g" ${GITHUB_WORKSPACE}/tizen-studio-data/profile/profiles.xml
sed -i 's|password=""|password="tizenpkcs12passfordsigner"|g' ${GITHUB_WORKSPACE}/tizen-studio-data/profile/profiles.xml
- name: Package WGT
${GITHUB_WORKSPACE}/tizen-studio/tools/ide/bin/tizen build-web -e ".*" -e "node_modules/*" -e "package*.json" -e "yarn.lock"
- name: Package TizenBrew for Old Tizen
env:
PASSWORD: ${{ secrets.TIZEN_AUTHOR_KEY_PW }}
APP_PATH: tizenbrew-app/TizenBrew
CERT: TizenBrew-Old
run: |
expect ./package.exp
mv tizenbrew-app/TizenBrew/release/TizenBrewStandalone.wgt tizenbrew-app/TizenBrew/release/TizenBrewStandalone-Old.wgt
- name: Package TizenBrew for New Tizen
env:
PASSWORD: ${{ secrets.TIZEN_AUTHOR_KEY_PW }}
APP_PATH: tizenbrew-app/TizenBrew
CERT: TizenBrew-New
run: |
expect ./package.exp
mv tizenbrew-app/TizenBrew/release/TizenBrewStandalone.wgt tizenbrew-app/TizenBrew/release/TizenBrewStandalone-New.wgt
- name: Package TizenBrew Updater for Old Tizen
env:
PASSWORD: ${{ secrets.TIZEN_AUTHOR_KEY_PW }}
APP_PATH: tizenbrew-updater/TizenBrewUpdater
CERT: TizenBrew-Old
run: |
expect ./package.exp
mv tizenbrew-updater/TizenBrewUpdater/release/TizenBrewUpdater.wgt tizenbrew-updater/TizenBrewUpdater/release/TizenBrewUpdater-Old.wgt
- name: Package TizenBrew Updater for New Tizen
env:
PASSWORD: ${{ secrets.TIZEN_AUTHOR_KEY_PW }}
APP_PATH: tizenbrew-updater/TizenBrewUpdater
CERT: TizenBrew-New
run: |
expect ./package.exp
mv tizenbrew-updater/TizenBrewUpdater/release/TizenBrewUpdater.wgt tizenbrew-updater/TizenBrewUpdater/release/TizenBrewUpdater-New.wgt
- name: Package WGT as USB Demo Package
- name: Package TizenBrew as USB Demo Package
run: |
wgt-to-usb tizenbrew-app/TizenBrew/release/TizenBrewStandalone.wgt
wgt-to-usb tizenbrew-app/TizenBrew/release/TizenBrewStandalone-Old.wgt
- name: Upload Tizen package artifact
- name: Package Updater as USB Demo Package
run: |
wgt-to-usb tizenbrew-updater/TizenBrewUpdater/release/TizenBrewUpdater-Old.wgt
- name: Upload TizenBrew package artifact for Old Tizen
uses: actions/upload-artifact@v2
with:
name: app-${{ github.sha }}-old.wgt
path: tizenbrew-app/TizenBrew/release/TizenBrewStandalone-Old.wgt

- name: Upload TizenBrew package artifact for New Tizen
uses: actions/upload-artifact@v2
with:
name: app-${{ github.sha }}.wgt
path: tizenbrew-app/TizenBrew/release/TizenBrewStandalone.wgt
name: app-${{ github.sha }}-new.wgt
path: tizenbrew-app/TizenBrew/release/TizenBrewStandalone-New.wgt

- name: Release Build Result
uses: softprops/action-gh-release@v1
- name: Upload TizenBrew Updater package artifact for Old Tizen
uses: actions/upload-artifact@v2
with:
tag_name: ${{ env.RELEASE_VERSION }}
files: |
tizenbrew-app/TizenBrew/release/TizenBrewStandalone.wgt
name: updater-${{ github.sha }}-old.wgt
path: tizenbrew-updater/TizenBrewUpdater/release/TizenBrewUpdater-Old.wgt

- name: Upload TizenBrew Updater package artifact for New Tizen
uses: actions/upload-artifact@v2
with:
name: updater-${{ github.sha }}-new.wgt
path: tizenbrew-updater/TizenBrewUpdater/release/TizenBrewUpdater-New.wgt

- name: Zip USB Demo Package
run: |
zip -r tizenbrew-app/TizenBrew/release/TizenBrewStandaloneUSBDemo.zip userwidget/
- name: Release USB Demo Package
- name: Zip Updater USB Demo Package
run: |
zip -r tizenbrew-updater/TizenBrewUpdater/release/TizenBrewUpdaterUSBDemo.zip userwidget/
- name: Release TizenBrew Build Results
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_VERSION }}
files: |
tizenbrew-app/TizenBrew/release/TizenBrewStandaloneUSBDemo.zip
tizenbrew-app/TizenBrew/release/TizenBrewStandalone-Old.wgt
tizenbrew-app/TizenBrew/release/TizenBrewStandalone-New.wgt
tizenbrew-updater/TizenBrewUpdater/release/TizenBrewUpdater-Old.wgt
tizenbrew-updater/TizenBrewUpdater/release/TizenBrewUpdater-New.wgt
tizenbrew-app/TizenBrew/release/TizenBrewStandaloneUSBDemo.zip
tizenbrew-updater/TizenBrewUpdater/release/TizenBrewUpdaterUSBDemo.zip
54 changes: 32 additions & 22 deletions docs/MODULES.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
# Making a module
# Creating modules for TizenBrew

There are two types of modules: apps and mods. The modules are normal NPM modules, but they only have files for the app or mods.
There are three types of modules: applications, site modifications and services. The modules itself are normal NPM/Node modules but special.

## Package.json format
## Application Modules

The format is pretty same as a normal package.json file, but with some differences. There are some properties that are required for the module to work.
Application modules are simply web pages without any modifications. They are not installed on the TV, but are served from a server. The module should contain a `package.json` file with the following properties:

`packageType`: The type of the module. Can be `app` or `mods`. Required.
- `packageType`: The type of the module. Should be `app`.
- `appName`: The name of the module (user friendly, like "TizenTube").
- `appPath`: The path to the index.html file. (like `app/index.html`)
- `keys`: The keys that should be registered using the [TVInputDevice](https://developer.samsung.com/smarttv/develop/api-references/tizen-web-device-api-references/tvinputdevice-api.html) API.

`appName`: The name of the module (user friendly, like "TizenTube"). Required.
## Site Modification Modules

`appPath`: The path to the app folder. Required if `packageType` is `app`.
Site modification modules are basically the same as application modules, but they are used to modify a website. The modifications are basically JavaScript code that is injected into a website. The module should contain a `package.json` file with the following properties:

`websiteURL`: The URL of the website. Required if `packageType` is `mods`.
- `packageType`: The type of the module. Should be `mods`
- `appName`: The name of the module (user friendly, like "TizenTube").
- `websiteURL`: The URL of the website.
- `main`: The JavaScript file to be injected to the website.
- `keys`: The keys that should be registered using the [TVInputDevice](https://developer.samsung.com/smarttv/develop/api-references/tizen-web-device-api-references/tvinputdevice-api.html) API.
- `tizenAppId`: The Tizen application ID of the application that should be modified. Will be used if it exists.

`main`: The main file of the mods module. Required if `packageType` is `mods`.
## Service Modules

`keys`: The keys that should be registered using the [TVInputDevice](https://developer.samsung.com/smarttv/develop/api-references/tizen-web-device-api-references/tvinputdevice-api.html) API. Not required.
Service modules are ran in the background using Node.js. They can be used to interact with the TV in the background.

Here's an example mods module:
```json
{
"name": "@foxreis/tizentube",
"appName": "TizenTube",
"version": "1.0.0",
"description": "TizenTube is an ad-free and sponsor-free solution for your favourite streaming website on your Tizen (Samsung) TVs.",
"main": "userScript.js",
"packageType": "mods",
"websiteURL": "https://example.com"
}
```
Service modules is also an application module, but with a special property called `serviceFile`. This property should contain the path to the main JavaScript file of the service.

The module should contain a `package.json` file with the following properties:

- `packageType`: The type of the module. Should be `service`.
- `appName`: The name of the module (user friendly, like "TizenTube").
- `serviceFile`: The main JavaScript file of the service.
- `appPath`: The path to the index.html file. (like `app/index.html`)
- `keys`: The keys that should be registered using the [TVInputDevice](https://developer.samsung.com/smarttv/develop/api-references/tizen-web-device-api-references/tvinputdevice-api.html) API.


## Examples

See [TizenTube](https://github.com/reisxd/TizenTube) for an example of an site modification module and [Jellyfin-Tizen](https://github.com/GlenLowland/jellyfin-tizen-npm-publish) for an example of an application module.
12 changes: 2 additions & 10 deletions package.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@

set timeout -1

cd tizenbrew-app/TizenBrew
cd $env(APP_PATH)

spawn /home/runner/work/TizenBrew/TizenBrew/tizen-studio/tools/ide/bin/tizen package -t wgt -o ./release -s TizenBrew -- .buildResult

expect "Author password:"

send -- "1234\r"

expect "Yes: (Y), No: (N) ?"

send -- "N\r"
spawn /home/runner/work/TizenBrew/TizenBrew/tizen-studio/tools/ide/bin/tizen package -t wgt -o ./release -s $env(CERT) -- .buildResult

expect eof
10 changes: 5 additions & 5 deletions tizenbrew-app/TizenBrew/.settings/.jsdtscope
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="">
<attributes>
<attribute name="hide" value="true"/>
<attribute name="provider" value="org.eclipse.wst.jsdt.web.core.internal.project.ModuleSourcePathProvider"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="">
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="provider" value="org.eclipse.wst.jsdt.web.core.internal.project.ModuleSourcePathProvider"/>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="con" path="org.tizen.web.project.initializer.WebLibraryInitializer"/>
<classpathentry kind="con" path="org.eclipselabs.jsdt.jquery.core.CoflictLibrary_2.0"/>
<classpathentry kind="con" path="org.tizen.web.project.initializer.TizenLibraryInitializer"/>
Expand Down
1 change: 1 addition & 0 deletions tizenbrew-app/TizenBrew/.tproject
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
</platforms>
<package>
<blacklist/>
<resFallback autoGen="true"/>
</package>
</tproject>
Loading

0 comments on commit 341c3d8

Please sign in to comment.