Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[server] Remove unused roadmap related endpoints

Manav Rathiaf6feaf73571
diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.go
index 531b720ee3..e1aab19cd9 100644
--- a/server/cmd/museum/main.go
+++ b/server/cmd/museum/main.go
@@ -484,9 +484,6 @@ func main() {
publicAPI.POST("/users/srp/create-session", userHandler.CreateSRPSession)
privateAPI.PUT("/users/recovery-key", userHandler.SetRecoveryKey)
privateAPI.GET("/users/public-key", userHandler.GetPublicKey)
- privateAPI.GET("/users/feedback", userHandler.GetRoadmapURL)
- privateAPI.GET("/users/roadmap", userHandler.GetRoadmapURL)
- privateAPI.GET("/users/roadmap/v2", userHandler.GetRoadmapURLV2)
privateAPI.GET("/users/session-validity/v2", userHandler.GetSessionValidityV2)
privateAPI.POST("/users/event", userHandler.ReportEvent)
privateAPI.POST("/users/logout", userHandler.Logout)
diff --git a/server/configurations/local.yaml b/server/configurations/local.yaml
index 3775d6158a..e9d93e7acd 100644
--- a/server/configurations/local.yaml
+++ b/server/configurations/local.yaml
@@ -185,7 +185,6 @@ s3:
# primaryBucket:
# replicaBuckets: []
-
# Key used for encrypting customer emails before storing them in DB
#
# To make it easy to get started, some randomly generated values are provided
@@ -260,17 +259,6 @@ webauthn:
rporigins:
- "http://localhost:3001"
-# Roadmap SSO (optional)
-#
-# Allow the user to sign into an hosted roadmap service using their ente.io
-# credentials. Here we can can configure the URL prefix and service levels
-# credentials for SSO.
-roadmap:
- # The prefix of the URL the user should be redirected to
- url-prefix:
- # This secret can be obtained from the roadmap dashboard
- sso-secret:
-
# Discord config (optional)
# Use case: Devops
discord:
diff --git a/server/pkg/api/user.go b/server/pkg/api/user.go
index 939c6bf5c6..b919572aba 100644
--- a/server/pkg/api/user.go
+++ b/server/pkg/api/user.go
@@ -146,30 +146,6 @@ func (h *UserHandler) GetPublicKey(c *gin.Context) {
})
}
-// GetRoadmapURL redirects the user to the feedback page
-func (h *UserHandler) GetRoadmapURL(c *gin.Context) {
- userID := auth.GetUserID(c.Request.Header)
- redirectURL, err := h.UserController.GetRoadmapURL(userID)
- if err != nil {
- handler.Error(c, stacktrace.Propagate(err, ""))
- return
- }
- c.Redirect(http.StatusTemporaryRedirect, redirectURL)
-}
-
-// GetRoadmapURLV2 returns the jwt token attached redirect url to roadmap
-func (h *UserHandler) GetRoadmapURLV2(c *gin.Context) {
- userID := auth.GetUserID(c.Request.Header)
- roadmapURL, err := h.UserController.GetRoadmapURL(userID)
- if err != nil {
- handler.Error(c, stacktrace.Propagate(err, ""))
- return
- }
- c.JSON(http.StatusOK, gin.H{
- "url": roadmapURL,
- })
-}
-
// GetSessionValidityV2 verifies the user's session token and returns if the user has set their keys or not
func (h *UserHandler) GetSessionValidityV2(c *gin.Context) {
userID := auth.GetUserID(c.Request.Header)
diff --git a/server/pkg/controller/user/user.go b/server/pkg/controller/user/user.go
index c81ff73c8a..3c1b0419f0 100644
--- a/server/pkg/controller/user/user.go
+++ b/server/pkg/controller/user/user.go
@@ -22,10 +22,8 @@ import (
"github.com/ente-io/museum/pkg/utils/email"
"github.com/ente-io/stacktrace"
"github.com/gin-gonic/gin"
- "github.com/golang-jwt/jwt"
"github.com/patrickmn/go-cache"
"github.com/sirupsen/logrus"
- "github.com/spf13/viper"
)
// UserController exposes request handlers for all user related requests
@@ -52,8 +50,6 @@ type UserController struct {
JwtSecret []byte
Cache *cache.Cache // refers to the auth token cache
HardCodedOTT HardCodedOTT
- roadmapURLPrefix string
- roadmapSSOSecret string
UserCache *cache2.UserCache
UserCacheController *usercache.Controller
}
@@ -144,8 +140,6 @@ func NewUserController(
MailingListsController: mailingListsController,
PushController: pushController,
HardCodedOTT: ReadHardCodedOTTFromConfig(),
- roadmapURLPrefix: viper.GetString("roadmap.url-prefix"),
- roadmapSSOSecret: viper.GetString("roadmap.sso-secret"),
UserCache: userCache,
UserCacheController: userCacheController,
}
@@ -244,28 +238,6 @@ func (c *UserController) GetPublicKey(email string) (string, error) {
return key, nil
}
-// GetRoadmapURL redirects the user to the feedback page
-func (c *UserController) GetRoadmapURL(userID int64) (string, error) {
- // If SSO is not configured, redirect the user to the plain roadmap
- if c.roadmapURLPrefix == "" || c.roadmapSSOSecret == "" {
- return "https://roadmap.ente.io", nil
- }
- user, err := c.UserRepo.Get(userID)
- if err != nil {
- return "", stacktrace.Propagate(err, "")
- }
- userData := jwt.MapClaims{
- "full_name": "",
- "email": user.Hash + "@ente.io",
- }
- token := jwt.NewWithClaims(jwt.SigningMethodHS256, userData)
- signature, err := token.SignedString([]byte(c.roadmapSSOSecret))
- if err != nil {
- return "", stacktrace.Propagate(err, "")
- }
- return c.roadmapURLPrefix + signature, nil
-}
-
// GetTwoFactorStatus returns a user's two factor status
func (c *UserController) GetTwoFactorStatus(userID int64) (bool, error) {
isTwoFactorEnabled, err := c.UserRepo.IsTwoFactorEnabled(userID)