Multiple profiles (#312)
* Navbar user profile * profiles stuff * fix profile * Lint fix * Some ui experiments * More ui work * progress * Lint fix * migration, web api, wip * profile view and web app * web app and apis * Invidious and profiles * Lint fix * bug fix * Remove ActionContentNode * Profile icon button, profile color * Lint fix * reset server url * href that doesn't work * remove activate button on active profile * TODO * Fin. * Final touches --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
1 parent
8e03ca0ea6
commit
394dd23999
60 files changed
+1725
-311
No files matched your search
@@ -11,6 +11,7 @@ namespace Http
|
||||
m.applicationInfoNode = task.applicationInfo
|
||||
m.invidiousNode = task.invidious
|
||||
m.preferencesNode = task.preferences
|
||||
m.profilesNode = task.profiles
|
||||
end function
|
||||
|
||||
@get("/api/state")
|
||||
@@ -18,7 +19,7 @@ namespace Http
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
keys = ["app", "device", "invidious", "preferences"]
|
||||
keys = ["app", "device", "invidious", "preferences", "profiles"]
|
||||
|
||||
if request.query.DoesExist("key")
|
||||
keys = request.query["key"]
|
||||
@@ -27,9 +28,14 @@ namespace Http
|
||||
end if
|
||||
end if
|
||||
|
||||
keysDict = {}
|
||||
for each key in keys
|
||||
keysDict[key] = true
|
||||
end for
|
||||
|
||||
state = {}
|
||||
|
||||
if ArrayUtils.IndexOfString(keys, "app") <> -1
|
||||
if keysDict["app"] = true
|
||||
appInfo = m.applicationInfoNode@.GetAppInfo()
|
||||
|
||||
if appInfo.lib_version_latest = "N/A"
|
||||
@@ -46,25 +52,25 @@ namespace Http
|
||||
state["app"] = appInfo
|
||||
end if
|
||||
|
||||
if ArrayUtils.IndexOfString(keys, "device") <> -1
|
||||
if keysDict["device"] = true
|
||||
state["device"] = m.applicationInfoNode@.GetDeviceInfo()
|
||||
end if
|
||||
|
||||
if ArrayUtils.IndexOfString(keys, "invidious") <> -1
|
||||
authToken = m.invidiousNode.authToken
|
||||
if keysDict["invidious"] = true
|
||||
state["invidious"] = {
|
||||
current_instance: m.invidiousNode@.GetCurrentInstance()
|
||||
auth_url: m.invidiousNode@.GetAuthorizeTokenLink()
|
||||
logged_in: authToken <> invalid
|
||||
logged_in_instance: authToken <> invalid ? authToken.instance : invalid
|
||||
logged_in_username: authToken <> invalid ? authToken.username : invalid
|
||||
}
|
||||
end if
|
||||
|
||||
if ArrayUtils.IndexOfString(keys, "preferences") <> -1
|
||||
if keysDict["preferences"] = true
|
||||
state["preferences"] = m.preferencesNode@.GetUserPreferences()
|
||||
end if
|
||||
|
||||
if keysDict["profiles"] = true
|
||||
state["profiles"] = m.profilesNode@.GetProfilesDto(false)
|
||||
end if
|
||||
|
||||
response.Json(state)
|
||||
return true
|
||||
end function
|
||||
|
||||
Reference in new issue
Block a user