-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#105 Migrate to newer jiotty API to fix double-login
- Loading branch information
ylexus
committed
Jun 15, 2021
1 parent
61d4199
commit 284454c
Showing
5 changed files
with
54 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/net/yudichev/googlephotosupload/core/LegacyAuthCleaner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package net.yudichev.googlephotosupload.core; | ||
|
||
import com.google.common.io.MoreFiles; | ||
import net.yudichev.jiotty.common.inject.BaseLifecycleComponent; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.inject.Inject; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
|
||
import static com.google.common.base.Preconditions.checkNotNull; | ||
import static com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE; | ||
import static net.yudichev.googlephotosupload.core.Bindings.GoogleAuthRootDir; | ||
|
||
final class LegacyAuthCleaner extends BaseLifecycleComponent { | ||
private static final Logger logger = LoggerFactory.getLogger(LegacyAuthCleaner.class); | ||
private final Path googleAuthRootDir; | ||
|
||
@Inject | ||
LegacyAuthCleaner(@GoogleAuthRootDir Path googleAuthRootDir) { | ||
this.googleAuthRootDir = checkNotNull(googleAuthRootDir); | ||
} | ||
|
||
@Override | ||
protected void doStart() { | ||
var legacyAuthDir = googleAuthRootDir.resolve("photos"); | ||
try { | ||
MoreFiles.deleteRecursively(legacyAuthDir, ALLOW_INSECURE); | ||
} catch (IOException e) { | ||
logger.warn("Unable to remove legacy auth dir {}", legacyAuthDir, e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters