Add ability to export and import followers with settings #121

This commit is contained in:
dragongoose
2024-06-02 11:01:40 -04:00
parent 7018e264b2
commit e5d021e94a
3 changed files with 19 additions and 14 deletions

View File

@ -5,7 +5,8 @@ import {
syncUserSettings,
setLanguage,
themeList,
getTheme
getTheme,
getFollows
} from '@/settingsManager'
import type { Settings } from '@/settingsManager'
@ -55,6 +56,8 @@ export default {
download() {
var hiddenElement = document.createElement('a')
this.settings.followers = getFollows()
hiddenElement.href = 'data:attachment/text,' + encodeURI(JSON.stringify(this.settings))
hiddenElement.target = '_blank'
hiddenElement.download = 'safetwitch_prefs.json'
@ -72,6 +75,7 @@ export default {
settings = parsed
}
localStorage.setItem('following', JSON.stringify(settings.followers))
this.settings = settings
this.save()
}