diff --git a/src/components/WebServer/Middleware/StateApiRouter.bs b/src/components/WebServer/Middleware/StateApiRouter.bs index 230303cb..0b1879fd 100644 --- a/src/components/WebServer/Middleware/StateApiRouter.bs +++ b/src/components/WebServer/Middleware/StateApiRouter.bs @@ -12,7 +12,8 @@ namespace Http response = context.response state = { - version: GetAppVersion(), + app: GetAppInfo(), + device: GetDeviceInfo(), invidious: { host: Invidious.GetCurrentHost(), auth_url: Invidious.GetAuthorizeTokenLink(), diff --git a/src/source/utils/General.bs b/src/source/utils/General.bs index 6d928085..86815ed0 100644 --- a/src/source/utils/General.bs +++ b/src/source/utils/General.bs @@ -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 diff --git a/src/www/index.html b/src/www/index.html index 9d438277..4f08e0be 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -27,7 +27,7 @@

This is a barebone page for now, stay tuned for a redesigned page!

-
Feedback is welcome over at: Feedback is welcome over at: https://github.com/iBicha/playlet