leonlatsch / Photok

Encrypted Photo Safe for Android
Apache License 2.0
430 stars 45 forks source link

Include Albums in Backups #301

Closed leonlatsch closed 1 month ago

leonlatsch commented 1 month ago

Currently albums are not included in backups.

leonlatsch commented 1 month ago

Flow

Creating a backup

  1. Open a zip file at desired location
  2. Move all internal files (photos, thumbnails, video previews) into zip file as they are
  3. Load all Photos, Albums and AlbumPhoto Refs from database
  4. Write all of them into meta.json into zip file

Restoring a backup

  1. Verify backup
    1. Open the zip file
    2. Check for meta.json and load it
    3. count internal files ending with .photok and check if they match the photos inside meta.json
    4. Check that backup version is supported
  2. Restore
    1. Version 1
    2. For each photo:
      1. Copy .photok file to internal storage (read with orig password)
      2. Create a new thumbnail from .photok file
      3. Insert photo into database
    3. Version 2
      1. Copy all files in zip except meta.json to internal storage (read with orig password)
      2. Insert all photos from meta.json into database
    4. Version 3
      1. Copy all files in zip except meta.json to internal storage (read with orig password)
      2. Insert all photos from meta.json into database
      3. Insert all albums from meta.json into database
      4. Insert all refs from meta.json into database