diff --git a/.gitignore b/.gitignore
index 0b46fb6f..d081f78f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ out/
node_modules
.vscode/.env
**/roku_modules/**
+playlet-lib/src/www
+playlet/src/lib/playlet-lib.zip
release/playlet.zip
release/playlet.pkg
-src/www
\ No newline at end of file
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 00000000..4fd02195
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1 @@
+engine-strict=true
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
index bf3ed69f..148739b8 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -10,23 +10,22 @@
"stopOnEntry": false,
"enableDebuggerAutoRecovery": false,
"stopDebuggerOnAppExit": false,
- "rootDir": "${workspaceFolder}/dist/build",
- "preLaunchTask": "build-dev",
+ "rootDir": "${workspaceFolder}/dist/build/playlet",
+ "sourceDirs": [
+ "${workspaceFolder}/playlet/src",
+ "${workspaceFolder}/playlet-lib/src"
+ ],
+ "files": [
+ "**/*",
+ ],
+ "preLaunchTask": "build",
"name": "Playlet (dev)",
- "injectRdbOnDeviceComponent": true
- },
- {
- "type": "brightscript",
- "request": "launch",
- "envFile": "${workspaceFolder}/.vscode/.env",
- "host": "${env:ROKU_DEV_TARGET}",
- "password": "${env:ROKU_DEVPASSWORD}",
- "stopOnEntry": false,
- "enableDebuggerAutoRecovery": false,
- "stopDebuggerOnAppExit": false,
- "rootDir": "${workspaceFolder}/dist/build",
- "preLaunchTask": "build-prod",
- "name": "Playlet (prod)"
+ "injectRdbOnDeviceComponent": true,
+ "injectRaleTrackerTask": true,
+ // TODO: change to ${workspaceFolder}/tools/RALE/TrackerTask.xml
+ // Once https://github.com/rokucommunity/vscode-brightscript-language/pull/462
+ // is released (after v2.38.7)
+ "raleTrackerTaskFileLocation": "/Users/brahim/Roku/playlet/tools/RALE/TrackerTask.xml"
},
{
"command": "npm run dev:web",
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000..6e50c2e6
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "brightscript.output.clearConsoleOnChannelStart": false
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index b647da80..e51455a6 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -2,23 +2,30 @@
"version": "2.0.0",
"tasks": [
{
- "label": "build-dev",
- "presentation": {
- "close": true,
- "reveal": "silent",
- "revealProblems": "onProblem"
- },
- "script": "build:dev",
- "type": "npm"
+ "label": "build",
+ "dependsOn": [
+ "build-app"
+ ]
},
{
- "label": "build-prod",
- "presentation": {
- "close": true,
- "reveal": "silent",
- "revealProblems": "onProblem"
- },
- "script": "build:prod",
+ "label": "build-app",
+ "script": "build:app:dev",
+ "type": "npm",
+ "dependsOn": [
+ "build-lib"
+ ]
+ },
+ {
+ "label": "build-lib",
+ "script": "build:lib:dev",
+ "type": "npm",
+ "dependsOn": [
+ "build-web"
+ ]
+ },
+ {
+ "label": "build-web",
+ "script": "build:web",
"type": "npm"
}
]
diff --git a/bsconfig.json b/bsconfig.json
deleted file mode 100644
index b05c19a2..00000000
--- a/bsconfig.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "extends": "config/bsconfig.base.json",
- "host": "If your Roku IP is static, you can set it here and remove the host entry from .vscode/launch.json",
- "password": ""
-}
\ No newline at end of file
diff --git a/config/bsconfig.base.json b/config/bsconfig.base.json
index 64f04a2c..cb4df27e 100644
--- a/config/bsconfig.base.json
+++ b/config/bsconfig.base.json
@@ -12,16 +12,19 @@
"source/**/*",
"components/**/*",
"images/**/*",
+ "!images/vector/**/*",
"fonts/**/*",
"config/**/*",
+ "lib/**/*",
"www/**/*.*",
"manifest"
],
- "lintConfig": "config/bslint.jsonc",
+ "lintConfig": "./config/bslint.jsonc",
"plugins": [
"roku-log-bsc-plugin",
"@rokucommunity/bslint",
- "../scripts/asynctask-plugin.ts"
+ "../tools/asynctask-plugin.ts",
+ "../tools/manifest-bsconst-debug-plugin.ts"
],
"retainStagingDir": true,
"require": [
@@ -32,7 +35,5 @@
"removeComments": false,
"strip": false
},
- "rootDir": "../src/",
- "sourceMap": true,
- "stagingDir": "dist/build"
+ "sourceMap": true
}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 33e3f6b0..6eebb466 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -28,6 +28,9 @@
"semver": "^7.3.8",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
+ },
+ "engines": {
+ "node": "<19.0.0"
}
},
"node_modules/@cspotcode/source-map-support": {
diff --git a/package.json b/package.json
index aa2d2086..ecb8bdb2 100644
--- a/package.json
+++ b/package.json
@@ -16,15 +16,17 @@
"convert-svg-to-png": "^0.6.4",
"dotenv": "^16.0.3",
"express": "^4.18.2",
- "ip": "^1.1.8",
"roku-log-bsc-plugin": "^0.7.0",
"ropm": "^0.10.11",
"semver": "^7.3.8",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
},
+ "engines": {
+ "node": "<19.0.0"
+ },
"ropm": {
- "rootDir": "src",
+ "rootDir": "playlet-lib/src",
"noprefix": [
"roku-requests"
]
@@ -32,23 +34,26 @@
"scripts": {
"dev:web": "cd playlet-web && npm run dev",
"prebuild": "rm -rf dist",
+ "build:dev": "npm run build:web && npm run build:lib:dev && npm run build:app:dev",
+ "build:prod": "npm run build:web && npm run build:lib:prod && npm run build:app:prod",
+ "build:release": "npm run format:fix && npm run lint:fix && npm run manifest-version && npm run generate-images && npm run build:prod && npm run sign-package",
+ "build:app": "cd playlet && bsc --create-package --lintConfig ../config/bslint.jsonc",
+ "build:app:dev": "npm run build:app -- --debug=true",
+ "build:app:prod": "npm run build:app -- --debug=false --sourceMap=false",
+ "build:lib": "cd playlet-lib && bsc --create-package --lintConfig ../config/bslint.jsonc",
+ "build:lib:dev": "npm run build:lib -- --debug=true",
+ "build:lib:prod": "npm run build:lib -- --debug=false --sourceMap=false",
"build:web": "cd playlet-web && npm run build",
- "build": "npm run build:web && bsc",
- "build:dev": "npm run manifest-symbols -- DEBUG=true && npm run build",
- "build:prod": "npm run manifest-symbols -- DEBUG=false && npm run build -- --sourceMap=false",
- "build:release": "npm run format:fix && npm run lint:fix && npm run manifest-version && npm run generate-images && npm run build:prod && npm run zip-package && npm run sign-package",
- "lint": "bslint --project config/bsconfig.lint.json --lintConfig config/bslint.jsonc",
+ "lint": "bslint --project playlet-lib/bsconfig.lint.json --lintConfig config/bslint.jsonc && bslint --project playlet/bsconfig.lint.json --lintConfig config/bslint.jsonc",
"lint:fix": "npm run lint -- --fix",
- "format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!src/components/lib/**/*\" \"!src/source/lib/**/*\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" --bsfmt-path \"config/bsfmt.jsonc\"",
+ "format:base": "bsfmt \"playlet/src/**/*.brs\" \"playlet/src/**/*.bs\" \"!playlet/src/components/lib/**/*\" \"!playlet/src/source/lib/**/*\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" \"playlet-lib/src/**/*.brs\" \"playlet-lib/src/**/*.bs\" \"!playlet-lib/src/components/lib/**/*\" \"!playlet-lib/src/source/lib/**/*\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" --bsfmt-path \"config/bsfmt.jsonc\"",
"format": "npm run format:base -- --check",
"format:fix": "npm run format:base -- --write",
- "generate-images": "node scripts/generate-images.js",
- "manifest-version": "node scripts/update-manifest-version.js",
- "zip-package": "node scripts/zip-package.js",
- "sign-package": "node scripts/sign-package.js",
- "screenshot": "node scripts/screenshot.js",
- "manifest-symbols": "node scripts/update-manifest-symbols.js",
- "profile-sync": "node scripts/profile-sync.js",
+ "generate-images": "node tools/generate-images.js",
+ "manifest-version": "node tools/update-manifest-version.js",
+ "sign-package": "node tools/sign-package.js",
+ "screenshot": "node tools/screenshot.js",
+ "profile-sync": "node tools/profile-sync.js",
"postinstall": "npx ropm copy && cd playlet-web && npm install"
}
-}
+}
\ No newline at end of file
diff --git a/playlet-lib/bsconfig.json b/playlet-lib/bsconfig.json
new file mode 100644
index 00000000..4e063602
--- /dev/null
+++ b/playlet-lib/bsconfig.json
@@ -0,0 +1,6 @@
+{
+ "extends": "../config/bsconfig.base.json",
+ "rootDir": "src/",
+ "stagingDir": "../dist/build/playlet-lib",
+ "outFile": "../playlet/src/lib/playlet-lib.zip"
+}
\ No newline at end of file
diff --git a/config/bsconfig.lint.json b/playlet-lib/bsconfig.lint.json
similarity index 74%
rename from config/bsconfig.lint.json
rename to playlet-lib/bsconfig.lint.json
index e5ecdf9a..920ff760 100644
--- a/config/bsconfig.lint.json
+++ b/playlet-lib/bsconfig.lint.json
@@ -1,7 +1,7 @@
{
"createPackage": false,
"deploy": false,
- "extends": "bsconfig.base.json",
+ "extends": "bsconfig.json",
"retainStagingDir": false,
"sourceMap": false
}
\ No newline at end of file
diff --git a/src/components/Dialog/Dialog.bs b/playlet-lib/src/components/Dialog/Dialog.bs
similarity index 100%
rename from src/components/Dialog/Dialog.bs
rename to playlet-lib/src/components/Dialog/Dialog.bs
diff --git a/src/components/Dialog/Dialog.xml b/playlet-lib/src/components/Dialog/Dialog.xml
similarity index 100%
rename from src/components/Dialog/Dialog.xml
rename to playlet-lib/src/components/Dialog/Dialog.xml
diff --git a/src/components/Dialog/DialogUtils.bs b/playlet-lib/src/components/Dialog/DialogUtils.bs
similarity index 100%
rename from src/components/Dialog/DialogUtils.bs
rename to playlet-lib/src/components/Dialog/DialogUtils.bs
diff --git a/src/components/HomeGridScreen/HomeGridScreen.bs b/playlet-lib/src/components/HomeGridScreen/HomeGridScreen.bs
similarity index 96%
rename from src/components/HomeGridScreen/HomeGridScreen.bs
rename to playlet-lib/src/components/HomeGridScreen/HomeGridScreen.bs
index 005df181..cc26a8b6 100644
--- a/src/components/HomeGridScreen/HomeGridScreen.bs
+++ b/playlet-lib/src/components/HomeGridScreen/HomeGridScreen.bs
@@ -8,8 +8,6 @@ function Init()
m.top.ObserveField("focus", "OnFocusChange")
m.top.ObserveField("refresh", "OnRefresh")
- m.top.focus = true
-
InitContent()
end function
@@ -32,7 +30,7 @@ function InitContent()
}, true)
m.top.content = contentNode
- m.defaultLayout = ParseJson(ReadAsciiFile("pkg:/config/default_home_layout.json"))
+ m.defaultLayout = ParseJson(ReadAsciiFile("libpkg:/config/default_home_layout.json"))
if m.defaultLayout.Count() > 0
m.currentLoadingIndex = 0
diff --git a/src/components/HomeGridScreen/HomeGridScreen.xml b/playlet-lib/src/components/HomeGridScreen/HomeGridScreen.xml
similarity index 100%
rename from src/components/HomeGridScreen/HomeGridScreen.xml
rename to playlet-lib/src/components/HomeGridScreen/HomeGridScreen.xml
diff --git a/src/components/HomeGridScreen/HomeGridScreenTask.bs b/playlet-lib/src/components/HomeGridScreen/HomeGridScreenTask.bs
similarity index 100%
rename from src/components/HomeGridScreen/HomeGridScreenTask.bs
rename to playlet-lib/src/components/HomeGridScreen/HomeGridScreenTask.bs
diff --git a/src/components/MainScene.bs b/playlet-lib/src/components/MainScene.bs
similarity index 79%
rename from src/components/MainScene.bs
rename to playlet-lib/src/components/MainScene.bs
index f78818bd..7b6c62de 100644
--- a/src/components/MainScene.bs
+++ b/playlet-lib/src/components/MainScene.bs
@@ -4,20 +4,15 @@ import "pkg:/components/VideoPlayer/Video.bs"
function Init()
log.initializeLogManager(["log_PrintTransport"], 2)
- m.top.backgroundColor = "0x242424FF"
- m.top.backgroundURI = ""
-
- m.loadingIndicator = m.top.findNode("LoadingIndicator")
m.videoContainer = m.top.findNode("VideoContainer")
m.global.addFields({
- loadingIndicator: m.loadingIndicator,
videoContainer: m.videoContainer
})
- m.loadingIndicator.visible = true
m.homeGridScreen = m.top.findNode("HomeGridScreen")
m.homeGridScreen.ObserveField("escape", "OnHomeGridScreenEscape")
m.homeGridScreen.SetFocus(true)
+ m.currentFocued = m.homeGridScreen
m.settingsScreen = m.top.findNode("SettingsScreen")
@@ -28,9 +23,12 @@ function Init()
m.navBar.ObserveField("escapeIndex", "OnNavBarEscape")
m.navBar.ObserveField("focusIndex", "OnNavIndexChange")
- m.currentFocued = m.homeGridScreen
-
InitWebServer()
+
+ LaunchArgumentsReceived()
+
+ scene = m.top.getScene()
+ scene.ObserveField("inputArgs", "InputArgumentsReceived")
end function
function InitWebServer()
@@ -97,25 +95,18 @@ function OnWebServerCommand()
end if
end function
-function GetIndexOfChild(parent as object, childId as string) as integer
- count = parent.getChildCount()
- for i = 0 to count - 1
- child = parent.getChild(i)
- if child.id = childId
- return i
- end if
- end for
- return -1
-end function
-
function LaunchArgumentsReceived() as void
- ? "LaunchArgumentsReceived" m.top.launchArgs
- PlayVideoFromArgs(m.top.launchArgs)
+ scene = m.top.getScene()
+ launchArgs = scene.launchArgs
+ ? "LaunchArgumentsReceived " launchArgs
+ PlayVideoFromArgs(launchArgs)
end function
function InputArgumentsReceived() as void
- ? "InputArgumentsReceived" m.top.inputArgs
- PlayVideoFromArgs(m.top.inputArgs)
+ scene = m.top.getScene()
+ inputArgs = scene.inputArgs
+ ? "InputArgumentsReceived " inputArgs
+ PlayVideoFromArgs(inputArgs)
end function
function PlayVideoFromArgs(args as object) as void
@@ -128,8 +119,10 @@ function PlayVideoFromArgs(args as object) as void
' bs:disable-next-line
mediaType = args.mediaType
- if contentId <> invalid
- sender = m.videoContainer.sender ?? m.currentFocued
- PlayVideo(contentId, { sender: sender })
+ if contentId = invalid
+ return
end if
+
+ sender = m.videoContainer.sender ?? m.currentFocued
+ PlayVideo(contentId, { sender: sender })
end function
diff --git a/playlet-lib/src/components/MainScene.xml b/playlet-lib/src/components/MainScene.xml
new file mode 100644
index 00000000..220a9ca0
--- /dev/null
+++ b/playlet-lib/src/components/MainScene.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/NavBar/IconButton.brs b/playlet-lib/src/components/NavBar/IconButton.brs
similarity index 100%
rename from src/components/NavBar/IconButton.brs
rename to playlet-lib/src/components/NavBar/IconButton.brs
diff --git a/src/components/NavBar/IconButton.xml b/playlet-lib/src/components/NavBar/IconButton.xml
similarity index 100%
rename from src/components/NavBar/IconButton.xml
rename to playlet-lib/src/components/NavBar/IconButton.xml
diff --git a/src/components/NavBar/NavBar.bs b/playlet-lib/src/components/NavBar/NavBar.bs
similarity index 97%
rename from src/components/NavBar/NavBar.bs
rename to playlet-lib/src/components/NavBar/NavBar.bs
index 08bf3562..28cdcd93 100644
--- a/src/components/NavBar/NavBar.bs
+++ b/playlet-lib/src/components/NavBar/NavBar.bs
@@ -51,7 +51,7 @@ function OnExitDialog(event as object)
buttonIndex = event.GetData()
if buttonIndex = 0 ' Exit
? "EXITING APP"
- m.top.GetScene().exitChannel = true
+ m.top.getScene().exitChannel = true
end if
end function
diff --git a/src/components/NavBar/NavBar.xml b/playlet-lib/src/components/NavBar/NavBar.xml
similarity index 100%
rename from src/components/NavBar/NavBar.xml
rename to playlet-lib/src/components/NavBar/NavBar.xml
diff --git a/src/components/SearchScreen/SearchHistory.bs b/playlet-lib/src/components/SearchScreen/SearchHistory.bs
similarity index 100%
rename from src/components/SearchScreen/SearchHistory.bs
rename to playlet-lib/src/components/SearchScreen/SearchHistory.bs
diff --git a/src/components/SearchScreen/SearchScreen.bs b/playlet-lib/src/components/SearchScreen/SearchScreen.bs
similarity index 100%
rename from src/components/SearchScreen/SearchScreen.bs
rename to playlet-lib/src/components/SearchScreen/SearchScreen.bs
diff --git a/src/components/SearchScreen/SearchScreen.xml b/playlet-lib/src/components/SearchScreen/SearchScreen.xml
similarity index 100%
rename from src/components/SearchScreen/SearchScreen.xml
rename to playlet-lib/src/components/SearchScreen/SearchScreen.xml
diff --git a/src/components/SearchScreen/SearchSuggestionsTask.bs b/playlet-lib/src/components/SearchScreen/SearchSuggestionsTask.bs
similarity index 100%
rename from src/components/SearchScreen/SearchSuggestionsTask.bs
rename to playlet-lib/src/components/SearchScreen/SearchSuggestionsTask.bs
diff --git a/src/components/SearchScreen/SearchTask.bs b/playlet-lib/src/components/SearchScreen/SearchTask.bs
similarity index 100%
rename from src/components/SearchScreen/SearchTask.bs
rename to playlet-lib/src/components/SearchScreen/SearchTask.bs
diff --git a/src/components/SettingsScreen/AppVersionTask.bs b/playlet-lib/src/components/SettingsScreen/AppVersionTask.bs
similarity index 100%
rename from src/components/SettingsScreen/AppVersionTask.bs
rename to playlet-lib/src/components/SettingsScreen/AppVersionTask.bs
diff --git a/src/components/SettingsScreen/SettingsScreen.bs b/playlet-lib/src/components/SettingsScreen/SettingsScreen.bs
similarity index 62%
rename from src/components/SettingsScreen/SettingsScreen.bs
rename to playlet-lib/src/components/SettingsScreen/SettingsScreen.bs
index 066a5fd2..0bc6fccf 100644
--- a/src/components/SettingsScreen/SettingsScreen.bs
+++ b/playlet-lib/src/components/SettingsScreen/SettingsScreen.bs
@@ -1,13 +1,15 @@
import "pkg:/source/utils/General.bs"
+import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/SettingsScreen/AppVersionTask.bs"
function Init()
m.versionLabel = m.top.findNode("VersionLabel")
m.top.url = `http://${GetLocalIpAddress()}:8888`
- appInfo = GetAppInfo()
- m.currentVersion = appInfo.version
- SetVersionLabel(m.currentVersion, "N/A")
+
+ m.appInfo = GetAppInfo()
+
+ SetVersionLabel(m.appInfo.version, m.appInfo.lib_version, "N/A")
GetLatestVersion()
end function
@@ -24,11 +26,11 @@ end function
function GetLatestVersion()
StartAsyncTask(AppVersionTask, {}, function(output as object) as void
if output.result.latest <> invalid
- SetVersionLabel(m.currentVersion, output.result.latest)
+ SetVersionLabel(m.appInfo.version, m.appInfo.lib_version, output.result.latest)
end if
end function)
end function
-function SetVersionLabel(current as string, latest as string)
- m.versionLabel.text = `Version: ${current} | Latest: ${latest}`
+function SetVersionLabel(appVersion as string, libVersion as string, latest as string)
+ m.versionLabel.text = `Playlet: ${appVersion} | Playlet-Lib: ${libVersion} | Latest: ${latest}`
end function
diff --git a/src/components/SettingsScreen/SettingsScreen.xml b/playlet-lib/src/components/SettingsScreen/SettingsScreen.xml
similarity index 100%
rename from src/components/SettingsScreen/SettingsScreen.xml
rename to playlet-lib/src/components/SettingsScreen/SettingsScreen.xml
diff --git a/src/components/VideoPlayer/SponsorBlockTask.bs b/playlet-lib/src/components/VideoPlayer/SponsorBlockTask.bs
similarity index 100%
rename from src/components/VideoPlayer/SponsorBlockTask.bs
rename to playlet-lib/src/components/VideoPlayer/SponsorBlockTask.bs
diff --git a/src/components/VideoPlayer/SponsorBlockTrackingTask.bs b/playlet-lib/src/components/VideoPlayer/SponsorBlockTrackingTask.bs
similarity index 100%
rename from src/components/VideoPlayer/SponsorBlockTrackingTask.bs
rename to playlet-lib/src/components/VideoPlayer/SponsorBlockTrackingTask.bs
diff --git a/src/components/VideoPlayer/Video.bs b/playlet-lib/src/components/VideoPlayer/Video.bs
similarity index 100%
rename from src/components/VideoPlayer/Video.bs
rename to playlet-lib/src/components/VideoPlayer/Video.bs
diff --git a/src/components/VideoPlayer/VideoContainer.xml b/playlet-lib/src/components/VideoPlayer/VideoContainer.xml
similarity index 100%
rename from src/components/VideoPlayer/VideoContainer.xml
rename to playlet-lib/src/components/VideoPlayer/VideoContainer.xml
diff --git a/src/components/VideoPlayer/VideoDetailsTask.bs b/playlet-lib/src/components/VideoPlayer/VideoDetailsTask.bs
similarity index 100%
rename from src/components/VideoPlayer/VideoDetailsTask.bs
rename to playlet-lib/src/components/VideoPlayer/VideoDetailsTask.bs
diff --git a/src/components/VideoPlayer/VideoPlayer.bs b/playlet-lib/src/components/VideoPlayer/VideoPlayer.bs
similarity index 100%
rename from src/components/VideoPlayer/VideoPlayer.bs
rename to playlet-lib/src/components/VideoPlayer/VideoPlayer.bs
diff --git a/src/components/VideoPlayer/VideoPlayer.xml b/playlet-lib/src/components/VideoPlayer/VideoPlayer.xml
similarity index 100%
rename from src/components/VideoPlayer/VideoPlayer.xml
rename to playlet-lib/src/components/VideoPlayer/VideoPlayer.xml
diff --git a/src/components/VideoPlayer/VideoPlayerCaptions.bs b/playlet-lib/src/components/VideoPlayer/VideoPlayerCaptions.bs
similarity index 100%
rename from src/components/VideoPlayer/VideoPlayerCaptions.bs
rename to playlet-lib/src/components/VideoPlayer/VideoPlayerCaptions.bs
diff --git a/src/components/VideoPlayer/VideoPlayerSponsorBlock.bs b/playlet-lib/src/components/VideoPlayer/VideoPlayerSponsorBlock.bs
similarity index 100%
rename from src/components/VideoPlayer/VideoPlayerSponsorBlock.bs
rename to playlet-lib/src/components/VideoPlayer/VideoPlayerSponsorBlock.bs
diff --git a/src/components/VideoRowCell/VideoRowCell.bs b/playlet-lib/src/components/VideoRowCell/VideoRowCell.bs
similarity index 100%
rename from src/components/VideoRowCell/VideoRowCell.bs
rename to playlet-lib/src/components/VideoRowCell/VideoRowCell.bs
diff --git a/src/components/VideoRowCell/VideoRowCell.xml b/playlet-lib/src/components/VideoRowCell/VideoRowCell.xml
similarity index 100%
rename from src/components/VideoRowCell/VideoRowCell.xml
rename to playlet-lib/src/components/VideoRowCell/VideoRowCell.xml
diff --git a/src/components/WebServer/HttpConnection.bs b/playlet-lib/src/components/WebServer/HttpConnection.bs
similarity index 100%
rename from src/components/WebServer/HttpConnection.bs
rename to playlet-lib/src/components/WebServer/HttpConnection.bs
diff --git a/src/components/WebServer/HttpConnectionState.bs b/playlet-lib/src/components/WebServer/HttpConnectionState.bs
similarity index 100%
rename from src/components/WebServer/HttpConnectionState.bs
rename to playlet-lib/src/components/WebServer/HttpConnectionState.bs
diff --git a/src/components/WebServer/HttpRequest.bs b/playlet-lib/src/components/WebServer/HttpRequest.bs
similarity index 100%
rename from src/components/WebServer/HttpRequest.bs
rename to playlet-lib/src/components/WebServer/HttpRequest.bs
diff --git a/src/components/WebServer/HttpRequestState.bs b/playlet-lib/src/components/WebServer/HttpRequestState.bs
similarity index 100%
rename from src/components/WebServer/HttpRequestState.bs
rename to playlet-lib/src/components/WebServer/HttpRequestState.bs
diff --git a/src/components/WebServer/HttpResponse.bs b/playlet-lib/src/components/WebServer/HttpResponse.bs
similarity index 97%
rename from src/components/WebServer/HttpResponse.bs
rename to playlet-lib/src/components/WebServer/HttpResponse.bs
index aed42879..4644e468 100644
--- a/src/components/WebServer/HttpResponse.bs
+++ b/playlet-lib/src/components/WebServer/HttpResponse.bs
@@ -88,6 +88,12 @@ namespace Http
m.source = Http.HttpResponseSource.GENERATED
end function
+ function SetBodyDataBuffer(buffer as object)
+ m.body_buffer = buffer
+ m.body_buffer_length = m.body_buffer.count()
+ m.ContentLength(m.body_buffer_length)
+ end function
+
function SetBodyDataString(data as string)
m.body_buffer.fromasciistring(data)
m.body_buffer_length = m.body_buffer.count()
diff --git a/src/components/WebServer/HttpResponseSource.bs b/playlet-lib/src/components/WebServer/HttpResponseSource.bs
similarity index 100%
rename from src/components/WebServer/HttpResponseSource.bs
rename to playlet-lib/src/components/WebServer/HttpResponseSource.bs
diff --git a/src/components/WebServer/HttpRouter.bs b/playlet-lib/src/components/WebServer/HttpRouter.bs
similarity index 100%
rename from src/components/WebServer/HttpRouter.bs
rename to playlet-lib/src/components/WebServer/HttpRouter.bs
diff --git a/src/components/WebServer/HttpServer.bs b/playlet-lib/src/components/WebServer/HttpServer.bs
similarity index 100%
rename from src/components/WebServer/HttpServer.bs
rename to playlet-lib/src/components/WebServer/HttpServer.bs
diff --git a/src/components/WebServer/HttpSettings.bs b/playlet-lib/src/components/WebServer/HttpSettings.bs
similarity index 100%
rename from src/components/WebServer/HttpSettings.bs
rename to playlet-lib/src/components/WebServer/HttpSettings.bs
diff --git a/src/components/WebServer/Middleware/BasicAuthMiddleware.bs b/playlet-lib/src/components/WebServer/Middleware/BasicAuthMiddleware.bs
similarity index 100%
rename from src/components/WebServer/Middleware/BasicAuthMiddleware.bs
rename to playlet-lib/src/components/WebServer/Middleware/BasicAuthMiddleware.bs
diff --git a/src/components/WebServer/Middleware/CommandsApiRouter.bs b/playlet-lib/src/components/WebServer/Middleware/CommandsApiRouter.bs
similarity index 100%
rename from src/components/WebServer/Middleware/CommandsApiRouter.bs
rename to playlet-lib/src/components/WebServer/Middleware/CommandsApiRouter.bs
diff --git a/src/components/WebServer/Middleware/CorsMiddleware.bs b/playlet-lib/src/components/WebServer/Middleware/CorsMiddleware.bs
similarity index 100%
rename from src/components/WebServer/Middleware/CorsMiddleware.bs
rename to playlet-lib/src/components/WebServer/Middleware/CorsMiddleware.bs
diff --git a/src/components/WebServer/Middleware/DashRouter.bs b/playlet-lib/src/components/WebServer/Middleware/DashRouter.bs
similarity index 100%
rename from src/components/WebServer/Middleware/DashRouter.bs
rename to playlet-lib/src/components/WebServer/Middleware/DashRouter.bs
diff --git a/src/components/WebServer/Middleware/HttpDefaultRouter.bs b/playlet-lib/src/components/WebServer/Middleware/HttpDefaultRouter.bs
similarity index 100%
rename from src/components/WebServer/Middleware/HttpDefaultRouter.bs
rename to playlet-lib/src/components/WebServer/Middleware/HttpDefaultRouter.bs
diff --git a/src/components/WebServer/Middleware/HttpStaticFilesRouter.bs b/playlet-lib/src/components/WebServer/Middleware/HttpStaticFilesRouter.bs
similarity index 91%
rename from src/components/WebServer/Middleware/HttpStaticFilesRouter.bs
rename to playlet-lib/src/components/WebServer/Middleware/HttpStaticFilesRouter.bs
index a462f3c8..4cf3e881 100644
--- a/src/components/WebServer/Middleware/HttpStaticFilesRouter.bs
+++ b/playlet-lib/src/components/WebServer/Middleware/HttpStaticFilesRouter.bs
@@ -7,8 +7,9 @@ namespace Http
private route
private showDirectories
private showHidden
+ private fsCheck
- function new(route as string, root as string, showDirectories = false as boolean, showHidden = false as boolean)
+ function new(route as string, root as string, showDirectories = false as boolean, showHidden = false as boolean, fsCheck = true as boolean)
super()
m.log = new log.Logger("HttpStaticFilesRouter")
@@ -16,6 +17,7 @@ namespace Http
m.route = route
m.showDirectories = showDirectories
m.showHidden = showHidden
+ m.fsCheck = fsCheck
m.Get("*", function(context as object) as boolean
router = context.router
@@ -31,6 +33,19 @@ namespace Http
decoded_path = path_in_route.DecodeUri()
full_path = PathJoin(router.root, decoded_path)
+ if not router.fsCheck
+ ' libpkg:/ does not work with roFilesystem...
+ buffer = createObject("roByteArray")
+ if buffer.ReadFile(full_path) and buffer.count() > 0
+ mimetype = WebUtils.MimeType(decoded_path)
+ response.SetBodyDataBuffer(buffer)
+ response.ContentType(mimetype)
+ response.http_code = 200
+ response.source = Http.HttpResponseSource.GENERATED
+ return true
+ end if
+ end if
+
path = CreateObject("roPath", full_path)
fs = CreateObject("roFilesystem")
diff --git a/src/components/WebServer/Middleware/InvidiousRouter.bs b/playlet-lib/src/components/WebServer/Middleware/InvidiousRouter.bs
similarity index 100%
rename from src/components/WebServer/Middleware/InvidiousRouter.bs
rename to playlet-lib/src/components/WebServer/Middleware/InvidiousRouter.bs
diff --git a/src/components/WebServer/Middleware/RegistryApiRouter.bs b/playlet-lib/src/components/WebServer/Middleware/RegistryApiRouter.bs
similarity index 100%
rename from src/components/WebServer/Middleware/RegistryApiRouter.bs
rename to playlet-lib/src/components/WebServer/Middleware/RegistryApiRouter.bs
diff --git a/src/components/WebServer/Middleware/StateApiRouter.bs b/playlet-lib/src/components/WebServer/Middleware/StateApiRouter.bs
similarity index 100%
rename from src/components/WebServer/Middleware/StateApiRouter.bs
rename to playlet-lib/src/components/WebServer/Middleware/StateApiRouter.bs
diff --git a/src/components/WebServer/Task/WebServerTask.bs b/playlet-lib/src/components/WebServer/Task/WebServerTask.bs
similarity index 92%
rename from src/components/WebServer/Task/WebServerTask.bs
rename to playlet-lib/src/components/WebServer/Task/WebServerTask.bs
index a1a9df00..306b7b99 100644
--- a/src/components/WebServer/Task/WebServerTask.bs
+++ b/playlet-lib/src/components/WebServer/Task/WebServerTask.bs
@@ -21,7 +21,7 @@ function WebServerLoop()
m.settings = new Http.HttpSettings(m.webServerPort)
' Root at www to get http://IP_ADDRESS:PORT/index.html
- m.settings.WwwRoot = "pkg:/www"
+ m.settings.WwwRoot = "libpkg:/www"
' Short interval to keep polling on web socket messages
m.settings.Timeout = 500
m.server = new Http.HttpServer(m.settings, m)
@@ -43,11 +43,11 @@ function WebServerLoop()
return true
end function)
- #if DEBUG
+ if IsDebugMode()
allowedOrigin = "*"
- #else
+ else
allowedOrigin = `http://${GetLocalIpAddress()}:8888`
- #end if
+ end if
m.server.UseRouter(new Http.CorsMiddleware(allowedOrigin))
#if WEB_SOCKETS
m.server.UseRouter(new Http.WebSocketMiddleware())
@@ -57,13 +57,14 @@ function WebServerLoop()
m.server.UseRouter(new Http.CommandsApiRouter())
m.server.UseRouter(new Http.StateApiRouter())
m.server.UseRouter(new Http.InvidiousRouter())
- m.server.UseRouter(new Http.HttpStaticFilesRouter("/", m.settings.WwwRoot))
- #if DEBUG
+ m.server.UseRouter(new Http.HttpStaticFilesRouter("/", m.settings.WwwRoot, false, false, false))
+ if IsDebugMode()
+ m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/libpkg", "libpkg:/", true, true, false))
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/pkg", "pkg:/", true, true))
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/tmp", "tmp:/", true, true))
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/cachefs", "cachefs:/", true, true))
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/common", "common:/", true, true))
- #end if
+ end if
#if WEB_SERVER_BASIC_AUTH
m.server.UseRouter(new Http.BasicAuthMiddleware())
#end if
diff --git a/src/components/WebServer/Task/WebServerTask.xml b/playlet-lib/src/components/WebServer/Task/WebServerTask.xml
similarity index 78%
rename from src/components/WebServer/Task/WebServerTask.xml
rename to playlet-lib/src/components/WebServer/Task/WebServerTask.xml
index af65b7ea..df185c42 100644
--- a/src/components/WebServer/Task/WebServerTask.xml
+++ b/playlet-lib/src/components/WebServer/Task/WebServerTask.xml
@@ -5,4 +5,5 @@
+
diff --git a/src/components/WebServer/WebSocket/Middleware/WebSocketMiddleware.bs b/playlet-lib/src/components/WebServer/WebSocket/Middleware/WebSocketMiddleware.bs
similarity index 100%
rename from src/components/WebServer/WebSocket/Middleware/WebSocketMiddleware.bs
rename to playlet-lib/src/components/WebServer/WebSocket/Middleware/WebSocketMiddleware.bs
diff --git a/src/components/WebServer/WebSocket/WebSocketConnection.bs b/playlet-lib/src/components/WebServer/WebSocket/WebSocketConnection.bs
similarity index 100%
rename from src/components/WebServer/WebSocket/WebSocketConnection.bs
rename to playlet-lib/src/components/WebServer/WebSocket/WebSocketConnection.bs
diff --git a/src/components/WebServer/WebSocket/WebSocketConnectionState.bs b/playlet-lib/src/components/WebServer/WebSocket/WebSocketConnectionState.bs
similarity index 100%
rename from src/components/WebServer/WebSocket/WebSocketConnectionState.bs
rename to playlet-lib/src/components/WebServer/WebSocket/WebSocketConnectionState.bs
diff --git a/src/components/WebServer/WebSocket/WebSocketFrame.bs b/playlet-lib/src/components/WebServer/WebSocket/WebSocketFrame.bs
similarity index 100%
rename from src/components/WebServer/WebSocket/WebSocketFrame.bs
rename to playlet-lib/src/components/WebServer/WebSocket/WebSocketFrame.bs
diff --git a/src/components/WebServer/WebSocket/WebSocketOpCode.bs b/playlet-lib/src/components/WebServer/WebSocket/WebSocketOpCode.bs
similarity index 100%
rename from src/components/WebServer/WebSocket/WebSocketOpCode.bs
rename to playlet-lib/src/components/WebServer/WebSocket/WebSocketOpCode.bs
diff --git a/src/components/WebServer/WebSocket/WebSocketServer.bs b/playlet-lib/src/components/WebServer/WebSocket/WebSocketServer.bs
similarity index 100%
rename from src/components/WebServer/WebSocket/WebSocketServer.bs
rename to playlet-lib/src/components/WebServer/WebSocket/WebSocketServer.bs
diff --git a/src/components/lib/QRCode/CREDITS.txt b/playlet-lib/src/components/lib/QRCode/CREDITS.txt
similarity index 100%
rename from src/components/lib/QRCode/CREDITS.txt
rename to playlet-lib/src/components/lib/QRCode/CREDITS.txt
diff --git a/src/components/lib/QRCode/QRCode/QRBitBuffer/QRBitBuffer.brs b/playlet-lib/src/components/lib/QRCode/QRCode/QRBitBuffer/QRBitBuffer.brs
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRBitBuffer/QRBitBuffer.brs
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRBitBuffer/QRBitBuffer.brs
diff --git a/src/components/lib/QRCode/QRCode/QRBitBuffer/QRBitBuffer.xml b/playlet-lib/src/components/lib/QRCode/QRCode/QRBitBuffer/QRBitBuffer.xml
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRBitBuffer/QRBitBuffer.xml
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRBitBuffer/QRBitBuffer.xml
diff --git a/src/components/lib/QRCode/QRCode/QRCode.brs b/playlet-lib/src/components/lib/QRCode/QRCode/QRCode.brs
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRCode.brs
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRCode.brs
diff --git a/src/components/lib/QRCode/QRCode/QRCode.exports.brs b/playlet-lib/src/components/lib/QRCode/QRCode/QRCode.exports.brs
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRCode.exports.brs
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRCode.exports.brs
diff --git a/src/components/lib/QRCode/QRCode/QRCode.xml b/playlet-lib/src/components/lib/QRCode/QRCode/QRCode.xml
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRCode.xml
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRCode.xml
diff --git a/src/components/lib/QRCode/QRCode/QRData/QRData.brs b/playlet-lib/src/components/lib/QRCode/QRCode/QRData/QRData.brs
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRData/QRData.brs
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRData/QRData.brs
diff --git a/src/components/lib/QRCode/QRCode/QRData/QRData.xml b/playlet-lib/src/components/lib/QRCode/QRCode/QRData/QRData.xml
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRData/QRData.xml
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRData/QRData.xml
diff --git a/src/components/lib/QRCode/QRCode/QRData_AlphaNumeric/QRData_AlphaNumeric.brs b/playlet-lib/src/components/lib/QRCode/QRCode/QRData_AlphaNumeric/QRData_AlphaNumeric.brs
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRData_AlphaNumeric/QRData_AlphaNumeric.brs
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRData_AlphaNumeric/QRData_AlphaNumeric.brs
diff --git a/src/components/lib/QRCode/QRCode/QRData_AlphaNumeric/QRData_AlphaNumeric.xml b/playlet-lib/src/components/lib/QRCode/QRCode/QRData_AlphaNumeric/QRData_AlphaNumeric.xml
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRData_AlphaNumeric/QRData_AlphaNumeric.xml
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRData_AlphaNumeric/QRData_AlphaNumeric.xml
diff --git a/src/components/lib/QRCode/QRCode/QRData_Byte/QRData_Byte.brs b/playlet-lib/src/components/lib/QRCode/QRCode/QRData_Byte/QRData_Byte.brs
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRData_Byte/QRData_Byte.brs
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRData_Byte/QRData_Byte.brs
diff --git a/src/components/lib/QRCode/QRCode/QRData_Byte/QRData_Byte.xml b/playlet-lib/src/components/lib/QRCode/QRCode/QRData_Byte/QRData_Byte.xml
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRData_Byte/QRData_Byte.xml
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRData_Byte/QRData_Byte.xml
diff --git a/src/components/lib/QRCode/QRCode/QRData_Kanji/QRData_Kanji.brs b/playlet-lib/src/components/lib/QRCode/QRCode/QRData_Kanji/QRData_Kanji.brs
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRData_Kanji/QRData_Kanji.brs
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRData_Kanji/QRData_Kanji.brs
diff --git a/src/components/lib/QRCode/QRCode/QRData_Kanji/QRData_Kanji.xml b/playlet-lib/src/components/lib/QRCode/QRCode/QRData_Kanji/QRData_Kanji.xml
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRData_Kanji/QRData_Kanji.xml
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRData_Kanji/QRData_Kanji.xml
diff --git a/src/components/lib/QRCode/QRCode/QRData_Numeric/QRData_Numeric.brs b/playlet-lib/src/components/lib/QRCode/QRCode/QRData_Numeric/QRData_Numeric.brs
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRData_Numeric/QRData_Numeric.brs
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRData_Numeric/QRData_Numeric.brs
diff --git a/src/components/lib/QRCode/QRCode/QRData_Numeric/QRData_Numeric.xml b/playlet-lib/src/components/lib/QRCode/QRCode/QRData_Numeric/QRData_Numeric.xml
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRData_Numeric/QRData_Numeric.xml
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRData_Numeric/QRData_Numeric.xml
diff --git a/src/components/lib/QRCode/QRCode/QRRSBlock/QRRSBlock.brs b/playlet-lib/src/components/lib/QRCode/QRCode/QRRSBlock/QRRSBlock.brs
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRRSBlock/QRRSBlock.brs
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRRSBlock/QRRSBlock.brs
diff --git a/src/components/lib/QRCode/QRCode/QRRSBlock/QRRSBlock.xml b/playlet-lib/src/components/lib/QRCode/QRCode/QRRSBlock/QRRSBlock.xml
similarity index 100%
rename from src/components/lib/QRCode/QRCode/QRRSBlock/QRRSBlock.xml
rename to playlet-lib/src/components/lib/QRCode/QRCode/QRRSBlock/QRRSBlock.xml
diff --git a/src/components/lib/QRCode/QRPoster/QRPoster.brs b/playlet-lib/src/components/lib/QRCode/QRPoster/QRPoster.brs
similarity index 100%
rename from src/components/lib/QRCode/QRPoster/QRPoster.brs
rename to playlet-lib/src/components/lib/QRCode/QRPoster/QRPoster.brs
diff --git a/src/components/lib/QRCode/QRPoster/QRPoster.xml b/playlet-lib/src/components/lib/QRCode/QRPoster/QRPoster.xml
similarity index 100%
rename from src/components/lib/QRCode/QRPoster/QRPoster.xml
rename to playlet-lib/src/components/lib/QRCode/QRPoster/QRPoster.xml
diff --git a/src/components/lib/QRCode/QRPrinter/QRPrinter.brs b/playlet-lib/src/components/lib/QRCode/QRPrinter/QRPrinter.brs
similarity index 100%
rename from src/components/lib/QRCode/QRPrinter/QRPrinter.brs
rename to playlet-lib/src/components/lib/QRCode/QRPrinter/QRPrinter.brs
diff --git a/src/components/lib/QRCode/QRPrinter/QRPrinter.xml b/playlet-lib/src/components/lib/QRCode/QRPrinter/QRPrinter.xml
similarity index 100%
rename from src/components/lib/QRCode/QRPrinter/QRPrinter.xml
rename to playlet-lib/src/components/lib/QRCode/QRPrinter/QRPrinter.xml
diff --git a/src/components/lib/QRCode/TestQRCode/TestQRCode.brs b/playlet-lib/src/components/lib/QRCode/TestQRCode/TestQRCode.brs
similarity index 100%
rename from src/components/lib/QRCode/TestQRCode/TestQRCode.brs
rename to playlet-lib/src/components/lib/QRCode/TestQRCode/TestQRCode.brs
diff --git a/src/components/lib/QRCode/TestQRCode/TestQRCode.xml b/playlet-lib/src/components/lib/QRCode/TestQRCode/TestQRCode.xml
similarity index 100%
rename from src/components/lib/QRCode/TestQRCode/TestQRCode.xml
rename to playlet-lib/src/components/lib/QRCode/TestQRCode/TestQRCode.xml
diff --git a/src/components/lib/QRCode/TestQRMath/TestQRMath.brs b/playlet-lib/src/components/lib/QRCode/TestQRMath/TestQRMath.brs
similarity index 100%
rename from src/components/lib/QRCode/TestQRMath/TestQRMath.brs
rename to playlet-lib/src/components/lib/QRCode/TestQRMath/TestQRMath.brs
diff --git a/src/components/lib/QRCode/TestQRMath/TestQRMath.xml b/playlet-lib/src/components/lib/QRCode/TestQRMath/TestQRMath.xml
similarity index 100%
rename from src/components/lib/QRCode/TestQRMath/TestQRMath.xml
rename to playlet-lib/src/components/lib/QRCode/TestQRMath/TestQRMath.xml
diff --git a/src/config/default_home_layout.json b/playlet-lib/src/config/default_home_layout.json
similarity index 100%
rename from src/config/default_home_layout.json
rename to playlet-lib/src/config/default_home_layout.json
diff --git a/src/config/invidious_video_api.json b/playlet-lib/src/config/invidious_video_api.json
similarity index 100%
rename from src/config/invidious_video_api.json
rename to playlet-lib/src/config/invidious_video_api.json
diff --git a/src/images/focus_grid.9.png b/playlet-lib/src/images/focus_grid.9.png
similarity index 100%
rename from src/images/focus_grid.9.png
rename to playlet-lib/src/images/focus_grid.9.png
diff --git a/src/images/icons/home.png b/playlet-lib/src/images/icons/home.png
similarity index 100%
rename from src/images/icons/home.png
rename to playlet-lib/src/images/icons/home.png
diff --git a/src/images/icons/search.png b/playlet-lib/src/images/icons/search.png
similarity index 100%
rename from src/images/icons/search.png
rename to playlet-lib/src/images/icons/search.png
diff --git a/src/images/icons/settings.png b/playlet-lib/src/images/icons/settings.png
similarity index 100%
rename from src/images/icons/settings.png
rename to playlet-lib/src/images/icons/settings.png
diff --git a/src/images/thumbnail-missing.jpg b/playlet-lib/src/images/thumbnail-missing.jpg
similarity index 100%
rename from src/images/thumbnail-missing.jpg
rename to playlet-lib/src/images/thumbnail-missing.jpg
diff --git a/src/images/white.9.png b/playlet-lib/src/images/white.9.png
similarity index 100%
rename from src/images/white.9.png
rename to playlet-lib/src/images/white.9.png
diff --git a/playlet-lib/src/manifest b/playlet-lib/src/manifest
new file mode 100644
index 00000000..acaf0b00
--- /dev/null
+++ b/playlet-lib/src/manifest
@@ -0,0 +1,11 @@
+title=PlayletLib
+
+# Do not update version manually, it is auto updated from package.json
+major_version=0
+minor_version=6
+build_version=00000
+
+sg_component_libs_provided=PlayletLib
+hidden=1
+
+bs_const=DEBUG=false;WEB_SERVER_BASIC_AUTH=false;DASH_THUMBNAILS=false;WEB_SOCKETS=true
\ No newline at end of file
diff --git a/src/source/asyncTask/asyncTask.bs b/playlet-lib/src/source/asyncTask/asyncTask.bs
similarity index 100%
rename from src/source/asyncTask/asyncTask.bs
rename to playlet-lib/src/source/asyncTask/asyncTask.bs
diff --git a/src/source/models/SearchFilter.bs b/playlet-lib/src/source/models/SearchFilter.bs
similarity index 100%
rename from src/source/models/SearchFilter.bs
rename to playlet-lib/src/source/models/SearchFilter.bs
diff --git a/src/source/models/SearchSuggestionResult.bs b/playlet-lib/src/source/models/SearchSuggestionResult.bs
similarity index 100%
rename from src/source/models/SearchSuggestionResult.bs
rename to playlet-lib/src/source/models/SearchSuggestionResult.bs
diff --git a/src/source/services/Invidious.bs b/playlet-lib/src/source/services/Invidious.bs
similarity index 100%
rename from src/source/services/Invidious.bs
rename to playlet-lib/src/source/services/Invidious.bs
diff --git a/src/source/services/InvidiousService.bs b/playlet-lib/src/source/services/InvidiousService.bs
similarity index 98%
rename from src/source/services/InvidiousService.bs
rename to playlet-lib/src/source/services/InvidiousService.bs
index b193e45d..75e80c41 100644
--- a/src/source/services/InvidiousService.bs
+++ b/playlet-lib/src/source/services/InvidiousService.bs
@@ -9,7 +9,7 @@ class InvidiousService
private responseHanlders
function new()
- apiDefnitions = ParseJson(ReadAsciiFile("pkg:/config/invidious_video_api.json"))
+ apiDefnitions = ParseJson(ReadAsciiFile("libpkg:/config/invidious_video_api.json"))
m.endpoints = {}
for each apiDefnition in apiDefnitions.endpoints
diff --git a/src/source/services/InvidiousSettings.bs b/playlet-lib/src/source/services/InvidiousSettings.bs
similarity index 100%
rename from src/source/services/InvidiousSettings.bs
rename to playlet-lib/src/source/services/InvidiousSettings.bs
diff --git a/src/source/services/SponsorBlock.bs b/playlet-lib/src/source/services/SponsorBlock.bs
similarity index 100%
rename from src/source/services/SponsorBlock.bs
rename to playlet-lib/src/source/services/SponsorBlock.bs
diff --git a/src/source/utils/Crypto.bs b/playlet-lib/src/source/utils/Crypto.bs
similarity index 100%
rename from src/source/utils/Crypto.bs
rename to playlet-lib/src/source/utils/Crypto.bs
diff --git a/playlet-lib/src/source/utils/Debug.bs b/playlet-lib/src/source/utils/Debug.bs
new file mode 100644
index 00000000..13ce179a
--- /dev/null
+++ b/playlet-lib/src/source/utils/Debug.bs
@@ -0,0 +1,17 @@
+function IsDebugMode() as boolean
+ appInfo = CreateObject("roAppInfo")
+ bsConst = appInfo.GetValue("bs_const")
+ symbols = bsConst.Tokenize(";")
+
+ for each symbol in symbols
+ keyValuePair = symbol.Tokenize("=")
+ if keyValuePair.Count() <> 2
+ continue for
+ end if
+ if UCase(keyValuePair[0]) = "DEBUG"
+ return UCase(keyValuePair[1]) = "TRUE"
+ end if
+ end for
+
+ return false
+end function
diff --git a/src/source/utils/General.bs b/playlet-lib/src/source/utils/General.bs
similarity index 69%
rename from src/source/utils/General.bs
rename to playlet-lib/src/source/utils/General.bs
index 1ab9b4c2..5a2f4073 100644
--- a/src/source/utils/General.bs
+++ b/playlet-lib/src/source/utils/General.bs
@@ -22,12 +22,41 @@ function GetAppInfo() as object
appInfo = CreateObject("roAppInfo")
m.appInfo = {
id: appInfo.GetID(),
- version: appInfo.GetVersion()
+ version: appInfo.GetVersion(),
+ lib_version: GetLibVersion()
}
end if
return m.appInfo
end function
+function GetLibVersion() as string
+ values = GetLibManifestValues()
+
+ Major = values["major_version"].toInt()
+ Minor = values["minor_version"].toInt()
+ Build = values["build_version"].toInt()
+
+ return `${Major}.${Minor}.${Build}`
+end function
+
+function GetLibManifestValues() as object
+ libManifest = ReadAsciiFile("libpkg:/manifest")
+ lines = libManifest.Tokenize(UnixNL())
+ values = {}
+ for each line in lines
+ if line.left(1) = "#"
+ continue for
+ end if
+ keyValuePair = line.Tokenize("=")
+ if keyValuePair.Count() <> 2
+ continue for
+ end if
+
+ values[keyValuePair[0]] = keyValuePair[1]
+ end for
+ return values
+end function
+
function GetDeviceInfo() as object
if m.deviceInfo = invalid
devInfo = CreateObject("roDeviceInfo")
diff --git a/src/source/utils/RegistryUtils.bs b/playlet-lib/src/source/utils/RegistryUtils.bs
similarity index 100%
rename from src/source/utils/RegistryUtils.bs
rename to playlet-lib/src/source/utils/RegistryUtils.bs
diff --git a/src/source/utils/StringUtils.bs b/playlet-lib/src/source/utils/StringUtils.bs
similarity index 100%
rename from src/source/utils/StringUtils.bs
rename to playlet-lib/src/source/utils/StringUtils.bs
diff --git a/src/source/utils/TimeUtils.bs b/playlet-lib/src/source/utils/TimeUtils.bs
similarity index 100%
rename from src/source/utils/TimeUtils.bs
rename to playlet-lib/src/source/utils/TimeUtils.bs
diff --git a/src/source/utils/Types.bs b/playlet-lib/src/source/utils/Types.bs
similarity index 100%
rename from src/source/utils/Types.bs
rename to playlet-lib/src/source/utils/Types.bs
diff --git a/src/source/utils/WebUtils.bs b/playlet-lib/src/source/utils/WebUtils.bs
similarity index 100%
rename from src/source/utils/WebUtils.bs
rename to playlet-lib/src/source/utils/WebUtils.bs
diff --git a/playlet-web/vite.config.ts b/playlet-web/vite.config.ts
index eddf799e..17a62a25 100644
--- a/playlet-web/vite.config.ts
+++ b/playlet-web/vite.config.ts
@@ -13,7 +13,7 @@ const PORT = 5173
export default defineConfig({
plugins: [svelte()],
build: {
- outDir: "../src/www",
+ outDir: "../playlet-lib/src/www",
emptyOutDir: true
},
server: {
diff --git a/playlet/bsconfig.json b/playlet/bsconfig.json
new file mode 100644
index 00000000..cf5bf9be
--- /dev/null
+++ b/playlet/bsconfig.json
@@ -0,0 +1,6 @@
+{
+ "extends": "../config/bsconfig.base.json",
+ "rootDir": "src/",
+ "stagingDir": "../dist/build/playlet",
+ "outFile": "../release/playlet.zip"
+}
\ No newline at end of file
diff --git a/playlet/bsconfig.lint.json b/playlet/bsconfig.lint.json
new file mode 100644
index 00000000..920ff760
--- /dev/null
+++ b/playlet/bsconfig.lint.json
@@ -0,0 +1,7 @@
+{
+ "createPackage": false,
+ "deploy": false,
+ "extends": "bsconfig.json",
+ "retainStagingDir": false,
+ "sourceMap": false
+}
\ No newline at end of file
diff --git a/playlet/src/components/BootstrapScene/BootstrapScene.bs b/playlet/src/components/BootstrapScene/BootstrapScene.bs
new file mode 100644
index 00000000..1f19d887
--- /dev/null
+++ b/playlet/src/components/BootstrapScene/BootstrapScene.bs
@@ -0,0 +1,103 @@
+function Init() as void
+ m.top.backgroundColor = "0x242424FF"
+ m.top.backgroundURI = ""
+
+ m.loadingIndicator = m.top.findNode("LoadingIndicator")
+ m.loadingIndicator.visible = true
+ m.global.addFields({
+ loadingIndicator: m.loadingIndicator
+ })
+
+ m.playletLibUrls = GetPlayletLibUrls()
+ m.playletLibUrlIndex = 0
+
+ LoadPlayletLib()
+end function
+
+function GetPlayletLibUrls() as object
+ github = { type: "github", link: ReadManifestValue("playlet_lib_remote_url") }
+ embedded = { type: "embedded", link: ReadManifestValue("playlet_lib_embedded_url") }
+ registry = { type: "registry", link: ReadRegistryKey("playlet_lib_url", "Playlet") }
+
+ if IsDebugMode()
+ return [embedded]
+ end if
+
+ urls = []
+
+ if registry.link <> invalid
+ urls.Push(registry)
+ end if
+
+ urls.push(github)
+ urls.push(embedded)
+
+ return urls
+end function
+
+function LoadPlayletLib() as void
+ if m.playletLibUrlIndex >= m.playletLibUrls.Count()
+ m.loadingIndicator.visible = false
+ ShowPlayletLibLoadErrorDialog()
+ return
+ end if
+
+ RemoveComponentLibrary()
+ m.lib = m.top.getScene().createChild("ComponentLibrary")
+ m.lib.observeField("loadStatus", "OnLoadStatusChanged")
+
+ uri = m.playletLibUrls[m.playletLibUrlIndex].link
+ ?"Loading Playlet lib from " uri
+ m.lib.uri = uri
+end function
+
+function OnLoadStatusChanged() as void
+ uri = m.playletLibUrls[m.playletLibUrlIndex].link
+ if m.lib.loadStatus = "ready"
+ RemoveComponentLibrary()
+ ?"Playlet lib loaded from " uri
+ scene = m.top.getScene()
+ container = scene.findNode("MainSceneContainer")
+ container.createChild("PlayletLib:MainScene")
+ return
+ end if
+
+ if m.lib.loadStatus = "failed"
+ ?"Playlet lib failed to load from " uri
+ if m.playletLibUrls[m.playletLibUrlIndex].type = "registry"
+ ' Delete library url from registry since it failed
+ DeleteRegistryKey("playlet_lib_url", "Playlet")
+ end if
+ ' Try next url
+ m.playletLibUrlIndex += 1
+ LoadPlayletLib()
+ end if
+end function
+
+function RemoveComponentLibrary() as void
+ if m.lib = invalid
+ return
+ end if
+
+ scene = m.top.getScene()
+ scene.removeChild(m.lib)
+ m.lib = invalid
+end function
+
+function ShowPlayletLibLoadErrorDialog()
+ message = [
+ "Could not load Playlet component library from any of the following urls:",
+ ]
+
+ bulletText = []
+ for each url in m.playletLibUrls
+ bulletText.push("[" + url.type + "] " + url.link)
+ end for
+
+ bottomText = [
+ "Please restart Playlet.",
+ "If the problem persist, contact Playlet authors."
+ ]
+
+ ShowErrorDialog(message, bulletText, bottomText)
+end function
diff --git a/playlet/src/components/BootstrapScene/BootstrapScene.xml b/playlet/src/components/BootstrapScene/BootstrapScene.xml
new file mode 100644
index 00000000..4bb496cf
--- /dev/null
+++ b/playlet/src/components/BootstrapScene/BootstrapScene.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/LoadingIndicator/LoadingIndicator.bs b/playlet/src/components/LoadingIndicator/LoadingIndicator.bs
similarity index 100%
rename from src/components/LoadingIndicator/LoadingIndicator.bs
rename to playlet/src/components/LoadingIndicator/LoadingIndicator.bs
diff --git a/src/components/LoadingIndicator/LoadingIndicator.xml b/playlet/src/components/LoadingIndicator/LoadingIndicator.xml
similarity index 100%
rename from src/components/LoadingIndicator/LoadingIndicator.xml
rename to playlet/src/components/LoadingIndicator/LoadingIndicator.xml
diff --git a/src/images/channel-poster_fhd.png b/playlet/src/images/channel-poster_fhd.png
similarity index 100%
rename from src/images/channel-poster_fhd.png
rename to playlet/src/images/channel-poster_fhd.png
diff --git a/src/images/channel-poster_hd.png b/playlet/src/images/channel-poster_hd.png
similarity index 100%
rename from src/images/channel-poster_hd.png
rename to playlet/src/images/channel-poster_hd.png
diff --git a/src/images/channel-poster_sd.png b/playlet/src/images/channel-poster_sd.png
similarity index 100%
rename from src/images/channel-poster_sd.png
rename to playlet/src/images/channel-poster_sd.png
diff --git a/src/images/spinner.png b/playlet/src/images/spinner.png
similarity index 100%
rename from src/images/spinner.png
rename to playlet/src/images/spinner.png
diff --git a/src/images/splash-screen_fhd.jpg b/playlet/src/images/splash-screen_fhd.jpg
similarity index 100%
rename from src/images/splash-screen_fhd.jpg
rename to playlet/src/images/splash-screen_fhd.jpg
diff --git a/src/images/splash-screen_hd.jpg b/playlet/src/images/splash-screen_hd.jpg
similarity index 100%
rename from src/images/splash-screen_hd.jpg
rename to playlet/src/images/splash-screen_hd.jpg
diff --git a/src/images/splash-screen_sd.jpg b/playlet/src/images/splash-screen_sd.jpg
similarity index 100%
rename from src/images/splash-screen_sd.jpg
rename to playlet/src/images/splash-screen_sd.jpg
diff --git a/src/images/vector/icons/home.svg b/playlet/src/images/vector/icons/home.svg
similarity index 100%
rename from src/images/vector/icons/home.svg
rename to playlet/src/images/vector/icons/home.svg
diff --git a/src/images/vector/icons/search.svg b/playlet/src/images/vector/icons/search.svg
similarity index 100%
rename from src/images/vector/icons/search.svg
rename to playlet/src/images/vector/icons/search.svg
diff --git a/src/images/vector/icons/settings.svg b/playlet/src/images/vector/icons/settings.svg
similarity index 100%
rename from src/images/vector/icons/settings.svg
rename to playlet/src/images/vector/icons/settings.svg
diff --git a/src/images/vector/logo-dark.svg b/playlet/src/images/vector/logo-dark.svg
similarity index 100%
rename from src/images/vector/logo-dark.svg
rename to playlet/src/images/vector/logo-dark.svg
diff --git a/src/images/vector/logo-fav.svg b/playlet/src/images/vector/logo-fav.svg
similarity index 100%
rename from src/images/vector/logo-fav.svg
rename to playlet/src/images/vector/logo-fav.svg
diff --git a/src/images/vector/logo-light.svg b/playlet/src/images/vector/logo-light.svg
similarity index 100%
rename from src/images/vector/logo-light.svg
rename to playlet/src/images/vector/logo-light.svg
diff --git a/src/manifest b/playlet/src/manifest
similarity index 76%
rename from src/manifest
rename to playlet/src/manifest
index 530e8584..dfcafd9c 100644
--- a/src/manifest
+++ b/playlet/src/manifest
@@ -23,4 +23,7 @@ splash_min_time=0
supports_input_launch=1
-bs_const=DEBUG=true;WEB_SERVER_BASIC_AUTH=false;DASH_THUMBNAILS=false;WEB_SOCKETS=true
\ No newline at end of file
+playlet_lib_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip
+playlet_lib_embedded_url=pkg:/lib/playlet-lib.zip
+
+bs_const=DEBUG=false;WEB_SERVER_BASIC_AUTH=false;DASH_THUMBNAILS=false;WEB_SOCKETS=true
\ No newline at end of file
diff --git a/playlet/src/source/Dialog.bs b/playlet/src/source/Dialog.bs
new file mode 100644
index 00000000..c62ee947
--- /dev/null
+++ b/playlet/src/source/Dialog.bs
@@ -0,0 +1,21 @@
+function ShowErrorDialog(message as object, bulletText as object, bottomMessage as object)
+ dialog = CreateObject("roSGNode", "StandardMessageDialog")
+ dialog.message = message
+ dialog.bulletText = bulletText
+ dialog.bottomMessage = bottomMessage
+ dialog.title = "Error loading Playlet"
+ dialog.buttons = ["Exit"]
+
+ dialog.observeField("buttonSelected", "OnButtonSelected")
+ dialog.observeField("wasClosed", "OnDialogClosed")
+
+ m.top.getScene().dialog = dialog
+end function
+
+function OnButtonSelected()
+ m.top.getScene().dialog.close = true
+end function
+
+function OnDialogClosed()
+ m.top.getScene().exitChannel = true
+end function
diff --git a/src/source/main.bs b/playlet/src/source/Main.bs
similarity index 83%
rename from src/source/main.bs
rename to playlet/src/source/Main.bs
index dcc4d2b3..9fb9434b 100644
--- a/src/source/main.bs
+++ b/playlet/src/source/Main.bs
@@ -14,13 +14,13 @@
' You should have received a copy of the GNU Affero General Public License
' along with this program. If not, see .
-function main(args as object) as void
+function Main(args as object) as void
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
m.global = screen.getGlobalNode()
- scene = screen.CreateScene("MainScene")
+ scene = screen.CreateScene("BootstrapScene")
screen.show()
scene.signalBeacon("AppLaunchComplete")
@@ -30,11 +30,14 @@ function main(args as object) as void
input = CreateObject("roInput")
input.setMessagePort(m.port)
- ' The following comment is to enable the SceneGraph inspector
- ' on the VSCode BrightScript plugin.
- #if DEBUG
+ if IsDebugMode()
+ ' The following comment is to enable the SceneGraph inspector
+ ' on the VSCode BrightScript plugin.
' vscode_rdb_on_device_component_entry
- #end if
+
+ ' The following comment is to enable RALE tracking
+ ' vscode_rale_tracker_entry
+ end if
while true
msg = wait(0, m.port)
@@ -53,4 +56,5 @@ function main(args as object) as void
scene.inputArgs = msg.getInfo()
end if
end while
+
end function
diff --git a/playlet/src/source/Manifest.bs b/playlet/src/source/Manifest.bs
new file mode 100644
index 00000000..a7016007
--- /dev/null
+++ b/playlet/src/source/Manifest.bs
@@ -0,0 +1,27 @@
+function IsDebugMode() as boolean
+ bsConst = GetBsConstValues()
+ return bsConst["DEBUG"]
+end function
+
+function GetBsConstValues() as object
+ result = {}
+
+ bsConst = ReadManifestValue("bs_const")
+ symbols = bsConst.Tokenize(";")
+
+ for each symbol in symbols
+ keyValuePair = symbol.Tokenize("=")
+ if keyValuePair.Count() <> 2
+ continue for
+ end if
+
+ result[UCase(keyValuePair[0])] = UCase(keyValuePair[1]) = "TRUE"
+ end for
+
+ return result
+end function
+
+function ReadManifestValue(key as string) as string
+ appInfo = CreateObject("roAppInfo")
+ return appInfo.GetValue(key)
+end function
diff --git a/playlet/src/source/Registry.bs b/playlet/src/source/Registry.bs
new file mode 100644
index 00000000..7484a8a9
--- /dev/null
+++ b/playlet/src/source/Registry.bs
@@ -0,0 +1,13 @@
+function ReadRegistryKey(key as string, section as string) as dynamic
+ sec = CreateObject("roRegistrySection", section)
+ if not sec.Exists(key)
+ return invalid
+ end if
+ return sec.Read(key)
+end function
+
+function DeleteRegistryKey(key as string, section as string)
+ sec = CreateObject("roRegistrySection", section)
+ sec.Delete(key)
+ sec.Flush()
+end function
diff --git a/scripts/update-manifest-symbols.js b/scripts/update-manifest-symbols.js
deleted file mode 100644
index f301912d..00000000
--- a/scripts/update-manifest-symbols.js
+++ /dev/null
@@ -1,33 +0,0 @@
-const fs = require('fs');
-
-if (process.argv.length < 3) {
- console.error("Invalid usage! usage: npm run manifest-symbols -- SYMBOL1=true [SYMBOL2=false]");
- exit(-1);
-}
-
-function argsToSymbolsObject(arr) {
- return arr.reduce(function (acc, value) {
- keyValue = value.split("=");
- acc[keyValue[0]] = keyValue[1];
- return acc;
- }, {});
-}
-
-const newSymbols = argsToSymbolsObject(process.argv.slice(2));
-let currentSymbols = {}
-
-const appManifestLines = fs.readFileSync("./src/manifest", { encoding: 'utf8', flag: 'r' }).split('\n');
-const bsConstIndex = appManifestLines.findIndex(line => line.startsWith("bs_const="));
-if (bsConstIndex !== -1) {
- let bsConst = appManifestLines[bsConstIndex];
- bsConst = bsConst.substring("bs_const=".length);
- currentSymbols = argsToSymbolsObject(bsConst.split(";"))
-}
-
-mergedSymbols = { ...currentSymbols, ...newSymbols };
-
-bsConst = "bs_const=" + Object.keys(mergedSymbols).map(key => `${key}=${mergedSymbols[key]}`).join(";");
-
-appManifestLines[bsConstIndex] = bsConst;
-
-fs.writeFileSync("./src/manifest", appManifestLines.join("\n"));
\ No newline at end of file
diff --git a/scripts/update-manifest-version.js b/scripts/update-manifest-version.js
deleted file mode 100644
index 84336050..00000000
--- a/scripts/update-manifest-version.js
+++ /dev/null
@@ -1,25 +0,0 @@
-const path = require('path');
-const fs = require('fs');
-const { execSync } = require("child_process");
-
-const semverParse = require('semver/functions/parse');
-
-const packageJsonContent = fs.readFileSync("./package.json", { encoding: 'utf8', flag: 'r' });
-const packageJson = JSON.parse(packageJsonContent);
-
-const version = packageJson.version;
-const parsedVersion = semverParse(version);
-
-let appManifestContent = fs.readFileSync("./src/manifest", { encoding: 'utf8', flag: 'r' });
-
-const majorPattern = /major_version=(\d+)/;
-const minorPattern = /minor_version=(\d+)/;
-const buildPattern = /build_version=(\d+)/;
-
-appManifestContent = appManifestContent.replace(majorPattern, `major_version=${parsedVersion.major}`);
-appManifestContent = appManifestContent.replace(minorPattern, `minor_version=${parsedVersion.minor}`);
-appManifestContent = appManifestContent.replace(buildPattern, `build_version=${String(parsedVersion.patch).padStart(5, '0')}`);
-
-fs.writeFileSync("./src/manifest", appManifestContent);
-
-execSync(`npm version ${version} --allow-same-version`, { cwd: 'playlet-web' });
\ No newline at end of file
diff --git a/scripts/zip-package.js b/scripts/zip-package.js
deleted file mode 100644
index d9f00f6b..00000000
--- a/scripts/zip-package.js
+++ /dev/null
@@ -1,19 +0,0 @@
-const rokuDeploy = require('roku-deploy');
-
-const options = {
- outDir: 'release',
- outFile: 'playlet.zip',
- //BUG: rokuDeploy does not read stagingDir properly fron config
- stagingDir: 'dist/build',
- retainStagingDir: true
-};
-
-(async () => {
- try {
- await rokuDeploy.zipPackage(options);
- console.log(`${options.outFile} created`);
- }
- catch (error) {
- console.error(error);
- }
-})();
diff --git a/src/components/MainScene.xml b/src/components/MainScene.xml
deleted file mode 100644
index 4e05405d..00000000
--- a/src/components/MainScene.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/tools/RALE/LICENSE b/tools/RALE/LICENSE
new file mode 100644
index 00000000..f2bfe637
--- /dev/null
+++ b/tools/RALE/LICENSE
@@ -0,0 +1,23 @@
+Roku Advanced Layout Editor
+
+Copyright © 2022 Roku, Inc.
+
+The Roku Advanced Layout Editor and associated documentation (collectively, the “Software”)
+
+is licensed under the Apache License, Version 2.0 (the "License");
+
+you may not use this Software except in compliance with the License.
+
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, the Software
+
+distributed under the License is distributed on an "AS IS" BASIS,
+
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
+See the License for the specific language governing permissions and
+
+limitations under the License.
diff --git a/tools/RALE/TrackerTask.xml b/tools/RALE/TrackerTask.xml
new file mode 100644
index 00000000..2fe96b5c
--- /dev/null
+++ b/tools/RALE/TrackerTask.xml
@@ -0,0 +1,2839 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scripts/asynctask-plugin.ts b/tools/asynctask-plugin.ts
similarity index 100%
rename from scripts/asynctask-plugin.ts
rename to tools/asynctask-plugin.ts
diff --git a/scripts/generate-images.js b/tools/generate-images.js
similarity index 84%
rename from scripts/generate-images.js
rename to tools/generate-images.js
index fdf9c7c1..b937f34d 100644
--- a/scripts/generate-images.js
+++ b/tools/generate-images.js
@@ -2,8 +2,8 @@ const fs = require('fs');
const path = require('path');
const { convertFile } = require('convert-svg-to-png');
-const logoPoster = './src/images/vector/logo-light.svg';
-const logoSplash = './src/images/vector/logo-dark.svg';
+const logoPoster = './playlet/src/images/vector/logo-light.svg';
+const logoSplash = './playlet/src/images/vector/logo-dark.svg';
const logoOutput = {
// Logo
@@ -45,13 +45,13 @@ const logoOutput = {
},
};
-const iconsInput = './src/images/vector/icons';
-const iconsOutput = './src/images/icons';
+const iconsInput = './playlet/src/images/vector/icons';
+const iconsOutput = './playlet-lib/src/images/icons';
(async () => {
for (var logo in logoOutput) {
await convertFile(logoOutput[logo].from, {
- outputFilePath: './src/images/' + logo,
+ outputFilePath: './playlet/src/images/' + logo,
background: logoOutput[logo].background,
height: logoOutput[logo].height,
width: logoOutput[logo].width,
diff --git a/tools/manifest-bsconst-debug-plugin.ts b/tools/manifest-bsconst-debug-plugin.ts
new file mode 100644
index 00000000..a41fbf44
--- /dev/null
+++ b/tools/manifest-bsconst-debug-plugin.ts
@@ -0,0 +1,28 @@
+import {
+ CompilerPlugin,
+ ProgramBuilder,
+ FileObj
+} from 'brighterscript';
+import path from 'path';
+import fs from 'fs';
+
+export class ManifestBsConstDebugPlugin implements CompilerPlugin {
+ public name = 'manifestBsConstDebugPlugin';
+
+ beforePublish(builder: ProgramBuilder, files: FileObj[]) {
+ const debugFlag = process.argv.find(arg => /--debug=(true|false)/i.test(arg))
+ if (!debugFlag) {
+ return;
+ }
+ const value = /--debug=(true|false)/i.exec(debugFlag)![1].toLowerCase()
+ builder.logger.log(`Setting bs_const DEBUG to ${value}`)
+ const manifestPath = path.join(builder.options.stagingDir!, "manifest")
+ let manifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' })
+ manifestContent = manifestContent.replace(/DEBUG=(true|false)/i, `DEBUG=${value}`);
+ fs.writeFileSync(manifestPath, manifestContent)
+ }
+}
+
+export default () => {
+ return new ManifestBsConstDebugPlugin();
+};
diff --git a/scripts/profile-sync.js b/tools/profile-sync.js
similarity index 100%
rename from scripts/profile-sync.js
rename to tools/profile-sync.js
diff --git a/scripts/screenshot.js b/tools/screenshot.js
similarity index 100%
rename from scripts/screenshot.js
rename to tools/screenshot.js
diff --git a/scripts/sign-package.js b/tools/sign-package.js
similarity index 95%
rename from scripts/sign-package.js
rename to tools/sign-package.js
index ec4ade64..e82e14c3 100644
--- a/scripts/sign-package.js
+++ b/tools/sign-package.js
@@ -10,7 +10,7 @@ const options = {
outDir: 'release',
outFile: 'playlet.zip',
failOnCompileError: true,
- stagingDir: 'dist/build',
+ stagingDir: 'dist/build/playlet',
retainStagingDir: true,
signingPassword: config.ROKU_SIGN_PASSWORD,
};
diff --git a/tools/update-manifest-version.js b/tools/update-manifest-version.js
new file mode 100644
index 00000000..992f77cf
--- /dev/null
+++ b/tools/update-manifest-version.js
@@ -0,0 +1,27 @@
+const path = require('path');
+const fs = require('fs');
+const { execSync } = require("child_process");
+
+const semverParse = require('semver/functions/parse');
+
+const packageJsonContent = fs.readFileSync("./package.json", { encoding: 'utf8', flag: 'r' });
+const packageJson = JSON.parse(packageJsonContent);
+
+const version = packageJson.version;
+const parsedVersion = semverParse(version);
+
+["playlet/src/manifest", "playlet-lib/src/manifest"].forEach(function (manifestPath) {
+ let appManifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' });
+
+ const majorPattern = /major_version=(\d+)/;
+ const minorPattern = /minor_version=(\d+)/;
+ const buildPattern = /build_version=(\d+)/;
+
+ appManifestContent = appManifestContent.replace(majorPattern, `major_version=${parsedVersion.major}`);
+ appManifestContent = appManifestContent.replace(minorPattern, `minor_version=${parsedVersion.minor}`);
+ appManifestContent = appManifestContent.replace(buildPattern, `build_version=${String(parsedVersion.patch).padStart(5, '0')}`);
+
+ fs.writeFileSync(manifestPath, appManifestContent);
+})
+
+execSync(`npm version ${version} --allow-same-version`, { cwd: 'playlet-web' });
\ No newline at end of file