π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Allow Photobook origin for public album imports
Anand Baburajanbbe145739c9b
diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.goindex ee22b57d63..dccdba87e3 100644--- a/server/cmd/museum/main.go+++ b/server/cmd/museum/main.go@@ -109,6 +109,7 @@ func main() {viper.SetDefault("apps.public-albums", "https://albums.ente.com")viper.SetDefault("apps.embed-albums", "https://embed.ente.com")+ viper.SetDefault("apps.photobook", "https://photobook.ente.com")viper.SetDefault("apps.custom-domain.cname", "my.ente.com")viper.SetDefault("apps.public-locker", "https://share.ente.com")viper.SetDefault("apps.public-paste", "https://paste.ente.com")diff --git a/server/config/example.yaml b/server/config/example.yamlindex 4be0c73fed..9e01810a53 100644--- a/server/config/example.yaml+++ b/server/config/example.yaml@@ -45,6 +45,7 @@ s3:apps:public-albums: http://localhost:3002embed-albums: http://localhost:3006+ photobook: http://localhost:3014public-locker: http://localhost:3005public-paste: http://localhost:3008cast: http://localhost:3004diff --git a/server/configurations/local.yaml b/server/configurations/local.yamlindex a3fd19649c..482c4e11e0 100644--- a/server/configurations/local.yaml+++ b/server/configurations/local.yaml@@ -65,6 +65,7 @@ apps:## For self-hosted instances, set this to the URL where your embed app is running.embed-albums:+ photobook:# Default is https://share.ente.com## If you're running a self-hosted instance and wish to serve public links for locker,diff --git a/server/pkg/middleware/collection_link.go b/server/pkg/middleware/collection_link.goindex 5d9fcee429..c101119436 100644--- a/server/pkg/middleware/collection_link.go+++ b/server/pkg/middleware/collection_link.go@@ -294,6 +294,7 @@ func (m *CollectionLinkMiddleware) validateOrigin(c *gin.Context, ownerID int64)// origin to embed.ente.com. Custom embed origins should not inherit this.(embedAlbumsOrigin == "https://embed.ente.com" && origin == "https://embed.ente.io") ||origin == viper.GetString("apps.public-locker") ||+ origin == viper.GetString("apps.photobook") ||network.IsLoopbackOrigin(origin) {return nil}diff --git a/server/pkg/middleware/collection_link_test.go b/server/pkg/middleware/collection_link_test.goindex 7327af8d88..2c7a092b2b 100644--- a/server/pkg/middleware/collection_link_test.go+++ b/server/pkg/middleware/collection_link_test.go@@ -15,9 +15,25 @@ import ("github.com/ente/museum/pkg/utils/auth"timeutil "github.com/ente/museum/pkg/utils/time""github.com/gin-gonic/gin"+ "github.com/spf13/viper""github.com/stretchr/testify/require")+func TestCollectionLinkAllowsConfiguredPhotobookOrigin(t *testing.T) {+ previousOrigin := viper.Get("apps.photobook")+ t.Cleanup(func() { viper.Set("apps.photobook", previousOrigin) })++ for _, origin := range []string{"https://photobook.ente.com", "https://photobook.example.org"} {+ t.Run(origin, func(t *testing.T) {+ viper.Set("apps.photobook", origin)+ c, _ := gin.CreateTestContext(httptest.NewRecorder())+ c.Request = httptest.NewRequest(http.MethodGet, "/public-collection/info", nil)+ c.Request.Header.Set("Origin", origin)+ require.NoError(t, (&CollectionLinkMiddleware{}).validateOrigin(c, 1))+ })+ }+}+func TestCollectionLinkCacheIsScopedToOrigin(t *testing.T) {const (accessToken = "access-token"diff --git a/server/quickstart.sh b/server/quickstart.shindex 40729a7bac..fc18d8dd68 100755--- a/server/quickstart.sh+++ b/server/quickstart.sh@@ -207,6 +207,7 @@ s3:apps:public-albums: http://localhost:3002embed-albums: http://localhost:3006+ photobook: http://localhost:3014public-locker: http://localhost:3005public-paste: http://localhost:3008cast: http://localhost:3004