Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68fd91bed2 | ||
|
|
e027c8cf47 | ||
|
|
f63d8e5a18 | ||
|
|
4428baae41 | ||
|
|
6ec392a4fe | ||
|
|
68a8d61eb0 | ||
|
|
2d1490f925 | ||
|
|
58d2fc7041 | ||
|
|
b739742006 | ||
|
|
953403f952 | ||
|
|
0409e61b5f | ||
|
|
d88c1c087f | ||
|
|
58ce258509 | ||
|
|
16797a5144 | ||
|
|
64cf7b54a0 | ||
|
|
21593001ae | ||
|
|
ce04a1af1a | ||
|
|
78a7c937ae | ||
|
|
a059702a0e | ||
|
|
68a32afc38 | ||
|
|
2f5ac709ba | ||
|
|
5b10696400 | ||
|
|
301cfe1b82 | ||
|
|
1734425b9c | ||
|
|
27b4ad90d3 | ||
|
|
e0cc6970ab | ||
|
|
52fd7c87aa | ||
|
|
1b121d9ace | ||
|
|
b1efa457a2 | ||
|
|
85209cb22e | ||
|
|
3f5cb84696 | ||
|
|
7fd466fb25 | ||
|
|
02e44960b7 | ||
|
|
386dfc1419 | ||
|
|
25b2ea7091 | ||
|
|
a1484c01eb | ||
|
|
5724f0c026 | ||
|
|
fb857c0281 | ||
|
|
ef971e1c19 | ||
|
|
38dfb5ca06 |
No files matched your search
@@ -11,13 +11,14 @@
|
||||
"enableDebuggerAutoRecovery": false,
|
||||
"stopDebuggerOnAppExit": false,
|
||||
"rootDir": "${workspaceFolder}/dist/build",
|
||||
"preLaunchTask": "build",
|
||||
"preLaunchTask": "build-dev",
|
||||
"name": "Launch playlet (dev)",
|
||||
"injectRdbOnDeviceComponent": true
|
||||
},
|
||||
{
|
||||
"type": "brightscript",
|
||||
"request": "launch",
|
||||
"envFile": "${workspaceFolder}/.vscode/.env",
|
||||
"host": "${env:ROKU_DEV_TARGET}",
|
||||
"password": "${env:ROKU_DEVPASSWORD}",
|
||||
"stopOnEntry": false,
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"label": "build-dev",
|
||||
"presentation": {
|
||||
"close": true,
|
||||
"reveal": "silent",
|
||||
"revealProblems": "onProblem"
|
||||
},
|
||||
"script": "build",
|
||||
"script": "build:dev",
|
||||
"type": "npm"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,6 +4,26 @@ 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.5.0] - 2022-12-02
|
||||
### Added
|
||||
- Version check in settings page
|
||||
- Support for web request body parsing
|
||||
- Error dialog for video load fail
|
||||
- SponsorBlock sections and category info
|
||||
- Loading spinner
|
||||
- Picture in picture support
|
||||
- [Deep linking support](https://developer.roku.com/en-ca/docs/developer-program/discovery/implementing-deep-linking.md)
|
||||
- Both Launch arguments and Input arguments are supported, using the "contentId" key as the Youtube video id
|
||||
- Error and Exit dialogs
|
||||
|
||||
### Fixed
|
||||
- Bug where playing and exiting a video too quickly would cause the video to play in the background.
|
||||
- Bug where logging in causes issues if a video is already playing
|
||||
- Bug where casting from web app while playing a video from the search
|
||||
- Spinner for the video
|
||||
- Bug where search sugggestions selected index is higher than total count
|
||||
- Race condition where button group gains focus before suggestions are set in Search Page
|
||||
|
||||
## [0.4.0] - 2022-11-24
|
||||
### Added
|
||||
- Play video API
|
||||
|
||||
@@ -1,14 +1,33 @@
|
||||
<p align="center">
|
||||
<img src="banner.png" style="display:block;text-align:center" alt="Playlet Logo" width="800"/>
|
||||
</p>
|
||||
|
||||
# Playlet
|
||||
|
||||
Unofficial Youtube client for Roku 📺
|
||||
|
||||
<img src="screenshot.jpg" alt="Screenshot of Playlet" width="350"/>
|
||||
|
||||
|
||||
## Features
|
||||
- 🔥 No Ads (Not now, not ever)
|
||||
- 🕵️ No Tracking
|
||||
- 🛡️ Privacy driven (uses Invidious backend)
|
||||
- ⚔️ SponsorBlock integration (skips undesirable sections in videos)
|
||||
- 📱 Cast from phone
|
||||
- 🔮 Picture-in-picture mode
|
||||
|
||||
### Cast from phone
|
||||
1. Open settings in Playlet
|
||||
1. Scan QR Code with Phone
|
||||
1. Enter video ID or video url, and press Play button
|
||||
|
||||
### Picture-in-picture
|
||||
- When viewing a video in full screen, press ⬇️ (down) button on your remote to shrink the video
|
||||
- You can browser or search for videos while you watch
|
||||
- To restore currently playing video to full screen, press the ✳️ (options) button
|
||||
|
||||
## Screenshots
|
||||
<img src="screenshot1.jpg" alt="Screenshot of Playlet" width="350"/>
|
||||
<img src="screenshot2.jpg" alt="Screenshot of Playlet" width="350"/>
|
||||
<img src="screenshot3.jpg" alt="Screenshot of Playlet" width="350"/>
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -24,7 +43,7 @@ For full instructions, see [Set up your Roku device to enable Developer Settings
|
||||
Make sure to remember the password you set during this step, you will need it later.
|
||||
|
||||
### Gather your info
|
||||
By now, you show have the following
|
||||
By now, you should have the following
|
||||
- Your Roku Dev password (setup in the previous step)
|
||||
- Your Roku TV local IP address
|
||||
- You can find this information in your TV network settings. It should look like 192.168.X.X or so
|
||||
|
||||
|
After Width: | Height: | Size: 36 KiB |
@@ -4,7 +4,8 @@
|
||||
"diagnosticFilters": [
|
||||
{
|
||||
"src": "**/roku_modules/**/*.*"
|
||||
}
|
||||
},
|
||||
1090
|
||||
],
|
||||
"diagnosticLevel": "error",
|
||||
"files": [
|
||||
@@ -21,7 +22,7 @@
|
||||
"roku-log-bsc-plugin",
|
||||
"@rokucommunity/bslint"
|
||||
],
|
||||
"retainStagingFolder": true,
|
||||
"retainStagingDir": true,
|
||||
"rokuLog": {
|
||||
"insertPkgPath": true,
|
||||
"removeComments": false,
|
||||
@@ -29,5 +30,5 @@
|
||||
},
|
||||
"rootDir": "../src/",
|
||||
"sourceMap": true,
|
||||
"stagingFolderPath": "dist/build"
|
||||
"stagingDir": "dist/build"
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
"createPackage": false,
|
||||
"deploy": false,
|
||||
"extends": "bsconfig.base.json",
|
||||
"retainStagingFolder": false,
|
||||
"retainStagingDir": false,
|
||||
"sourceMap": false
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||
@@ -19,6 +19,7 @@
|
||||
"brighterscript": "^0.60.6",
|
||||
"brighterscript-formatter": "^1.6.19",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"dotenv": "^16.0.3",
|
||||
"roku-log-bsc-plugin": "^0.6.1",
|
||||
"ropm": "^0.10.10",
|
||||
"semver": "^7.3.8"
|
||||
@@ -1266,6 +1267,15 @@
|
||||
"url": "https://github.com/fb55/domutils?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "16.0.3",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
|
||||
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/ecc-jsbn": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
|
||||
@@ -4563,6 +4573,12 @@
|
||||
"domhandler": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"dotenv": {
|
||||
"version": "16.0.3",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
|
||||
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
|
||||
"dev": true
|
||||
},
|
||||
"ecc-jsbn": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.4.0",
|
||||
"version": "0.5.0",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"dependencies": {
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||
@@ -13,6 +13,7 @@
|
||||
"brighterscript": "^0.60.6",
|
||||
"brighterscript-formatter": "^1.6.19",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"dotenv": "^16.0.3",
|
||||
"roku-log-bsc-plugin": "^0.6.1",
|
||||
"ropm": "^0.10.10",
|
||||
"semver": "^7.3.8"
|
||||
@@ -27,7 +28,8 @@
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf dist",
|
||||
"build": "bsc",
|
||||
"build:prod": "npm run build -- --sourceMap=false",
|
||||
"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",
|
||||
"lint": "bslint --project config/bsconfig.lint.json --lintConfig config/bslint.jsonc",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
@@ -37,6 +39,8 @@
|
||||
"generate-images": "node scripts/generate-images.js",
|
||||
"manifest-version": "node scripts/update-manifest-version.js",
|
||||
"zip-package": "node scripts/zip-package.js",
|
||||
"screenshot": "node scripts/screenshot.js",
|
||||
"manifest-symbols": "node scripts/update-manifest-symbols.js",
|
||||
"postinstall": "npx ropm copy"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 599 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 48 KiB |
@@ -2,33 +2,46 @@ const fs = require('fs')
|
||||
const path = require('path')
|
||||
const { convertFile } = require('convert-svg-to-png');
|
||||
|
||||
const logoInput = './src/images/vector/logo.svg';
|
||||
const logoPoster = './src/images/vector/logo-light.svg';
|
||||
const logoSplash = './src/images/vector/logo-dark.svg';
|
||||
|
||||
logoOutput = {
|
||||
// Logo
|
||||
"splash-screen_fhd.jpg": {
|
||||
width: 1920,
|
||||
height: 1080
|
||||
height: 1080,
|
||||
background: "#242424",
|
||||
from: logoSplash
|
||||
},
|
||||
"splash-screen_hd.jpg": {
|
||||
width: 1280,
|
||||
height: 720
|
||||
height: 720,
|
||||
background: "#242424",
|
||||
from: logoSplash
|
||||
},
|
||||
"splash-screen_sd.jpg": {
|
||||
width: 720,
|
||||
height: 480
|
||||
height: 480,
|
||||
background: "#242424",
|
||||
from: logoSplash
|
||||
},
|
||||
"channel-poster_fhd.png": {
|
||||
width: 540,
|
||||
height: 405
|
||||
height: 405,
|
||||
background: "#FFFFFF",
|
||||
from: logoPoster
|
||||
},
|
||||
"channel-poster_hd.png": {
|
||||
width: 290,
|
||||
height: 218
|
||||
height: 218,
|
||||
background: "#FFFFFF",
|
||||
from: logoPoster
|
||||
},
|
||||
"channel-poster_sd.png": {
|
||||
width: 214,
|
||||
height: 144
|
||||
height: 144,
|
||||
background: "#FFFFFF",
|
||||
from: logoPoster
|
||||
},
|
||||
};
|
||||
|
||||
@@ -38,9 +51,9 @@ const iconsOutput = './src/images/icons';
|
||||
(async () => {
|
||||
|
||||
for (var logo in logoOutput) {
|
||||
await convertFile(logoInput, {
|
||||
await convertFile(logoOutput[logo].from, {
|
||||
outputFilePath: './src/images/' + logo,
|
||||
background: "#242424",
|
||||
background: logoOutput[logo].background,
|
||||
height: logoOutput[logo].height,
|
||||
width: logoOutput[logo].width,
|
||||
});
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
const rokuDeploy = require('roku-deploy');
|
||||
const dotenv = require('dotenv')
|
||||
const fs = require('fs');
|
||||
const { exit } = require('process');
|
||||
|
||||
if(process.argv.length !== 3) {
|
||||
console.error("Invalid usage! usage: npm run screenshot -- filename")
|
||||
exit(-1)
|
||||
}
|
||||
|
||||
const filename = process.argv[2]
|
||||
const config = dotenv.parse(fs.readFileSync('.vscode/.env'))
|
||||
|
||||
rokuDeploy.takeScreenshot({
|
||||
host: config.ROKU_DEV_TARGET,
|
||||
password: config.ROKU_DEVPASSWORD,
|
||||
outDir: '.',
|
||||
outFile: filename
|
||||
}).then(function(filename){
|
||||
console.log(`${filename} created`)
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
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"))
|
||||
@@ -5,8 +5,8 @@ const zip_name = 'playlet.zip'
|
||||
rokuDeploy.zipPackage({
|
||||
outDir: 'release',
|
||||
outFile: zip_name,
|
||||
//BUG: rokuDeploy does not read stagingFolderPath properly fron config
|
||||
stagingFolderPath: 'dist/build'
|
||||
//BUG: rokuDeploy does not read stagingDir properly fron config
|
||||
stagingDir: 'dist/build'
|
||||
}).then(function(){
|
||||
console.log(`${zip_name} created`)
|
||||
}, function(error) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
function Init()
|
||||
m.top.observeField("buttonSelected", "CloseDialog")
|
||||
end function
|
||||
|
||||
function CloseDialog()
|
||||
m.top.close = true
|
||||
end function
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<component name="Dialog" extends="StandardMessageDialog" >
|
||||
</component>
|
||||
@@ -0,0 +1,15 @@
|
||||
function ShowDialog(message as dynamic, title as string) as object
|
||||
return ShowDialogButtons(message, title, ["Ok"])
|
||||
end function
|
||||
|
||||
function ShowDialogButtons(message as dynamic, title as string, buttons as object) as object
|
||||
dialog = CreateObject("roSGNode", "Dialog")
|
||||
if GetInterface(message, "ifArray") = invalid
|
||||
message = message.Tokenize(UnixNL()).ToArray()
|
||||
end if
|
||||
dialog.message = message
|
||||
dialog.title = title
|
||||
dialog.buttons = buttons
|
||||
m.top.getScene().dialog = dialog
|
||||
return dialog
|
||||
end function
|
||||
@@ -6,6 +6,7 @@ function Init()
|
||||
m.top.ObserveField("rowItemSelected", "OnHomeGridScreenVideoSelected")
|
||||
m.top.ObserveField("focus", "OnFocusChange")
|
||||
m.top.ObserveField("playvideo", "OnPlayVideoCommand")
|
||||
m.top.ObserveField("refresh", "OnRefresh")
|
||||
|
||||
m.top.focus = true
|
||||
|
||||
@@ -18,6 +19,10 @@ function OnFocusChange()
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnRefresh()
|
||||
InitContent()
|
||||
end function
|
||||
|
||||
function InitContent()
|
||||
m.sortedContent = []
|
||||
contentNode = CreateObject("roSGNode", "ContentNode")
|
||||
@@ -46,8 +51,6 @@ function StartFetchTask() as void
|
||||
if m.sortedContent.Count() = m.defaultLayout.Count()
|
||||
' All tasks are done
|
||||
m.Delete("sortedContent")
|
||||
' TODO: uncommment if auto-play
|
||||
' m.top.ObserveField("rowItemFocused", "OnHomeGridScreenVideoFocused")
|
||||
end if
|
||||
return
|
||||
end if
|
||||
@@ -108,72 +111,23 @@ function OnHomeGridScreenVideoSelected(event as object) as void
|
||||
|
||||
videoId = itemContent.videoId
|
||||
|
||||
if m.videoPlayer <> invalid
|
||||
if m.videoPlayer.videoId = videoId
|
||||
ExpandVideoScreenFull()
|
||||
return
|
||||
else
|
||||
m.videoPlayer.control = "stop"
|
||||
m.videoPlayer.visible = false
|
||||
m.videoPlayer.getParent().removeChild(m.videoPlayer)
|
||||
m.videoPlayer = invalid
|
||||
end if
|
||||
end if
|
||||
|
||||
ShowVideoScreenFull(videoId, m.top)
|
||||
end function
|
||||
|
||||
function CloseVideo()
|
||||
if m.videoPlayer <> invalid
|
||||
m.videoPlayer.control = "stop"
|
||||
m.videoPlayer.visible = false
|
||||
m.videoPlayer.getParent().removeChild(m.videoPlayer)
|
||||
m.videoPlayer = invalid
|
||||
end if
|
||||
PlayVideo(videoId, m.top)
|
||||
end function
|
||||
|
||||
function OnPlayVideoCommand()
|
||||
videoId = m.top.playvideo
|
||||
CloseVideo()
|
||||
ShowVideoScreenFull(videoId, m.top)
|
||||
end function
|
||||
|
||||
function OnHomeGridScreenVideoFocused(event as object) as void
|
||||
if m.videoPlayer <> invalid
|
||||
m.videoPlayer.control = "stop"
|
||||
m.videoPlayer.visible = false
|
||||
m.videoPlayer.getParent().removeChild(m.videoPlayer)
|
||||
m.videoPlayer = invalid
|
||||
end if
|
||||
grid = event.GetRoSGNode()
|
||||
|
||||
selectedPair = event.GetData()
|
||||
selectedRow = selectedPair[0]
|
||||
selectedRowItem = selectedPair[1]
|
||||
|
||||
rowContent = grid.content.GetChild(selectedRow)
|
||||
itemContent = rowContent.GetChild(selectedRowItem)
|
||||
|
||||
videoId = itemContent.videoId
|
||||
thumbnail = GetThumbnailPoster(videoId)
|
||||
ShowVideoScreenEmbedded(videoId, thumbnail)
|
||||
end function
|
||||
|
||||
function GetThumbnailPoster(videoId as string) as object
|
||||
' TODO: make this faster
|
||||
all = m.top.getAll()
|
||||
for each item in all
|
||||
if item.id = `thumbnail-${videoId}`
|
||||
return item
|
||||
end if
|
||||
end for
|
||||
return invalid
|
||||
PlayVideo(videoId)
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if press = false
|
||||
return false
|
||||
end if
|
||||
if key = "options"
|
||||
if ToggleVideoPictureInPicture(m.top)
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
if key = "left" or key = "back"
|
||||
m.top.escape = key
|
||||
return true
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<field id="escape" type="string" alwaysNotify="true" />
|
||||
<field id="focus" type="boolean" alwaysNotify="true" />
|
||||
<field id="playvideo" type="string" alwaysNotify="true" />
|
||||
<field id="refresh" type="boolean" alwaysNotify="true" />
|
||||
</interface>
|
||||
<children>
|
||||
<RowList
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
function Init()
|
||||
m.busySpinner = m.top.findNode("busySpinner")
|
||||
m.busyspinner.poster.width = 150
|
||||
m.busyspinner.poster.height = 150
|
||||
m.busyspinner.poster.observeField("loadStatus", "PositionSpinner")
|
||||
m.busySpinner.poster.uri = "pkg:/images/spinner.png"
|
||||
m.top.observeField("visible", "OnVisibleChange")
|
||||
end function
|
||||
|
||||
function PositionSpinner()
|
||||
if m.busyspinner.poster.loadStatus = "ready"
|
||||
centerx = (1280 - m.busyspinner.poster.width) / 2
|
||||
centery = (720 - m.busyspinner.poster.height) / 2
|
||||
m.busyspinner.translation = [centerx, centery]
|
||||
m.busyspinner.visible = true
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnVisibleChange()
|
||||
m.busyspinner.visible = m.top.visible
|
||||
if m.busyspinner.visible
|
||||
m.busyspinner.control = "start"
|
||||
else
|
||||
m.busyspinner.control = "stop"
|
||||
end if
|
||||
end function
|
||||
@@ -6,17 +6,11 @@
|
||||
width="1280"
|
||||
height="720"
|
||||
color="#000000"
|
||||
opacity="0.5"
|
||||
>
|
||||
<Label
|
||||
text="Loading..."
|
||||
width="1280"
|
||||
height="720"
|
||||
translation="[0, 0]"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
font="font:MediumBoldSystemFont"
|
||||
/>
|
||||
opacity="0.5">
|
||||
<BusySpinner
|
||||
id="busySpinner"
|
||||
inheritParentOpacity="false"
|
||||
spinInterval="1" />
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
@@ -1,4 +1,5 @@
|
||||
import "pkg:/source/roku_modules/log/LogMixin.brs"
|
||||
import "pkg:/components/VideoPlayer/Video.bs"
|
||||
|
||||
function Init()
|
||||
log.initializeLogManager(["log_PrintTransport"], 2)
|
||||
@@ -6,9 +7,13 @@ function Init()
|
||||
m.top.backgroundColor = "0x242424FF"
|
||||
m.top.backgroundURI = ""
|
||||
|
||||
loadingIndicator = m.top.findNode("LoadingIndicator")
|
||||
m.global.addFields({ loadingIndicator: loadingIndicator })
|
||||
m.global.loadingIndicator.visible = true
|
||||
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")
|
||||
@@ -76,38 +81,12 @@ function OnNavIndexChange() as void
|
||||
end function
|
||||
|
||||
function OnWebServerLogin()
|
||||
' TODO: refresh same component instead of creating a new one
|
||||
m.global.loadingIndicator.visible = true
|
||||
homeIndex = GetIndexOfChild(m.top, m.homeGridScreen.id)
|
||||
newHomeGridScreen = CreateObject("roSGNode", "HomeGridScreen")
|
||||
m.top.replaceChild(newHomeGridScreen, homeIndex)
|
||||
m.homeGridScreen = newHomeGridScreen
|
||||
m.homeGridScreen.id = "HomeGridScreen"
|
||||
m.homeGridScreen.ObserveField("escape", "OnHomeGridScreenEscape")
|
||||
|
||||
' Selecting home
|
||||
m.navBar.focusIndex = -1
|
||||
m.homeGridScreen.focus = true
|
||||
|
||||
m.searchScreen.visible = false
|
||||
m.homeGridScreen.visible = true
|
||||
m.settingsScreen.visible = false
|
||||
m.homeGridScreen.refresh = true
|
||||
end function
|
||||
|
||||
function OnWebServerCommand()
|
||||
if m.serverTask.command.StartsWith("play:")
|
||||
' Selecting home
|
||||
m.navBar.focusIndex = -1
|
||||
m.homeGridScreen.focus = true
|
||||
|
||||
m.searchScreen.visible = false
|
||||
m.homeGridScreen.visible = true
|
||||
m.settingsScreen.visible = false
|
||||
' Trigger play video from home
|
||||
' TODO: allow returning to current screen, instead of home
|
||||
' BUG: if current video is playing in search screen, new video does not play
|
||||
' TODO: Owner of video player needs to be independant
|
||||
m.homeGridScreen.playvideo = m.serverTask.command.Mid(5)
|
||||
PlayVideo(m.serverTask.command.Mid(5))
|
||||
end if
|
||||
end function
|
||||
|
||||
@@ -121,3 +100,17 @@ function GetIndexOfChild(parent as object, childId as string) as integer
|
||||
end for
|
||||
return -1
|
||||
end function
|
||||
|
||||
function LaunchArgumentsReceived()
|
||||
? "LaunchArgumentsReceived" m.top.launchArgs
|
||||
if m.top.launchArgs <> invalid and m.top.launchArgs.contentId <> invalid
|
||||
PlayVideo(m.top.launchArgs.contentId, m.homeGridScreen)
|
||||
end if
|
||||
end function
|
||||
|
||||
function InputArgumentsReceived()
|
||||
? "InputArgumentsReceived" m.top.inputArgs
|
||||
if m.top.inputArgs <> invalid and m.top.inputArgs.contentId <> invalid
|
||||
PlayVideo(m.top.inputArgs.contentId)
|
||||
end if
|
||||
end function
|
||||
@@ -1,11 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="MainScene" extends="Scene">
|
||||
<interface>
|
||||
<field id="exitChannel" type="bool" alwaysNotify="true" />
|
||||
<field id="launchArgs" type="assocarray" onChange="LaunchArgumentsReceived" />
|
||||
<field id="inputArgs" type="assocarray" onChange="InputArgumentsReceived" />
|
||||
</interface>
|
||||
<children>
|
||||
<SearchScreen id="SearchScreen" visible="false" />
|
||||
<HomeGridScreen id="HomeGridScreen" />
|
||||
<SettingsScreen id="SettingsScreen" visible="false" />
|
||||
<NavBar id="NavBar" />
|
||||
<VideoContainer id="VideoContainer" />
|
||||
<LoadingIndicator id="LoadingIndicator" />
|
||||
</children>
|
||||
</component>
|
||||
@@ -1,3 +1,5 @@
|
||||
import "pkg:/components/VideoPlayer/Video.bs"
|
||||
|
||||
function Init()
|
||||
m.buttonGroup = m.top.findNode("NavBarButtonGroup")
|
||||
m.top.observeField("focusIndex", "OnFocusIndexChange")
|
||||
@@ -7,6 +9,11 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press
|
||||
return false
|
||||
end if
|
||||
if key = "options"
|
||||
if ToggleVideoPictureInPicture(m.top)
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
if key = "down"
|
||||
i = m.top.focusIndex
|
||||
target = i + 1
|
||||
@@ -31,11 +38,23 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||
m.top.focusIndex = -1
|
||||
return true
|
||||
end if
|
||||
else if key = "back"
|
||||
dialog = ShowDialogButtons("Do you want to exit Playlet?", "Exit", ["Exit", "Cancel"])
|
||||
dialog.observeField("buttonSelected", "OnExitDialog", ["buttonSelected"])
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
function OnExitDialog(event as object)
|
||||
buttonIndex = event.GetData()
|
||||
if buttonIndex = 0 ' Exit
|
||||
? "EXITING APP"
|
||||
m.top.GetScene().exitChannel = true
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnFocusIndexChange()
|
||||
focusIndex = m.top.focusIndex
|
||||
childCount = m.buttonGroup.getChildCount()
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<IconButton
|
||||
id="searchButton"
|
||||
background="#242424"
|
||||
focusBackground="#E5252B"
|
||||
focusBackground="#ff1c30"
|
||||
padding="20"
|
||||
icon="pkg:/images/icons/search.png"
|
||||
text="Search"
|
||||
@@ -27,7 +27,7 @@
|
||||
<IconButton
|
||||
id="homeButton"
|
||||
background="#242424"
|
||||
focusBackground="#E5252B"
|
||||
focusBackground="#ff1c30"
|
||||
padding="20"
|
||||
icon="pkg:/images/icons/home.png"
|
||||
text="Home"
|
||||
@@ -36,7 +36,7 @@
|
||||
<IconButton
|
||||
id="settingsButton"
|
||||
background="#242424"
|
||||
focusBackground="#E5252B"
|
||||
focusBackground="#ff1c30"
|
||||
padding="20"
|
||||
icon="pkg:/images/icons/settings.png"
|
||||
text="Settings"
|
||||
|
||||
@@ -12,6 +12,7 @@ function Init()
|
||||
|
||||
m.keyboard.ObserveField("text", "OnTextChange")
|
||||
m.suggestions.ObserveField("buttonSelected", "OnSearchButtonSelected")
|
||||
m.suggestions.ObserveField("buttonFocused", "OnSearchButtonFocused")
|
||||
m.rowList.ObserveField("rowItemSelected", "OnSearchVideoSelected")
|
||||
m.top.ObserveField("focus", "OnFocusChange")
|
||||
m.top.ObserveField("visible", "OnVisibilityChange")
|
||||
@@ -28,6 +29,9 @@ function OnFocusChange() as void
|
||||
return
|
||||
end if
|
||||
if m.suggestions.buttons.Count() > 0
|
||||
if m.suggestions.buttonFocused >= m.suggestions.buttons.Count()
|
||||
m.suggestions.focusButton = 0
|
||||
end if
|
||||
m.suggestions.SetFocus(true)
|
||||
return
|
||||
end if
|
||||
@@ -36,6 +40,9 @@ function OnFocusChange() as void
|
||||
end function
|
||||
|
||||
function OnTextChange() as void
|
||||
if IsNodeFocused("suggestions")
|
||||
return
|
||||
end if
|
||||
text = m.keyboard.text
|
||||
|
||||
createTaskPromise("SearchSuggestionsTask", {
|
||||
@@ -47,10 +54,25 @@ function OnTextChange() as void
|
||||
if task.output.q <> m.keyboard.text
|
||||
return
|
||||
end if
|
||||
q = task.output.q
|
||||
suggestions = task.output.response
|
||||
if suggestions <> invalid
|
||||
' TODO: fix race condition where button group gains focus before suggestions are set
|
||||
if q.len() > 0 and ArrayIndexOf(suggestions, q) = -1
|
||||
suggestions.Unshift(q)
|
||||
end if
|
||||
|
||||
' Capture current focused button and restore it after resetting the buttons
|
||||
buttonFocused = -1
|
||||
if IsNodeFocused("suggestions")
|
||||
buttonFocused = m.suggestions.buttonFocused
|
||||
end if
|
||||
if buttonFocused >= m.suggestions.buttons.Count()
|
||||
buttonFocused = m.suggestions.buttons.Count() - 1
|
||||
end if
|
||||
m.suggestions.buttons = suggestions
|
||||
if buttonFocused <> -1
|
||||
m.suggestions.focusButton = buttonFocused
|
||||
end if
|
||||
end if
|
||||
end function)
|
||||
end function
|
||||
@@ -61,6 +83,16 @@ function OnSearchButtonSelected()
|
||||
Search(text)
|
||||
end function
|
||||
|
||||
function OnSearchButtonFocused() as void
|
||||
if not IsNodeFocused("suggestions")
|
||||
return
|
||||
end if
|
||||
|
||||
selected = m.suggestions.buttonFocused
|
||||
text = m.suggestions.buttons[selected]
|
||||
m.keyboard.text = text
|
||||
end function
|
||||
|
||||
function Search(text as string)
|
||||
SaveSearchHistory(text)
|
||||
createTaskPromise("SearchTask", {
|
||||
@@ -93,7 +125,7 @@ function ClearSearch()
|
||||
end function
|
||||
|
||||
function IsNodeFocused(id as string) as boolean
|
||||
return m.top.focusedChild.id = id or m.container.focusedChild.id = id
|
||||
return m.top.focusedChild?.id = id or m.container.focusedChild?.id = id
|
||||
end function
|
||||
|
||||
function ScrollUp() as void
|
||||
@@ -127,13 +159,18 @@ function OnSearchVideoSelected(event as object)
|
||||
itemContent = rowContent.GetChild(selectedRowItem)
|
||||
|
||||
videoId = itemContent.videoId
|
||||
ShowVideoScreenFull(videoId, m.top)
|
||||
PlayVideo(videoId, m.top)
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if press = false
|
||||
return false
|
||||
end if
|
||||
if key = "options"
|
||||
if ToggleVideoPictureInPicture(m.top)
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
if key = "back"
|
||||
ScrollUp()
|
||||
m.top.escape = key
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import "pkg:/source/utils/General.bs"
|
||||
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "TaskMain"
|
||||
end function
|
||||
|
||||
function TaskMain()
|
||||
latest = "N/A"
|
||||
response = Requests().request("HEAD", "https://github.com/iBicha/playlet/releases/latest", invalid)
|
||||
|
||||
if response.statusCode = 200
|
||||
if response.headers.location <> invalid
|
||||
regex = CreateObject("roRegex", "/v?(\d+\.\d+\.\d+)", "")
|
||||
match = regex.match(response.headers.location)
|
||||
if match.Count() = 2
|
||||
latest = match[1]
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
m.top.setField("output", {
|
||||
latest: latest
|
||||
})
|
||||
end function
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="AppVersionTask" extends="Task">
|
||||
<interface>
|
||||
<field id="input" type="assocarray" />
|
||||
<field id="output" type="assocarray" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,7 +1,13 @@
|
||||
import "pkg:/source/utils/General.bs"
|
||||
import "pkg:/source/roku_modules/rokupromise/Promise.brs"
|
||||
|
||||
function Init()
|
||||
m.top.url = `http:/${GetLocalIpAddress()}:8888`
|
||||
m.versionLabel = m.top.findNode("VersionLabel")
|
||||
m.top.url = `http://${GetLocalIpAddress()}:8888`
|
||||
appInfo = GetAppInfo()
|
||||
m.currentVersion = appInfo.version
|
||||
SetVersionLabel(m.currentVersion, "N/A")
|
||||
GetLatestVersion()
|
||||
end function
|
||||
|
||||
function OnUrlSet()
|
||||
@@ -13,3 +19,17 @@ function OnUrlSet()
|
||||
urlLabel = m.top.findNode("urlLabel")
|
||||
urlLabel.text = url
|
||||
end function
|
||||
|
||||
function GetLatestVersion()
|
||||
createTaskPromise("AppVersionTask", {
|
||||
input: {}
|
||||
}).then(function(task as object) as void
|
||||
if task.output.latest <> invalid
|
||||
SetVersionLabel(m.currentVersion, task.output.latest)
|
||||
end if
|
||||
end function)
|
||||
end function
|
||||
|
||||
function SetVersionLabel(current as string, latest as string)
|
||||
m.versionLabel.text = `Version: ${current} | Latest: ${latest}`
|
||||
end function
|
||||
@@ -5,12 +5,20 @@
|
||||
<field id="url" type="string" onChange="OnUrlSet" />
|
||||
</interface>
|
||||
<children>
|
||||
<Label
|
||||
id='VersionLabel'
|
||||
height='50'
|
||||
width='1280'
|
||||
font='font:MediumBoldSystemFont'
|
||||
horizAlign="center"
|
||||
translation="[0,100]"
|
||||
/>
|
||||
<QRPoster
|
||||
id='SettingsQRPoster'
|
||||
loadWidth='500'
|
||||
loadHeight='500'
|
||||
loadWidth='400'
|
||||
loadHeight='400'
|
||||
loadPadding='20'
|
||||
translation='[395, 60]' />
|
||||
translation='[440, 160]' />
|
||||
|
||||
<Label
|
||||
id='UrlLabel'
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
import "pkg:/source/services/SponsorBlock.bs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "TaskMain"
|
||||
end function
|
||||
|
||||
function TaskMain()
|
||||
input = m.top.getField("input")
|
||||
videoId = input.videoId
|
||||
|
||||
skipSegments = SponsorBlock.GetSkipSegmentsForVideo(videoId)
|
||||
barPath = invalid
|
||||
|
||||
if skipSegments <> invalid
|
||||
barPath = `tmp:/sponsorblock_bar_${videoId}.png`
|
||||
SponsorBlock.GenerateProgressBarBackground(skipSegments, barPath)
|
||||
end if
|
||||
|
||||
m.top.setField("output", {
|
||||
videoId: videoId,
|
||||
skipSegments: skipSegments
|
||||
skipSegments: skipSegments,
|
||||
barPath: barPath
|
||||
})
|
||||
end function
|
||||
|
||||
@@ -1,215 +1,60 @@
|
||||
import "pkg:/source/services/Invidious.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/source/roku_modules/rokupromise/Promise.brs"
|
||||
|
||||
function ShowVideoScreenEmbedded(videoId as string, thumbnailNode as object)
|
||||
m.videoPlayer = CreateObject("roSGNode", "VideoPlayer")
|
||||
AddVideoFields()
|
||||
m.videoPlayer.embedded = true
|
||||
|
||||
m.videoPlayer.enableUI = false
|
||||
m.videoPlayer.width = thumbnailNode.width
|
||||
m.videoPlayer.height = thumbnailNode.height
|
||||
thumbnailNode.AppendChild(m.videoPlayer)
|
||||
ShowVideoScreen(videoId)
|
||||
end function
|
||||
|
||||
function ShowVideoScreenFull(videoId as string, sender as object)
|
||||
m.videoPlayer = CreateObject("roSGNode", "VideoPlayer")
|
||||
m.videoPlayer.sender = sender
|
||||
AddVideoFields()
|
||||
m.videoPlayer.embedded = false
|
||||
|
||||
' TODO: make sure video is at right node
|
||||
m.top.getParent().AppendChild(m.videoPlayer)
|
||||
ShowVideoScreen(videoId)
|
||||
end function
|
||||
|
||||
function AddVideoFields()
|
||||
m.videoPlayer.addFields({
|
||||
embedded: false,
|
||||
sponsorBlockTask: false,
|
||||
videoPlayingSuccess: false,
|
||||
ignoreNextFinishedState: false
|
||||
})
|
||||
end function
|
||||
|
||||
function ExpandVideoScreenFull()
|
||||
m.videoPlayer.embedded = true
|
||||
m.videoPlayer.reparent(m.top, false)
|
||||
m.videoPlayer.enableUI = true
|
||||
m.videoPlayer.width = 1280
|
||||
m.videoPlayer.height = 720
|
||||
m.videoPlayer.SetFocus(true)
|
||||
StartSponsorBlockTask(m.videoPlayer.videoId)
|
||||
end function
|
||||
|
||||
function ShowVideoScreen(videoId as string)
|
||||
m.videoPlayer.addFields({ videoId: videoId })
|
||||
m.videoPlayer.trickPlayBar.filledBarBlendColor = "0xFF0000FF"
|
||||
m.videoPlayer.bufferingBar.filledBarBlendColor = "0xFF0000FF"
|
||||
m.videoPlayer.retrievingBar.filledBarBlendColor = "0xFF0000FF"
|
||||
|
||||
if not m.videoPlayer.embedded
|
||||
m.videoPlayer.visible = true
|
||||
m.videoPlayer.SetFocus(true)
|
||||
else
|
||||
m.videoPlayer.visible = false
|
||||
function PlayVideo(videoId as string, sender = invalid as object)
|
||||
CloseVideo(false)
|
||||
videoContainer = GetVideoContainer()
|
||||
if sender <> invalid
|
||||
videoContainer.sender = sender
|
||||
end if
|
||||
|
||||
m.videoPlayer.ObserveField("state", "OnVideoPlayerStateChange")
|
||||
|
||||
StartVideoDetailsTask(videoId)
|
||||
if not m.videoPlayer.embedded
|
||||
StartSponsorBlockTask(videoId)
|
||||
videoContainer.videoPlayer = videoContainer.createChild("VideoPlayer")
|
||||
videoContainer.videoPlayer.videoId = videoId
|
||||
if videoContainer.fullscreen
|
||||
videoContainer.videoPlayer.SetFocus(true)
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnVideoPlayerStateChange() as void
|
||||
state = m.videoPlayer.state
|
||||
|
||||
' If we successfully played the video, then any error that comes later is not due to rate limiting.
|
||||
' This is to reduce false positives, as we do not want retry another link if the first link is working fine.
|
||||
if state = "playing"
|
||||
m.videoPlayer.videoPlayingSuccess = true
|
||||
|
||||
if m.videoPlayer.visible = false and m.videoPlayer.embedded = true
|
||||
m.videoPlayer.visible = true
|
||||
end if
|
||||
function CloseVideo(setFocus = true as boolean)
|
||||
videoContainer = GetVideoContainer()
|
||||
if videoContainer.videoPlayer <> invalid
|
||||
videoContainer.videoPlayer.control = "stop"
|
||||
videoContainer.RemoveChild(videoContainer.videoPlayer)
|
||||
videoContainer.videoPlayer = invalid
|
||||
end if
|
||||
|
||||
if state = "error"
|
||||
' A hack to see if we could use the proxy here
|
||||
if m.videoPlayingSuccess <> true
|
||||
errorInfo = m.videoPlayer.errorInfo
|
||||
' http for stream format, mediaerror for DASH
|
||||
if errorInfo.category = "http" or errorInfo.category = "mediaerror"
|
||||
url = m.videoPlayer.content.url
|
||||
if url.InStr("local=true") = -1
|
||||
print(`Video ${url} failed to play. Trying a proxy (local=true)`)
|
||||
if url.InStr("?") = -1
|
||||
url += "?local=true"
|
||||
else
|
||||
url += "&local=true"
|
||||
end if
|
||||
m.videoPlayer.content.url = url
|
||||
' This video errored, and is about to finish, so don't close the video yet
|
||||
' TODO: perhaps creating a second player is better?
|
||||
m.videoPlayer.ignoreNextFinishedState = true
|
||||
m.videoPlayer.control = "play"
|
||||
return
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
if state = "finished" and m.videoPlayer.ignoreNextFinishedState = true
|
||||
m.videoPlayer.ignoreNextFinishedState = false
|
||||
return
|
||||
end if
|
||||
|
||||
if state = "error" or state = "finished"
|
||||
CloseVideoPlayer()
|
||||
end if
|
||||
end function
|
||||
|
||||
function CloseVideoPlayer()
|
||||
m.videoPlayer.control = "stop"
|
||||
m.videoPlayer.visible = false
|
||||
m.videoPlayer.getParent().RemoveChild(m.videoPlayer)
|
||||
m.videoPlayer = invalid
|
||||
m.top.focus = true
|
||||
end function
|
||||
|
||||
function StartVideoDetailsTask(videoId as string)
|
||||
createTaskPromise("VideoDetailsTask", {
|
||||
input: {
|
||||
videoId: videoId
|
||||
}
|
||||
}).then(function(task as object)
|
||||
videoId = task.output.videoId
|
||||
metadata = task.output.metadata
|
||||
if metadata <> invalid
|
||||
contentNode = CreateObject("roSGNode", "ContentNode")
|
||||
contentNode.addFields({ videoId: videoId })
|
||||
|
||||
if metadata.hlsUrl <> invalid
|
||||
contentNode.url = metadata.hlsUrl
|
||||
else if metadata.dashUrl <> invalid
|
||||
contentNode.url = metadata.dashUrl
|
||||
else
|
||||
stream = metadata.formatStreams[metadata.formatStreams.Count() - 1]
|
||||
itag = stream.itag
|
||||
' Use an url relative to the host, so we can proxy(local=true) in case it fails
|
||||
contentNode.url = Invidious.GetVideoUrl(videoId, itag)
|
||||
end if
|
||||
|
||||
contentNode.title = metadata.title
|
||||
contentNode.secondaryTitle = metadata.author
|
||||
SetCaptions(metadata, m.videoPlayer, contentNode)
|
||||
m.videoPlayer.content = contentNode
|
||||
m.videoPlayer.control = "play"
|
||||
if setFocus and videoContainer.sender <> invalid
|
||||
if videoContainer.sender.hasField("focus")
|
||||
videoContainer.sender.focus = true
|
||||
else
|
||||
print "FAILED TO LOAD VIDEO " + videoId
|
||||
CloseVideoPlayer()
|
||||
videoContainer.sender.SetFocus(true)
|
||||
end if
|
||||
end function)
|
||||
end function
|
||||
|
||||
function StartSponsorBlockTask(videoId as string)
|
||||
m.videoPlayer.sponsorBlockTask = true
|
||||
createTaskPromise("SponsorBlockTask", {
|
||||
input: {
|
||||
videoId: videoId
|
||||
}
|
||||
}).then(function(task as object)
|
||||
skipSegments = task.output.skipSegments
|
||||
if skipSegments <> invalid
|
||||
m.videoPlayer.addFields({ skipSegments: skipSegments })
|
||||
m.videoPlayer.seekMode = "accurate"
|
||||
m.videoPlayer.ObserveField("position", "OnPositionChangeSkipSponsorBlockSections")
|
||||
end if
|
||||
end function)
|
||||
end function
|
||||
|
||||
function SetCaptions(metadata as object, videoPlayer as object, contentNode as object) as void
|
||||
' TODO: check if we have caption settings ON
|
||||
' TODO: read favorate language from system settings
|
||||
' TODO: populate list of caption tracks
|
||||
if metadata.captions.Count() = 0
|
||||
return
|
||||
end if
|
||||
videoPlayer.globalCaptionMode = "ON"
|
||||
contentNode.ClosedCaptions = True
|
||||
selectedCaption = metadata.captions[0]
|
||||
|
||||
' Use favorite caption langauage, or the first one
|
||||
for each caption in metadata.captions
|
||||
if caption.language_code = "en"
|
||||
selectedCaption = caption
|
||||
exit for
|
||||
end if
|
||||
end for
|
||||
|
||||
contentNode.SubtitleConfig = {
|
||||
ShowSubtitle: 1,
|
||||
TrackName: InvidiousSettings.GetSelectedInstance() + selectedCaption.url
|
||||
}
|
||||
end function
|
||||
|
||||
function OnPositionChangeSkipSponsorBlockSections() as void
|
||||
segments = m.videoPlayer.skipSegments
|
||||
for each segment in segments
|
||||
' TODO: handle other action types
|
||||
if segment["actionType"] = "skip"
|
||||
segmentRange = segment["segment"]
|
||||
segmentStart = segmentRange[0]
|
||||
segmentEnd = segmentRange[1]
|
||||
currentPosition = m.videoPlayer.position
|
||||
if (segmentStart < currentPosition) and ((segmentEnd - 1) > currentPosition)
|
||||
' TODO: if segmentEnd is at the end of the video, close video
|
||||
m.videoPlayer.seek = segmentEnd
|
||||
print("Skiping section:" + segment["category"])
|
||||
return
|
||||
function ToggleVideoPictureInPicture(sender = invalid as object) as boolean
|
||||
videoContainer = GetVideoContainer()
|
||||
if videoContainer.videoPlayer = invalid
|
||||
return false
|
||||
end if
|
||||
videoContainer.fullscreen = not videoContainer.fullscreen
|
||||
if sender <> invalid
|
||||
videoContainer.sender = sender
|
||||
end if
|
||||
if videoContainer.fullscreen
|
||||
videoContainer.videoPlayer.SetFocus(true)
|
||||
else
|
||||
if videoContainer.sender <> invalid
|
||||
if videoContainer.sender.hasField("focus")
|
||||
videoContainer.sender.focus = true
|
||||
else
|
||||
videoContainer.sender.SetFocus(true)
|
||||
end if
|
||||
end if
|
||||
end for
|
||||
videoContainer.sender = invalid
|
||||
end if
|
||||
return true
|
||||
end function
|
||||
|
||||
function GetVideoContainer() as object
|
||||
return m.global.videoContainer
|
||||
end function
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="VideoContainer" extends="Group">
|
||||
<interface>
|
||||
<field id="videoPlayer" type="node" />
|
||||
<field id="sender" type="node" />
|
||||
<field id="fullscreen" type="boolean" value="true" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,10 +1,49 @@
|
||||
import "pkg:/source/utils/TimeUtils.bs"
|
||||
import "pkg:/source/services/SponsorBlock.bs"
|
||||
import "pkg:/components/VideoPlayer/Video.bs"
|
||||
|
||||
function Init()
|
||||
SetupSponsorBlock()
|
||||
m.videoDetailsTask = m.top.findNode("VideoDetailsTask")
|
||||
' busySpinner is our spinner, shown when loading the video details (like links, title, etc)
|
||||
m.busySpinner = m.top.findNode("BusySpinner")
|
||||
' Once the Content is ready, the rokuBusySpinner shows up, which is loading the video feed
|
||||
m.rokuBusySpinner = FindChildNodeOfType(m.top, "BusySpinner")
|
||||
' The label that shows the buffering percentage
|
||||
m.rokuBusySpinnerLabel = FindChildNodeOfType(m.rokuBusySpinner, "Label")
|
||||
SetupBusySpinner()
|
||||
m.busySpinner.visible = true
|
||||
m.busySpinner.control = "start"
|
||||
|
||||
m.videoPlayingSuccess = false
|
||||
m.ignoreNextFinishedState = false
|
||||
|
||||
m.top.trickPlayBar.filledBarBlendColor = "0xFF0000FF"
|
||||
m.top.bufferingBar.filledBarBlendColor = "0xFF0000FF"
|
||||
m.top.retrievingBar.filledBarBlendColor = "0xFF0000FF"
|
||||
|
||||
m.top.observeField("control", "OnControlChange")
|
||||
m.top.observeField("videoId", "StartVideoDetailsTask")
|
||||
|
||||
m.videoContainer = GetVideoContainer()
|
||||
m.videoContainer.observeFieldScoped("fullscreen", "OnFullScreenChange")
|
||||
OnFullScreenChange()
|
||||
|
||||
m.top.ObserveField("state", "OnVideoPlayerStateChange")
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if press = false
|
||||
return false
|
||||
end if
|
||||
' Unfortunately, a Video node cannot capture the "options" key (because, Roku...)
|
||||
' https://community.roku.com/t5/Roku-Developer-Program/Bug-in-10-0-1-Options-key-is-not-being-consumed-by-onKeyEvent-when-Video-node-is-in-focus/m-p/709200/highlight/true#M49312
|
||||
' Because of that, the button "down" is used to shrink the video for picture in picture mode
|
||||
if key = "down"
|
||||
if ToggleVideoPictureInPicture()
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
if key = "back"
|
||||
CloseVideo()
|
||||
return true
|
||||
@@ -12,10 +51,192 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
return false
|
||||
end function
|
||||
|
||||
function CloseVideo()
|
||||
sender = m.top.sender
|
||||
m.top.control = "stop"
|
||||
m.top.visible = false
|
||||
m.top.getParent().removeChild(m.videoPlayer)
|
||||
sender.focus = true
|
||||
function OnControlChange()
|
||||
if m.top.control = "stop"
|
||||
m.sponsorBlockTask.control = "stop"
|
||||
m.videoDetailsTask.control = "stop"
|
||||
end if
|
||||
end function
|
||||
|
||||
function StartVideoDetailsTask()
|
||||
m.videoDetailsTask.input = { videoId: m.top.videoId }
|
||||
m.videoDetailsTask.observeField("output", "OnVideoDetailsTaskResults")
|
||||
m.videoDetailsTask.control = "run"
|
||||
end function
|
||||
|
||||
function OnVideoDetailsTaskResults() as void
|
||||
task = m.videoDetailsTask
|
||||
videoId = task.output.videoId
|
||||
metadata = task.output.metadata
|
||||
if videoId <> m.top.videoId
|
||||
return
|
||||
end if
|
||||
if metadata = invalid
|
||||
m.busySpinner.visible = false
|
||||
m.busySpinner.control = "stop"
|
||||
ShowDialog(`Failed to load video information for ${videoId}`, "Video load fail")
|
||||
CloseVideo()
|
||||
end if
|
||||
|
||||
contentNode = CreateObject("roSGNode", "ContentNode")
|
||||
contentNode.addFields({ metadata: metadata })
|
||||
|
||||
if metadata.hlsUrl <> invalid
|
||||
contentNode.url = metadata.hlsUrl
|
||||
else if metadata.dashUrl <> invalid
|
||||
#if DASH_THUMBNAILS
|
||||
' Redirect to our server so we can inject thumbnails (storyboards) into the DASH manifest
|
||||
contentNode.url = `http://${GetLocalIpAddress()}:8888/dash?v=${videoId}`
|
||||
#else
|
||||
contentNode.url = metadata.dashUrl
|
||||
#end if
|
||||
|
||||
else
|
||||
stream = metadata.formatStreams[metadata.formatStreams.Count() - 1]
|
||||
itag = stream.itag
|
||||
' Use an url relative to the host, so we can proxy(local=true) in case it fails
|
||||
contentNode.url = Invidious.GetVideoUrl(videoId, itag, false)
|
||||
end if
|
||||
|
||||
contentNode.title = metadata.title
|
||||
contentNode.secondaryTitle = metadata.author
|
||||
SetCaptions(metadata, m.top, contentNode)
|
||||
m.busySpinner.visible = false
|
||||
m.busySpinner.control = "stop"
|
||||
m.top.content = contentNode
|
||||
m.top.control = "play"
|
||||
end function
|
||||
|
||||
function FindChildNodeOfType(node as object, nodeType as string) as object
|
||||
if node.subtype() = nodeType
|
||||
return node
|
||||
end if
|
||||
|
||||
childCount = node.getChildCount()
|
||||
children = node.getChildren(childCount, 0)
|
||||
for i = 0 to childCount - 1
|
||||
child = FindChildNodeOfType(children[i], nodeType)
|
||||
if child <> invalid
|
||||
return child
|
||||
end if
|
||||
end for
|
||||
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function SetupBusySpinner()
|
||||
m.rokuBusySpinner.poster.width = 150
|
||||
m.rokuBusySpinner.poster.height = 150
|
||||
m.rokuBusySpinner.poster.uri = "pkg:/images/spinner.png"
|
||||
m.rokuBusySpinner.observeField("translation", "OnRokuSpinnerMoved")
|
||||
|
||||
m.rokuBusySpinnerLabel.width = 150
|
||||
m.rokuBusySpinnerLabel.height = 150
|
||||
m.rokuBusySpinnerLabel.translation = [0, 0]
|
||||
m.rokuBusySpinnerLabel.observeField("translation", "OnRokuSpinnerLabelMoved")
|
||||
|
||||
m.busySpinner.poster.width = 150
|
||||
m.busySpinner.poster.height = 150
|
||||
m.busySpinner.poster.uri = "pkg:/images/spinner.png"
|
||||
end function
|
||||
|
||||
function OnRokuSpinnerMoved()
|
||||
currentTranslation = m.rokuBusySpinner.translation
|
||||
parentRect = m.top.boundingRect()
|
||||
centerx = (parentRect.width - m.rokuBusySpinner.poster.width) / 2
|
||||
centery = (parentRect.height - m.rokuBusySpinner.poster.height) / 2
|
||||
|
||||
if currentTranslation[0] <> centerx or currentTranslation[1] <> centery
|
||||
m.rokuBusySpinner.translation = [centerx, centery]
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnRokuSpinnerLabelMoved()
|
||||
currentTranslation = m.rokuBusySpinnerLabel.translation
|
||||
if currentTranslation[0] <> 0 or currentTranslation[1] <> 0
|
||||
m.rokuBusySpinnerLabel.translation = [0, 0]
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnVideoPlayerStateChange() as void
|
||||
state = m.top.state
|
||||
|
||||
' If we successfully played the video, then any error that comes later is not due to a 403 (FORBIDDEN).
|
||||
' This is to reduce false positives, as we do not want retry another link if the first link is working fine.
|
||||
if state = "playing"
|
||||
m.videoPlayingSuccess = true
|
||||
end if
|
||||
|
||||
if state = "error"
|
||||
' A hack to see if we could use the proxy here
|
||||
if m.videoPlayingSuccess <> true
|
||||
errorInfo = m.top.errorInfo
|
||||
' http for stream format, mediaerror for DASH
|
||||
if errorInfo.category = "http" or errorInfo.category = "mediaerror"
|
||||
url = m.top.content.url
|
||||
if url.InStr("local=true") = -1
|
||||
print(`Video ${url} failed to play. Trying a proxy (local=true)`)
|
||||
if url.InStr("?") = -1
|
||||
url += "?local=true"
|
||||
else
|
||||
url += "&local=true"
|
||||
end if
|
||||
m.top.content.url = url
|
||||
' This video errored, and is about to finish, so don't close the video yet
|
||||
' TODO: perhaps creating a second player is better?
|
||||
m.ignoreNextFinishedState = true
|
||||
m.top.control = "play"
|
||||
return
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
if state = "finished" and m.ignoreNextFinishedState = true
|
||||
m.ignoreNextFinishedState = false
|
||||
return
|
||||
end if
|
||||
|
||||
if state = "finished"
|
||||
CloseVideo()
|
||||
end if
|
||||
|
||||
if state = "error"
|
||||
errorInfo = m.top.errorInfo
|
||||
messageLines = [`VideoId: ${m.top.videoId}`]
|
||||
for each info in errorInfo
|
||||
messageLines.push(`${info}: ${errorInfo[info]}`)
|
||||
end for
|
||||
ShowDialog(messageLines, "Error playing video")
|
||||
CloseVideo()
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnFullScreenChange()
|
||||
margin = 20
|
||||
width = 1280
|
||||
height = 720
|
||||
if m.videoContainer.fullscreen
|
||||
m.top.translation = [0, 0]
|
||||
m.top.width = width
|
||||
m.top.height = height
|
||||
else
|
||||
small_width = width / 3
|
||||
small_height = height / 3
|
||||
x = width - small_width - margin
|
||||
y = height - small_height - margin
|
||||
|
||||
m.top.translation = [x, y]
|
||||
m.top.width = small_width
|
||||
m.top.height = small_height
|
||||
end if
|
||||
|
||||
m.top.enableUI = m.videoContainer.fullscreen
|
||||
PositionSpinner()
|
||||
end function
|
||||
|
||||
function PositionSpinner()
|
||||
centerx = (m.top.width - m.busySpinner.poster.width) / 2
|
||||
centery = (m.top.height - m.busySpinner.poster.height) / 2
|
||||
m.busySpinner.translation = [centerx, centery]
|
||||
end function
|
||||
@@ -1,7 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="VideoPlayer" extends="Video">
|
||||
<script type="text/brightscript" uri="VideoPlayerSponsorBlock.bs" />
|
||||
<script type="text/brightscript" uri="VideoPlayerCaptions.bs" />
|
||||
<interface>
|
||||
<field id="sender" type="node" />
|
||||
<field id="chapter" type="string" alias="chapterLabel.text" />
|
||||
<field id="videoId" type="string" />
|
||||
</interface>
|
||||
<children>
|
||||
<SponsorBlockTask
|
||||
functionName="TaskMain"
|
||||
id="SponsorBlockTask" />
|
||||
<VideoDetailsTask
|
||||
functionName="TaskMain"
|
||||
id="VideoDetailsTask" />
|
||||
|
||||
<Label
|
||||
id="chapterLabel"
|
||||
width="350"
|
||||
height="25"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
font="font:SmallestSystemFont"
|
||||
/>
|
||||
<Timer
|
||||
id="chapterLabelTimer"
|
||||
repeat="true"
|
||||
duration="0.25"
|
||||
/>
|
||||
<BusySpinner
|
||||
id="busySpinner"
|
||||
spinInterval="1" />
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,24 @@
|
||||
function SetCaptions(metadata as object, videoPlayer as object, contentNode as object) as void
|
||||
' TODO: check if we have caption settings ON
|
||||
' TODO: read favorate language from system settings
|
||||
' TODO: populate list of caption tracks
|
||||
if metadata.captions.Count() = 0
|
||||
return
|
||||
end if
|
||||
videoPlayer.globalCaptionMode = "ON"
|
||||
contentNode.ClosedCaptions = True
|
||||
selectedCaption = metadata.captions[0]
|
||||
|
||||
' Use favorite caption langauage, or the first one
|
||||
for each caption in metadata.captions
|
||||
if caption.language_code = "en"
|
||||
selectedCaption = caption
|
||||
exit for
|
||||
end if
|
||||
end for
|
||||
|
||||
contentNode.SubtitleConfig = {
|
||||
ShowSubtitle: 1,
|
||||
TrackName: InvidiousSettings.GetSelectedInstance() + selectedCaption.url
|
||||
}
|
||||
end function
|
||||
@@ -0,0 +1,143 @@
|
||||
function SetupSponsorBlock()
|
||||
PositionChapterLabel()
|
||||
m.timeLabel = FindTimeLabel()
|
||||
m.top.trickPlayBar.observeField("visible", "OnTrickPlayBarVisible")
|
||||
m.chapterLabelTimer = m.top.findNode("chapterLabelTimer")
|
||||
m.chapterLabelTimer.observeField("fire", "OnChapterLabelTimer")
|
||||
m.sponsorBlockTask = m.top.findNode("SponsorBlockTask")
|
||||
m.top.observeField("videoId", "StartSponsorBlockTask")
|
||||
end function
|
||||
|
||||
function PositionChapterLabel()
|
||||
m.chapterLabel = m.top.findNode("chapterLabel")
|
||||
m.chapterLabel.reparent(m.top.trickPlayBar, false)
|
||||
trickPlayBarWidth = m.top.trickPlayBar.boundingRect().width
|
||||
#if DASH_THUMBNAILS
|
||||
yPos = 25
|
||||
#else
|
||||
yPos = 55
|
||||
#end if
|
||||
m.chapterLabel.translation = [trickPlayBarWidth / 2 - m.chapterLabel.width / 2, yPos]
|
||||
end function
|
||||
|
||||
' This is a hack to access the position of the trickplay
|
||||
function FindTimeLabel() as object
|
||||
children = m.top.trickPlayBar.getChildren(m.top.trickPlayBar.getChildCount(), 0)
|
||||
label = invalid
|
||||
for each child in children
|
||||
' It's very unfortunate to have to find a label with 0:00 text,
|
||||
' and that's on the left side of the screen. This might need completely custom trickPlayBar
|
||||
if child.isSubtype("Label") and child.text = "0:00"
|
||||
if label = invalid
|
||||
label = child
|
||||
else
|
||||
if child.translation[0] < label.translation[0]
|
||||
label = child
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end for
|
||||
return label
|
||||
end function
|
||||
|
||||
function OnTrickPlayBarVisible()
|
||||
if m.top.trickPlayBar.visible
|
||||
m.top.chapter = ""
|
||||
m.chapterLabelTimer.control = "start"
|
||||
else
|
||||
m.chapterLabelTimer.control = "stop"
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnChapterLabelTimer() as void
|
||||
if m.timeLabel = invalid or m.skipSegments = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
if m.sponsorBlockLastTime = m.timeLabel.text
|
||||
return
|
||||
end if
|
||||
m.sponsorBlockLastTime = m.timeLabel.text
|
||||
|
||||
time = TimeUtils.ParseTime(m.timeLabel.text)
|
||||
UpdateSponsorBlockChapter(time)
|
||||
end function
|
||||
|
||||
function UpdateSponsorBlockChapter(time as integer) as void
|
||||
segments = m.skipSegments
|
||||
for each segment in segments
|
||||
segmentRange = segment["segment"]
|
||||
segmentStart = segmentRange[0]
|
||||
segmentEnd = segmentRange[1]
|
||||
|
||||
if (segmentStart <= time) and (segmentEnd >= time)
|
||||
m.top.chapter = SponsorBlock.SegmentTitle(segment["category"])
|
||||
return
|
||||
end if
|
||||
end for
|
||||
m.top.chapter = ""
|
||||
end function
|
||||
|
||||
function StartSponsorBlockTask()
|
||||
m.sponsorBlockTask.input = { videoId: m.top.videoId }
|
||||
m.sponsorBlockTask.observeField("output", "OnSponsorBlockTaskResults")
|
||||
m.sponsorBlockTask.control = "run"
|
||||
end function
|
||||
|
||||
function OnSponsorBlockTaskResults()
|
||||
task = m.sponsorBlockTask
|
||||
skipSegments = task.output.skipSegments
|
||||
barPath = task.output.barPath
|
||||
if skipSegments <> invalid
|
||||
m.skipSegments = skipSegments
|
||||
m.top.seekMode = "accurate"
|
||||
if barPath <> invalid
|
||||
m.top.trickPlayBar.trackImageUri = barPath
|
||||
m.top.trickPlayBar.filledBarBlendColor = "0xFF000080"
|
||||
end if
|
||||
|
||||
m.top.ObserveField("position", "OnPositionChangeSkipSponsorBlockSections")
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnPositionChangeSkipSponsorBlockSections() as void
|
||||
shouldMute = false
|
||||
muteCategory = ""
|
||||
segments = m.skipSegments
|
||||
if segments = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
for each segment in segments
|
||||
' TODO: handle other action types
|
||||
if segment["actionType"] = "skip"
|
||||
segmentRange = segment["segment"]
|
||||
segmentStart = segmentRange[0]
|
||||
segmentEnd = segmentRange[1]
|
||||
currentPosition = m.top.position
|
||||
if (segmentStart < currentPosition) and ((segmentEnd - 1) > currentPosition)
|
||||
' TODO: if segmentEnd is at the end of the video, close video
|
||||
m.top.seek = segmentEnd
|
||||
print("Skiping section:" + segment["category"])
|
||||
return
|
||||
end if
|
||||
end if
|
||||
|
||||
if segment["actionType"] = "mute"
|
||||
segmentRange = segment["segment"]
|
||||
segmentStart = segmentRange[0]
|
||||
segmentEnd = segmentRange[1]
|
||||
currentPosition = m.top.position
|
||||
if (segmentStart < currentPosition) and (segmentEnd > currentPosition)
|
||||
shouldMute = true
|
||||
muteCategory = segment["category"]
|
||||
exit for
|
||||
end if
|
||||
end if
|
||||
end for
|
||||
|
||||
if m.top.mute <> shouldMute
|
||||
print(`Muting section: ${muteCategory} - ${shouldMute}`)
|
||||
m.top.mute = shouldMute
|
||||
end if
|
||||
end function
|
||||
@@ -29,7 +29,6 @@
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
font="font:SmallestSystemFont"
|
||||
inheritParentOpacity="true"
|
||||
/>
|
||||
</Rectangle>
|
||||
<Rectangle
|
||||
@@ -46,7 +45,6 @@
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
font="font:SmallestBoldSystemFont"
|
||||
inheritParentOpacity="true"
|
||||
text="LIVE"
|
||||
/>
|
||||
</Rectangle>
|
||||
|
||||
@@ -79,9 +79,9 @@ namespace Http
|
||||
' append to connection request
|
||||
m.request.Add(rcvStr)
|
||||
|
||||
if m.request.IsComplete()
|
||||
server.num_requests = validint(server.num_requests) + 1
|
||||
if m.request.Process(m)
|
||||
if m.request.ProcessNext(m)
|
||||
if m.request.state = Http.HttpRequestState.DONE
|
||||
server.num_requests = validint(server.num_requests) + 1
|
||||
m.response = new HttpResponse(m.request, m.server, m.settings)
|
||||
m.response.Process()
|
||||
m.SetState(Http.HttpConnectionState.SEND_HEADER)
|
||||
@@ -90,7 +90,7 @@ namespace Http
|
||||
m.close = true
|
||||
m.log.error("couldn't process request or response, closing @" + m.client)
|
||||
end if
|
||||
else if m.request.buf.len() > m.settings.MaxRequestLength ' die if it's too long
|
||||
else if m.request.buffer.len() > m.settings.MaxRequestLength ' die if it's too long
|
||||
m.response = new HttpResponse(m.request, m.server, m.settings)
|
||||
m.response.Default(413, "Your request was dropped because it was too long.")
|
||||
m.SetState(Http.HttpConnectionState.SEND_HEADER)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import "pkg:/components/WebServer/HttpRequestState.bs"
|
||||
|
||||
namespace Http
|
||||
|
||||
function GetHttpRequestId() as integer
|
||||
@@ -8,82 +10,181 @@ namespace Http
|
||||
class HttpRequest
|
||||
private log as log.Logger
|
||||
|
||||
Unix2NewLine = UnixNL() + UnixNL()
|
||||
Windows2NewLine = WinNL() + WinNL()
|
||||
|
||||
' members
|
||||
private method = invalid
|
||||
private uri = invalid
|
||||
private route = invalid
|
||||
private query = invalid
|
||||
private protocol = invalid
|
||||
private buf = invalid
|
||||
private fields = invalid
|
||||
private buffer = invalid
|
||||
private buffer_index = 0
|
||||
private headers = invalid
|
||||
private body = invalid
|
||||
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 ok = true
|
||||
private ready_for_response = false
|
||||
|
||||
function new()
|
||||
m.log = new log.Logger("HttpRequest")
|
||||
m.id = Http.GetHttpRequestId()
|
||||
m.fields = CreateObject("roAssociativeArray")
|
||||
m.headers = CreateObject("roAssociativeArray")
|
||||
end function
|
||||
|
||||
function Add(incoming as string)
|
||||
if isstr(m.buf)
|
||||
m.buf = m.buf + incoming
|
||||
if isstr(m.buffer)
|
||||
m.buffer = m.buffer + incoming
|
||||
else
|
||||
m.buf = incoming
|
||||
m.buffer = incoming
|
||||
end if
|
||||
end function
|
||||
|
||||
function IsComplete() as boolean
|
||||
' TODO: this function is correct only if request does not have a body
|
||||
' Need read and process line by line
|
||||
' Once there's an empty line, we've read all headers
|
||||
' Check for Content-Length header, and read that amount of data
|
||||
' If header is missing, error out
|
||||
buf = m.buf
|
||||
complete = isstr(buf) and (right(buf, 2) = m.Unix2NewLine) or (right(buf, 4) = m.Windows2NewLine)
|
||||
'if complete then info(m,"header:"+UnixNL()+buf)
|
||||
return complete
|
||||
function ProcessNext(connection as HttpConnection) as boolean
|
||||
if m.state = Http.HttpRequestState.DONE
|
||||
return m.ready_for_response
|
||||
end if
|
||||
|
||||
if m.state = Http.HttpRequestState.INIT
|
||||
m.state = Http.HttpRequestState.READING_OPERATION
|
||||
end if
|
||||
|
||||
if m.state = Http.HttpRequestState.READING_OPERATION
|
||||
if m.ParseOperation()
|
||||
m.ProcessOperation()
|
||||
m.state = Http.HttpRequestState.READING_HEADERS
|
||||
end if
|
||||
end if
|
||||
|
||||
if m.state = Http.HttpRequestState.READING_HEADERS
|
||||
if m.ParseHeaders()
|
||||
m.ProcessHeaders(connection)
|
||||
m.state = Http.HttpRequestState.READING_BODY
|
||||
end if
|
||||
end if
|
||||
|
||||
if m.state = Http.HttpRequestState.READING_BODY
|
||||
if m.ParseBody()
|
||||
m.state = Http.HttpRequestState.DONE
|
||||
end if
|
||||
end if
|
||||
|
||||
return m.ready_for_response
|
||||
end function
|
||||
|
||||
function Parse(connection as HttpConnection) as boolean
|
||||
lines = m.buf.tokenize(WinNL())
|
||||
operation = lines.RemoveHead()
|
||||
if operation <> invalid
|
||||
parts = operation.tokenize(" ")
|
||||
if parts.count() = 3
|
||||
m.method = Ucase(parts.RemoveHead())
|
||||
m.uri = parts.RemoveHead()
|
||||
m.protocol = Ucase(parts.RemoveHead())
|
||||
m.log.info(m.method + " '" + m.uri + "'")
|
||||
for each line in lines
|
||||
av = line.tokenize(": ")
|
||||
if av.count() = 2
|
||||
m.fields[av.GetHead()] = av.GetTail()
|
||||
end if
|
||||
end for
|
||||
' interpret some fields if present
|
||||
m.ParseRange()
|
||||
m.ParseConnection(connection)
|
||||
function ParseOperation() as boolean
|
||||
if m.buffer_index <> 0
|
||||
m.log.error(`invalid state: reading operation, but request is at index ${m.buffer_index}`)
|
||||
m.ready_for_response = true
|
||||
return false
|
||||
end if
|
||||
|
||||
if m.buffer.len() = 0
|
||||
return false
|
||||
end if
|
||||
|
||||
operation = m.ReadHeaderLine()
|
||||
|
||||
if operation = invalid or operation = ""
|
||||
m.log.error("empty request")
|
||||
m.ready_for_response = true
|
||||
return false
|
||||
end if
|
||||
|
||||
parts = operation.tokenize(" ")
|
||||
if parts.count() = 3
|
||||
m.method = Ucase(parts[0])
|
||||
m.uri = parts[1]
|
||||
m.protocol = Ucase(parts[2])
|
||||
m.log.info(m.method + " '" + m.uri + "'")
|
||||
else
|
||||
m.log.error("invalid request: " + operation)
|
||||
m.ready_for_response = true
|
||||
end if
|
||||
|
||||
return not m.ready_for_response
|
||||
end function
|
||||
|
||||
function ParseHeaders() as boolean
|
||||
line = m.ReadHeaderLine()
|
||||
while line <> invalid and line <> ""
|
||||
splitIndex = line.InStr(": ")
|
||||
if splitIndex > 0
|
||||
key = line.Left(splitIndex)
|
||||
value = line.Mid(splitIndex + 2)
|
||||
m.headers[key] = value
|
||||
end if
|
||||
line = m.ReadHeaderLine()
|
||||
end while
|
||||
|
||||
' Unfinished line, we wait for the rest
|
||||
if line = invalid
|
||||
return false
|
||||
end if
|
||||
|
||||
' Empty line, we're done with headers
|
||||
if line = ""
|
||||
return true
|
||||
end if
|
||||
|
||||
return not m.ready_for_response
|
||||
end function
|
||||
|
||||
function ParseBody() as boolean
|
||||
data = m.ReadBufferToEnd()
|
||||
if isstr(m.body)
|
||||
m.body = m.body + data
|
||||
else
|
||||
m.body = data
|
||||
end if
|
||||
|
||||
if m.headers["Content-Length"] = invalid
|
||||
m.ready_for_response = true
|
||||
if m.body.len() > 0
|
||||
m.log.error("invalid request: request body found, but no Content-Length header")
|
||||
return false
|
||||
else
|
||||
m.log.error("invalid request: " + operation)
|
||||
m.ok = false
|
||||
return true
|
||||
end if
|
||||
else
|
||||
m.log.error("empty request")
|
||||
m.ok = false
|
||||
contentLength = m.headers["Content-Length"].toInt()
|
||||
if not isstr(m.body)
|
||||
return false
|
||||
end if
|
||||
|
||||
if m.body.len() > contentLength
|
||||
m.log.error("invalid request: request body is larger than Content-Length")
|
||||
m.ready_for_response = true
|
||||
return false
|
||||
end if
|
||||
|
||||
m.ready_for_response = m.body.len() = contentLength
|
||||
return m.ready_for_response
|
||||
end if
|
||||
return m.ok
|
||||
end function
|
||||
|
||||
function ProcessHeaders(connection as HttpConnection)
|
||||
m.ParseRange()
|
||||
m.ParseConnection(connection)
|
||||
end function
|
||||
|
||||
function ProcessOperation()
|
||||
m.route = m.uri
|
||||
split = m.route.Instr("?")
|
||||
if split <> -1
|
||||
m.route = m.route.Left(split)
|
||||
m.query = WebUtils.UrlQueryComponents(m.uri)
|
||||
else
|
||||
m.query = {}
|
||||
end if
|
||||
end function
|
||||
|
||||
' TODO: this function does not take into account multiple ranges.
|
||||
function ParseRange()
|
||||
range = m.fields.range
|
||||
range = m.headers.range
|
||||
if range <> invalid
|
||||
endpoints = lcase(range).tokenize("=")
|
||||
if endpoints.count() = 2 and endpoints.GetHead() = "bytes"
|
||||
@@ -104,14 +205,40 @@ namespace Http
|
||||
end function
|
||||
|
||||
function ParseConnection(connection as HttpConnection)
|
||||
connectionStr = m.fields.connection
|
||||
connectionStr = m.headers.connection
|
||||
if connectionStr <> invalid
|
||||
connection.close = (lcase(connectionStr.trim()) = "close")
|
||||
end if
|
||||
end function
|
||||
|
||||
function Process(connection as HttpConnection) as boolean
|
||||
return m.Parse(connection)
|
||||
function ReadHeaderLine() as dynamic
|
||||
index = m.buffer.Instr(m.buffer_index, WinNL())
|
||||
if index = -1
|
||||
return invalid
|
||||
end if
|
||||
|
||||
length = index - m.buffer_index
|
||||
line = m.buffer.Mid(m.buffer_index, length)
|
||||
m.buffer_index += length + 2 'WinNL().len() = 2
|
||||
return line
|
||||
end function
|
||||
|
||||
function ReadBufferToEnd() as dynamic
|
||||
if m.buffer_index = m.buffer.len()
|
||||
return ""
|
||||
end if
|
||||
|
||||
data = m.buffer.Mid(m.buffer_index)
|
||||
m.buffer_index += data.len()
|
||||
return data
|
||||
end function
|
||||
|
||||
function Json() as dynamic
|
||||
if m.body = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
return ParseJson(m.body)
|
||||
end function
|
||||
end class
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Http
|
||||
|
||||
enum HttpRequestState
|
||||
INIT = 0
|
||||
READING_OPERATION = 1
|
||||
READING_HEADERS = 2
|
||||
READING_BODY = 3
|
||||
DONE = 4
|
||||
end enum
|
||||
|
||||
end namespace
|
||||
@@ -17,20 +17,19 @@ namespace Http
|
||||
private source = Http.HttpResponseSource.NONE
|
||||
|
||||
' members
|
||||
private buf = invalid
|
||||
private header = invalid
|
||||
private body_buffer = invalid
|
||||
private header_buffer = invalid
|
||||
private path = invalid
|
||||
private request = invalid
|
||||
private id = 0
|
||||
' copy-initializable members
|
||||
private start = 0
|
||||
private length = 0
|
||||
private body_buffer_length = 0
|
||||
private sent = 0
|
||||
private header_sent = 0
|
||||
private header_only = false
|
||||
private buf_start = 0
|
||||
private http_code = 0
|
||||
private mimetype = "text/html" ' for errors
|
||||
|
||||
private server
|
||||
private settings
|
||||
@@ -38,14 +37,11 @@ namespace Http
|
||||
function new(request as HttpRequest, server as HttpServer, settings as HttpSettings)
|
||||
m.log = new log.Logger("HttpResponse")
|
||||
m.id = Http.GetHttpResponseId()
|
||||
m.request = request
|
||||
m.server = server
|
||||
m.settings = settings
|
||||
m.Init(request)
|
||||
end function
|
||||
|
||||
function Init(request as HttpRequest)
|
||||
m.buf = CreateObject("roByteArray")
|
||||
m.request = request
|
||||
m.body_buffer = CreateObject("roByteArray")
|
||||
m.headers = {}
|
||||
end function
|
||||
|
||||
function Process() as boolean
|
||||
@@ -63,22 +59,21 @@ namespace Http
|
||||
errname = WebUtils.HttpTitle(errcode)
|
||||
m.http_code = errcode
|
||||
|
||||
buf = "<html><head><title>" + Stri(errcode).trim() + " " + errname + "</title></head><body>" + UnixNL()
|
||||
buf = buf + "<h1>" + errname + "</h1>" + UnixNL()
|
||||
buf = buf + reason + UnixNL()
|
||||
buf = buf + "<hr>" + UnixNL()
|
||||
buf = buf + m.GeneratedBy() + UnixNL()
|
||||
buf = buf + "</body></html>" + UnixNL()
|
||||
buffer = "<html><head><title>" + Stri(errcode).trim() + " " + errname + "</title></head><body>" + UnixNL()
|
||||
buffer = buffer + "<h1>" + errname + "</h1>" + UnixNL()
|
||||
buffer = buffer + reason + UnixNL()
|
||||
buffer = buffer + "<hr>" + UnixNL()
|
||||
buffer = buffer + m.GeneratedBy() + UnixNL()
|
||||
buffer = buffer + "</body></html>" + UnixNL()
|
||||
|
||||
m.buf.fromasciistring(buf)
|
||||
m.length = m.buf.count()
|
||||
m.SetBodyDataString(buffer)
|
||||
m.ContentType("text/html")
|
||||
|
||||
m.GenerateHeader(true)
|
||||
m.source = Http.HttpResponseSource.GENERATED
|
||||
end function
|
||||
|
||||
function Redirect(where as string, code = 301 as integer)
|
||||
m.location = where
|
||||
m.headers["Location"] = where
|
||||
message = "Moved to: <a href=" + Quote() + where + Quote() + ">" + where + "</a>"
|
||||
m.Default(code, message)
|
||||
end function
|
||||
@@ -86,37 +81,47 @@ namespace Http
|
||||
function Json(data as object)
|
||||
m.http_code = 200
|
||||
|
||||
buf = FormatJson(data)
|
||||
buffer = FormatJson(data)
|
||||
m.SetBodyDataString(buffer)
|
||||
m.ContentType("application/json")
|
||||
|
||||
m.buf.fromasciistring(buf)
|
||||
m.length = m.buf.count()
|
||||
|
||||
m.mimetype = "application/json"
|
||||
|
||||
m.GenerateHeader(true)
|
||||
m.source = Http.HttpResponseSource.GENERATED
|
||||
end function
|
||||
|
||||
function SetBodyDataString(data as string)
|
||||
m.body_buffer.fromasciistring(data)
|
||||
m.body_buffer_length = m.body_buffer.count()
|
||||
m.ContentLength(m.body_buffer_length)
|
||||
end function
|
||||
|
||||
function ContentLength(length as integer)
|
||||
m.headers["Content-Length"] = Stri(length).trim()
|
||||
end function
|
||||
|
||||
function ContentType(mimeType as string)
|
||||
m.headers["Content-Type"] = mimeType
|
||||
end function
|
||||
|
||||
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.buf.count()
|
||||
if m.start + m.sent >= m.buf_start + m.body_buffer.count()
|
||||
m.buf_start = m.start + m.sent
|
||||
m.buf.ReadFile(m.path, m.buf_start, bufsize)
|
||||
m.log.info("Read" + Stri(m.buf.count()) + " bytes from source file @" + itostr(m.buf_start))
|
||||
m.body_buffer.ReadFile(m.path, m.buf_start, bufsize)
|
||||
m.log.info("Read" + Stri(m.body_buffer.count()) + " bytes from source file @" + itostr(m.buf_start))
|
||||
end if
|
||||
end if
|
||||
buf_pos = m.start + m.sent - m.buf_start
|
||||
buf_remaining = m.buf.count() - buf_pos
|
||||
buf_remaining = m.body_buffer.count() - buf_pos
|
||||
if buf_remaining = 0
|
||||
m.log.info("source buf is empty")
|
||||
m.log.info("source buffer is empty")
|
||||
end if
|
||||
req_remaining = m.length - m.sent
|
||||
req_remaining = m.body_buffer_length - m.sent
|
||||
if buf_remaining > req_remaining
|
||||
buf_remaining = req_remaining
|
||||
end if
|
||||
sent = sock.send(m.buf, buf_pos, buf_remaining)
|
||||
m.LogInfo(sent, m.buf_start + buf_pos, m.length)
|
||||
sent = sock.send(m.body_buffer, buf_pos, buf_remaining)
|
||||
m.LogInfo(sent, m.buf_start + buf_pos, m.body_buffer_length)
|
||||
if sent > 0
|
||||
m.sent = m.sent + sent
|
||||
end if
|
||||
@@ -124,6 +129,10 @@ namespace Http
|
||||
end function
|
||||
|
||||
function SendHeader(sock as object, bufsize as integer) as integer
|
||||
if m.header = invalid
|
||||
m.GenerateHeader()
|
||||
end if
|
||||
|
||||
if m.header_sent = 0
|
||||
sent = sock.sendStr(m.header)
|
||||
else
|
||||
@@ -136,28 +145,28 @@ namespace Http
|
||||
return sent
|
||||
end function
|
||||
|
||||
function GenerateHeader(close = false as boolean)
|
||||
function GenerateHeader()
|
||||
code = m.http_code
|
||||
title = WebUtils.HttpTitle(code)
|
||||
|
||||
m.headers["Date"] = m.Now()
|
||||
m.headers["Server"] = m.settings.PackageName
|
||||
|
||||
if not m.headers.DoesExist("Connection")
|
||||
m.KeepAlive(false)
|
||||
end if
|
||||
|
||||
m.header = "HTTP/1.1" + Stri(code) + " " + title + WinNL()
|
||||
m.header = m.header + "Date: " + m.Now() + WinNL()
|
||||
m.header = m.header + "Server: " + m.settings.PackageName + WinNL()
|
||||
if isstr(m.location)
|
||||
m.header = m.header + "Location: " + m.location + WinNL()
|
||||
end if
|
||||
m.header = m.header + m.KeepAlive(close) + WinNL()
|
||||
m.header = m.header + "Content-Length:" + Stri(m.length) + WinNL()
|
||||
if code = 206
|
||||
m.header = m.header + "Content-Range: bytes" + m.MakeRange(m.start, m.length, m.filelength) + WinNL()
|
||||
end if
|
||||
m.header = m.header + "Content-Type: " + m.mimetype + WinNL()
|
||||
m.header = m.header + "Accept-Ranges: bytes" + WinNL()
|
||||
for each header in m.headers
|
||||
m.header = m.header + header + ": " + m.headers[header] + WinNL()
|
||||
end for
|
||||
|
||||
m.header = m.header + WinNL()
|
||||
m.header_length = m.header.len()
|
||||
end function
|
||||
|
||||
function Done() as boolean
|
||||
return m.sent = m.length
|
||||
return m.sent = m.body_buffer_length
|
||||
end function
|
||||
|
||||
function DoneHeader() as boolean
|
||||
@@ -168,13 +177,14 @@ namespace Http
|
||||
m.log.info("Sent" + Stri(recent) + " [" + m.MakeRange(from, recent, total) + "]")
|
||||
end function
|
||||
|
||||
function KeepAlive(close as boolean) as string
|
||||
if close
|
||||
base = "Connection: close"
|
||||
function KeepAlive(keepAlive as boolean)
|
||||
if keepAlive
|
||||
m.headers["Connection"] = "keep-alive"
|
||||
m.headers["Keep-Alive"] = "timeout=" + Stri(m.settings.Idletime).trim()
|
||||
else
|
||||
base = "Keep-Alive: timeout=" + Stri(m.settings.Idletime).trim()
|
||||
m.headers["Connection"] = "close"
|
||||
m.headers.Delete("Keep-Alive")
|
||||
end if
|
||||
return base
|
||||
end function
|
||||
|
||||
function Now() as string
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Http
|
||||
return false
|
||||
end if
|
||||
|
||||
if route.path <> "*" and route.path <> request.uri
|
||||
if route.path <> "*" and route.path <> request.route
|
||||
return false
|
||||
end if
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Http
|
||||
MessagePort = invalid
|
||||
MaxConnections = 10
|
||||
Timeout = 60 * 1000
|
||||
MaxRequestLength = 4000
|
||||
MaxRequestLength = 2097152
|
||||
Idletime = 60
|
||||
WwwRoot = "pkg:/"
|
||||
IndexName = "index.html"
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
namespace Http
|
||||
|
||||
class BasicAuthMiddleware extends HttpRouter
|
||||
public Username = "playlet"
|
||||
public Password = "1234"
|
||||
|
||||
function new()
|
||||
super()
|
||||
|
||||
m.All("*", function(context as object) as boolean
|
||||
router = context.router
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
if not router.IsAuthorized(request, router)
|
||||
response.headers["WWW-Authenticate"] = `Basic realm="Playlet web app"`
|
||||
response.Default(401, "Unauthorized")
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function)
|
||||
end function
|
||||
|
||||
function IsAuthorized(request as HttpRequest, router as HttpRouter) as boolean
|
||||
authHeader = request.headers["Authorization"]
|
||||
if authHeader = invalid
|
||||
return false
|
||||
end if
|
||||
|
||||
if not authHeader.StartsWith("Basic ")
|
||||
return false
|
||||
end if
|
||||
|
||||
encoded = authHeader.Mid(6)
|
||||
|
||||
buffer = createObject("roByteArray")
|
||||
buffer.FromBase64String(encoded)
|
||||
|
||||
decoded = buffer.ToAsciiString()
|
||||
|
||||
components = decoded.Tokenize(":")
|
||||
|
||||
if components.Count() = 2
|
||||
return components[0] = router.Username and components[1] = router.Password
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
end namespace
|
||||
@@ -5,43 +5,32 @@ namespace Http
|
||||
function new()
|
||||
super()
|
||||
|
||||
m.Get("/api/command/logout", function(context as object) as boolean
|
||||
response = context.response
|
||||
server = context.server
|
||||
|
||||
if Invidious.Logout()
|
||||
server.task.top.login = false
|
||||
end if
|
||||
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
end function)
|
||||
|
||||
m.Get("*", function(context as object) as boolean
|
||||
m.Post("/api/command", function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
server = context.server
|
||||
|
||||
route = request.uri
|
||||
|
||||
if route.StartsWith("/api/command/play")
|
||||
components = WebUtils.UrlQueryComponents(route)
|
||||
if components["v"] = invalid
|
||||
response.Default(400, "Missing arg 'v'")
|
||||
return true
|
||||
end if
|
||||
|
||||
server.task.top.command = `play:${components["v"]}`
|
||||
if components["redirect"] = "true"
|
||||
' 302 to prevent redirection to current host permanently
|
||||
response.Redirect(`${InvidiousSettings.GetSelectedInstance()}/watch?v=${components["v"]}`, 302)
|
||||
else
|
||||
response.Default(204, "OK")
|
||||
end if
|
||||
payload = request.Json()
|
||||
if payload = invalid
|
||||
response.Default(400, "Invalid payload")
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
if payload.command = "logout"
|
||||
if Invidious.Logout()
|
||||
server.task.top.login = false
|
||||
end if
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
else if payload.command = "play"
|
||||
videoId = payload.videoId
|
||||
server.task.top.command = `play:${videoId}`
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
end if
|
||||
|
||||
response.Default(400, `Invalid command: ${payload.command}`)
|
||||
return true
|
||||
end function)
|
||||
end function
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace Http
|
||||
|
||||
class CorsMiddleware extends HttpRouter
|
||||
private origin
|
||||
|
||||
function new(origin = "*" as string)
|
||||
super()
|
||||
|
||||
m.origin = origin
|
||||
|
||||
m.All("*", function(context as object) as boolean
|
||||
router = context.router
|
||||
response = context.response
|
||||
response.headers["Access-Control-Allow-Origin"] = router.origin
|
||||
return false
|
||||
end function)
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
end namespace
|
||||
@@ -0,0 +1,156 @@
|
||||
import "pkg:/source/utils/WebUtils.bs"
|
||||
import "pkg:/source/services/InvidiousSettings.bs"
|
||||
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
|
||||
|
||||
namespace Http
|
||||
|
||||
class DashRouter extends HttpRouter
|
||||
|
||||
function new()
|
||||
super()
|
||||
|
||||
m.Get("/dash", function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
router = context.router
|
||||
|
||||
v = request.query.v
|
||||
local = request.query.local
|
||||
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
metadata = router.GetVideoMetadata(context, v)
|
||||
dashUrl = `${instance}/api/manifest/dash/id/${v}`
|
||||
|
||||
if metadata = invalid and local = invalid
|
||||
response.Redirect(dashUrl, 302)
|
||||
return true
|
||||
end if
|
||||
|
||||
if local <> invalid
|
||||
dashUrl = `${dashUrl}?local=${local}`
|
||||
end if
|
||||
|
||||
resp = Requests().get(dashUrl)
|
||||
text = resp.text ?? ""
|
||||
if resp.statuscode = 200 and local = "true"
|
||||
text = text.Replace("<BaseURL>/videoplayback", `<BaseURL>${instance}/videoplayback`)
|
||||
end if
|
||||
|
||||
if resp.statuscode = 200 and metadata <> invalid
|
||||
text = router.InjectStoryBoard(router, text, metadata)
|
||||
end if
|
||||
|
||||
response.http_code = resp.statuscode
|
||||
response.SetBodyDataString(text)
|
||||
response.ContentType("application/dash+xml")
|
||||
response.source = Http.HttpResponseSource.GENERATED
|
||||
|
||||
return true
|
||||
end function)
|
||||
end function
|
||||
|
||||
function GetVideoMetadata(context as object, videoId as string) as object
|
||||
scene = context.server.task.top.getScene()
|
||||
videoPlayer = scene.findNode("VideoPlayer")
|
||||
metadata = videoPlayer?.content?.metadata
|
||||
if metadata <> invalid and metadata.videoId = videoId
|
||||
return metadata
|
||||
end if
|
||||
metadata = Invidious.GetVideoMetadata(videoId)
|
||||
return metadata
|
||||
end function
|
||||
|
||||
function InjectStoryBoard(router as object, dash as string, metadata as object) as string
|
||||
xml = CreateObject ("roXMLElement")
|
||||
if not xml.Parse(dash)
|
||||
return dash
|
||||
end if
|
||||
|
||||
thumb_id = 0
|
||||
period = xml.GetChildNodes()[0]
|
||||
sets = period.GetChildNodes()
|
||||
for each set in sets
|
||||
attributes = set.GetAttributes()
|
||||
contentType = attributes.contentType
|
||||
mimeType = attributes.mimeType
|
||||
' If the DASH already has thumbnails, abort
|
||||
if contentType = "image" or (mimeType <> invalid and mimeType.StartsWith("image"))
|
||||
return ""
|
||||
end if
|
||||
id = attributes.id
|
||||
idInt = id.toInt()
|
||||
if idInt >= thumb_id
|
||||
thumb_id = idInt + 1
|
||||
end if
|
||||
end for
|
||||
|
||||
thumbnails = router.GenerateThumbnailAdaptationSet(router, metadata, thumb_id)
|
||||
|
||||
injectPoint = StringLastIndexOf(dash, "</AdaptationSet>") + "</AdaptationSet>".Len()
|
||||
|
||||
newDash = dash.Left(injectPoint) + thumbnails + dash.Mid(injectPoint)
|
||||
|
||||
return newDash
|
||||
end function
|
||||
|
||||
function GenerateThumbnailAdaptationSet(router as object, metadata as object, id as integer) as string
|
||||
result = ""
|
||||
storyboards = metadata.storyboards
|
||||
for each storyboard in storyboards
|
||||
' BUG: Broken storyboards have interval = 0 https://github.com/iv-org/invidious/issues/3441
|
||||
if storyboard.interval > 0
|
||||
' BUG: storyboardHeight can be wrong https://github.com/iv-org/invidious/issues/3440
|
||||
' TODO: this fix/assumption is only if we have storyboard.storyboardCount = 1
|
||||
storyboardHeight = storyboard.storyboardHeight
|
||||
if storyboard.storyboardCount = 1
|
||||
storyboardHeight = storyboard.count \ storyboard.storyboardWidth
|
||||
if storyboard.count mod storyboard.storyboardWidth > 0
|
||||
storyboardHeight += 1
|
||||
end if
|
||||
end if
|
||||
|
||||
tilesPerPage = storyboard.storyboardWidth * storyboardHeight
|
||||
intervalSeconds = (storyboard.interval / 1000)
|
||||
|
||||
' If the template changed from known format, abort.
|
||||
if storyboard.templateUrl.Instr("$M") = -1
|
||||
return ""
|
||||
end if
|
||||
' Youtube template uses the var $M for tile pages
|
||||
' DASH-IF uses $Number$ in the SegmentTemplate
|
||||
url = WebUtils.EscapeUrlForXml(storyboard.templateUrl.Replace("$M", "$Number$"))
|
||||
|
||||
tileCount = tilesPerPage
|
||||
duration = tileCount * intervalSeconds
|
||||
|
||||
width = storyboard.width * storyboard.storyboardWidth
|
||||
height = storyboard.height * storyboardHeight
|
||||
|
||||
' Bandwidth is kind of a guess...
|
||||
bandwidth = Int((width * height * 0.5) / duration)
|
||||
|
||||
result += `<AdaptationSet id="${id}" mimeType="image/jpeg" contentType="image">`
|
||||
result += `<SegmentTemplate media="${url}" duration="${duration}" startNumber="0" />`
|
||||
result += `<Representation id="thumbnails_${id}" bandwidth="${bandwidth}" `
|
||||
result += ` width="${width}" height="${height}">`
|
||||
|
||||
' TODO: the last image in the list is usually smaller than the others. For example:
|
||||
' Consider a video with 85 thumbnails, in tiles of 5x5
|
||||
' 1st tile is 5x5 (25)
|
||||
' 2nd tile is 5x5 (50)
|
||||
' 3rd tile is 5x5 (75)
|
||||
' 4th tile is 5x2 (85)
|
||||
' This makes the display always misinterpret the the last tile if it is smaller
|
||||
result += `<EssentialProperty schemeIdUri="http://dashif.org/guidelines/thumbnail_tile" value="${storyboard.storyboardWidth}x${storyboardHeight}"/>`
|
||||
result += `</Representation>`
|
||||
result += `</AdaptationSet>`
|
||||
|
||||
id += 1
|
||||
end if
|
||||
end for
|
||||
return result
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
end namespace
|
||||
@@ -4,26 +4,34 @@ namespace Http
|
||||
private log as log.Logger
|
||||
|
||||
private root
|
||||
private filesOnly
|
||||
private route
|
||||
private showDirectories
|
||||
private showHidden
|
||||
|
||||
function new(root as string, filesOnly = false as boolean)
|
||||
function new(route as string, root as string, showDirectories = false as boolean, showHidden = false as boolean)
|
||||
super()
|
||||
m.log = new log.Logger("HttpStaticFilesRouter")
|
||||
|
||||
m.root = root
|
||||
m.filesOnly = filesOnly
|
||||
m.route = route
|
||||
m.showDirectories = showDirectories
|
||||
m.showHidden = showHidden
|
||||
|
||||
m.Get("*", function(context as object) as boolean
|
||||
router = context.router
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
uri = request.uri
|
||||
decoded_uri = WebUtils.UrlUnescape(uri)
|
||||
if decoded_uri.instr("?")
|
||||
decoded_uri = decoded_uri.Tokenize("?")[0]
|
||||
if not request.route.StartsWith(router.route)
|
||||
return false
|
||||
end if
|
||||
path = CreateObject("roPath", router.root + decoded_uri)
|
||||
|
||||
path_in_route = request.route.Mid(router.route.Len())
|
||||
|
||||
decoded_path = WebUtils.UrlUnescape(path_in_route)
|
||||
full_path = PathJoin(router.root, decoded_path)
|
||||
|
||||
path = CreateObject("roPath", full_path)
|
||||
fs = CreateObject("roFilesystem")
|
||||
|
||||
if not path.isValid()
|
||||
@@ -41,17 +49,18 @@ namespace Http
|
||||
end if
|
||||
|
||||
if stat.type = "directory"
|
||||
if router.filesOnly
|
||||
if not router.showDirectories
|
||||
response.Default(403, "Forbidden")
|
||||
return false
|
||||
return true
|
||||
end if
|
||||
response.mimetype = "text/html"
|
||||
response.ContentType("text/html")
|
||||
router.GenerateDirectoryListing(path, router, request, response)
|
||||
return true
|
||||
else if stat.type = "file"
|
||||
response.mimetype = WebUtils.MimeType(decoded_uri)
|
||||
mimetype = WebUtils.MimeType(decoded_path)
|
||||
response.ContentType(mimetype)
|
||||
response.fileLength = stat.size
|
||||
router.log.info("uri=" + uri + ", target=" + path + ", content-type=" + response.mimetype + ", content-length=" + Stri(response.fileLength).trim())
|
||||
router.log.info("uri=" + request.uri + ", target=" + path + ", content-type=" + mimetype + ", content-length=" + Stri(response.fileLength).trim())
|
||||
router.GenerateFile(path, router, request, response)
|
||||
return true
|
||||
else
|
||||
@@ -94,16 +103,20 @@ namespace Http
|
||||
end if
|
||||
|
||||
response.start = start
|
||||
response.length = finish - start + 1
|
||||
response.body_buffer_length = finish - start + 1
|
||||
response.ContentLength(response.body_buffer_length)
|
||||
response.headers["Content-Range"] = "bytes " + response.MakeRange(response.start, response.body_buffer_length, response.filelength)
|
||||
response.http_code = 206
|
||||
|
||||
router.log.info("sending range " + response.MakeRange(start, response.length, response.fileLength))
|
||||
router.log.info("sending range " + response.MakeRange(start, response.body_buffer_length, response.fileLength))
|
||||
else ' no range stuff
|
||||
response.length = response.fileLength
|
||||
response.body_buffer_length = response.fileLength
|
||||
response.ContentLength(response.body_buffer_length)
|
||||
response.http_code = 200
|
||||
end if
|
||||
|
||||
response.GenerateHeader()
|
||||
response.headers["Accept-Ranges"] = "bytes"
|
||||
response.KeepAlive(true)
|
||||
return true
|
||||
end function
|
||||
|
||||
@@ -140,8 +153,19 @@ namespace Http
|
||||
if uriDir.len() > 0 and uriDir.right(1) <> "/"
|
||||
uriDir = uriDir + "/"
|
||||
end if
|
||||
|
||||
routeDir = router.route
|
||||
if routeDir.len() > 0 and routeDir.right(1) <> "/"
|
||||
routeDir = routeDir + "/"
|
||||
end if
|
||||
|
||||
if not uriDir = routeDir
|
||||
uri = uriDir + ".."
|
||||
listing = listing + "<a href=" + Quote() + uri + Quote() + ">" + ".." + "</a>" + UnixNL()
|
||||
end if
|
||||
|
||||
for each item in dirList
|
||||
if item.left(1) <> "."
|
||||
if router.showHidden or item.left(1) <> "."
|
||||
indicator = invalid
|
||||
stat = fs.stat(dir + item)
|
||||
if stat <> invalid
|
||||
@@ -170,11 +194,9 @@ namespace Http
|
||||
listing = listing + "</body>" + UnixNL()
|
||||
listing = listing + "</html>" + UnixNL()
|
||||
|
||||
response.buf.FromAsciiString(listing)
|
||||
response.length = response.buf.count()
|
||||
|
||||
response.SetBodyDataString(listing)
|
||||
response.http_code = 200
|
||||
response.GenerateHeader()
|
||||
response.KeepAlive(true)
|
||||
response.source = Http.HttpResponseSource.GENERATED
|
||||
return true
|
||||
end function
|
||||
|
||||
@@ -5,24 +5,15 @@ namespace Http
|
||||
function new()
|
||||
super()
|
||||
|
||||
' TODO: use POST once supported
|
||||
m.Get("*", function(context as object) as boolean
|
||||
m.Post("/invidious/instances", function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
route = request.uri
|
||||
if not route.StartsWith("/invidious/set-instances")
|
||||
return false
|
||||
end if
|
||||
instances = request.Json()
|
||||
|
||||
components = WebUtils.UrlQueryComponents(route)
|
||||
|
||||
instances = []
|
||||
if components.DoesExist("instances")
|
||||
instances = components["instances"]
|
||||
if GetInterface(instances, "ifArray") = invalid
|
||||
instances = [instances]
|
||||
end if
|
||||
if GetInterface(instances, "ifArray") = invalid
|
||||
response.Default(400, "Expected json array")
|
||||
return true
|
||||
end if
|
||||
|
||||
for i = 0 to instances.Count() - 1
|
||||
@@ -36,21 +27,15 @@ namespace Http
|
||||
return true
|
||||
end function)
|
||||
|
||||
m.Get("*", function(context as object) as boolean
|
||||
m.Get(Invidious.TOKEN_CALLBACK, function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
server = context.server
|
||||
|
||||
route = request.uri
|
||||
if not route.StartsWith(Invidious.TOKEN_CALLBACK)
|
||||
return false
|
||||
end if
|
||||
|
||||
components = WebUtils.UrlQueryComponents(route)
|
||||
if components["token"] <> invalid and components["referer"] <> invalid
|
||||
if request.query["token"] <> invalid and request.query["referer"] <> invalid
|
||||
' Token is encoded twice for some reason
|
||||
token = WebUtils.UrlUnescape(components["token"]).DecodeUriComponent()
|
||||
referer = WebUtils.UrlUnescape(components["referer"])
|
||||
token = WebUtils.UrlUnescape(request.query["token"]).DecodeUriComponent()
|
||||
referer = WebUtils.UrlUnescape(request.query["referer"])
|
||||
InvidiousSettings.SetAuthToken(token, referer)
|
||||
server.task.top.login = true
|
||||
end if
|
||||
|
||||
@@ -8,21 +8,14 @@ namespace Http
|
||||
function new()
|
||||
super()
|
||||
|
||||
m.Get("*", function(context as object) as boolean
|
||||
m.Get("/api/state", function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
route = request.uri
|
||||
' TODO: this is not the right filtering. /api/state/something will go through, which is not correct
|
||||
if not route.StartsWith("/api/state")
|
||||
return false
|
||||
end if
|
||||
|
||||
keys = ["app", "device", "invidious"]
|
||||
|
||||
components = WebUtils.UrlQueryComponents(route)
|
||||
if components.DoesExist("key")
|
||||
keys = components["key"]
|
||||
if request.query.DoesExist("key")
|
||||
keys = request.query["key"]
|
||||
if GetInterface(keys, "ifArray") = invalid
|
||||
keys = [keys]
|
||||
end if
|
||||
|
||||
@@ -6,6 +6,9 @@ import "pkg:/components/WebServer/Middleware/InvidiousRouter.bs"
|
||||
import "pkg:/components/WebServer/Middleware/RegistryApiRouter.bs"
|
||||
import "pkg:/components/WebServer/Middleware/StateApiRouter.bs"
|
||||
import "pkg:/components/WebServer/Middleware/CommandsApiRouter.bs"
|
||||
import "pkg:/components/WebServer/Middleware/CorsMiddleware.bs"
|
||||
import "pkg:/components/WebServer/Middleware/BasicAuthMiddleware.bs"
|
||||
import "pkg:/components/WebServer/Middleware/DashRouter.bs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "WebServerLoop"
|
||||
@@ -17,7 +20,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.Timeout = 5000
|
||||
m.settings.Timeout = 2000
|
||||
m.server = new Http.HttpServer(m.settings, m)
|
||||
|
||||
homeRouter = new Http.HttpRouter()
|
||||
@@ -27,12 +30,22 @@ function WebServerLoop()
|
||||
return true
|
||||
end function)
|
||||
|
||||
m.server.UseRouter(new Http.CorsMiddleware(`http://${GetLocalIpAddress()}:8888`))
|
||||
m.server.UseRouter(homeRouter)
|
||||
m.server.UseRouter(new Http.DashRouter())
|
||||
m.server.UseRouter(new Http.CommandsApiRouter())
|
||||
m.server.UseRouter(new Http.StateApiRouter())
|
||||
m.server.UseRouter(new Http.RegistryApiRouter())
|
||||
m.server.UseRouter(new Http.InvidiousRouter())
|
||||
m.server.UseRouter(new Http.HttpStaticFilesRouter(m.settings.WwwRoot))
|
||||
m.server.UseRouter(new Http.HttpStaticFilesRouter("/", m.settings.WwwRoot))
|
||||
#if DEBUG
|
||||
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))
|
||||
#end if
|
||||
#if WEB_SERVER_BASIC_AUTH
|
||||
m.server.UseRouter(new Http.BasicAuthMiddleware())
|
||||
#end if
|
||||
m.server.UseRouter(new Http.RegistryApiRouter())
|
||||
m.server.UseRouter(new Http.HttpDefaultRouter())
|
||||
|
||||
timeout = m.settings.Timeout
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
"required": false,
|
||||
"type": "#ISO3166",
|
||||
"default": "GetUserCountryCode"
|
||||
},
|
||||
"fields": {
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"default": "title,videoId,videoThumbnails,lengthSeconds,viewCount,author,publishedText,liveNow"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -25,7 +30,14 @@
|
||||
"name": "popular",
|
||||
"displayName": "Popular",
|
||||
"url": "/api/v1/popular",
|
||||
"authenticated": false
|
||||
"authenticated": false,
|
||||
"queryParams": {
|
||||
"fields": {
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"default": "title,videoId,videoThumbnails,lengthSeconds,viewCount,author,publishedText,liveNow"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "search",
|
||||
@@ -90,6 +102,11 @@
|
||||
"required": false,
|
||||
"type": "#ISO3166",
|
||||
"default": "GetUserCountryCode"
|
||||
},
|
||||
"fields": {
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"default": "title,videoId,videoThumbnails,lengthSeconds,viewCount,author,publishedText,liveNow"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="1920"
|
||||
height="1080"
|
||||
viewBox="0 0 508 285.75"
|
||||
version="1.1"
|
||||
id="svg10011"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs10008">
|
||||
<rect
|
||||
x="180.21565"
|
||||
y="328.72668"
|
||||
width="570.68286"
|
||||
height="243.62486"
|
||||
id="rect418-2-51" />
|
||||
<rect
|
||||
x="180.21565"
|
||||
y="328.72668"
|
||||
width="570.68286"
|
||||
height="243.62486"
|
||||
id="rect418-2-8-2" />
|
||||
<rect
|
||||
x="180.21565"
|
||||
y="328.72668"
|
||||
width="570.68286"
|
||||
height="243.62486"
|
||||
id="rect418-2-53-6" />
|
||||
<rect
|
||||
x="180.21565"
|
||||
y="328.72668"
|
||||
width="570.68286"
|
||||
height="243.62486"
|
||||
id="rect418-2-6-6" />
|
||||
<rect
|
||||
x="180.21565"
|
||||
y="328.72668"
|
||||
width="570.68286"
|
||||
height="243.62486"
|
||||
id="rect418-2-5-5" />
|
||||
<rect
|
||||
x="180.21565"
|
||||
y="328.72668"
|
||||
width="570.68286"
|
||||
height="243.62486"
|
||||
id="rect418-2-1-4" />
|
||||
<rect
|
||||
x="180.21565"
|
||||
y="328.72668"
|
||||
width="570.68286"
|
||||
height="243.62486"
|
||||
id="rect418-2-3-1" />
|
||||
</defs>
|
||||
<g
|
||||
id="layer1"
|
||||
transform="matrix(0.8999741,0,0,0.8999741,25.406579,14.291204)">
|
||||
<rect
|
||||
style="fill:#f0f9f2;fill-opacity:1;stroke:none;stroke-width:3.68071;stroke-linejoin:round;stroke-dasharray:none"
|
||||
id="rect8445-7"
|
||||
width="192.9267"
|
||||
height="108.94424"
|
||||
x="109.70631"
|
||||
y="88.402878"
|
||||
rx="20.13974"
|
||||
ry="19.408449" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
transform="matrix(1.3208994,0,0,1.3208994,-115.36013,-354.38654)"
|
||||
id="text416-2-13"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-51);display:inline;fill:#ff1c30;fill-opacity:1;stroke:none;stroke-width:1.06591;stroke-linejoin:round;stroke-dasharray:none"><tspan
|
||||
x="180.21484"
|
||||
y="397.45387"
|
||||
id="tspan11055"><tspan
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="tspan11053">P</tspan></tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
transform="matrix(1.3208994,0,0,1.3208994,-65.866935,-354.45042)"
|
||||
id="text416-2-1-4"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-8-2);display:inline;fill:#ff1c30;fill-opacity:1;stroke:none;stroke-width:1.06591;stroke-linejoin:round;stroke-dasharray:none"><tspan
|
||||
x="180.21484"
|
||||
y="397.45387"
|
||||
id="tspan11059"><tspan
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="tspan11057">l</tspan></tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
transform="matrix(1.3208994,0,0,1.3208994,87.108046,-354.30193)"
|
||||
id="text416-2-5-8"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-53-6);display:inline;fill:#ff1c30;fill-opacity:1;stroke:none;stroke-width:1.06591;stroke-linejoin:round;stroke-dasharray:none"><tspan
|
||||
x="180.21484"
|
||||
y="397.45387"
|
||||
id="tspan11063"><tspan
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="tspan11061">e</tspan></tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
transform="matrix(1.3208994,0,0,1.3208994,138.55003,-354.31168)"
|
||||
id="text416-2-59-6"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-6-6);display:inline;fill:#ff1c30;fill-opacity:1;stroke:none;stroke-width:1.06591;stroke-linejoin:round;stroke-dasharray:none"><tspan
|
||||
x="180.21484"
|
||||
y="397.45387"
|
||||
id="tspan11067"><tspan
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="tspan11065">t</tspan></tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
transform="matrix(1.3208994,0,0,1.3208994,69.600141,-354.30583)"
|
||||
id="text416-2-8-1"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-5-5);display:inline;fill:#ff1c30;fill-opacity:1;stroke:none;stroke-width:1.06591;stroke-linejoin:round;stroke-dasharray:none"><tspan
|
||||
x="180.21484"
|
||||
y="397.45387"
|
||||
id="tspan11071"><tspan
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="tspan11069">l</tspan></tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
transform="matrix(1.3208994,0,0,1.3208994,-48.469095,-354.51494)"
|
||||
id="text416-2-4-5"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-1-4);display:inline;fill:#ff1c30;fill-opacity:1;stroke:none;stroke-width:1.06591;stroke-linejoin:round;stroke-dasharray:none"><tspan
|
||||
x="180.21484"
|
||||
y="397.45387"
|
||||
id="tspan11075"><tspan
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="tspan11073">a</tspan></tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
transform="matrix(1.3208994,0,0,1.3208994,9.0695965,-354.11012)"
|
||||
id="text416-2-84-0"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-3-1);display:inline;fill:#ff1c30;fill-opacity:1;stroke:none;stroke-width:1.06591;stroke-linejoin:round;stroke-dasharray:none"><tspan
|
||||
x="180.21484"
|
||||
y="397.45387"
|
||||
id="tspan11079"><tspan
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="tspan11077">y</tspan></tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.1 KiB |
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="100"
|
||||
height="100"
|
||||
viewBox="0 0 26.458333 26.458333"
|
||||
version="1.1"
|
||||
id="svg9602"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs9599" />
|
||||
<g
|
||||
id="layer1">
|
||||
<rect
|
||||
style="fill:#242424;fill-opacity:1;stroke:none;stroke-width:0.671348;stroke-linejoin:round;stroke-dasharray:none"
|
||||
id="rect8445"
|
||||
width="26.378244"
|
||||
height="26.508022"
|
||||
x="0.059478253"
|
||||
y="0.0009513023"
|
||||
rx="4"
|
||||
ry="4" />
|
||||
<g
|
||||
aria-label="P"
|
||||
transform="matrix(0.3883926,0,0,0.3883926,-64.217943,-131.42398)"
|
||||
id="text416-2"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 182.08151,397.45387 v -50.02669 h 15.38134 q 4.032,0 7.54134,1.49333 3.50933,1.49334 6.12267,4.18134 2.61333,2.61333 4.10667,6.12267 1.49333,3.50933 1.49333,7.54133 0,3.95734 -1.49333,7.46667 -1.49334,3.50934 -4.10667,6.12267 -2.61334,2.53867 -6.12267,4.03201 -3.50934,1.49333 -7.54134,1.49333 h -8.81067 v 11.57334 z m 6.57067,-18.14401 h 8.81067 q 2.61334,0 4.928,-0.97067 2.31467,-1.04533 4.03201,-2.688 1.71733,-1.71733 2.688,-3.95733 1.04533,-2.31467 1.04533,-4.92801 0,-2.688 -1.04533,-5.00267 -0.97067,-2.31466 -2.688,-4.032 -1.71734,-1.71733 -4.03201,-2.688 -2.31466,-0.97067 -4.928,-0.97067 h -8.81067 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9573" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="540"
|
||||
height="405"
|
||||
viewBox="0 0 142.875 107.15625"
|
||||
version="1.1"
|
||||
id="svg9602"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs9599" />
|
||||
<g
|
||||
id="layer1">
|
||||
<rect
|
||||
style="fill:#242424;fill-opacity:0.99;stroke:none;stroke-width:1.24539;stroke-linejoin:round;stroke-dasharray:none"
|
||||
id="rect8445"
|
||||
width="65.39537"
|
||||
height="36.795055"
|
||||
x="22.703459"
|
||||
y="35.180595"
|
||||
rx="6.8266635"
|
||||
ry="6.5550508" />
|
||||
<g
|
||||
aria-label="P"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,-53.310985,-114.20369)"
|
||||
id="text416-2"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 182.08151,397.45387 v -50.02669 h 15.38134 q 4.032,0 7.54134,1.49333 3.50933,1.49334 6.12267,4.18134 2.61333,2.61333 4.10667,6.12267 1.49333,3.50933 1.49333,7.54133 0,3.95734 -1.49333,7.46667 -1.49334,3.50934 -4.10667,6.12267 -2.61334,2.53867 -6.12267,4.03201 -3.50934,1.49333 -7.54134,1.49333 h -8.81067 v 11.57334 z m 6.57067,-18.14401 h 8.81067 q 2.61334,0 4.928,-0.97067 2.31467,-1.04533 4.03201,-2.688 1.71733,-1.71733 2.688,-3.95733 1.04533,-2.31467 1.04533,-4.92801 0,-2.688 -1.04533,-5.00267 -0.97067,-2.31466 -2.688,-4.032 -1.71734,-1.71733 -4.03201,-2.688 -2.31466,-0.97067 -4.928,-0.97067 h -8.81067 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9573" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="l"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,-36.59502,-114.22526)"
|
||||
id="text416-2-1"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-8);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 189.92152,349.36851 v 48.08536 h -6.27201 v -48.08536 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9570" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="e"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,15.071073,-114.17511)"
|
||||
id="text416-2-5"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-53);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 216.35353,388.8672 q -3.06134,4.55467 -7.24267,6.64533 -4.10667,2.09067 -8.96001,2.09067 -3.808,0 -7.168,-1.41867 -3.36,-1.49333 -5.824,-3.95733 -2.464,-2.464 -3.95734,-5.824 -1.41867,-3.36001 -1.41867,-7.16801 0,-3.88267 1.41867,-7.24267 1.49334,-3.36 3.95734,-5.824 2.464,-2.53867 5.824,-3.95734 3.36,-1.49333 7.168,-1.49333 4.85334,0 9.10934,2.24 4.33067,2.24 7.46667,6.944 l -21.65334,20.16001 q 1.19466,0.82134 2.98667,1.19467 1.792,0.29867 3.584,0.0747 3.136,-0.37334 5.824,-2.09067 2.76267,-1.792 4.62934,-4.48 z m -28.59735,-10.60267 q -0.224,2.83733 0.74667,5.22666 0.97066,2.38934 2.76267,3.73334 l 17.09867,-16.65067 q -1.41867,-1.71734 -3.808,-2.76267 -2.38934,-1.12 -5.22667,-0.97067 -2.31467,0.14933 -4.33067,1.04533 -2.016,0.896 -3.584,2.46401 -1.49333,1.49333 -2.464,3.50933 -0.97067,2.016 -1.19467,4.40534 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9558" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="t"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,32.445174,-114.17841)"
|
||||
id="text416-2-59"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-6);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 180.21484,360.71785 h 3.43467 v -11.34934 h 6.34667 v 11.34934 h 6.64534 v 5.22667 h -6.64534 v 20.23468 q 0,2.61333 1.64267,4.256 1.64267,1.568 4.256,1.568 v 5.6 q -6.048,0 -9.184,-2.912 -3.06134,-2.912 -3.06134,-8.512 v -20.23468 h -3.43467 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9555" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="l"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,9.157916,-114.17642)"
|
||||
id="text416-2-8"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-5);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 189.92152,349.36851 v 48.08536 h -6.27201 v -48.08536 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9561" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="a"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,-30.719029,-114.24707)"
|
||||
id="text416-2-4"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-1);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 181.85751,379.23519 q 0,-3.88267 1.344,-7.24267 1.344,-3.36 3.584,-5.824 2.31467,-2.53867 5.37601,-3.95734 3.136,-1.49333 6.72,-1.49333 4.256,0 7.76534,2.09067 3.50933,2.016 5.74933,5.45067 v -7.39201 h 6.34667 v 36.58669 h -6.34667 v -7.31734 q -2.24,3.43467 -5.74933,5.45067 -3.50934,2.016 -7.76534,2.016 -3.584,0 -6.72,-1.41867 -3.06134,-1.49333 -5.37601,-3.95733 -2.24,-2.464 -3.584,-5.824 -1.344,-3.36001 -1.344,-7.16801 z m 6.34667,0 q 0,2.464 0.896,4.704 0.97067,2.16534 2.53867,3.80801 1.64267,1.64266 3.808,2.61333 2.24,0.896 4.77867,0.896 2.464,0 4.62934,-0.896 2.24,-0.97067 3.88266,-2.61333 1.64267,-1.64267 2.61334,-3.80801 0.97067,-2.24 0.97067,-4.704 0,-2.464 -0.97067,-4.704 -0.97067,-2.24 -2.61334,-3.88267 -1.64266,-1.64267 -3.88266,-2.61333 -2.16534,-0.97067 -4.62934,-0.97067 -2.53867,0 -4.77867,0.97067 -2.16533,0.97066 -3.808,2.61333 -1.568,1.64267 -2.53867,3.88267 -0.896,2.24 -0.896,4.704 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9567" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="y"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,-11.285794,-114.11033)"
|
||||
id="text416-2-84"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-3);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 186.56151,360.86718 10.97601,28.07468 10.752,-28.07468 h 6.72001 l -18.74135,47.56269 h -6.272 l 4.256,-10.82667 -14.48534,-36.73602 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9564" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.0 KiB |
@@ -1,144 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="1920"
|
||||
height="1080"
|
||||
viewBox="0 0 507.99997 285.75"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs2">
|
||||
<linearGradient
|
||||
id="linearGradient1156">
|
||||
<stop
|
||||
style="stop-color:#505050;stop-opacity:0.30202579;"
|
||||
offset="0"
|
||||
id="stop1152" />
|
||||
<stop
|
||||
style="stop-color:#c7c7c7;stop-opacity:0.16758747;"
|
||||
offset="1"
|
||||
id="stop1154" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient1156"
|
||||
id="radialGradient5833"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.31128638,0,13.805446)"
|
||||
cx="168.40327"
|
||||
cy="20.045263"
|
||||
fx="168.40327"
|
||||
fy="20.045263"
|
||||
r="8.3192425" />
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient1156"
|
||||
id="radialGradient5835"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.31128638,0,13.805446)"
|
||||
cx="168.40327"
|
||||
cy="20.045263"
|
||||
fx="168.40327"
|
||||
fy="20.045263"
|
||||
r="8.3192425" />
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient1156"
|
||||
id="radialGradient5837"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.31128638,0,13.805446)"
|
||||
cx="168.40327"
|
||||
cy="20.045263"
|
||||
fx="168.40327"
|
||||
fy="20.045263"
|
||||
r="8.3192425" />
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient1156"
|
||||
id="radialGradient5839"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.31128638,0,13.805446)"
|
||||
cx="168.40327"
|
||||
cy="20.045263"
|
||||
fx="168.40327"
|
||||
fy="20.045263"
|
||||
r="8.3192425" />
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient1156"
|
||||
id="radialGradient5841"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.31128638,0,13.805446)"
|
||||
cx="168.40327"
|
||||
cy="20.045263"
|
||||
fx="168.40327"
|
||||
fy="20.045263"
|
||||
r="8.3192425" />
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient1156"
|
||||
id="radialGradient5843"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.31128638,0,13.805446)"
|
||||
cx="168.40327"
|
||||
cy="20.045263"
|
||||
fx="168.40327"
|
||||
fy="20.045263"
|
||||
r="8.3192425" />
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient1156"
|
||||
id="radialGradient5845"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.31128638,0,13.805446)"
|
||||
cx="168.40327"
|
||||
cy="20.045263"
|
||||
fx="168.40327"
|
||||
fy="20.045263"
|
||||
r="8.3192425" />
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient1156"
|
||||
id="radialGradient5847"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.31128638,0,13.805446)"
|
||||
cx="168.40327"
|
||||
cy="20.045263"
|
||||
fx="168.40327"
|
||||
fy="20.045263"
|
||||
r="8.3192425" />
|
||||
</defs>
|
||||
<g
|
||||
id="layer1">
|
||||
<g
|
||||
aria-label="Playlet"
|
||||
transform="matrix(18.534073,0,0,21.199658,-2867.2105,-282.0651)"
|
||||
id="text484"
|
||||
style="font-size:3.175px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;inline-size:111.711;opacity:1;fill:#ff0000;stroke:url(#radialGradient5847);stroke-width:0.264494;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 161.15529,20.959066 c 0.80222,0.347114 2.36423,-0.674942 2.83476,-1.858985 0.6518,-1.631434 -1.01049,-2.055683 -2.80005,-0.713511 -0.70965,0.536097 -1.13776,1.164758 -0.91407,1.353742 0.0926,0.07714 0.23527,-0.03857 0.18513,-0.146559 -0.15041,-0.3394 1.02591,-1.349886 1.91684,-1.64686 1.26118,-0.42425 1.85513,0.150415 1.29203,1.245751 -0.49753,0.975775 -1.8667,1.882127 -2.45679,1.62372 -0.0771,-0.03085 0.62095,-1.592865 0.79836,-1.785706 0.11571,-0.127275 0.10799,-0.323972 -0.0154,-0.3394 -0.0849,-0.01157 -0.15427,0.09256 -0.4551,0.6788 -0.58624,1.133904 -0.91407,2.395083 -0.66337,2.549356 0.0617,0.03857 0.13499,0.0039 0.15427,-0.07714 0.0116,-0.05014 0.004,-0.08485 -0.027,-0.09642 -0.0231,-0.0039 -0.0231,-0.0077 -0.0116,-0.138845 0.027,-0.258407 0.12728,-0.663373 0.16199,-0.647946 z"
|
||||
style="font-size:4.62818px;stroke:url(#radialGradient5833)"
|
||||
id="path1162" />
|
||||
<path
|
||||
d="m 165.26279,18.101165 c -0.0848,-0.115704 -0.26226,0.05014 -0.63637,0.605521 -0.96035,1.430878 -1.31132,2.973605 -0.69809,3.085453 0.28927,0.05014 0.7058,-0.246836 1.48102,-1.064482 0.28155,-0.289261 0.30083,-0.320115 0.25455,-0.374111 -0.0501,-0.05785 -0.054,-0.054 -0.55538,0.451248 -0.58624,0.590093 -0.82921,0.782934 -1.03748,0.825359 -0.58624,0.115704 0.0193,-1.731711 1.04905,-3.193445 0.18127,-0.258406 0.18899,-0.273834 0.1427,-0.335543 z"
|
||||
style="font-size:4.62818px;stroke:url(#radialGradient5835)"
|
||||
id="path1164" />
|
||||
<path
|
||||
d="m 167.789,20.561814 c 0.2237,-0.242979 0.24684,-0.27769 0.20056,-0.323972 -0.0386,-0.03857 -0.0617,-0.02314 -0.26227,0.18127 -0.6248,0.644088 -1.04905,0.921779 -1.22647,0.817645 -0.21212,-0.119561 -0.0656,-0.77522 0.28155,-1.376883 0.16199,-0.277691 0.0154,-0.416537 -0.18513,-0.154273 -0.0386,0.04628 -0.0386,0.04628 -0.054,0.02314 -0.20441,-0.289261 -0.5361,-0.165843 -0.85236,0.285404 -0.5978,0.856214 -0.22369,1.589009 0.40497,0.786791 0.0386,-0.05014 0.0733,-0.09256 0.0733,-0.08871 0,0 -0.004,0.03085 -0.008,0.06942 -0.0386,0.343257 0.0347,0.601663 0.2507,0.651802 0.2854,0.06557 0.72122,-0.173557 1.37688,-0.871641 z m -1.48487,-0.335543 c -0.0733,0.181271 -0.38954,0.574666 -0.53996,0.6788 -0.0964,0.06171 -0.1157,0.05785 -0.11185,-0.027 0,-0.185127 0.15813,-0.566952 0.3394,-0.813788 0.17742,-0.239123 0.32398,-0.327829 0.42811,-0.26612 0.0694,0.04242 0.0694,0.04628 -0.0154,0.212125 -0.0386,0.08099 -0.0849,0.177413 -0.10027,0.215981 z"
|
||||
style="font-size:4.62818px;stroke:url(#radialGradient5837)"
|
||||
id="path1166" />
|
||||
<path
|
||||
d="m 170.10694,20.233985 c -0.027,-0.05014 -0.0694,-0.03857 -0.1697,0.05785 -0.25069,0.231409 -0.60552,0.447391 -0.94878,0.628661 -0.16584,0.08485 -0.16198,0.08871 -0.10413,-0.027 0.18513,-0.381825 0.53995,-1.172473 0.55152,-1.288177 0.0193,-0.185127 -0.16198,-0.146559 -0.26226,0.05785 -0.0424,0.08485 -0.10799,0.165843 -0.38954,0.512957 -0.39339,0.474388 -0.6518,0.70194 -0.77136,0.686513 -0.13499,-0.01928 0.0347,-0.624804 0.29697,-1.056768 0.10028,-0.165843 0.0964,-0.258406 -0.0193,-0.293118 -0.25069,-0.07328 -0.65566,0.894782 -0.53224,1.288177 0.11956,0.389538 0.46282,0.250693 1.05291,-0.42425 0.054,-0.06171 0.10028,-0.111848 0.10028,-0.111848 0,0.0077 -0.10414,0.239123 -0.16585,0.374112 -0.2314,0.489815 -0.27769,0.574665 -0.35097,0.613234 -0.61323,0.320115 -0.9642,0.613233 -1.06062,0.894781 -0.0656,0.18127 -0.0193,0.308545 0.12342,0.347113 0.32397,0.08485 0.85621,-0.470531 1.25346,-1.249608 0.004,-0.01157 0.0771,-0.054 0.16199,-0.100277 0.49753,-0.258407 0.69808,-0.358684 0.9912,-0.601664 0.21213,-0.177413 0.27384,-0.250693 0.24298,-0.308545 z m -1.8397,1.330602 c -0.2237,0.370254 -0.45896,0.632518 -0.65952,0.732795 -0.13884,0.07328 -0.18898,0.01157 -0.12341,-0.142702 0.0887,-0.212125 0.41653,-0.489816 0.7945,-0.682657 0.0617,-0.03085 0.0617,-0.03085 -0.0116,0.09256 z"
|
||||
style="font-size:4.62818px;stroke:url(#radialGradient5839)"
|
||||
id="path1168" />
|
||||
<path
|
||||
d="m 171.39126,18.101165 c -0.0848,-0.115704 -0.26226,0.05014 -0.63637,0.605521 -0.96035,1.430878 -1.31132,2.973605 -0.69809,3.085453 0.28926,0.05014 0.7058,-0.246836 1.48102,-1.064482 0.28155,-0.289261 0.30083,-0.320115 0.25455,-0.374111 -0.0501,-0.05785 -0.054,-0.054 -0.55538,0.451248 -0.58624,0.590093 -0.82922,0.782934 -1.03749,0.825359 -0.58623,0.115704 0.0193,-1.731711 1.04906,-3.193445 0.18127,-0.258406 0.18898,-0.273834 0.1427,-0.335543 z"
|
||||
style="font-size:4.62818px;stroke:url(#radialGradient5841)"
|
||||
id="path1170" />
|
||||
<path
|
||||
d="m 171.81936,21.14805 c 0.27383,0.054 0.69423,-0.142702 1.22261,-0.578522 0.24298,-0.200555 0.27383,-0.239123 0.21598,-0.277691 -0.0347,-0.02314 -0.0579,-0.0077 -0.21598,0.123418 -0.59781,0.49753 -1.1339,0.725082 -1.23804,0.524527 -0.0463,-0.09642 0.0347,-0.493672 0.10028,-0.478245 0.25841,0.054 0.56309,-0.219838 0.67494,-0.597806 0.10028,-0.3394 -0.1967,-0.455105 -0.50524,-0.192841 -0.55153,0.470531 -0.70965,1.388454 -0.25455,1.47716 z m 0.4551,-1.303604 c 0.11957,-0.119561 0.1697,-0.127275 0.16199,-0.02314 -0.0116,0.177413 -0.16199,0.412679 -0.31626,0.489815 -0.0617,0.03085 -0.17741,0.05014 -0.17741,0.027 0,-0.05785 0.21598,-0.381825 0.33168,-0.493673 z"
|
||||
style="font-size:4.62818px;stroke:url(#radialGradient5843)"
|
||||
id="path1172" />
|
||||
<path
|
||||
d="m 174.17587,18.899526 c 0.0501,-0.0077 0.29697,-0.05785 0.54381,-0.107991 1.14162,-0.227552 1.56201,-0.250693 1.71243,-0.100277 0.0656,0.06557 0.15813,0.027 0.15813,-0.06942 -0.004,-0.223696 -0.40883,-0.258407 -1.25347,-0.100278 -0.081,0.01543 -0.2854,0.054 -0.4551,0.08485 -0.54381,0.100278 -0.6788,0.127275 -0.6788,0.123418 -0.004,-0.0039 0.15427,-0.250693 0.22755,-0.358684 0.18127,-0.258406 0.18898,-0.273834 0.1427,-0.335543 -0.0887,-0.119561 -0.26226,0.05014 -0.64409,0.617091 -0.10799,0.161986 -0.0771,0.150416 -0.49753,0.204411 -0.84078,0.107991 -1.36917,0.05785 -1.43859,-0.142702 -0.054,-0.146559 -0.22369,-0.123418 -0.21212,0.027 0.0231,0.323972 0.66337,0.416536 1.76642,0.262263 0.1967,-0.027 0.18513,-0.04628 0.0926,0.115705 -0.75208,1.322888 -0.93335,2.510788 -0.40111,2.607208 0.28926,0.05014 0.70194,-0.250693 1.48488,-1.064481 0.32011,-0.331687 0.3394,-0.362541 0.29311,-0.416537 -0.0501,-0.05785 -0.054,-0.054 -0.5978,0.493673 -0.58624,0.590093 -0.82922,0.782934 -1.03749,0.825359 -0.46667,0.09256 -0.20055,-1.068339 0.55153,-2.395083 0.15813,-0.277691 0.13113,-0.250694 0.24298,-0.269978 z"
|
||||
style="font-size:4.62818px;stroke:url(#radialGradient5845)"
|
||||
id="path1174" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 9.9 KiB |
@@ -2,7 +2,7 @@ title=Playlet
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=4
|
||||
minor_version=5
|
||||
build_version=00000
|
||||
|
||||
## Channel Assets
|
||||
@@ -20,3 +20,7 @@ splash_screen_sd=pkg:/images/splash-screen_sd.jpg
|
||||
|
||||
splash_color=#242424
|
||||
splash_min_time=0
|
||||
|
||||
supports_input_launch=1
|
||||
|
||||
bs_const=DEBUG=true;WEB_SERVER_BASIC_AUTH=false;DASH_THUMBNAILS=false
|
||||
@@ -1,16 +1,22 @@
|
||||
function main() as void
|
||||
function main(args as object) as void
|
||||
screen = CreateObject("roSGScreen")
|
||||
m.port = CreateObject("roMessagePort")
|
||||
screen.setMessagePort(m.port)
|
||||
m.global = screen.getGlobalNode()
|
||||
|
||||
screen.CreateScene("MainScene")
|
||||
scene = screen.CreateScene("MainScene")
|
||||
screen.show()
|
||||
scene.ObserveField("exitChannel", m.port)
|
||||
scene.launchArgs = args
|
||||
|
||||
input = CreateObject("roInput")
|
||||
input.setMessagePort(m.port)
|
||||
|
||||
' The following comment is to enable the SceneGraph inspector
|
||||
' on the VSCode BrightScript plugin.
|
||||
|
||||
' vscode_rdb_on_device_component_entry
|
||||
#if DEBUG
|
||||
' vscode_rdb_on_device_component_entry
|
||||
#end if
|
||||
|
||||
while true
|
||||
msg = wait(0, m.port)
|
||||
@@ -19,6 +25,14 @@ function main() as void
|
||||
if msg.isScreenClosed()
|
||||
return
|
||||
end if
|
||||
else if msgType = "roSGNodeEvent"
|
||||
field = msg.getField()
|
||||
data = msg.getData()
|
||||
if field = "exitChannel" and data = true
|
||||
END
|
||||
end if
|
||||
else if msgType = "roInputEvent"
|
||||
scene.inputArgs = msg.getInfo()
|
||||
end if
|
||||
end while
|
||||
end function
|
||||
@@ -31,36 +31,6 @@ namespace Invidious
|
||||
}
|
||||
end function
|
||||
|
||||
function GetPopular() as object
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
url = `${instance}${Invidious.POPULAR_ENDPOINT}`
|
||||
|
||||
args = Invidious.DefaultArgs()
|
||||
response = Requests().get(url, args)
|
||||
|
||||
if response.statuscode = 200
|
||||
return response.json
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function GetTrending(trendingType = "" as string) as object
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
url = `${instance}${Invidious.TRENDING_ENDPOINT}`
|
||||
|
||||
args = Invidious.DefaultArgs()
|
||||
if trendingType <> ""
|
||||
args.params.type = trendingType
|
||||
end if
|
||||
|
||||
response = Requests().get(url, args)
|
||||
|
||||
if response.statuscode = 200
|
||||
return response.json
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function GetVideoUrl(videoId as string, itag as string, local as boolean) as string
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
url = `${instance}/latest_version?id=${videoId}&itag=${itag}`
|
||||
@@ -152,56 +122,6 @@ namespace Invidious
|
||||
}
|
||||
end function
|
||||
|
||||
function GetUserFeed() as object
|
||||
authToken = InvidiousSettings.GetAuthToken()
|
||||
if authToken = invalid
|
||||
return false
|
||||
end if
|
||||
headers = Invidious.GetAuthenticationHeaders(authToken.token)
|
||||
|
||||
url = `${authToken.instance}${Invidious.AUTH_FEED}`
|
||||
|
||||
args = {
|
||||
headers: headers,
|
||||
retryCount: 3 'Sometimes authentication fails randomly with a valid token...
|
||||
}
|
||||
|
||||
response = Requests().get(url, args)
|
||||
|
||||
if response.statuscode = 403
|
||||
RegistryUtils.Delete(RegistryUtils.INVIDIOUS_TOKEN)
|
||||
end if
|
||||
if response.statuscode = 200
|
||||
return response.json.videos
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function GetUserPlaylists() as object
|
||||
authToken = InvidiousSettings.GetAuthToken()
|
||||
if authToken = invalid
|
||||
return false
|
||||
end if
|
||||
headers = Invidious.GetAuthenticationHeaders(authToken.token)
|
||||
|
||||
url = `${authToken.instance}${Invidious.AUTH_PLAYLISTS}`
|
||||
|
||||
args = {
|
||||
headers: headers,
|
||||
retryCount: 3 'Sometimes authentication fails randomly with a valid token...
|
||||
}
|
||||
|
||||
response = Requests().get(url, args)
|
||||
|
||||
if response.statuscode = 403
|
||||
RegistryUtils.Delete(RegistryUtils.INVIDIOUS_TOKEN)
|
||||
end if
|
||||
if response.statuscode = 200
|
||||
return response.json
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function Logout() as boolean
|
||||
authToken = InvidiousSettings.GetAuthToken()
|
||||
if authToken = invalid
|
||||
|
||||
@@ -92,7 +92,10 @@ class InvidiousService
|
||||
m.DeleteExpiredToken(response)
|
||||
|
||||
if response.statuscode = 200
|
||||
return response.json.videos
|
||||
videos = []
|
||||
videos.Append(response.json.notifications)
|
||||
videos.Append(response.json.videos)
|
||||
return videos
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
@@ -1,23 +1,99 @@
|
||||
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
|
||||
import "pkg:/source/utils/WebUtils.bs"
|
||||
import "pkg:/source/utils/Crypto.bs"
|
||||
|
||||
namespace SponsorBlock
|
||||
const API_URL = "https://sponsor.ajay.app"
|
||||
const SKIP_SEGMENT_ENDPOINT = "/api/skipSegments"
|
||||
|
||||
function SegmentColor(category as string) as integer
|
||||
map = m.SponsorBlockColors
|
||||
if map = invalid
|
||||
map = {
|
||||
sponsor: &h00D400FF,
|
||||
selfpromo: &hFFFF00FF,
|
||||
exclusive_access: &h008A5CFF,
|
||||
interaction: &hCC00FFFF,
|
||||
poi_highlight: &hFF1684FF,
|
||||
intro: &h00FFFFFF,
|
||||
outro: &h0202EDFF,
|
||||
preview: &h008FD6FF,
|
||||
filler: &h7300FFFF,
|
||||
music_offtopic: &hFF9900FF
|
||||
}
|
||||
m.SponsorBlockColors = map
|
||||
end if
|
||||
if map.doesexist(category)
|
||||
return map[category]
|
||||
end if
|
||||
return 0
|
||||
end function
|
||||
|
||||
function SegmentTitle(category as string) as string
|
||||
map = m.SponsorBlockTitles
|
||||
if map = invalid
|
||||
map = {
|
||||
sponsor: "Sponsor",
|
||||
selfpromo: "Unpaid/Self Promotion",
|
||||
exclusive_access: "Exclusive Access",
|
||||
interaction: "Interaction Reminder (Subscribe)",
|
||||
poi_highlight: "Highlight",
|
||||
intro: "Intermission/Intro Animation",
|
||||
outro: "Endcards/Credits",
|
||||
preview: "Preview/Recap",
|
||||
filler: "Filler Tangent/Jokes",
|
||||
music_offtopic: "Non-Music Section"
|
||||
}
|
||||
m.SponsorBlockTitles = map
|
||||
end if
|
||||
if map.doesexist(category)
|
||||
return map[category]
|
||||
end if
|
||||
return ""
|
||||
end function
|
||||
|
||||
function GetSkipSegmentsForVideo(videoId as string) as object
|
||||
categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "poi_highlight", "chapter", "filler", "exclusive_access"]
|
||||
actionTypes = ["skip", "mute", "chapter", "full", "poi"]
|
||||
|
||||
categoriesJson = WebUtils.UrlEscape(FormatJson(categories))
|
||||
actionTypesJson = WebUtils.UrlEscape(FormatJson(actionTypes))
|
||||
url = `${SponsorBlock.API_URL}${SponsorBlock.SKIP_SEGMENT_ENDPOINT}?videoID=${videoId}&categories=${categoriesJson}&actionTypes=${actionTypesJson}`
|
||||
|
||||
' From SponsorBlock docs: It should be the first 4 - 32 characters (4 is recommended).
|
||||
hashPrefix = GetSha256(videoId).Left(4)
|
||||
url = `${SponsorBlock.API_URL}${SponsorBlock.SKIP_SEGMENT_ENDPOINT}/${hashPrefix}?categories=${categoriesJson}&actionTypes=${actionTypesJson}`
|
||||
response = Requests().get(url)
|
||||
|
||||
if response.statuscode = 200
|
||||
return response.json
|
||||
results = response.json
|
||||
for each item in results
|
||||
if item.videoId = videoId
|
||||
return item.segments
|
||||
end if
|
||||
end for
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function GenerateProgressBarBackground(segments as object, path as string)
|
||||
bar = CreateObject("roBitmap", { width: 1000, height: 20, AlphaEnable: true })
|
||||
bar.Clear(&hFFFFFF80)
|
||||
width = bar.GetWidth()
|
||||
height = bar.GetHeight()
|
||||
for each segment in segments
|
||||
pixelStart = (segment.segment[0] / segment.videoDuration) * width
|
||||
pixelEnd = (segment.segment[1] / segment.videoDuration) * width
|
||||
color = SponsorBlock.SegmentColor(segment.category)
|
||||
' highlight's duration is zero, so it is not visble on the bar.
|
||||
' Add a couple of pixels to see it
|
||||
if pixelStart = pixelEnd
|
||||
pixelEnd += 2
|
||||
end if
|
||||
bar.DrawRect(pixelStart, 0, pixelEnd - pixelStart, height, color)
|
||||
end for
|
||||
bar.Finish()
|
||||
buffer = bar.GetPng(0, 0, width, height)
|
||||
buffer.WriteFile(path)
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -0,0 +1,8 @@
|
||||
function GetSha256(input as string) as string
|
||||
buffer = CreateObject("roByteArray")
|
||||
buffer.FromAsciiString(input)
|
||||
|
||||
digest = CreateObject("roEVPDigest")
|
||||
digest.Setup("sha256")
|
||||
return digest.Process(buffer)
|
||||
end function
|
||||
@@ -113,3 +113,25 @@ end function
|
||||
function Quote() as string
|
||||
return chr(34)
|
||||
end function
|
||||
|
||||
function StringLastIndexOf(str as string, substr as string) as integer
|
||||
index = str.InStr(substr)
|
||||
while index <> -1
|
||||
newIndex = str.InStr(index + 1, substr)
|
||||
if newIndex = -1
|
||||
return index
|
||||
end if
|
||||
index = newIndex
|
||||
end while
|
||||
return index
|
||||
end function
|
||||
|
||||
function PathJoin(path1 as string, path2 as string) as string
|
||||
if path1.EndsWith("/")
|
||||
path1 = path1.left(path1.len() - 1)
|
||||
end if
|
||||
if path2.StartsWith("/")
|
||||
path2 = path2.Mid(1)
|
||||
end if
|
||||
return path1 + "/" + path2
|
||||
end function
|
||||
@@ -45,4 +45,20 @@ namespace TimeUtils
|
||||
return validstr(ma[mNum - 1])
|
||||
end function
|
||||
|
||||
function ParseTime(time as string) as integer
|
||||
hours = 0
|
||||
minutes = 0
|
||||
seconds = 0
|
||||
tokens = time.Tokenize(":")
|
||||
if tokens.Count() = 3
|
||||
hours = tokens[0].ToInt()
|
||||
minutes = tokens[1].ToInt()
|
||||
seconds = tokens[2].ToInt()
|
||||
else if tokens.Count() = 2
|
||||
minutes = tokens[0].ToInt()
|
||||
seconds = tokens[1].ToInt()
|
||||
end if
|
||||
return hours * 3600 + minutes * 60 + seconds
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -118,11 +118,25 @@ namespace WebUtils
|
||||
if hcm = invalid
|
||||
hcm = { n200: "OK", n206: "Partial Content" }
|
||||
hcm.append({ n301: "Moved Permanently", n304: "Not Modified" })
|
||||
hcm.append({ n400: "Bad Request", n403: "Forbidden", n404: "Not Found", n413: "Request Entity Too Large" })
|
||||
hcm.append({ n400: "Bad Request", n401: "Unauthorized", n403: "Forbidden", n404: "Not Found", n413: "Request Entity Too Large" })
|
||||
hcm.append({ n500: "Internal Server Error", n501: "Not Implemented" })
|
||||
m.HttpTitles = hcm
|
||||
end if
|
||||
return validstr(hcm["n" + Stri(code).trim()])
|
||||
end function
|
||||
|
||||
function EscapeUrlForXml(url as string) as string
|
||||
urlEscapeChars = {}
|
||||
urlEscapeChars["&"] = "&"
|
||||
urlEscapeChars["'"] = "'"
|
||||
urlEscapeChars[`"`] = """
|
||||
urlEscapeChars["<"] = "<"
|
||||
urlEscapeChars[">"] = ">"
|
||||
|
||||
for each escapeChar in urlEscapeChars
|
||||
url = url.Replace(escapeChar, urlEscapeChars[escapeChar])
|
||||
end for
|
||||
return url
|
||||
end function
|
||||
|
||||
end namespace
|
||||
|
After Width: | Height: | Size: 15 KiB |
@@ -82,7 +82,7 @@
|
||||
}
|
||||
|
||||
function Logout() {
|
||||
fetch('/api/command/logout')
|
||||
PostJson('/api/command', { command: "logout" })
|
||||
.then(function (response) {
|
||||
window.location.reload();
|
||||
})
|
||||
@@ -100,7 +100,7 @@
|
||||
alert("Please set video id")
|
||||
return
|
||||
}
|
||||
fetch(`/api/command/play?v=${v}`)
|
||||
PostJson('/api/command', { command: "play", videoId: v })
|
||||
.catch(function (err) {
|
||||
alert(err)
|
||||
});
|
||||
@@ -210,9 +210,7 @@ ${JSON.stringify(window.appState.device, null, 2)}
|
||||
.filter(a => !!a)
|
||||
.map(a => a.innerText);
|
||||
|
||||
args = instances.map(instance => `instances=${instance}`).join("&")
|
||||
|
||||
fetch(`/invidious/set-instances?${args}`)
|
||||
PostJson('/invidious/instances', instances)
|
||||
.then(function (response) {
|
||||
alert("Instances updated. Restart Playlet to reflect changes.")
|
||||
window.location.reload();
|
||||
@@ -222,6 +220,17 @@ ${JSON.stringify(window.appState.device, null, 2)}
|
||||
});
|
||||
}
|
||||
|
||||
function PostJson(url, payload) {
|
||||
return fetch(url,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload)
|
||||
})
|
||||
}
|
||||
|
||||
function Initialize() {
|
||||
fetch("/api/state")
|
||||
.then(function (response) {
|
||||
|
||||