From a01b54227cb4b094839695432e91fc478611ea1f Mon Sep 17 00:00:00 2001 From: Patxi Bocos Date: Sat, 11 May 2024 15:45:38 -0700 Subject: [PATCH] Minor changes --- README.md | 8 ++++---- .../googlephotosexporter/cli/ExporterSubcommands.kt | 8 ++++---- .../googlephotosexporter/GooglePhotosRepository.kt | 4 +++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f895753..a423850 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It is shipped as a GitHub action, but it can be easily built and run by yourself ## GitHub action 🚀 -First of all, it is required to setup Google Photos auth to get a client id, client secret and a non expiring refresh +First of all, it is required to set up Google Photos auth to get a client id, client secret and a non expiring refresh token. Please follow the steps in [Google Photos OAuth](#google-photos-oauth-). Then, you need to configure auth for GitHub, Dropbox, Box or OneDrive: @@ -24,7 +24,7 @@ Then, you need to configure auth for GitHub, Dropbox, Box or OneDrive: ### Usage 📕 The mandatory fields are `exporter` (**github**, **dropbox**, **box** or **onedrive**), `googlePhotosClientId`, `googlePhotosClientSecret` and `googlePhotosRefreshToken`. -Additionally there are exporter dependant mandatory fields. +Additionally, there are exporter dependant mandatory fields. - For **GitHub** => `githubAccessToken`, `githubRepositoryOwner` and `githubRepositoryName` - For **Dropbox** => `dropboxAppKey`, `dropboxAppSecret` and `dropboxRefreshToken` @@ -122,7 +122,7 @@ create one, follow these steps: 5. Give any desired name to the app 6. Follow the steps [here](https://www.codemzy.com/blog/dropbox-long-lived-access-refresh-token#how-can-i-get-a-refresh-token-manually) - to generate a **long lived refresh token** + to generate a **long-lived refresh token** 7. Get app key and secret from app settings, and refresh token from the previous step ### Box OAuth 📦 @@ -141,7 +141,7 @@ create one, follow these steps: 1. Follow the steps described in => https://learn.microsoft.com/en-us/graph/auth-v2-user?view=graph-rest-1.0 1. When setting the scopes, set `offline_access files.readwrite`. The first one will allow getting new access - tokens. The later is required to upload photos/videos and also for reading the sync file. + tokens. The latter is required to upload photos/videos and also for reading the sync file. ## Build on your own 📙 diff --git a/cli/src/main/kotlin/io/github/patxibocos/googlephotosexporter/cli/ExporterSubcommands.kt b/cli/src/main/kotlin/io/github/patxibocos/googlephotosexporter/cli/ExporterSubcommands.kt index de35ffb..d586bc8 100644 --- a/cli/src/main/kotlin/io/github/patxibocos/googlephotosexporter/cli/ExporterSubcommands.kt +++ b/cli/src/main/kotlin/io/github/patxibocos/googlephotosexporter/cli/ExporterSubcommands.kt @@ -23,25 +23,25 @@ internal sealed interface ExporterSubcommands { } } - object GitHub : Subcommand("github", "GitHub exporter"), ExporterSubcommands { + data object GitHub : Subcommand("github", "GitHub exporter"), ExporterSubcommands { override fun execute() {} override fun data() = Unit override val type = Exporter.ExporterType.GITHUB } - object Dropbox : Subcommand("dropbox", "Dropbox exporter"), ExporterSubcommands { + data object Dropbox : Subcommand("dropbox", "Dropbox exporter"), ExporterSubcommands { override fun execute() {} override fun data() = Unit override val type = Exporter.ExporterType.DROPBOX } - object Box : Subcommand("box", "Box exporter"), ExporterSubcommands { + data object Box : Subcommand("box", "Box exporter"), ExporterSubcommands { override fun execute() {} override fun data() = Unit override val type = Exporter.ExporterType.BOX } - object OneDrive : Subcommand("onedrive", "OneDrive exporter"), ExporterSubcommands { + data object OneDrive : Subcommand("onedrive", "OneDrive exporter"), ExporterSubcommands { override fun execute() {} override fun data() = Unit override val type = Exporter.ExporterType.ONEDRIVE diff --git a/exporter/src/main/kotlin/io/github/patxibocos/googlephotosexporter/GooglePhotosRepository.kt b/exporter/src/main/kotlin/io/github/patxibocos/googlephotosexporter/GooglePhotosRepository.kt index 806a81f..bec8d75 100644 --- a/exporter/src/main/kotlin/io/github/patxibocos/googlephotosexporter/GooglePhotosRepository.kt +++ b/exporter/src/main/kotlin/io/github/patxibocos/googlephotosexporter/GooglePhotosRepository.kt @@ -16,7 +16,9 @@ enum class ItemType { PHOTO, VIDEO } -private object GooglePhotosItemForbidden : Exception() +private object GooglePhotosItemForbidden : Exception() { + private fun readResolve(): Any = GooglePhotosItemForbidden +} private const val BASE_PATH = "https://photoslibrary.googleapis.com"