Skip to content

Commit

Permalink
Merge pull request #1510 from cewert/fix-migration-crash
Browse files Browse the repository at this point in the history
Fix migration crash
  • Loading branch information
1hitsong authored Nov 18, 2023
2 parents df43093 + 3ca40e8 commit 1a470ed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/migrations.bs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ sub runGlobalMigrations()
appLastRunVersion = m.global.app.lastRunVersion
' Global registry migrations
if isValid(appLastRunVersion) and not versionChecker(appLastRunVersion, CLIENT_VERSION_REQUIRING_BASE_MIGRATION)
' last app version used < CLIENT_VERSION_REQUIRING_BASE_MIGRATION
m.wasMigrated = true
' last app version used was less than CLIENT_VERSION_REQUIRING_BASE_MIGRATION
print `Running ${CLIENT_VERSION_REQUIRING_BASE_MIGRATION} global registry migrations`
' no longer saving raw password to registry
' auth token and username are now stored in user settings and not global settings

' migrate saved credentials for "active_user" if found
savedUserId = get_setting("active_user")
if isValid(savedUserId)
registry_write("serverId", m.global.session.server.id, savedUserId)
' copy saved credentials to user block
savedUsername = get_setting("username")
if isValid(savedUsername)
registry_write("username", savedUsername, savedUserId)
Expand All @@ -30,11 +29,12 @@ sub runGlobalMigrations()
registry_write("token", savedToken, savedUserId)
end if
end if
' remove settings from global "jellyfin" registry block
unset_setting("port")
unset_setting("token")
unset_setting("username")
unset_setting("password")
' remove saved credentials from saved_servers
' remove any saved credentials found in saved_servers assocArray
saved = get_setting("saved_servers")
if isValid(saved)
savedServers = ParseJson(saved)
Expand Down

0 comments on commit 1a470ed

Please sign in to comment.