diff --git a/src/Backup.ts b/src/Backup.ts index 2c0c174..6fec441 100644 --- a/src/Backup.ts +++ b/src/Backup.ts @@ -477,6 +477,7 @@ class Backup { await this.backupNotebooks(); const backupDst = await this.makeBackupSet(); + await this.writeReadme(backupDst); await joplin.settings.setValue( "lastBackup", @@ -684,6 +685,16 @@ class Backup { } } + private async writeReadme(backupFolder: string) { + const readmePath = path.join(backupFolder, "README.md"); + this.log.info("writeReadme to", readmePath); + const readmeText = i18n.__( + "backupReadme", + this.backupStartTime.toLocaleString() + ); + await fs.writeFile(readmePath, readmeText, "utf8"); + } + private async backupNotebooks() { const notebooks = await this.selectNotebooks(); diff --git a/src/locales/en_US.json b/src/locales/en_US.json index 79b6d55..771d14c 100644 --- a/src/locales/en_US.json +++ b/src/locales/en_US.json @@ -86,6 +86,7 @@ "description": "Execute command when backup is finished" } }, + "backupReadme": "# Joplin Backup\n\nThe backups in this folder were created with the Simple Backup plugin for Joplin. The most recent backup was created on %s.\n\nSee the [Simple Backup documentation](https://joplinapp.org/plugins/plugin/io.github.jackgruber.backup/#restore) for information about how to restore from this backup.", "command": { "createBackup": "Create backup" }