From 3aa419b43027dda9cfba7d463b614accf30172e2 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 18 Jul 2025 13:23:55 +0530 Subject: [PATCH] Add config for locker url --- server/cmd/museum/main.go | 4 +++- server/configurations/local.yaml | 7 ++++++- server/pkg/repo/public/file_link.go | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.go index bda540113e..f0b8c2c371 100644 --- a/server/cmd/museum/main.go +++ b/server/cmd/museum/main.go @@ -98,6 +98,7 @@ func main() { } viper.SetDefault("apps.public-albums", "https://albums.ente.io") + viper.SetDefault("apps.public-locker", "https://locker.ente.io") viper.SetDefault("apps.accounts", "https://accounts.ente.io") viper.SetDefault("apps.cast", "https://cast.ente.io") viper.SetDefault("apps.family", "https://family.ente.io") @@ -179,6 +180,7 @@ func main() { familyRepo := &repo.FamilyRepository{DB: db} trashRepo := &repo.TrashRepository{DB: db, ObjectRepo: objectRepo, FileRepo: fileRepo, QueueRepo: queueRepo} collectionLinkRepo := public.NewCollectionLinkRepository(db, viper.GetString("apps.public-albums")) + fileLinkRepo := public.NewFileLinkRepo(db) collectionRepo := &repo.CollectionRepository{DB: db, FileRepo: fileRepo, CollectionLinkRepo: collectionLinkRepo, TrashRepo: trashRepo, SecretEncryptionKey: secretEncryptionKeyBytes, QueueRepo: queueRepo, LatencyLogger: latencyLogger} pushRepo := &repo.PushTokenRepository{DB: db} @@ -430,7 +432,7 @@ func main() { } fileLinkCtrl := &publicCtrl.FileLinkController{ FileController: fileController, - FileLinkRepo: nil, + FileLinkRepo: fileLinkRepo, FileRepo: fileRepo, JwtSecret: jwtSecretBytes, } diff --git a/server/configurations/local.yaml b/server/configurations/local.yaml index b6b1d567eb..a16f560e43 100644 --- a/server/configurations/local.yaml +++ b/server/configurations/local.yaml @@ -79,9 +79,14 @@ http: apps: # Default is https://albums.ente.io # - # If you're running a self hosted instance and wish to serve public links, + # If you're running a self hosted instance and wish to serve public links for photos, # set this to the URL where your albums web app is running. public-albums: + # Default is https://locker.ente.io + # + # If you're running a self-hosted instance and wish to serve public links for locker, + # set this to the URL where your albums web app is running. + public-locker: # Default is https://cast.ente.io cast: # Default is https://accounts.ente.io diff --git a/server/pkg/repo/public/file_link.go b/server/pkg/repo/public/file_link.go index 3f6dbf7b33..c03b74c693 100644 --- a/server/pkg/repo/public/file_link.go +++ b/server/pkg/repo/public/file_link.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "github.com/ente-io/museum/ente/base" + "github.com/spf13/viper" "github.com/ente-io/museum/ente" "github.com/ente-io/stacktrace" @@ -20,10 +21,12 @@ type FileLinkRepository struct { } // NewFileLinkRepo .. -func NewFileLinkRepo(db *sql.DB, albumHost string, lockerHost string) *FileLinkRepository { +func NewFileLinkRepo(db *sql.DB) *FileLinkRepository { + albumHost := viper.GetString("apps.public-albums") if albumHost == "" { albumHost = "https://albums.ente.io" } + lockerHost := viper.GetString("apps.public-locker") if lockerHost == "" { lockerHost = "https://locker.ente.io" }