feat(ui): 导出/备份 — otpauth URI 列表 + 加密备份导出/恢复
- qr/export.go: EntryToOtpAuth + OtpAuth.URI,将 config.Entry 反向 转换为标准 otpauth:// URI(Battle.Net/Steam 标记为 partial) - dialog_export.go: Tab 切换对话框,otpauth URI 列表可复制 + 加密备份文件导出(独立密码,0o600 权限) - dialog_restore_backup.go: 从 .winauth.bak 恢复,密码验证后合并 - settings_menu: 新增 Export / Restore Backup 菜单项 - i18n: en/zh-CN/de 三语翻译
This commit is contained in:
@@ -100,6 +100,8 @@ type appState struct {
|
||||
changePwDlg *changePasswordDialog
|
||||
welcomeDlg *welcomeDialog
|
||||
importDialog *importLegacyDialog
|
||||
exportDlg *exportDialog
|
||||
restoreDlg *restoreBackupDialog
|
||||
hotkeyDialog *hotkeyDialog
|
||||
hotkeyTarget *entry
|
||||
tradesDialog *steamTradesDialog
|
||||
@@ -556,6 +558,10 @@ func drawFrame(gtx layout.Context, th *material.Theme, st *appState, w *app.Wind
|
||||
st.changePwDlg = newChangePasswordDialog()
|
||||
case settingsActionImportLegacy:
|
||||
st.importDialog = newImportLegacyDialog()
|
||||
case settingsActionExport:
|
||||
st.exportDlg = newExportDialog(st.snapshotEntries())
|
||||
case settingsActionRestoreBackup:
|
||||
st.restoreDlg = newRestoreBackupDialog()
|
||||
case settingsActionPreferences:
|
||||
lang, theme, autoLock, minToTray := st.store.Preferences()
|
||||
st.prefsDialog = newPreferencesDialog(lang, normalizeThemeMode(theme), autoLock, minToTray)
|
||||
@@ -606,6 +612,25 @@ func drawFrame(gtx layout.Context, th *material.Theme, st *appState, w *app.Wind
|
||||
})
|
||||
}
|
||||
|
||||
if st.exportDlg != nil {
|
||||
return st.exportDlg.Layout(gtx, th, func(r exportResult) {
|
||||
st.exportDlg = nil
|
||||
w.Invalidate()
|
||||
})
|
||||
}
|
||||
|
||||
if st.restoreDlg != nil {
|
||||
return st.restoreDlg.Layout(gtx, th, func(r restoreBackupResult) {
|
||||
if !r.cancel && r.cfg != nil {
|
||||
st.mergeImportedConfig(r.cfg)
|
||||
st.store.Push()
|
||||
st.toast.Show(i18n.T("msg_restore_done"), w)
|
||||
}
|
||||
st.restoreDlg = nil
|
||||
w.Invalidate()
|
||||
})
|
||||
}
|
||||
|
||||
if st.vendorMenu != nil {
|
||||
if v, closed := st.vendorMenu.Pick(gtx); closed {
|
||||
st.vendorMenu = nil
|
||||
|
||||
Reference in New Issue
Block a user