-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move migration logic to functions in their own file
- Loading branch information
Showing
2 changed files
with
52 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
' Functions that update the registry based on the last run version and the currently running version | ||
|
||
' Run all necessary registry mirations on the "global" Jellyfin registry section | ||
sub runGlobalMigrations() | ||
' Global registry migrations | ||
if isValid(m.global.app.lastRunVersion) and not versionChecker(m.global.app.lastRunVersion, "1.7.0") | ||
' last app version used was less than 1.7.0 | ||
print "Running 1.7.0 global registry migrations" | ||
' no longer saving raw password to registry | ||
' auth token and username are now stored in user settings and not global settings | ||
unset_setting("port") | ||
unset_setting("token") | ||
unset_setting("username") | ||
unset_setting("password") | ||
' remove saved credentials from saved_servers | ||
saved = get_setting("saved_servers") | ||
if isValid(saved) | ||
savedServers = ParseJson(saved) | ||
if isValid(savedServers.serverList) and savedServers.serverList.Count() > 0 | ||
newServers = { serverList: [] } | ||
for each item in savedServers.serverList | ||
item.Delete("username") | ||
item.Delete("password") | ||
newServers.serverList.Push(item) | ||
end for | ||
set_setting("saved_servers", FormatJson(newServers)) | ||
end if | ||
end if | ||
' now saving LastRunVersion globally and per user so that we can run user specific registry migrations | ||
' duplicate LastRunVersion to all user settings in the registry so that we can run user specific migrations | ||
regSections = getRegistrySections() | ||
for each section in regSections | ||
if section <> "Jellyfin" | ||
registry_write("LastRunVersion", m.global.app.version, section) | ||
end if | ||
end for | ||
end if | ||
end sub | ||
|
||
' Run all necessary registry mirations on the user specific registry section | ||
sub runUserMigrations() | ||
' User registry migrations | ||
if m.global.session.user.lastRunVersion <> invalid and not versionChecker(m.global.session.user.lastRunVersion, "1.7.0") | ||
' last run version was less than 1.7.0 | ||
print "Running 1.7.0 user registry migrations" | ||
' no longer saving password to registry | ||
unset_user_setting("password") | ||
end if | ||
end sub |