mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
email: add migration for pwr email file rename
sorry this was broken for a while for old users.
This commit is contained in:
@@ -202,8 +202,8 @@ func NewConfig(configPathOrContents any, dataPath string, logs LoggerSet) (*Conf
|
||||
config.Section("email").Key("no_username").SetValue(strconv.FormatBool(config.Section("email").Key("no_username").MustBool(false)))
|
||||
|
||||
// FIXME: Remove all these, eventually
|
||||
// config.MustSetValue("password_resets", "email_html", "jfa-go:"+"email.html")
|
||||
// config.MustSetValue("password_resets", "email_text", "jfa-go:"+"email.txt")
|
||||
// config.MustSetValue("password_resets", "email_html", "jfa-go:"+"password-reset.html")
|
||||
// config.MustSetValue("password_resets", "email_text", "jfa-go:"+"password-reset.txt")
|
||||
|
||||
// config.MustSetValue("invite_emails", "email_html", "jfa-go:"+"invite-email.html")
|
||||
// config.MustSetValue("invite_emails", "email_text", "jfa-go:"+"invite-email.txt")
|
||||
|
||||
@@ -23,6 +23,7 @@ func runMigrations(app *appContext) {
|
||||
migrateToBadger(app)
|
||||
intialiseCustomContent(app)
|
||||
migrateJellyseerrImportDaemon(app)
|
||||
migratePWREmailPath(app)
|
||||
}
|
||||
|
||||
// Migrate pre-0.2.0 user templates to profiles
|
||||
@@ -514,3 +515,23 @@ func migrateJellyseerrImportDaemon(app *appContext) {
|
||||
app.storage.db.Upsert("jellyseerr_inital_sync_status", JellyseerrInitialSyncStatus{false})
|
||||
}
|
||||
}
|
||||
|
||||
// Migrate previous filepath to the password reset email (email.html/txt) to new one.
|
||||
func migratePWREmailPath(app *appContext) {
|
||||
if app.config.Section("password_resets").Key("email_html").String() != "jfa-go:email.html" && app.config.Section("password_resets").Key("email_text").String() != "jfa-go:email.txt" {
|
||||
return
|
||||
}
|
||||
tempConfig, _ := ini.ShadowLoad(app.configPath)
|
||||
if app.config.Section("password_resets").Key("email_html").String() == "jfa-go:email.html" {
|
||||
tempConfig.Section("password_resets").Key("email_html").SetValue("")
|
||||
}
|
||||
if app.config.Section("password_resets").Key("email_text").String() == "jfa-go:email.txt" {
|
||||
tempConfig.Section("password_resets").Key("email_text").SetValue("")
|
||||
}
|
||||
err := tempConfig.SaveTo(app.configPath)
|
||||
if err != nil {
|
||||
app.err.Fatalf("Failed to save config: %v", err)
|
||||
return
|
||||
}
|
||||
app.ReloadConfig()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user