Compare commits

..
8 Commits
Author SHA1 Message Date
Brahim Hadriche e2822baac1 Release v0.13.0 (#159) 2023-10-02 09:17:19 -04:00
Brahim Hadricheandgithub-action linter 256fc22bd9 Bug/a few fixes (#158)
* Change default instance

* Fix cropped buttons

* Lint fix

* changelog

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2023-10-02 09:10:52 -04:00
Brahim Hadriche cb877f9415 Xml consistency pass 2023-09-30 08:58:02 -04:00
Brahim Hadricheandgithub-action linter acce520752 Sort imports (#155)
* Sort imports

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2023-09-29 18:16:00 -04:00
Brahim Hadriche 5d81f025ad Log testing errors 2023-09-23 22:53:19 -04:00
Brahim Hadriche c5680f7b06 Add Etag support (#151)
* Add Etag support

* small tweak
2023-09-23 18:22:23 -04:00
Brahim Hadriche dab6dc5bc4 Feature/channel view content (#150)
* ChannelView feeds

* Fixes for web app

* Add request id to error message
2023-09-22 17:52:53 -04:00
Brahim Hadriche e2df0b524a Fix copy paste bug 2023-09-21 15:41:40 -04:00
125 changed files with 832 additions and 536 deletions

No files matched your search

+19
View File
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.13.0] - 2023-10-02
### Added
- Playlists, streams, podcasts and related channels to Channel UI
- Pagination supported
- Channels show up in web app (but no UI for channel details yet)
- Support for `Etag` header on the web server to improve performance with caching
### Fixed
- Another bug where the app crashes if an error happens loading channel info
- Issue with default instance (by changing default instance)
- Cropped text in a couple of buttons
### Removed
- Partial content (`Range` header) from the web server, since we never serve very big files
## [0.12.1] - 2023-09-19
### Added
+3 -1
View File
@@ -17,5 +17,7 @@
// Enforces all keywords and types to be lowercase.
"keywordCase": "lower",
// Remove trailing whitespace at the end of each line.
"removeTrailingWhiteSpace": true
"removeTrailingWhiteSpace": true,
// Sort imports alphabetically.
"sortImports": true
}
+1 -1
View File
@@ -2,7 +2,7 @@ openapi: 3.0.0
info:
title: Playlet Web API
version: 0.12.1
version: 0.13.0
description:
Playlet Web API is a RESTful API for controlling the Playlet app on
Roku devices. The API is intended to be used by the Playlet web app, but can
+32 -32
View File
@@ -1,27 +1,27 @@
{
"name": "playlet",
"version": "0.12.1",
"version": "0.13.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet",
"version": "0.12.1",
"version": "0.13.0",
"hasInstallScript": true,
"devDependencies": {
"@rokucommunity/bslint": "^0.8.9",
"@types/fs-extra": "^11.0.1",
"@types/node": "^20.5.9",
"@rokucommunity/bslint": "^0.8.10",
"@types/fs-extra": "^11.0.2",
"@types/node": "^20.7.2",
"@types/xml2js": "^0.4.12",
"argparse": "^2.0.1",
"brighterscript": "^0.65.5",
"brighterscript-formatter": "^1.6.31",
"brighterscript": "^0.65.7",
"brighterscript-formatter": "^1.6.33",
"convert-svg-to-png": "^0.6.4",
"cross-fetch": "^4.0.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"fs-extra": "^11.1.1",
"glob": "^10.3.4",
"glob": "^10.3.10",
"ip": "^1.1.8",
"json5": "^2.2.3",
"roku-deploy": "^3.10.3",
@@ -272,9 +272,9 @@
"dev": true
},
"node_modules/@rokucommunity/bslint": {
"version": "0.8.9",
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.9.tgz",
"integrity": "sha512-7rXHcGL8XVguqzjKtsUoRvnm/g6ySJwV+xGO9n8Mc1r1zNIvjMi9Spfz1Kh8zJTXwfxOkG1X68lMAtp9bk/gxA==",
"version": "0.8.10",
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.10.tgz",
"integrity": "sha512-2aaWPtt5xACm7sIaKR5ctF7f3HrjKGfTVSAT6ZGdojDsXPQanHK2+XyYX20fQVdjJFVn414UCfVkUiaO0PTtog==",
"dev": true,
"dependencies": {
"fs-extra": "^10.0.0",
@@ -328,9 +328,9 @@
"dev": true
},
"node_modules/@types/fs-extra": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.1.tgz",
"integrity": "sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==",
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.2.tgz",
"integrity": "sha512-c0hrgAOVYr21EX8J0jBMXGLMgJqVf/v6yxi0dLaJboW9aQPh16Id+z6w2Tx1hm+piJOLv8xPfVKZCLfjPw/IMQ==",
"dev": true,
"dependencies": {
"@types/jsonfile": "*",
@@ -347,9 +347,9 @@
}
},
"node_modules/@types/node": {
"version": "20.5.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.9.tgz",
"integrity": "sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ==",
"version": "20.7.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.7.2.tgz",
"integrity": "sha512-RcdC3hOBOauLP+r/kRt27NrByYtDjsXyAuSbR87O6xpsvi763WI+5fbSIvYJrXnt9w4RuxhV6eAXfIs7aaf/FQ==",
"dev": true
},
"node_modules/@types/xml2js": {
@@ -702,9 +702,9 @@
}
},
"node_modules/brighterscript": {
"version": "0.65.5",
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.5.tgz",
"integrity": "sha512-xDkWIZhjTLhp6dVZ6lX7zWRyNvjdiAwZncJRnErSbqRhteNJFL7ic2UDJew9zCOYTQDrG7B85lpPpXc/1JlV+Q==",
"version": "0.65.7",
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.7.tgz",
"integrity": "sha512-cmV0JzlYuKIKkMsbHR2FyaD2YugHeHESdMmUOtK61EsEUS895Y6yXftDVnFUwij7beLiZR6s1oRpMfiS7MJ40g==",
"dev": true,
"dependencies": {
"@rokucommunity/bslib": "^0.1.1",
@@ -745,12 +745,12 @@
}
},
"node_modules/brighterscript-formatter": {
"version": "1.6.31",
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.31.tgz",
"integrity": "sha512-XOc1LVAUXrWtCwAZeOUS/7gH5TbiEqZ0IwyAJcM7J5CxrFpMrw6NKg/Yox1oKaH1m11kcLR7KgckK5CTha0eYQ==",
"version": "1.6.33",
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.33.tgz",
"integrity": "sha512-XmirSAOBBHsprJvLOuh8nzXNiPQJXQa2NJ581OZdQrofFdBNPGH+yFhV6XXUZ+pA6fVLSxMxXA0toF83jtKjrA==",
"dev": true,
"dependencies": {
"brighterscript": "^0.65.4",
"brighterscript": "^0.65.7",
"glob-all": "^3.3.0",
"jsonc-parser": "^3.0.0",
"source-map": "^0.7.3",
@@ -2192,19 +2192,19 @@
}
},
"node_modules/glob": {
"version": "10.3.4",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.3.4.tgz",
"integrity": "sha512-6LFElP3A+i/Q8XQKEvZjkEWEOTgAIALR9AO2rwT8bgPhDd1anmqDJDZ6lLddI4ehxxxR1S5RIqKe1uapMQfYaQ==",
"version": "10.3.10",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz",
"integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==",
"dev": true,
"dependencies": {
"foreground-child": "^3.1.0",
"jackspeak": "^2.0.3",
"jackspeak": "^2.3.5",
"minimatch": "^9.0.1",
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0",
"path-scurry": "^1.10.1"
},
"bin": {
"glob": "dist/cjs/src/bin.js"
"glob": "dist/esm/bin.mjs"
},
"engines": {
"node": ">=16 || 14 >=14.17"
@@ -2616,9 +2616,9 @@
"dev": true
},
"node_modules/jackspeak": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.1.tgz",
"integrity": "sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==",
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz",
"integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==",
"dev": true,
"dependencies": {
"@isaacs/cliui": "^8.0.2"
+7 -7
View File
@@ -1,21 +1,21 @@
{
"name": "playlet",
"version": "0.12.1",
"version": "0.13.0",
"description": "Unofficial Youtube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.9",
"@types/fs-extra": "^11.0.1",
"@types/node": "^20.5.9",
"@rokucommunity/bslint": "^0.8.10",
"@types/fs-extra": "^11.0.2",
"@types/node": "^20.7.2",
"@types/xml2js": "^0.4.12",
"argparse": "^2.0.1",
"brighterscript": "^0.65.5",
"brighterscript-formatter": "^1.6.31",
"brighterscript": "^0.65.7",
"brighterscript-formatter": "^1.6.33",
"convert-svg-to-png": "^0.6.4",
"cross-fetch": "^4.0.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"fs-extra": "^11.1.1",
"glob": "^10.3.4",
"glob": "^10.3.10",
"ip": "^1.1.8",
"json5": "^2.2.3",
"roku-deploy": "^3.10.3",
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.12.1",
"version": "0.13.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.12.1"
"version": "0.13.0"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.12.1",
"version": "0.13.0",
"description": "Unofficial Youtube client for Roku",
"scripts": {
"prebuild": "rm -rf build/playlet-app",
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="BootstrapScene" extends="Scene">
<interface>
<field id="exitChannel" type="bool" alwaysNotify="true" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="LoadingIndicator" extends="Group">
<children>
<Rectangle
+2 -2
View File
@@ -2,8 +2,8 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=12
build_version=00001
minor_version=13
build_version=00000
ui_resolutions=hd
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.12.1",
"version": "0.13.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.12.1"
"version": "0.13.0"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.12.1",
"version": "0.13.0",
"description": "Unofficial Youtube client for Roku",
"scripts": {
"prebuild": "rm -rf build/playlet-lib",
@@ -1,9 +1,9 @@
import "pkg:/source/utils/Types.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/components/VideoPlayer/VideoUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.screens = {}
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="AppController" extends="Group" includes="AutoBind">
<interface>
<field id="root" type="node" />
@@ -1,4 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="AppRoot" extends="Group" includes="Focus">
</component>
@@ -1,14 +1,21 @@
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Types.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.container = m.top.findNode("container")
m.scrollAnimation = m.top.findNode("scrollAnimation")
m.scrollAnimationInterpolator = m.scrollAnimation.findNode("scrollAnimationInterpolator")
m.banner = m.top.findNode("banner")
m.thumbnail = m.top.findNode("thumbnail")
m.authorLabel = m.top.findNode("authorLabel")
m.rowList = m.top.FindNode("rowList")
m.banner.ObserveField("loadStatus", FuncName(OnBannerLoadStatus))
m.authorId = ""
InitializeTabs()
end function
function OnNodeready()
@@ -42,9 +49,28 @@ function OnContentSet() as void
end if
end if
m.rowList.content = content
content@.LoadChannel(m.invidious)
authorId = ValidString(content.authorId)
if authorId <> m.authorId and IsArray(content.tabs)
m.authorId = authorId
m.rowList.contentData = CreateChannelFeeds(m.authorId, content.tabs)
end if
end function
function CreateChannelFeeds(authorId as string, tabs as object) as object
if authorId = ""
return invalid
end if
feeds = []
for i = 0 to tabs.count() - 1
tabName = tabs[i]
if m.tabs.DoesExist(tabName)
feeds.Push(m.tabs[tabName](authorId))
end if
end for
return feeds
end function
function OnkeyEvent(key as string, press as boolean) as boolean
@@ -71,4 +97,47 @@ function OnBannerLoadStatus() as void
aspect = m.banner.bitmapWidth / m.banner.bitmapHeight
m.banner.height = m.banner.width / aspect
m.banner.translation = [0, -m.banner.height]
m.banner.visible = true
startPos = [0, 0]
endPos = [0, m.banner.height]
midPos = [0, m.banner.height / 2]
m.scrollAnimationInterpolator.keyValue = [startPos, midPos, endPos]
m.scrollAnimation.control = "start"
end function
function InitializeTabs()
m.tabs = {
videos: function(authorId as string) as object
return CreateChannelFeed("Latest videos", "channel_videos", authorId)
end function,
shorts: function(authorId as string) as object
return CreateChannelFeed("Shorts", "channel_shorts", authorId)
end function,
streams: function(authorId as string) as object
return CreateChannelFeed("Live", "channel_streams", authorId)
end function,
podcasts: function(authorId as string) as object
return CreateChannelFeed("Podcasts", "channel_podcasts", authorId)
end function,
playlists: function(authorId as string) as object
return CreateChannelFeed("Playlists", "channel_playlists", authorId)
end function,
channels: function(authorId as string) as object
return CreateChannelFeed("Channels", "channel_channels", authorId)
end function
}
end function
function CreateChannelFeed(title as string, endpoint as string, ucid as string) as object
return {
title: title,
apiType: "Invidious",
endpoint: endpoint,
pathParams: {
ucid: ucid
}
}
end function
@@ -11,44 +11,57 @@
color="0x242424">
</Rectangle>
<Poster
id="banner"
translation="[0,0]"
width="1280" />
<Group id="container">
<Poster
id="banner"
width="1280"
visible="false" />
<Poster
translation="[115,180]"
width="104"
height="104"
uri="pkg:/images/circle-mask-500.png">
<Poster
translation="[115,20]"
width="104"
height="104"
uri="pkg:/images/circle-mask-500.png">
<CirclePoster
id="thumbnail"
width="100"
height="100"
translation="[2,2]" />
</Poster>
<CirclePoster
id="thumbnail"
width="100"
height="100"
translation="[2,2]" />
<Label
id="authorLabel"
translation="[228,226]"
font="font:MediumBoldSystemFont" />
<Label
id="authorLabel"
translation="[115,40]"
font="font:MediumBoldSystemFont" />
</Poster>
<VideoRowList
itemComponentName="RowCell"
id="rowList"
focusable="false"
translation="[0,320]"
numRows="1"
rowitemSize="[[350,196]]"
rowItemSpacing="[[25,0]]"
itemSize="[1280,326]"
itemSpacing="[0,65]"
rowLabelOffset="[[115,20]]"
focusXOffset="[115]"
showRowLabel="[true]"
rowFocusAnimationStyle="floatingfocus"
variableWidthItems="true"
focusBitmapUri="pkg:/images/focus_grid.9.png" />
<VideoRowList
itemComponentName="RowCell"
id="rowList"
focusable="false"
translation="[0,160]"
numRows="2"
rowitemSize="[[350,196]]"
rowItemSpacing="[[25,0]]"
itemSize="[1280,326]"
itemSpacing="[0,65]"
rowLabelOffset="[[115,20]]"
focusXOffset="[115]"
showRowLabel="[true]"
rowFocusAnimationStyle="floatingfocus"
variableWidthItems="true"
focusBitmapUri="pkg:/images/focus_grid.9.png" />
<Animation
id="scrollAnimation"
delay="0.3"
duration="0.6">
<Vector2DFieldInterpolator
id="scrollAnimationInterpolator"
key="[ 0.0, 0.5, 1.0 ]"
fieldToInterp="container.translation" />
</Animation>
</Group>
</children>
</component>
@@ -1,10 +1,9 @@
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/ContentNode/ChannelContentTask.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/utils/ErrorUtils.bs"
function Init()
m.top.latestVideos = m.top.findNode("latestVideos")
end function
function LoadChannel(invidiousNode as object) as void
@@ -40,9 +39,9 @@ function OnChannelContentTaskResult(output as object) as void
end if
error = ErrorUtils.Format(error)
LogError(error)
playlistId = output.task.input.content.playlistId
message = `Failed to load playlist ${playlistId}\n${error}`
DialogUtils.ShowDialog(message, "Playlist load fail", true)
authorId = output.task.input.content.authorId
message = `Failed to load channel ${authorId}\n${error}`
DialogUtils.ShowDialog(message, "Channel load fail", true)
return
end if
end function
@@ -14,15 +14,8 @@
<field id="videoCountText" type="string" />
<field id="thumbnail" type="string" />
<field id="banner" type="string" />
<field id="latestVideos" type="node" />
<field id="tabs" type="array" />
<field id="HDItemWidth" type="float" value="196" />
</interface>
<children>
<ContentNode id="latestVideos" title="Latest Videos">
</ContentNode>
</children>
</component>
@@ -2,7 +2,8 @@
<interface>
<field id="feed" type="assocarray" />
<field id="loadState" type="string" />
<field id="pagination" type="boolean" />
<field id="paginationType" type="string" />
<field id="page" type="integer" value="0" />
<field id="continuation" type="string" />
</interface>
</component>
@@ -1,7 +1,7 @@
import "pkg:/source/utils/Types.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/Screens/WebAppScreen/GenerateQrCodeTask.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.urlLabel = m.top.findNode("urlLabel")
@@ -26,11 +26,11 @@
<Font role="font" uri="font:SystemFontFile" size="24" />
</Label>
<Poster
id='QrCodePoster'
width='300'
height='300'
loadWidth='300'
loadHeight='300'
id="QrCodePoster"
width="300"
height="300"
loadWidth="300"
loadHeight="300"
translation="[50, 50]" />
<Label
id="urlLabel"
@@ -1,4 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="SimpleDialog" extends="StandardMessageDialog">
</component>
+1 -1
View File
@@ -1,5 +1,5 @@
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/components/VideoPlayer/VideoUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function InitEcpArgs()
+6 -7
View File
@@ -1,10 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<component name='Logger' extends='Task'>
<component name="Logger" extends="Task">
<interface>
<field id='logLevel' type='int' value='2' />
<field id='logLine' type='string' />
<field id='folder' type='string' value='cachefs:/logs' />
<field id='filename' type='string' value='app_logs.txt' />
<field id='filenamePrevious' type='string' value='app_logs_previous.txt' />
<field id="logLevel" type="int" value="2" />
<field id="logLine" type="string" />
<field id="folder" type="string" value="cachefs:/logs" />
<field id="filename" type="string" value="app_logs.txt" />
<field id="filenamePrevious" type="string" value="app_logs_previous.txt" />
</interface>
</component>
+1 -1
View File
@@ -1,7 +1,7 @@
import "pkg:/components/EcpArgs.bs"
import "pkg:/components/parts/AutoBind/AutoBind.part.bs"
import "pkg:/source/utils/LoadingScreen.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/components/EcpArgs.bs"
function Init()
InitializeLogger()
@@ -1,7 +1,7 @@
'import "pkg:/components/EcpArgs.bs"
'import "pkg:/components/parts/AutoBind/AutoBind.part.bs"
'import "pkg:/source/utils/LoadingScreen.bs"
'import "pkg:/source/utils/Logging.bs"
'import "pkg:/components/EcpArgs.bs"
function Init()
InitializeBindings() ' auto-generated!
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8" ?>
<component name="MainScene" extends="Group">
<interface>
<field id="bindings" type="assocarray" onChange="OnBindingSetRegisterAutoBind" />
-2
View File
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="MainScene" extends="Group" includes="AutoBind">
<children>
<AppController id="AppController" root="bind:./AppRoot" stack="bind:./Stack">
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="IconButton" extends="Group" includes="Focus">
<children>
<Poster id="buttonBackground" uri="pkg:/images/white.9.png" visible="false" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="NavBar" extends="Group" includes="AutoBind">
<interface>
<field id="appController" type="node" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="NavBarItem" extends="ContentNode">
<interface>
<field id="screen" type="string" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="NavigationTestNode" extends="Node">
<interface>
<function name="SetNavigation" />
@@ -1,12 +1,12 @@
import "pkg:/source/utils/Types.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/components/VideoPlayer/VideoUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/source/utils/ArrayUtils.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.pendingLoadTasks = {}
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="PlayQueue" extends="Node">
<interface>
<field id="queue" type="array" />
@@ -1,13 +1,13 @@
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Types.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/components/VideoPlayer/VideoUtils.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/components/VideoPlayer/VideoUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.background = m.top.findNode("background")
@@ -1,5 +1,5 @@
import "pkg:/source/utils/Types.bs"
import "pkg:/source/utils/TimeUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.titleLabel = m.top.findNode("titleLabel")
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="AppInfoScreen" extends="Group" includes="AutoBind">
<interface>
<field id="applicationInfo" type="node" bind="/ApplicationInfo" />
@@ -1,5 +1,5 @@
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/source/utils/FocusManagement.bs"
function Init()
m.rowList = m.top.FindNode("rowList")
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="HomeScreen" extends="Group" includes="AutoBind,Focus">
<interface>
<field id="navBar" type="node" bind="/NavBar" />
@@ -1,6 +1,6 @@
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/source/utils/Types.bs"
import "pkg:/source/utils/ArrayUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
options = {
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="SearchFilters" extends="Group" includes="AutoBind,Focus">
<interface>
<field id="searchScreen" type="node" />
@@ -2,10 +2,10 @@ import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/Screens/SearchScreen/SearchSuggestionsTask.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/services/SearchHistory.bs"
import "pkg:/source/utils/LoadingScreen.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/LoadingScreen.bs"
import "pkg:/source/utils/Logging.bs"
function Init()
m.container = m.top.FindNode("container")
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="SearchScreen" extends="Group" includes="AutoBind,Focus">
<interface>
<field id="navBar" type="node" bind="/NavBar" />
@@ -12,7 +10,7 @@
<Button
id="filtersButton"
translation="[160,40]"
minWidth="0"
minWidth="180"
height="48"
showFocusFootprint="true"
iconUri="pkg:/images/icons/filters-white.png"
@@ -1,5 +1,5 @@
import "pkg:/source/services/SearchHistory.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/services/SearchHistory.bs"
@asynctask
function SearchSuggestionsTask(input as object) as object
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="BooleanControl" extends="LayoutGroup" includes="Focus">
<interface>
<field id="displayText" type="string" alias="Checkbox.title" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="Checkbox" extends="CheckList">
<interface>
<field id="title" type="string" alias="checkboxNode.title" />
@@ -1,6 +1,6 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/source/services/SearchHistory.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
function Init()
m.top.focusable = true
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="ClearSearchHistoryControl" extends="LayoutGroup" includes="Focus">
<interface>
<field id="displayText" type="string" alias="Button.text" />
@@ -1,5 +1,5 @@
import "pkg:/source/utils/Types.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.top.focusable = true
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="InvidiousInstanceControl" extends="LayoutGroup" includes="AutoBind,Focus">
<interface>
<field id="displayText" type="string" alias="DisplayTextLabel.text" />
@@ -1,4 +1,5 @@
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/utils/Types.bs"
function Init()
@@ -29,6 +30,7 @@ function Init()
SetNavigation(m.testButton, "right", m.saveButton)
m.currentNavigtionNode = m.editButton
m.textEditBox.hintText = `e.g. ${Invidious.DEFAULT_INSTANCE}`
end function
function OnFocusChange() as void
@@ -76,7 +78,7 @@ end function
function OnEditButtonSelected()
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
keyboardDialog.title = "Edit Instance"
keyboardDialog.message = ["Enter the instance url (e.g. https://vid.puffyan.us)"]
keyboardDialog.message = [`Enter the instance url (e.g. ${Invidious.DEFAULT_INSTANCE})`]
keyboardDialog.text = m.top.text
keyboardDialog.buttons = ["OK", "Cancel"]
keyboardDialog.observeField("buttonSelected", FuncName(OnKeyboardButton))
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="InvidiousInstanceSettings" extends="Group" includes="AutoBind,Focus">
<interface>
<field id="text" type="string" alias="textEditBox.text" />
@@ -23,7 +21,6 @@
translation="[326,13]" />
<TextEditBox
id="textEditBox"
hintText="e.g. https://https://vid.puffyan.us"
width="480"
height="50"
translation="[200,50]" />
@@ -1,9 +1,9 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceTesting/InvidiousInstanceTestingTask.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Types.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceTesting/InvidiousInstanceTestingTask.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
function Init()
m.titleLabel = m.top.findNode("titleLabel")
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="InvidiousInstanceTesting" extends="Group" includes="AutoBind,Focus">
<interface>
<field id="instance" type="string" />
@@ -37,9 +35,9 @@
<Button
id="closeButton"
text="Close"
minWidth="0"
minWidth="160"
showFocusFootprint="true"
translation="[404,506]" />
translation="[400,506]" />
</Rectangle>
</children>
</component>
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="InvidiousInstanceTestingItem" extends="Group">
<interface>
<field id="itemContent" type="node" onChange="OnContentSet" />
@@ -53,6 +53,10 @@ function RunTests(instance as string, content as object) as void
m[testNode.func](instance, testNode)
testNode.duration = timer.TotalMilliseconds()
if testNode.state = "failed"
LogError(testNode.details)
end if
if m.top.cancel
return
end if
@@ -1,9 +1,9 @@
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Screens/SettingsScreen/InvidiousInstance/InvidiousPublicInstances/InvidiousPublicInstancesTask.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
function Init()
m.failedLabel = m.top.findNode("failedLabel")
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="InvidiousPublicInstances" extends="Group" includes="Focus">
<interface>
<field id="instance" type="string" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="InvidiousPublicInstancesListItem" extends="Group">
<interface>
<field id="itemContent" type="node" onChange="OnContentSet" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="InvidiousPublicInstancesListItemContent" extends="ContentNode">
<interface>
<field id="name" type="string" />
@@ -1,5 +1,5 @@
import "pkg:/source/services/HttpClient.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/services/HttpClient.bs"
@asynctask
function InvidiousPublicInstancesTask(input as object) as object
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="RadioControl" extends="LayoutGroup" includes="Focus">
<interface>
<field id="displayText" type="string" alias="DisplayTextLabel.text" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="SettingCategory" extends="Button">
<interface>
<field id="padding" type="integer" value="10" onChange="Resize" />
@@ -1,6 +1,6 @@
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/components/Navigation/ScrollTo.bs"
import "pkg:/source/utils/FocusManagement.bs"
function Init()
m.container = m.top.findNode("Container")
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="SettingsScreen" extends="Group" includes="AutoBind,Focus">
<interface>
<field id="navBar" type="node" bind="/NavBar" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="StringControl" extends="LayoutGroup" includes="Focus">
<interface>
<field id="displayText" type="string" alias="DisplayTextLabel.text" />
@@ -1,6 +1,6 @@
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/Screens/WebAppScreen/GenerateQrCodeTask.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/utils/StringUtils.bs"
function Init()
end function
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="WebAppScreen" extends="Group" includes="AutoBind">
<interface>
<field id="webServer" type="node" bind="/WebServer" />
@@ -9,9 +7,9 @@
<children>
<Group id="noInternet" visible="false">
<Label
height='720'
width='1280'
font='font:MediumBoldSystemFont'
height="720"
width="1280"
font="font:MediumBoldSystemFont"
horizAlign="center"
vertAlign="center"
text="Could not get IP address: are we connected to the internet?"
@@ -19,26 +17,26 @@
</Group>
<Group id="yesInternet" visible="false">
<Label
height='60'
width='1280'
font='font:MediumBoldSystemFont'
height="60"
width="1280"
font="font:MediumBoldSystemFont"
horizAlign="center"
translation="[0,92]"
text="Scan the QR code with your phone camera, or open the URL in a web browser:"
/>
<Poster
id='QrCodePoster'
height='400'
width='400'
loadHeight='400'
loadWidth='400'
translation='[440, 160]' />
id="QrCodePoster"
height="400"
width="400"
loadHeight="400"
loadWidth="400"
translation="[440, 160]" />
<Label
id='UrlLabel'
height='50'
width='1280'
font='font:MediumBoldSystemFont'
id="UrlLabel"
height="50"
width="1280"
font="font:MediumBoldSystemFont"
horizAlign="center"
translation="[0,600]"
/>
@@ -1,5 +1,5 @@
import "pkg:/source/asyncTask/asyncTask.bs"
import "LatestLibVersionTask.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/services/ApplicationInfo.bs"
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="ApplicationInfo" extends="Node">
<interface>
<field id="lib_version_latest" type="string" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="Invidious" extends="Node">
<interface>
<field id="applicationInfo" type="node" />
@@ -1,14 +1,15 @@
import "pkg:/components/VideoFeed/PaginationType.bs"
import "pkg:/source/services/HttpClient.bs"
import "pkg:/source/utils/CryptoUtils.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/RegistryUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/TimeUtils.bs"
import "pkg:/source/utils/CryptoUtils.bs"
import "pkg:/source/services/HttpClient.bs"
import "pkg:/source/utils/Logging.bs"
namespace Invidious
const INSTANCES_API = "https://api.invidious.io/instances.json?sort_by=type,users"
const DEFAULT_INSTANCE = "https://vid.puffyan.us"
const DEFAULT_INSTANCE = "https://invidious.fdn.fr"
const TOKEN_CALLBACK = "/invidious/token_callback"
@@ -48,7 +49,9 @@ namespace Invidious
DefaultHandler: m.DefaultHandler,
AuthFeedHandler: m.AuthFeedHandler,
PlaylistHandler: m.PlaylistHandler,
ChannelHandler: m.ChannelHandler
ChannelVideosHandler: m.ChannelVideosHandler,
ChannelPlaylistsHandler: m.ChannelPlaylistsHandler,
ChannelRelatedChannelsHandler: m.ChannelRelatedChannelsHandler
}
end function
@@ -155,18 +158,26 @@ namespace Invidious
requestData = contentNode.feed
endpoint = m.endpoints[requestData.endpoint]
if endpoint = invalid or endpoint.pagination <> true
if endpoint = invalid or StringUtils.IsNullOrEmpty(endpoint.paginationType)
return
end if
contentNode.pagination = true
contentNode.page += 1
if not requestData.DoesExist("queryParams")
requestData.queryParams = {}
end if
requestData.queryParams.page = contentNode.page
contentNode.paginationType = endpoint.paginationType
if endpoint.paginationType = PaginationType.Pages
contentNode.page += 1
requestData.queryParams.page = contentNode.page
else if endpoint.paginationType = PaginationType.Continuation
continuation = contentNode.continuation
if not StringUtils.IsNullOrEmpty(continuation)
requestData.queryParams.continuation = continuation
end if
end if
contentNode.feed = requestData
end function
@@ -254,21 +265,54 @@ namespace Invidious
end function
function DefaultHandler(m as object, requestData as object, response as object) as object
return response.Json()
if response.StatusCode() = 200
json = response.Json()
return {
items: json
}
end if
return invalid
end function
function PlaylistHandler(m as object, requestData as object, response as object) as object
if response.StatusCode() = 200
json = response.Json()
return json.videos
return {
items: json.videos
}
end if
return invalid
end function
function ChannelHandler(m as object, requestData as object, response as object) as object
function ChannelVideosHandler(m as object, requestData as object, response as object) as object
if response.StatusCode() = 200
json = response.Json()
return json.videos
return {
items: json.videos,
continuation: json.continuation
}
end if
return invalid
end function
function ChannelPlaylistsHandler(m as object, requestData as object, response as object) as object
if response.StatusCode() = 200
json = response.Json()
return {
items: json.playlists,
continuation: json.continuation
}
end if
return invalid
end function
function ChannelRelatedChannelsHandler(m as object, requestData as object, response as object) as object
if response.StatusCode() = 200
json = response.Json()
return {
items: json.relatedChannels,
continuation: json.continuation
}
end if
return invalid
end function
@@ -281,7 +325,9 @@ namespace Invidious
videos = []
videos.Append(json.notifications)
videos.Append(json.videos)
return videos
return {
items: videos
}
end if
return invalid
end function
@@ -1,5 +1,5 @@
import "pkg:/source/utils/TimeUtils.bs"
import "pkg:/components/VideoFeed/FeedLoadState.bs"
import "pkg:/source/utils/TimeUtils.bs"
namespace InvidiousContent
@@ -115,22 +115,7 @@ namespace InvidiousContent
node.videoCountText = GetVideoCountText(item)
node.thumbnail = GetChannelThumbnail(item.authorThumbnails)
node.banner = GetChannelBanner(item.authorBanners)
if item.latestVideos <> invalid
newNodes = []
for each video in item.latestVideos
video.type = "video"
videoNode = ToVideoContentNode(invalid, video, instance)
if videoNode <> invalid
newNodes.push(videoNode)
end if
end for
if newNodes.Count() > 0
node.latestVideos.appendChildren(newNodes)
end if
end if
SetIfExists(node, "tabs", item, "tabs")
return node
end function
@@ -245,7 +230,7 @@ namespace InvidiousContent
if authorBanners = invalid or authorBanners.Count() = 0
return ""
end if
return authorBanners[authorBanners.Count() - 1].url
return authorBanners[0].url
end function
function GetVideoCountText(item as object) as string
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="Preferences" extends="Node">
<interface>
<field id="__version" type="integer" value="1" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="SponsorBlockNotification" extends="Group">
<interface>
<field id="segment" type="assocarray" onChange="OnSegmentSet" />
@@ -1,6 +1,6 @@
import "pkg:/source/services/HttpClient.bs"
import "pkg:/source/utils/ColorUtils.bs"
import "pkg:/source/utils/CryptoUtils.bs"
import "pkg:/source/services/HttpClient.bs"
namespace SponsorBlock
const SKIP_SEGMENT_ENDPOINT = "/api/skipSegments"
@@ -107,9 +107,9 @@ namespace SponsorBlock
pixelEnd = (segment.segment[1] / videoDuration) * width
color = m.SegmentColor(segment.category)
' highlight's duration is zero, so it is not visble on the bar.
' Add a couple of pixels to see it
' Add a few pixels to see it
if pixelStart = pixelEnd
pixelEnd += 2
pixelEnd += 5
end if
bar.DrawRect(pixelStart, 0, pixelEnd - pixelStart, height, color)
end for
@@ -0,0 +1,4 @@
enum PaginationType
Pages = "Pages"
Continuation = "Continuation"
end enum
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="ActionRowCell" extends="Group">
<interface>
<field id="itemContent" type="node" onChange="OnContentSet" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="ChannelRowCell" extends="Group">
<interface>
<field id="itemContent" type="node" onChange="OnContentSet" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="LoadingRowCell" extends="Group">
<interface>
<field id="itemContent" type="node" onChange="OnContentSet" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="PlaylistRowCell" extends="Group">
<interface>
<field id="itemContent" type="node" onChange="OnContentSet" />
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="RowCell" extends="Group">
<interface>
<field id="type" type="string" />
@@ -1,3 +1,4 @@
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/TimeUtils.bs"
import "pkg:/source/utils/Types.bs"
@@ -23,36 +24,30 @@ function OnContentSet() as void
m.titleLabel.text = content.title
m.authorLabel.text = content.author
if content.isUpcoming = true
m.viewCountDateLabel.text = content.premiereTimestampText
else
publishedText = ValidString(content.publishedText)
viewCountText = ValidString(content.viewCountText)
if publishedText = "" and viewCountText = ""
m.viewCountDateLabel.text = ""
else
m.viewCountDateLabel.text = `${publishedText} • ${viewCountText}`
if not StringUtils.IsNullOrEmpty(content.publishedText)
label = content.publishedText
if not StringUtils.IsNullOrEmpty(content.viewCountText)
label = `${label} • ${content.viewCountText}`
end if
m.viewCountDateLabel.text = label
else if content.isUpcoming = true
m.viewCountDateLabel.text = content.premiereTimestampText
end if
m.thumbnail.uri = content.thumbnail
if content.isUpcoming = true
m.upcomingRect.visible = true
m.liveRect.visible = false
m.durationRect.visible = false
else if content.liveNow
m.upcomingRect.visible = false
m.liveRect.visible = true
m.durationRect.visible = false
m.durationRect.visible = false
m.upcomingRect.visible = false
m.liveRect.visible = false
if ValidInt(content.lengthSeconds) <> 0
SetDurationText(content.lengthText)
m.durationRect.visible = true
else
m.upcomingRect.visible = false
m.liveRect.visible = false
if ValidInt(content.lengthSeconds) <> 0
SetDurationText(content.lengthText)
m.durationRect.visible = true
else
m.durationRect.visible = false
if content.isUpcoming = true
m.upcomingRect.visible = true
else if content.liveNow
m.liveRect.visible = true
end if
end if
end function
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="VideoRowCell" extends="Group">
<interface>
<field id="itemContent" type="node" onChange="OnContentSet" />
@@ -1,14 +1,16 @@
import "pkg:/source/utils/Types.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/ChannelView/ChannelUtils.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/PlaylistView/PlaylistUtils.bs"
import "pkg:/components/VideoFeed/VideoRowListContentTask.bs"
import "pkg:/components/VideoFeed/VideoRowListRowContentTask.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/VideoPlayer/VideoUtils.bs"
import "pkg:/components/PlaylistView/PlaylistUtils.bs"
import "pkg:/components/ChannelView/ChannelUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/Types.bs"
' TODO:P1 add the option to remove a row if it does not have any content
' E.g. NBC News does not return any related chnanels
function Init()
m.pendingLoadTasks = {}
end function
@@ -152,7 +154,7 @@ function GetRowsToLoad() as object
end if
subContentNodes = []
range = m.top.numRows + 2
range = m.top.numRows + 1
for i = -range to range
index = focus + i
if index < 0
@@ -172,6 +174,8 @@ function GetRowsToLoad() as object
end function
function LoadRowContent(contentNode as object)
LogInfo("Loading row content:", contentNode.title)
contentNode.loadState = FeedLoadState.Loading
task = StartAsyncTask(VideoRowListRowContentTask, {
node: m.top,
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="VideoRowList" extends="RowList" includes="AutoBind">
<interface>
<field id="appController" type="node" bind="/AppController" />
@@ -43,7 +43,7 @@ function VideoRowListRowContentTask(input as object) as object
instance = service.GetInstance()
itemNodes = []
for each item in response.result
for each item in response.result.items
itemNode = InvidiousContent.ToRowCellContentNode(item, instance)
if itemNode <> invalid
itemNodes.Push(itemNode)
@@ -53,8 +53,20 @@ function VideoRowListRowContentTask(input as object) as object
RemovePlaceHolderItems(contentNode)
contentNode.appendChildren(itemNodes)
if contentNode.pagination = true and response.result.Count() > 0
contentNode.loadState = FeedLoadState.LoadedPage
hasContinuation = not StringUtils.IsNullOrEmpty(response.result.continuation)
if hasContinuation
contentNode.continuation = response.result.continuation
end if
if response.result.items.Count() > 0
pageType = contentNode.paginationType
if pageType = PaginationType.Continuation and hasContinuation
contentNode.loadState = FeedLoadState.LoadedPage
else if pageType = PaginationType.Pages
contentNode.loadState = FeedLoadState.LoadedPage
else
contentNode.loadState = FeedLoadState.Loaded
end if
else
contentNode.loadState = FeedLoadState.Loaded
end if
@@ -1,7 +1,7 @@
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/Services/SponsorBlock/SponsorBlockTask.bs"
import "pkg:/components/Services/SponsorBlock/SponsorBlockSegmentViewedTask.bs"
import "pkg:/components/Services/SponsorBlock/Notifications/SponsorBlockNotificationUtils.bs"
import "pkg:/components/Services/SponsorBlock/SponsorBlockSegmentViewedTask.bs"
import "pkg:/components/Services/SponsorBlock/SponsorBlockTask.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
namespace SponsorBlock
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="VideoContainer" extends="Group">
<interface>
<field id="fullscreen" type="boolean" value="true" />
@@ -1,13 +1,13 @@
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
import "pkg:/components/VideoPlayer/MarkVideoWatchedTask.bs"
import "pkg:/components/VideoPlayer/SponsorBlock.bs"
import "pkg:/components/VideoPlayer/VideoContentTask.bs"
import "pkg:/components/VideoPlayer/VideoPlayerStyle.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/components/VideoPlayer/VideoUtils.bs"
import "pkg:/components/VideoPlayer/MarkVideoWatchedTask.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/components/VideoPlayer/SponsorBlock.bs"
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
import "pkg:/source/utils/Logging.bs"
function Init()
SetPlayerStyle()
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="VideoPlayer" extends="Video" includes="AutoBind">
<interface>
<field id="appController" type="node" bind="/AppController" />
@@ -1,5 +1,5 @@
import "pkg:/components/VideoPlayer/VideoUtils.bs"
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
import "pkg:/components/VideoPlayer/VideoUtils.bs"
namespace Http
@@ -1,11 +1,12 @@
import "pkg:/components/Web/PlayletWebServer/Middleware/InvidiousRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/PlayletLibUrlsRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/PlayQueueRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/PreferencesRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/SearchHistoryRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/StateApiRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/PreferencesRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/InvidiousRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/PlayQueueRouter.bs"
import "pkg:/components/Web/WebServer/Middleware/CorsMiddleware.bs"
import "pkg:/components/Web/WebServer/Middleware/EtagMiddleware.bs"
import "pkg:/components/Web/WebServer/Middleware/HttpStaticFilesRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/PlayletLibUrlsRouter.bs"
function Init()
m.top.packageName = "Playlet"
@@ -37,14 +38,22 @@ function SetupRoutes(server as object)
server.UseRouter(new Http.PlayQueueRouter())
server.UseRouter(new Http.SearchHistoryRouter())
server.UseRouter(new Http.PlayletLibUrlsRouter())
server.UseRouter(new Http.HttpStaticFilesRouter("/", "libpkg:/www", false, false, false))
server.UseRouter(new Http.HttpStaticFilesRouter("/config", "libpkg:/config", false, false, false))
server.UseRouter(new Http.HttpStaticFilesRouter("/logs", "cachefs:/logs", false, false))
etags = new Http.EtagUtils()
server.UseRouter(new Http.HttpStaticFilesRouter("/", "libpkg:/www", etags, { staticFiles: true }))
server.UseRouter(new Http.HttpStaticFilesRouter("/config", "libpkg:/config", etags, { staticFiles: true }))
server.UseRouter(new Http.HttpStaticFilesRouter("/logs", "cachefs:/logs", etags, { fsCheck: true }))
#if DEBUG
server.UseRouter(new Http.HttpStaticFilesRouter("/debug/libpkg", "libpkg:/", true, true, false))
server.UseRouter(new Http.HttpStaticFilesRouter("/debug/pkg", "pkg:/", true, true))
server.UseRouter(new Http.HttpStaticFilesRouter("/debug/tmp", "tmp:/", true, true))
server.UseRouter(new Http.HttpStaticFilesRouter("/debug/cachefs", "cachefs:/", true, true))
server.UseRouter(new Http.HttpStaticFilesRouter("/debug/common", "common:/", true, true))
options = { showDirectories: true, showHidden: true, staticFiles: true }
server.UseRouter(new Http.HttpStaticFilesRouter("/debug/libpkg", "libpkg:/", etags, options))
options = { showDirectories: true, showHidden: true, fsCheck: true, staticFiles: true }
server.UseRouter(new Http.HttpStaticFilesRouter("/debug/pkg", "pkg:/", etags, options))
options = { showDirectories: true, showHidden: true }
server.UseRouter(new Http.HttpStaticFilesRouter("/debug/tmp", "tmp:/", etags, options))
options = { showDirectories: true, showHidden: true }
server.UseRouter(new Http.HttpStaticFilesRouter("/debug/cachefs", "cachefs:/", etags, options))
options = { showDirectories: true, showHidden: true, fsCheck: true, staticFiles: true }
server.UseRouter(new Http.HttpStaticFilesRouter("/debug/common", "common:/", etags, options))
#end if
server.UsePostRouter(new Http.EtagMiddleware(etags))
end function
@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="PlayletWebServer" extends="WebServer" includes="AutoBind">
<interface>
<field id="preferences" type="node" />
@@ -1,9 +1,9 @@
import "HttpSettings.bs"
import "HttpRequest.bs"
import "HttpResponse.bs"
import "pkg:/source/utils/Types.bs"
import "pkg:/source/utils/StringUtils.bs"
import "HttpSettings.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace Http
const BUFSIZE = 65536
@@ -1,6 +1,6 @@
import "HttpRequestState.bs"
import "pkg:/source/utils/Types.bs"
import "pkg:/components/Web/WebServer/Http/HttpUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace Http
@@ -24,10 +24,6 @@ namespace Http
private state = Http.HttpRequestState.INIT
private id = 0
' copied members
private range_begin = 0
private range_end = 0
private range_begin_given = false
private range_end_given = false
private ready_for_response = false
function new()
@@ -197,7 +193,6 @@ namespace Http
end function
function ProcessHeaders(connection as HttpConnection)
m.ParseRange()
m.ParseConnection(connection)
end function
@@ -212,28 +207,6 @@ namespace Http
end if
end function
' TODO:P2 this function does not take into account multiple ranges.
function ParseRange()
range = m.headers.range
if range <> invalid
endpoints = lcase(range).tokenize("=")
if endpoints.count() = 2 and endpoints.GetHead() = "bytes"
range = endpoints.GetTail().Trim()
hyphen = range.instr("-")
if hyphen > 0
m.range_begin = strtoi(range.left(hyphen))
m.range_begin_given = true
end if
last = range.len() - 1
if hyphen < last
m.range_end = strtoi(range.right(last - hyphen))
m.range_end_given = true
end if
end if
LogInfo("range request begin" + Stri(m.range_begin) + " end" + Stri(m.range_end))
end if
end function
function ParseConnection(connection as HttpConnection)
connectionStr = m.headers.connection
if connectionStr <> invalid
@@ -1,6 +1,5 @@
import "pkg:/source/utils/TimeUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "HttpResponseSource.bs"
import "pkg:/source/utils/TimeUtils.bs"
namespace Http
function GetHttpResponseId() as integer
@@ -9,8 +8,6 @@ namespace Http
end function
class HttpResponse
private source = Http.HttpResponseSource.NONE
' members
private body_buffer = invalid
private header_buffer = invalid
@@ -42,7 +39,14 @@ namespace Http
routers = m.server.routers
for each router in routers
if router.OnRequest(m.request, m, connection)
return true
exit for
end if
end for
postRouters = m.server.postRouters
for each router in postRouters
if router.OnRequest(m.request, m, connection)
exit for
end if
end for
@@ -62,8 +66,6 @@ namespace Http
m.SetBodyDataString(buffer)
m.ContentType("text/html")
m.source = Http.HttpResponseSource.GENERATED
end function
function Redirect(where as string, code = 302 as integer)
@@ -78,8 +80,6 @@ namespace Http
buffer = FormatJson(data)
m.SetBodyDataString(buffer)
m.ContentType("application/json")
m.source = Http.HttpResponseSource.GENERATED
end function
function SetBodyDataBuffer(buffer as object)
@@ -94,6 +94,20 @@ namespace Http
m.ContentLength(m.body_buffer_length)
end function
function SetBodyDataFile(path as string)
m.body_buffer.ReadFile(path)
m.body_buffer_length = m.body_buffer.count()
m.ContentLength(m.body_buffer_length)
end function
function ClearBody(clearContentLength = true as boolean)
m.body_buffer.clear()
m.body_buffer_length = 0
if clearContentLength
m.ContentLength(0)
end if
end function
function ContentLength(length as integer)
m.headers["Content-Length"] = Stri(length).trim()
end function
@@ -104,13 +118,6 @@ namespace Http
function Send(sock as object, bufsize as integer) as integer
sent = -1
if m.source = Http.HttpResponseSource.FROMFILE
if m.start + m.sent >= m.buf_start + m.body_buffer.count()
m.buf_start = m.start + m.sent
m.body_buffer.ReadFile(m.path, m.buf_start, bufsize)
LogDebug(`Read ${m.body_buffer.count()} bytes from source file @${m.buf_start}`)
end if
end if
buf_pos = m.start + m.sent - m.buf_start
buf_remaining = m.body_buffer.count() - buf_pos
if buf_remaining = 0
@@ -1,9 +0,0 @@
namespace Http
enum HttpResponseSource
NONE = 0
GENERATED = 1
FROMFILE = 2
end enum
end namespace
@@ -1,8 +1,8 @@
import "HttpUtils.bs"
import "HttpSettings.bs"
import "HttpRouter.bs"
import "HttpConnectionState.bs"
import "HttpConnection.bs"
import "HttpConnectionState.bs"
import "HttpRouter.bs"
import "HttpSettings.bs"
import "HttpUtils.bs"
namespace Http
@@ -18,6 +18,7 @@ namespace Http
private total_out = 0
private routers
private postRouters
public success as boolean
public settings as Http.HttpSettings
@@ -27,6 +28,7 @@ namespace Http
m.settings = settings
m.task = task
m.routers = []
m.postRouters = []
m.utils = new Utils()
m.success = m.Init()
end function
@@ -76,6 +78,10 @@ namespace Http
m.routers.Push(router)
end function
function UsePostRouter(router as HttpRouter)
m.postRouters.Push(router)
end function
function PreWait()
connections = m.connections
for each id in connections
Loaded 100 of 125 files, more files were not shown because too many files have changed in this diff. Show more