diff --git a/docs/README.md b/docs/README.md index 64f23472..e8fbe4f6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -294,14 +294,20 @@ This is mostly useful to QA the `canary` release (see [Canary release](https://e #### In case of a softlock -If the dev menu is used to load a custom Playlet lib url, but the lib does not have a functionality to revert back: +If the dev menu is used to load a custom Playlet lib url, but you couldn't revert back: ```bash -curl -d '' "http://$ROKU_DEV_TARGET:8060/launch/dev?clearPlayletLibUrls=true" +curl -d '' "http://$ROKU_DEV_TARGET:8060/launch/693751?clearPlayletLibUrls=true" ``` This will remove the custom lib, and revert to using default (latest release from Github). +If you need to clear all the data from the registry, use + +```bash +curl -d '' "http://$ROKU_DEV_TARGET:8060/launch/693751?clearRegistry=true" +``` + ## CI/CD On pull requests, a Github action will run `lint:fix` and `format:fix` and push changes to the PR branch, to keep things tidy. diff --git a/playlet-app/src/source/Main.bs b/playlet-app/src/source/Main.bs index f97b9158..3e1ada37 100644 --- a/playlet-app/src/source/Main.bs +++ b/playlet-app/src/source/Main.bs @@ -22,6 +22,7 @@ function Main(args as object) as void Logger.Init() Registry.ClearPlayletLibUrlsIfNeeded(args) + Registry.ClearRegistryIfNeeded(args) scene = screen.CreateScene("BootstrapScene") screen.show() diff --git a/playlet-app/src/source/Registry.bs b/playlet-app/src/source/Registry.bs index c6f28632..6d622bf2 100644 --- a/playlet-app/src/source/Registry.bs +++ b/playlet-app/src/source/Registry.bs @@ -14,6 +14,15 @@ namespace Registry sec.Flush() end function + function DeleteAll() + reg = CreateObject("roRegistry") + sectionNames = reg.GetSectionList() + for each sectionName in sectionNames + reg.Delete(sectionName) + end for + reg.Flush() + end function + function GetPlayletLibUrlsFromRegistry() as object urlsJson = ReadKey("playlet_lib_urls", "Playlet") if urlsJson = invalid @@ -31,4 +40,12 @@ namespace Registry Logger.Log("Cleared key playlet_lib_urls from registry") end function + function ClearRegistryIfNeeded(launchArgs as object) as void + if launchArgs = invalid or launchArgs.clearRegistry = invalid + return + end if + DeleteAll() + Logger.Log("Cleared all data from registry") + end function + end namespace