Add device info stuff
This commit is contained in:
1 parent
97ae825126
commit
3db3613877
3 files changed
+54
-40
No files matched your search
@@ -12,7 +12,8 @@ namespace Http
|
||||
response = context.response
|
||||
|
||||
state = {
|
||||
version: GetAppVersion(),
|
||||
app: GetAppInfo(),
|
||||
device: GetDeviceInfo(),
|
||||
invidious: {
|
||||
host: Invidious.GetCurrentHost(),
|
||||
auth_url: Invidious.GetAuthorizeTokenLink(),
|
||||
|
||||
+31
-37
@@ -1,36 +1,3 @@
|
||||
REM This file has no dependencies on other common files.
|
||||
REM
|
||||
REM Functions in this file:
|
||||
REM GetDeviceVersion
|
||||
REM GetDeviceESN
|
||||
REM IsHD
|
||||
REM GetLocalIpAddress
|
||||
REM GetUserCountryCode
|
||||
REM GetAppVersion
|
||||
REM
|
||||
|
||||
'******************************************************
|
||||
'Get our device version
|
||||
'******************************************************
|
||||
function GetDeviceVersion() as string
|
||||
if m.softwareVersion = invalid or m.softwareVersion = ""
|
||||
m.softwareVersion = CreateObject("roDeviceInfo").GetVersion()
|
||||
end if
|
||||
return m.softwareVersion
|
||||
end function
|
||||
|
||||
|
||||
'******************************************************
|
||||
'Get our serial number
|
||||
'******************************************************
|
||||
function GetDeviceESN() as string
|
||||
if m.serialNumber = invalid or m.serialNumber = ""
|
||||
m.serialNumber = CreateObject("roDeviceInfo").GetDeviceUniqueId()
|
||||
end if
|
||||
return m.serialNumber
|
||||
end function
|
||||
|
||||
|
||||
'******************************************************
|
||||
'Determine if the UI is displayed in SD or HD mode
|
||||
'******************************************************
|
||||
@@ -61,9 +28,36 @@ function GetUserCountryCode() as string
|
||||
return m.countryCode
|
||||
end function
|
||||
|
||||
function GetAppVersion() as string
|
||||
if m.appVersion = invalid or m.appVersion = ""
|
||||
m.appVersion = CreateObject("roAppInfo").GetVersion()
|
||||
function GetAppInfo() as object
|
||||
if m.appInfo = invalid
|
||||
appInfo = CreateObject("roAppInfo")
|
||||
m.appInfo = {
|
||||
id: appInfo.GetID(),
|
||||
version: appInfo.GetVersion()
|
||||
}
|
||||
end if
|
||||
return m.appVersion
|
||||
return m.appInfo
|
||||
end function
|
||||
|
||||
function GetDeviceInfo() as object
|
||||
if m.deviceInfo = invalid
|
||||
devInfo = CreateObject("roDeviceInfo")
|
||||
m.deviceInfo = {
|
||||
model: devInfo.GetModel(),
|
||||
model_display_name: devInfo.GetModelDisplayName(),
|
||||
model_type: devInfo.GetModelType(),
|
||||
model_details: devInfo.GetModelDetails(),
|
||||
os_version: devInfo.GetOSVersion(),
|
||||
display_type: devInfo.GetDisplayType(),
|
||||
display_mode: devInfo.GetDisplayMode(),
|
||||
display_aspect_ratio: devInfo.GetDisplayAspectRatio(),
|
||||
display_size: devInfo.GetDisplaySize(),
|
||||
video_mode: devInfo.GetVideoMode(),
|
||||
ui_resolution: devInfo.GetUIResolution(),
|
||||
graphics_platform: devInfo.GetGraphicsPlatform(),
|
||||
internet_status: devInfo.GetInternetStatus()
|
||||
}
|
||||
end if
|
||||
return m.deviceInfo
|
||||
|
||||
end function
|
||||
+21
-2
@@ -27,7 +27,7 @@
|
||||
<p>
|
||||
This is a barebone page for now, stay tuned for a redesigned page!
|
||||
</p>
|
||||
<h5>Feedback is welcome over at: <a href="https://github.com/iBicha/playlet"
|
||||
<h5>Feedback is welcome over at: <a id="feedback-url" href="https://github.com/iBicha/playlet"
|
||||
target="_blank">https://github.com/iBicha/playlet</a></h5>
|
||||
|
||||
<script>
|
||||
@@ -52,6 +52,23 @@
|
||||
window.location = window.appState.invidious.auth_url
|
||||
}
|
||||
|
||||
function CreateGithubIssueUrl() {
|
||||
title = "[Feedback] Playlet"
|
||||
body = `### Feedback
|
||||
_insert feedback here_
|
||||
|
||||
#### App Info
|
||||
\`\`\`
|
||||
${JSON.stringify(window.appState.app, null, 2)}
|
||||
\`\`\`
|
||||
|
||||
#### Device Info
|
||||
\`\`\`
|
||||
${JSON.stringify(window.appState.device, null, 2)}
|
||||
\`\`\``;
|
||||
return `https://github.com/iBicha/playlet/issues/new?title=${encodeURIComponent(title)}&body=${encodeURIComponent(body)}`
|
||||
}
|
||||
|
||||
RequestGet("/api/state", function (err, response) {
|
||||
if (err) {
|
||||
alert(err)
|
||||
@@ -59,7 +76,7 @@
|
||||
}
|
||||
window.appState = response
|
||||
console.log(response)
|
||||
document.getElementById("app-version").innerText = `Version: ${response.version}`
|
||||
document.getElementById("app-version").innerText = `Version: ${response.app.version}`
|
||||
document.getElementById("logged-in").innerText = `Logged In: ${response.invidious.logged_in}`
|
||||
document.getElementById("host").innerText = response.invidious.host
|
||||
document.getElementById("host").href = response.invidious.host
|
||||
@@ -67,6 +84,8 @@
|
||||
document.getElementById("login-button").style.visibility = response.invidious.logged_in ? "hidden" : "visible";
|
||||
// TODO: log out feature
|
||||
// document.getElementById("logout-button").style.visibility = response.invidious.logged_in ? "hidden" : "visible";
|
||||
|
||||
document.getElementById("feedback-url").href = CreateGithubIssueUrl()
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in new issue
Block a user