Add version check (#13)
This commit is contained in:
1 parent
a1484c01eb
commit
25b2ea7091
5 files changed
+68
-3
No files matched your search
@@ -4,6 +4,10 @@ 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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- Version check in settings page
|
||||||
|
|
||||||
## [0.4.0] - 2022-11-24
|
## [0.4.0] - 2022-11-24
|
||||||
### Added
|
### Added
|
||||||
- Play video API
|
- Play video API
|
||||||
|
|||||||
@@ -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/utils/General.bs"
|
||||||
|
import "pkg:/source/roku_modules/rokupromise/Promise.brs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
|
m.versionLabel = m.top.findNode("VersionLabel")
|
||||||
m.top.url = `http:/${GetLocalIpAddress()}:8888`
|
m.top.url = `http:/${GetLocalIpAddress()}:8888`
|
||||||
|
appInfo = GetAppInfo()
|
||||||
|
m.currentVersion = appInfo.version
|
||||||
|
SetVersionLabel(m.currentVersion, "N/A")
|
||||||
|
GetLatestVersion()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnUrlSet()
|
function OnUrlSet()
|
||||||
@@ -13,3 +19,17 @@ function OnUrlSet()
|
|||||||
urlLabel = m.top.findNode("urlLabel")
|
urlLabel = m.top.findNode("urlLabel")
|
||||||
urlLabel.text = url
|
urlLabel.text = url
|
||||||
end function
|
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" />
|
<field id="url" type="string" onChange="OnUrlSet" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
|
<Label
|
||||||
|
id='VersionLabel'
|
||||||
|
height='50'
|
||||||
|
width='1280'
|
||||||
|
font='font:MediumBoldSystemFont'
|
||||||
|
horizAlign="center"
|
||||||
|
translation="[0,100]"
|
||||||
|
/>
|
||||||
<QRPoster
|
<QRPoster
|
||||||
id='SettingsQRPoster'
|
id='SettingsQRPoster'
|
||||||
loadWidth='500'
|
loadWidth='400'
|
||||||
loadHeight='500'
|
loadHeight='400'
|
||||||
loadPadding='20'
|
loadPadding='20'
|
||||||
translation='[395, 60]' />
|
translation='[440, 160]' />
|
||||||
|
|
||||||
<Label
|
<Label
|
||||||
id='UrlLabel'
|
id='UrlLabel'
|
||||||
|
|||||||
Reference in new issue
Block a user