Add Setting to check for and import legacy subscriptions
This commit is contained in:
parent
1e1d0164f0
commit
ffeefe25e0
|
@ -95,24 +95,7 @@ export default Vue.extend({
|
|||
}
|
||||
},
|
||||
|
||||
importFreeTubeSubscriptions: function () {
|
||||
const options = {
|
||||
properties: ['openFile'],
|
||||
filters: [
|
||||
{
|
||||
name: 'Database File',
|
||||
extensions: ['db']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
dialog.showOpenDialog(options).then((response) => {
|
||||
if (response.canceled || response.filePaths.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
const filePath = response.filePaths[0]
|
||||
|
||||
handleFreetubeImportFile: function (filePath) {
|
||||
fs.readFile(filePath, async (err, data) => {
|
||||
if (err) {
|
||||
const message = this.$t('Settings.Data Settings.Unable to read file')
|
||||
|
@ -185,6 +168,26 @@ export default Vue.extend({
|
|||
message: this.$t('Settings.Data Settings.All subscriptions and profiles have been successfully imported')
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
importFreeTubeSubscriptions: function () {
|
||||
const options = {
|
||||
properties: ['openFile'],
|
||||
filters: [
|
||||
{
|
||||
name: 'Database File',
|
||||
extensions: ['db']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
dialog.showOpenDialog(options).then((response) => {
|
||||
if (response.canceled || response.filePaths.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
const filePath = response.filePaths[0]
|
||||
this.handleFreetubeImportFile(filePath)
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -624,6 +627,17 @@ export default Vue.extend({
|
|||
})
|
||||
},
|
||||
|
||||
checkForLegacySubscriptions: function () {
|
||||
let dbLocation = app.getPath('userData')
|
||||
dbLocation = dbLocation + '/subscriptions.db'
|
||||
this.handleFreetubeImportFile(dbLocation)
|
||||
fs.unlink(dbLocation, (err) => {
|
||||
if (err) {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
importHistory: function () {
|
||||
const options = {
|
||||
properties: ['openFile'],
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
:label="$t('Settings.Data Settings.Import Subscriptions')"
|
||||
@click="showImportSubscriptionsPrompt = true"
|
||||
/>
|
||||
<ft-button
|
||||
:label="$t('Settings.Data Settings.Check for Legacy Subscriptions')"
|
||||
@click="checkForLegacySubscriptions"
|
||||
/>
|
||||
<ft-button
|
||||
:label="$t('Settings.Data Settings.Export Subscriptions')"
|
||||
@click="showExportSubscriptionsPrompt = true"
|
||||
|
|
|
@ -217,6 +217,7 @@ Settings:
|
|||
Import FreeTube: Import FreeTube
|
||||
Import YouTube: Import YouTube
|
||||
Import NewPipe: Import NewPipe
|
||||
Check for Legacy Subscriptions: Check for Legacy Subscriptions
|
||||
Export Subscriptions: Export Subscriptions
|
||||
Export FreeTube: Export FreeTube
|
||||
Export YouTube: Export YouTube
|
||||
|
|
Loading…
Reference in New Issue