* 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>
71 lines
2.3 KiB
Plaintext
71 lines
2.3 KiB
Plaintext
namespace RegistryUtils
|
|
|
|
const DEFAULT_SECTION = "Playlet"
|
|
|
|
const USER_PREFERENCES = "user_prefs"
|
|
const USER_PROFILES = "user_profiles"
|
|
|
|
const SEARCH_HISTORY = "search_history"
|
|
const PLAYLET_LIB_URLS = "playlet_lib_urls"
|
|
const BOOKMARKS = "bookmarks"
|
|
|
|
const LAST_LOUNGE_DATA = "last_lounge_data"
|
|
|
|
' "invidious_instances" is deprecated, but we keep for migration purposes
|
|
const INVIDIOUS_INSTANCES = "invidious_instances"
|
|
' "invidious_token" is deprecated, but we keep for migration purposes
|
|
const INVIDIOUS_TOKEN = "invidious_token"
|
|
|
|
function Read(key as string, sectionName = DEFAULT_SECTION as string) as dynamic
|
|
section = CreateObject("roRegistrySection", sectionName)
|
|
if section.Exists(key)
|
|
return section.Read(key)
|
|
end if
|
|
return invalid
|
|
end function
|
|
|
|
function Write(key as string, value as string, sectionName = DEFAULT_SECTION as string)
|
|
section = CreateObject("roRegistrySection", sectionName)
|
|
section.Write(key, value)
|
|
section.Flush()
|
|
end function
|
|
|
|
function Delete(key as string, sectionName = DEFAULT_SECTION as string)
|
|
section = CreateObject("roRegistrySection", sectionName)
|
|
section.Delete(key)
|
|
section.Flush()
|
|
end function
|
|
|
|
function ReadAll() as object
|
|
result = {}
|
|
registry = CreateObject("roRegistry")
|
|
sectionNames = registry.GetSectionList()
|
|
for each sectionName in sectionNames
|
|
section = CreateObject("roRegistrySection", sectionName)
|
|
keys = section.GetKeyList()
|
|
values = section.ReadMulti(keys)
|
|
result[sectionName] = values
|
|
end for
|
|
return result
|
|
end function
|
|
|
|
function WriteAll(values as object) as void
|
|
DeleteAll()
|
|
for each sectionName in values
|
|
section = CreateObject("roRegistrySection", sectionName)
|
|
section.WriteMulti(values[sectionName])
|
|
section.Flush()
|
|
end for
|
|
end function
|
|
|
|
function DeleteAll() as void
|
|
registry = CreateObject("roRegistry")
|
|
sectionNames = registry.GetSectionList()
|
|
for each sectionName in sectionNames
|
|
registry.Delete(sectionName)
|
|
end for
|
|
registry.Flush()
|
|
end function
|
|
|
|
end namespace
|