From 93c44f40ccf4ee3fc13588c5ddde592ec95befc1 Mon Sep 17 00:00:00 2001 From: Bagas Aulia Rezki Date: Wed, 2 Oct 2024 15:33:41 +0700 Subject: [PATCH] Grouping route --- .../forgotPassword/forgotPassword.go | 4 +- .../forgotPassword/verify/verify.go | 12 +- handler/auth/google/callback/callback.go | 7 +- handler/auth/google/setup/setup.go | 4 +- handler/{ => auth}/signin/signin.go | 2 +- handler/{ => auth}/signup/signup.go | 4 +- handler/{ => auth}/signup/verify/verify.go | 4 +- handler/logout/logout.go | 2 +- handler/user/ResetPassword/ResetPassword.go | 2 +- handler/user/user.go | 210 ---------------- handler/websocket/websocket.go | 221 +++++++++++++++++ middleware/middleware.go | 6 +- public/main.js | 2 +- public/validatePassword.js | 8 +- routes/client/routes.go | 80 +++--- staging.sh | 4 +- view/admin/index/index_templ.go | 4 +- view/admin/layout/base_templ.go | 6 +- view/client/auth/auth.templ | 74 +++--- view/client/auth/auth_templ.go | 52 +--- .../forgotPassword/forgotPassword.templ | 61 +++-- .../forgotPassword/forgotPassword_templ.go | 26 +- view/client/auth/signin/signin.templ | 88 +++++++ view/client/auth/signin/signin_templ.go | 116 +++++++++ view/client/auth/signup/signup.templ | 201 +++++++++++++++ view/client/auth/signup/signup_templ.go | 210 ++++++++++++++++ view/client/email/email_templ.go | 22 +- view/client/error/error_templ.go | 6 +- view/client/file/file_templ.go | 168 ++++++------- view/client/index/index.templ | 4 +- view/client/index/index_templ.go | 20 +- view/client/layout/base.templ | 4 +- view/client/layout/base_templ.go | 44 ++-- view/client/signin/signin.templ | 66 ----- view/client/signin/signin_templ.go | 116 --------- view/client/signup/signup.templ | 159 ------------ view/client/signup/signup_templ.go | 228 ------------------ view/client/totp/totp_templ.go | 10 +- view/client/user/totp/setup_templ.go | 24 +- view/client/user/user.templ | 11 +- view/client/user/user_templ.go | 42 ++-- 41 files changed, 1176 insertions(+), 1158 deletions(-) rename handler/{ => auth}/forgotPassword/forgotPassword.go (95%) rename handler/{ => auth}/forgotPassword/verify/verify.go (93%) rename handler/{ => auth}/signin/signin.go (99%) rename handler/{ => auth}/signup/signup.go (95%) rename handler/{ => auth}/signup/verify/verify.go (93%) create mode 100644 handler/websocket/websocket.go mode change 100644 => 100755 staging.sh rename view/client/{ => auth}/forgotPassword/forgotPassword.templ (76%) rename view/client/{ => auth}/forgotPassword/forgotPassword_templ.go (53%) create mode 100644 view/client/auth/signin/signin.templ create mode 100644 view/client/auth/signin/signin_templ.go create mode 100644 view/client/auth/signup/signup.templ create mode 100644 view/client/auth/signup/signup_templ.go delete mode 100644 view/client/signin/signin.templ delete mode 100644 view/client/signin/signin_templ.go delete mode 100644 view/client/signup/signup.templ delete mode 100644 view/client/signup/signup_templ.go diff --git a/handler/forgotPassword/forgotPassword.go b/handler/auth/forgotPassword/forgotPassword.go similarity index 95% rename from handler/forgotPassword/forgotPassword.go rename to handler/auth/forgotPassword/forgotPassword.go index 1829a80..bb6cd2f 100644 --- a/handler/forgotPassword/forgotPassword.go +++ b/handler/auth/forgotPassword/forgotPassword.go @@ -7,8 +7,8 @@ import ( "errors" "fmt" "github.com/fossyy/filekeeper/app" + "github.com/fossyy/filekeeper/view/client/auth/forgotPassword" "github.com/fossyy/filekeeper/view/client/email" - "github.com/fossyy/filekeeper/view/client/forgotPassword" "github.com/google/uuid" "github.com/redis/go-redis/v9" "net/http" @@ -130,7 +130,7 @@ func verifyForgot(user *models.User) error { } var buffer bytes.Buffer - err = emailView.ForgotPassword(user.Username, fmt.Sprintf("https://%s/forgot-password/verify/%s", utils.Getenv("DOMAIN"), code)).Render(context.Background(), &buffer) + err = emailView.ForgotPassword(user.Username, fmt.Sprintf("https://%s/auth/forgot-password/verify/%s", utils.Getenv("DOMAIN"), code)).Render(context.Background(), &buffer) if err != nil { return err } diff --git a/handler/forgotPassword/verify/verify.go b/handler/auth/forgotPassword/verify/verify.go similarity index 93% rename from handler/forgotPassword/verify/verify.go rename to handler/auth/forgotPassword/verify/verify.go index 342fe4a..7c27a89 100644 --- a/handler/forgotPassword/verify/verify.go +++ b/handler/auth/forgotPassword/verify/verify.go @@ -4,22 +4,16 @@ import ( "encoding/json" "errors" "github.com/fossyy/filekeeper/app" - forgotPasswordHandler "github.com/fossyy/filekeeper/handler/forgotPassword" + "github.com/fossyy/filekeeper/handler/auth/forgotPassword" "github.com/fossyy/filekeeper/session" "github.com/fossyy/filekeeper/types" "github.com/fossyy/filekeeper/utils" - "github.com/fossyy/filekeeper/view/client/forgotPassword" - signupView "github.com/fossyy/filekeeper/view/client/signup" + "github.com/fossyy/filekeeper/view/client/auth/forgotPassword" + signupView "github.com/fossyy/filekeeper/view/client/auth/signup" "github.com/redis/go-redis/v9" "net/http" ) -func init() { - - //TESTING - -} - func GET(w http.ResponseWriter, r *http.Request) { code := r.PathValue("code") diff --git a/handler/auth/google/callback/callback.go b/handler/auth/google/callback/callback.go index ed949b2..1dbe9bc 100644 --- a/handler/auth/google/callback/callback.go +++ b/handler/auth/google/callback/callback.go @@ -48,21 +48,22 @@ func GET(w http.ResponseWriter, r *http.Request) { _, err := app.Server.Cache.GetCache(r.Context(), "CsrfTokens:"+r.URL.Query().Get("state")) if err != nil { if errors.Is(err, redis.Nil) { - http.Redirect(w, r, fmt.Sprintf("/signin?error=%s", "csrf_token_error"), http.StatusFound) + http.Redirect(w, r, fmt.Sprintf("/auth/signin?error=%s", "csrf_token_error"), http.StatusFound) return } + app.Server.Logger.Error(err.Error()) w.WriteHeader(http.StatusInternalServerError) return } err = app.Server.Cache.DeleteCache(r.Context(), "CsrfTokens:"+r.URL.Query().Get("state")) if err != nil { - http.Redirect(w, r, fmt.Sprintf("/signin?error=%s", "csrf_token_error"), http.StatusFound) + http.Redirect(w, r, fmt.Sprintf("/auth/signin?error=%s", "csrf_token_error"), http.StatusFound) return } if err := r.URL.Query().Get("error"); err != "" { - http.Redirect(w, r, fmt.Sprintf("/signin?error=%s", err), http.StatusFound) + http.Redirect(w, r, fmt.Sprintf("/auth/signin?error=%s", err), http.StatusFound) return } diff --git a/handler/auth/google/setup/setup.go b/handler/auth/google/setup/setup.go index e150a1a..68b2e75 100644 --- a/handler/auth/google/setup/setup.go +++ b/handler/auth/google/setup/setup.go @@ -9,7 +9,7 @@ import ( "github.com/fossyy/filekeeper/types/models" "github.com/fossyy/filekeeper/utils" "github.com/fossyy/filekeeper/view/client/auth" - signupView "github.com/fossyy/filekeeper/view/client/signup" + signupView "github.com/fossyy/filekeeper/view/client/auth/signup" "github.com/google/uuid" "github.com/redis/go-redis/v9" "net/http" @@ -27,7 +27,7 @@ func GET(w http.ResponseWriter, r *http.Request) { _, err := app.Server.Cache.GetCache(r.Context(), "GoogleSetup:"+code) if err != nil { if errors.Is(err, redis.Nil) { - http.Redirect(w, r, "/signup", http.StatusSeeOther) + http.Redirect(w, r, "/auth/signup", http.StatusSeeOther) return } w.WriteHeader(http.StatusInternalServerError) diff --git a/handler/signin/signin.go b/handler/auth/signin/signin.go similarity index 99% rename from handler/signin/signin.go rename to handler/auth/signin/signin.go index c7fb9ff..38fc617 100644 --- a/handler/signin/signin.go +++ b/handler/auth/signin/signin.go @@ -7,7 +7,7 @@ import ( "github.com/fossyy/filekeeper/session" "github.com/fossyy/filekeeper/types" "github.com/fossyy/filekeeper/utils" - "github.com/fossyy/filekeeper/view/client/signin" + "github.com/fossyy/filekeeper/view/client/auth/signin" "net/http" ) diff --git a/handler/signup/signup.go b/handler/auth/signup/signup.go similarity index 95% rename from handler/signup/signup.go rename to handler/auth/signup/signup.go index c603b2b..ea79406 100644 --- a/handler/signup/signup.go +++ b/handler/auth/signup/signup.go @@ -8,8 +8,8 @@ import ( "fmt" "github.com/fossyy/filekeeper/app" "github.com/fossyy/filekeeper/utils" + signupView "github.com/fossyy/filekeeper/view/client/auth/signup" "github.com/fossyy/filekeeper/view/client/email" - signupView "github.com/fossyy/filekeeper/view/client/signup" "github.com/redis/go-redis/v9" "net/http" "time" @@ -117,7 +117,7 @@ func verifyEmail(user *models.User) error { code = storedCode } - err = emailView.RegistrationEmail(user.Username, fmt.Sprintf("https://%s/signup/verify/%s", utils.Getenv("DOMAIN"), code)).Render(context.Background(), &buffer) + err = emailView.RegistrationEmail(user.Username, fmt.Sprintf("https://%s/auth/signup/verify/%s", utils.Getenv("DOMAIN"), code)).Render(context.Background(), &buffer) if err != nil { return err } diff --git a/handler/signup/verify/verify.go b/handler/auth/signup/verify/verify.go similarity index 93% rename from handler/signup/verify/verify.go rename to handler/auth/signup/verify/verify.go index a155cd4..3791f57 100644 --- a/handler/signup/verify/verify.go +++ b/handler/auth/signup/verify/verify.go @@ -5,8 +5,8 @@ import ( "encoding/json" "errors" "github.com/fossyy/filekeeper/app" - signupHandler "github.com/fossyy/filekeeper/handler/signup" - signupView "github.com/fossyy/filekeeper/view/client/signup" + "github.com/fossyy/filekeeper/handler/auth/signup" + signupView "github.com/fossyy/filekeeper/view/client/auth/signup" "github.com/redis/go-redis/v9" "net/http" diff --git a/handler/logout/logout.go b/handler/logout/logout.go index 6083729..b4aedfe 100644 --- a/handler/logout/logout.go +++ b/handler/logout/logout.go @@ -39,6 +39,6 @@ func GET(w http.ResponseWriter, r *http.Request) { MaxAge: -1, }) - http.Redirect(w, r, "/signin", http.StatusSeeOther) + http.Redirect(w, r, "/auth/signin", http.StatusSeeOther) return } diff --git a/handler/user/ResetPassword/ResetPassword.go b/handler/user/ResetPassword/ResetPassword.go index 80b1c07..053d109 100644 --- a/handler/user/ResetPassword/ResetPassword.go +++ b/handler/user/ResetPassword/ResetPassword.go @@ -58,6 +58,6 @@ func POST(w http.ResponseWriter, r *http.Request) { return } - http.Redirect(w, r, "/signin", http.StatusSeeOther) + http.Redirect(w, r, "/auth/signin", http.StatusSeeOther) return } diff --git a/handler/user/user.go b/handler/user/user.go index 3f3a8d7..8416fb1 100644 --- a/handler/user/user.go +++ b/handler/user/user.go @@ -1,67 +1,22 @@ package userHandler import ( - "context" - "encoding/json" - "errors" "fmt" "github.com/a-h/templ" "github.com/fossyy/filekeeper/app" "github.com/fossyy/filekeeper/session" "github.com/fossyy/filekeeper/types" - "github.com/fossyy/filekeeper/types/models" "github.com/fossyy/filekeeper/utils" "github.com/fossyy/filekeeper/view/client/user" - "github.com/google/uuid" - "github.com/gorilla/websocket" - "gorm.io/gorm" "net/http" - "strings" ) var errorMessages = map[string]string{ "password_not_match": "The passwords provided do not match. Please try again.", } -var upgrader = websocket.Upgrader{ - ReadBufferSize: 1024, - WriteBufferSize: 1024, -} - -type ActionType string - -const ( - UploadNewFile ActionType = "UploadNewFile" - DeleteFile ActionType = "DeleteFile" - Ping ActionType = "Ping" -) - -type WebsocketAction struct { - Action ActionType `json:"action"` -} - -type ActionUploadNewFile struct { - Action string `json:"action"` - Name string `json:"name"` - Size uint64 `json:"size"` - Chunk uint64 `json:"chunk"` - StartHash string `json:"startHash"` - EndHash string `json:"endHash"` - RequestID string `json:"requestID"` -} - func GET(w http.ResponseWriter, r *http.Request) { userSession := r.Context().Value("user").(types.User) - if r.Header.Get("upgrade") == "websocket" { - upgrade, err := upgrader.Upgrade(w, r, nil) - if err != nil { - w.WriteHeader(http.StatusInternalServerError) - app.Server.Logger.Error(err.Error()) - return - } - handlerWS(upgrade, userSession) - } - sessions, err := session.GetSessions(userSession.Email) if err != nil { w.WriteHeader(http.StatusInternalServerError) @@ -126,168 +81,3 @@ func GET(w http.ResponseWriter, r *http.Request) { return } } - -func handlerWS(conn *websocket.Conn, userSession types.User) { - defer conn.Close() - var err error - var message []byte - - for { - _, message, err = conn.ReadMessage() - if err != nil { - if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) { - app.Server.Logger.Error("Unexpected connection closure:", err) - } else { - app.Server.Logger.Error("Connection closed:", err) - } - return - } - var action WebsocketAction - err = json.Unmarshal(message, &action) - if err != nil { - app.Server.Logger.Error("Error unmarshalling WebsocketAction:", err) - sendErrorResponse(conn, action.Action, "Internal Server Error") - continue - } - - switch action.Action { - case UploadNewFile: - var uploadNewFile ActionUploadNewFile - err = json.Unmarshal(message, &uploadNewFile) - if err != nil { - app.Server.Logger.Error("Error unmarshalling ActionUploadNewFile:", err) - sendErrorResponse(conn, action.Action, "Internal Server Error") - continue - } - var file *models.File - file, err = app.Server.Database.GetUserFile(uploadNewFile.Name, userSession.UserID.String()) - allowedFileTypes := []string{"jpg", "jpeg", "png", "gif", "bmp", "tiff", "pdf", "doc", "docx", "txt", "odt", "xls", "xlsx", "ppt", "pptx", "zip", "rar", "tar", "gz", "7z", "bz2", "exe", "bin", "sh", "bat", "cmd", "msi", "apk"} - isAllowedFileType := func(fileType string) bool { - for _, allowed := range allowedFileTypes { - if fileType == allowed { - return true - } - } - return false - } - fileName := strings.Split(uploadNewFile.Name, ".") - fileType := fileName[len(fileName)-1] - if !isAllowedFileType(fileType) { - fileType = "doc" - } - - if err != nil { - if errors.Is(err, gorm.ErrRecordNotFound) { - fileID := uuid.New() - newFile := models.File{ - ID: fileID, - OwnerID: userSession.UserID, - Name: uploadNewFile.Name, - Size: uploadNewFile.Size, - StartHash: uploadNewFile.StartHash, - EndHash: uploadNewFile.EndHash, - Type: fileType, - TotalChunk: uploadNewFile.Chunk, - Downloaded: 0, - } - - err := app.Server.Database.CreateFile(&newFile) - if err != nil { - app.Server.Logger.Error(err.Error()) - sendErrorResponse(conn, action.Action, "Error Creating File") - continue - } - - err = app.Server.Service.RemoveUserFilesCache(context.Background(), userSession.UserID) - if err != nil { - app.Server.Logger.Error(err.Error()) - sendErrorResponse(conn, action.Action, "Error Creating File") - return - } - - userFile, err := app.Server.Service.GetFileDetail(context.Background(), fileID) - if err != nil { - app.Server.Logger.Error(err.Error()) - sendErrorResponse(conn, action.Action, "Unknown error") - continue - } - - sendSuccessResponseWithID(conn, action.Action, userFile, uploadNewFile.RequestID) - continue - } else { - app.Server.Logger.Error(err.Error()) - sendErrorResponse(conn, action.Action, "Unknown error") - continue - } - } - if uploadNewFile.StartHash != file.StartHash || uploadNewFile.EndHash != file.EndHash { - sendErrorResponse(conn, action.Action, "File Is Different") - continue - } - userFile, err := app.Server.Service.GetFileDetail(context.Background(), file.ID) - if err != nil { - app.Server.Logger.Error(err.Error()) - sendErrorResponse(conn, action.Action, "Unknown error") - continue - } - - sendSuccessResponseWithID(conn, action.Action, userFile, uploadNewFile.RequestID) - continue - case Ping: - sendSuccessResponse(conn, action.Action, map[string]string{"message": "received"}) - continue - } - } -} - -func sendErrorResponse(conn *websocket.Conn, action ActionType, message string) { - response := map[string]interface{}{ - "action": action, - "status": "error", - "message": message, - } - marshal, err := json.Marshal(response) - if err != nil { - app.Server.Logger.Error("Error marshalling error response:", err) - return - } - err = conn.WriteMessage(websocket.TextMessage, marshal) - if err != nil { - app.Server.Logger.Error("Error writing error response:", err) - } -} - -func sendSuccessResponse(conn *websocket.Conn, action ActionType, response interface{}) { - responseJSON := map[string]interface{}{ - "action": action, - "status": "success", - "response": response, - } - marshal, err := json.Marshal(responseJSON) - if err != nil { - app.Server.Logger.Error("Error marshalling success response:", err) - return - } - err = conn.WriteMessage(websocket.TextMessage, marshal) - if err != nil { - app.Server.Logger.Error("Error writing success response:", err) - } -} - -func sendSuccessResponseWithID(conn *websocket.Conn, action ActionType, response interface{}, responseID string) { - responseJSON := map[string]interface{}{ - "action": action, - "status": "success", - "response": response, - "responseID": responseID, - } - marshal, err := json.Marshal(responseJSON) - if err != nil { - app.Server.Logger.Error("Error marshalling success response:", err) - return - } - err = conn.WriteMessage(websocket.TextMessage, marshal) - if err != nil { - app.Server.Logger.Error("Error writing success response:", err) - } -} diff --git a/handler/websocket/websocket.go b/handler/websocket/websocket.go new file mode 100644 index 0000000..c5b699f --- /dev/null +++ b/handler/websocket/websocket.go @@ -0,0 +1,221 @@ +package websocketHandler + +import ( + "context" + "encoding/json" + "errors" + "github.com/fossyy/filekeeper/app" + "github.com/fossyy/filekeeper/types" + "github.com/fossyy/filekeeper/types/models" + "github.com/google/uuid" + "github.com/gorilla/websocket" + "gorm.io/gorm" + "net/http" + "strings" +) + +var upgrader = websocket.Upgrader{ + ReadBufferSize: 1024, + WriteBufferSize: 1024, +} + +type ActionUploadNewFile struct { + Action string `json:"action"` + Name string `json:"name"` + Size uint64 `json:"size"` + Chunk uint64 `json:"chunk"` + StartHash string `json:"startHash"` + EndHash string `json:"endHash"` + RequestID string `json:"requestID"` +} + +type ActionType string + +type WebsocketAction struct { + Action ActionType `json:"action"` +} + +const ( + UploadNewFile ActionType = "UploadNewFile" + DeleteFile ActionType = "DeleteFile" + Ping ActionType = "Ping" +) + +func GET(w http.ResponseWriter, r *http.Request) { + userSession := r.Context().Value("user").(types.User) + if r.Header.Get("upgrade") == "websocket" { + upgrade, err := upgrader.Upgrade(w, r, nil) + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + app.Server.Logger.Error(err.Error()) + return + } + handlerWS(upgrade, userSession) + } + +} + +func handlerWS(conn *websocket.Conn, userSession types.User) { + defer conn.Close() + var err error + var message []byte + + for { + _, message, err = conn.ReadMessage() + if err != nil { + if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) { + app.Server.Logger.Error("Unexpected connection closure:", err) + } else { + app.Server.Logger.Error("Connection closed:", err) + } + return + } + var action WebsocketAction + err = json.Unmarshal(message, &action) + if err != nil { + app.Server.Logger.Error("Error unmarshalling WebsocketAction:", err) + sendErrorResponse(conn, action.Action, "Internal Server Error") + continue + } + + switch action.Action { + case UploadNewFile: + var uploadNewFile ActionUploadNewFile + err = json.Unmarshal(message, &uploadNewFile) + if err != nil { + app.Server.Logger.Error("Error unmarshalling ActionUploadNewFile:", err) + sendErrorResponse(conn, action.Action, "Internal Server Error") + continue + } + var file *models.File + file, err = app.Server.Database.GetUserFile(uploadNewFile.Name, userSession.UserID.String()) + allowedFileTypes := []string{"jpg", "jpeg", "png", "gif", "bmp", "tiff", "pdf", "doc", "docx", "txt", "odt", "xls", "xlsx", "ppt", "pptx", "zip", "rar", "tar", "gz", "7z", "bz2", "exe", "bin", "sh", "bat", "cmd", "msi", "apk"} + isAllowedFileType := func(fileType string) bool { + for _, allowed := range allowedFileTypes { + if fileType == allowed { + return true + } + } + return false + } + fileName := strings.Split(uploadNewFile.Name, ".") + fileType := fileName[len(fileName)-1] + if !isAllowedFileType(fileType) { + fileType = "doc" + } + + if err != nil { + if errors.Is(err, gorm.ErrRecordNotFound) { + fileID := uuid.New() + newFile := models.File{ + ID: fileID, + OwnerID: userSession.UserID, + Name: uploadNewFile.Name, + Size: uploadNewFile.Size, + StartHash: uploadNewFile.StartHash, + EndHash: uploadNewFile.EndHash, + Type: fileType, + TotalChunk: uploadNewFile.Chunk, + Downloaded: 0, + } + + err := app.Server.Database.CreateFile(&newFile) + if err != nil { + app.Server.Logger.Error(err.Error()) + sendErrorResponse(conn, action.Action, "Error Creating File") + continue + } + + err = app.Server.Service.RemoveUserFilesCache(context.Background(), userSession.UserID) + if err != nil { + app.Server.Logger.Error(err.Error()) + sendErrorResponse(conn, action.Action, "Error Creating File") + return + } + + userFile, err := app.Server.Service.GetFileDetail(context.Background(), fileID) + if err != nil { + app.Server.Logger.Error(err.Error()) + sendErrorResponse(conn, action.Action, "Unknown error") + continue + } + + sendSuccessResponseWithID(conn, action.Action, userFile, uploadNewFile.RequestID) + continue + } else { + app.Server.Logger.Error(err.Error()) + sendErrorResponse(conn, action.Action, "Unknown error") + continue + } + } + if uploadNewFile.StartHash != file.StartHash || uploadNewFile.EndHash != file.EndHash { + sendErrorResponse(conn, action.Action, "File Is Different") + continue + } + userFile, err := app.Server.Service.GetFileDetail(context.Background(), file.ID) + if err != nil { + app.Server.Logger.Error(err.Error()) + sendErrorResponse(conn, action.Action, "Unknown error") + continue + } + + sendSuccessResponseWithID(conn, action.Action, userFile, uploadNewFile.RequestID) + continue + case Ping: + sendSuccessResponse(conn, action.Action, map[string]string{"message": "received"}) + continue + } + } +} + +func sendErrorResponse(conn *websocket.Conn, action ActionType, message string) { + response := map[string]interface{}{ + "action": action, + "status": "error", + "message": message, + } + marshal, err := json.Marshal(response) + if err != nil { + app.Server.Logger.Error("Error marshalling error response:", err) + return + } + err = conn.WriteMessage(websocket.TextMessage, marshal) + if err != nil { + app.Server.Logger.Error("Error writing error response:", err) + } +} + +func sendSuccessResponse(conn *websocket.Conn, action ActionType, response interface{}) { + responseJSON := map[string]interface{}{ + "action": action, + "status": "success", + "response": response, + } + marshal, err := json.Marshal(responseJSON) + if err != nil { + app.Server.Logger.Error("Error marshalling success response:", err) + return + } + err = conn.WriteMessage(websocket.TextMessage, marshal) + if err != nil { + app.Server.Logger.Error("Error writing success response:", err) + } +} + +func sendSuccessResponseWithID(conn *websocket.Conn, action ActionType, response interface{}, responseID string) { + responseJSON := map[string]interface{}{ + "action": action, + "status": "success", + "response": response, + "responseID": responseID, + } + marshal, err := json.Marshal(responseJSON) + if err != nil { + app.Server.Logger.Error("Error marshalling success response:", err) + return + } + err = conn.WriteMessage(websocket.TextMessage, marshal) + if err != nil { + app.Server.Logger.Error("Error writing success response:", err) + } +} diff --git a/middleware/middleware.go b/middleware/middleware.go index 03b7f1e..e8e3d57 100644 --- a/middleware/middleware.go +++ b/middleware/middleware.go @@ -109,7 +109,7 @@ func Auth(next http.HandlerFunc) http.Handler { Path: "/", }) } - http.Redirect(w, r, "/signin", http.StatusSeeOther) + http.Redirect(w, r, "/auth/signin", http.StatusSeeOther) return case session.InvalidSession: http.SetCookie(w, &http.Cookie{ @@ -118,7 +118,7 @@ func Auth(next http.HandlerFunc) http.Handler { Path: "/", MaxAge: -1, }) - http.Redirect(w, r, "/signin", http.StatusSeeOther) + http.Redirect(w, r, "/auth/signin", http.StatusSeeOther) return case session.Suspicious: userSession := session.Get(sessionID) @@ -137,7 +137,7 @@ func Auth(next http.HandlerFunc) http.Handler { Path: "/", MaxAge: -1, }) - http.Redirect(w, r, "/signin?error=suspicious_session", http.StatusSeeOther) + http.Redirect(w, r, "/auth/signin?error=suspicious_session", http.StatusSeeOther) return default: http.Redirect(w, r, "/", http.StatusSeeOther) diff --git a/public/main.js b/public/main.js index 7aaa08f..00a11a7 100644 --- a/public/main.js +++ b/public/main.js @@ -1,6 +1,6 @@ if (!window.mySocket) { const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - window.mySocket = new WebSocket(`${wsProtocol}//${window.location.host}/user`); + window.mySocket = new WebSocket(`${wsProtocol}//${window.location.host}/ws`); window.mySocket.onopen = function(event) { console.log('WebSocket is open now.'); diff --git a/public/validatePassword.js b/public/validatePassword.js index 6ec6485..bf4a7e2 100644 --- a/public/validatePassword.js +++ b/public/validatePassword.js @@ -3,6 +3,7 @@ var isValid = false; var hasUppercase = false; function validatePasswords() { + var checkContainer = document.getElementById('checkContainer') var password = document.getElementById('password').value; var confirmPassword = document.getElementById('confirmPassword').value; var matchGoodPath = document.getElementById('matchGoodPath'); @@ -17,7 +18,12 @@ function validatePasswords() { var matchStatusText = document.getElementById('matchStatusText'); var lengthStatusText = document.getElementById('lengthStatusText'); var uppercaseStatusText = document.getElementById('uppercaseStatusText'); - + console.log("jalan") + if (password.length > 0) { + checkContainer.classList.remove("hidden") + } else { + checkContainer.classList.add("hidden") + } if (password === confirmPassword && password.length > 0 && confirmPassword.length > 0 && password.length === confirmPassword.length) { matchSvgContainer.classList.remove('bg-red-200'); matchSvgContainer.classList.add('bg-green-200'); diff --git a/routes/client/routes.go b/routes/client/routes.go index edefffa..24d5398 100644 --- a/routes/client/routes.go +++ b/routes/client/routes.go @@ -1,9 +1,14 @@ package client import ( + "github.com/fossyy/filekeeper/handler/auth/forgotPassword" + "github.com/fossyy/filekeeper/handler/auth/forgotPassword/verify" googleOauthHandler "github.com/fossyy/filekeeper/handler/auth/google" googleOauthCallbackHandler "github.com/fossyy/filekeeper/handler/auth/google/callback" googleOauthSetupHandler "github.com/fossyy/filekeeper/handler/auth/google/setup" + "github.com/fossyy/filekeeper/handler/auth/signin" + "github.com/fossyy/filekeeper/handler/auth/signup" + "github.com/fossyy/filekeeper/handler/auth/signup/verify" totpHandler "github.com/fossyy/filekeeper/handler/auth/totp" fileHandler "github.com/fossyy/filekeeper/handler/file" deleteHandler "github.com/fossyy/filekeeper/handler/file/delete" @@ -13,62 +18,59 @@ import ( fileTableHandler "github.com/fossyy/filekeeper/handler/file/table" uploadHandler "github.com/fossyy/filekeeper/handler/file/upload" visibilityHandler "github.com/fossyy/filekeeper/handler/file/visibility" - forgotPasswordHandler "github.com/fossyy/filekeeper/handler/forgotPassword" - forgotPasswordVerifyHandler "github.com/fossyy/filekeeper/handler/forgotPassword/verify" indexHandler "github.com/fossyy/filekeeper/handler/index" logoutHandler "github.com/fossyy/filekeeper/handler/logout" - signinHandler "github.com/fossyy/filekeeper/handler/signin" - signupHandler "github.com/fossyy/filekeeper/handler/signup" - signupVerifyHandler "github.com/fossyy/filekeeper/handler/signup/verify" userHandler "github.com/fossyy/filekeeper/handler/user" userHandlerResetPassword "github.com/fossyy/filekeeper/handler/user/ResetPassword" userSessionTerminateHandler "github.com/fossyy/filekeeper/handler/user/session/terminate" userHandlerTotpSetup "github.com/fossyy/filekeeper/handler/user/totp" + websocketHandler "github.com/fossyy/filekeeper/handler/websocket" "github.com/fossyy/filekeeper/middleware" "net/http" ) func SetupRoutes() *http.ServeMux { handler := http.NewServeMux() - - // Index handler.HandleFunc("GET /{$}", indexHandler.GET) - // Auth Routes - handler.Handle("GET /auth/google", middleware.Guest(googleOauthHandler.GET)) - handler.Handle("GET /auth/totp", middleware.Guest(totpHandler.GET)) - handler.Handle("POST /auth/totp", middleware.Guest(totpHandler.POST)) - handler.Handle("GET /auth/google/callback", middleware.Guest(googleOauthCallbackHandler.GET)) - handler.Handle("GET /auth/google/setup/{code}", middleware.Guest(googleOauthSetupHandler.GET)) - handler.Handle("POST /auth/google/setup/{code}", middleware.Guest(googleOauthSetupHandler.POST)) + authRoute := http.NewServeMux() + handler.Handle("/auth/", http.StripPrefix("/auth", authRoute)) + authRoute.Handle("GET /google", middleware.Guest(googleOauthHandler.GET)) + authRoute.Handle("GET /totp", middleware.Guest(totpHandler.GET)) + authRoute.Handle("POST /totp", middleware.Guest(totpHandler.POST)) + authRoute.Handle("GET /google/callback", middleware.Guest(googleOauthCallbackHandler.GET)) + authRoute.Handle("GET /google/setup/{code}", middleware.Guest(googleOauthSetupHandler.GET)) + authRoute.Handle("POST /google/setup/{code}", middleware.Guest(googleOauthSetupHandler.POST)) + authRoute.Handle("GET /signin", middleware.Guest(signinHandler.GET)) + authRoute.Handle("POST /signin", middleware.Guest(signinHandler.POST)) + authRoute.Handle("GET /signup", middleware.Guest(signupHandler.GET)) + authRoute.Handle("POST /signup", middleware.Guest(signupHandler.POST)) + authRoute.Handle("GET /signup/verify/{code}", middleware.Guest(signupVerifyHandler.GET)) + authRoute.Handle("GET /forgot-password", middleware.Guest(forgotPasswordHandler.GET)) + authRoute.Handle("POST /forgot-password", middleware.Guest(forgotPasswordHandler.POST)) + authRoute.Handle("GET /forgot-password/verify/{code}", middleware.Guest(forgotPasswordVerifyHandler.GET)) + authRoute.Handle("POST /forgot-password/verify/{code}", middleware.Guest(forgotPasswordVerifyHandler.POST)) - // Signin/Signup/Forgot Password - handler.Handle("GET /signin", middleware.Guest(signinHandler.GET)) - handler.Handle("POST /signin", middleware.Guest(signinHandler.POST)) - handler.Handle("GET /signup", middleware.Guest(signupHandler.GET)) - handler.Handle("POST /signup", middleware.Guest(signupHandler.POST)) - handler.Handle("GET /signup/verify/{code}", middleware.Guest(signupVerifyHandler.GET)) - handler.Handle("GET /forgot-password", middleware.Guest(forgotPasswordHandler.GET)) - handler.Handle("POST /forgot-password", middleware.Guest(forgotPasswordHandler.POST)) - handler.Handle("GET /forgot-password/verify/{code}", middleware.Guest(forgotPasswordVerifyHandler.GET)) - handler.Handle("POST /forgot-password/verify/{code}", middleware.Guest(forgotPasswordVerifyHandler.POST)) + userRoute := http.NewServeMux() + handler.Handle("/user/", http.StripPrefix("/user", userRoute)) + userRoute.Handle("GET /{$}", middleware.Auth(userHandler.GET)) + userRoute.Handle("POST /reset-password", middleware.Auth(userHandlerResetPassword.POST)) + userRoute.Handle("DELETE /session/terminate/{id}", middleware.Auth(userSessionTerminateHandler.DELETE)) + userRoute.Handle("GET /totp/setup", middleware.Auth(userHandlerTotpSetup.GET)) + userRoute.Handle("POST /totp/setup", middleware.Auth(userHandlerTotpSetup.POST)) - // User Routes - handler.Handle("GET /user", middleware.Auth(userHandler.GET)) - handler.Handle("POST /user/reset-password", middleware.Auth(userHandlerResetPassword.POST)) - handler.Handle("DELETE /user/session/terminate/{id}", middleware.Auth(userSessionTerminateHandler.DELETE)) - handler.Handle("GET /user/totp/setup", middleware.Auth(userHandlerTotpSetup.GET)) - handler.Handle("POST /user/totp/setup", middleware.Auth(userHandlerTotpSetup.POST)) + handler.Handle("/ws", middleware.Auth(websocketHandler.GET)) - // File Routes - handler.Handle("GET /file", middleware.Auth(fileHandler.GET)) - handler.Handle("GET /file/table", middleware.Auth(fileTableHandler.GET)) - handler.Handle("GET /file/query", middleware.Auth(queryHandler.GET)) - handler.Handle("POST /file/{id}", middleware.Auth(uploadHandler.POST)) - handler.Handle("DELETE /file/{id}", middleware.Auth(deleteHandler.DELETE)) - handler.HandleFunc("GET /file/{id}", downloadHandler.GET) - handler.Handle("PUT /file/{id}", middleware.Auth(visibilityHandler.PUT)) - handler.Handle("PATCH /file/{id}", middleware.Auth(renameFileHandler.PATCH)) + fileRoute := http.NewServeMux() + handler.Handle("/file/", http.StripPrefix("/file", fileRoute)) + fileRoute.Handle("GET /{$}", middleware.Auth(fileHandler.GET)) + fileRoute.Handle("GET /table", middleware.Auth(fileTableHandler.GET)) + fileRoute.Handle("GET /query", middleware.Auth(queryHandler.GET)) + fileRoute.Handle("POST /{id}", middleware.Auth(uploadHandler.POST)) + fileRoute.Handle("DELETE /{id}", middleware.Auth(deleteHandler.DELETE)) + fileRoute.HandleFunc("GET /{id}", downloadHandler.GET) + fileRoute.Handle("PUT /{id}", middleware.Auth(visibilityHandler.PUT)) + fileRoute.Handle("PATCH /{id}", middleware.Auth(renameFileHandler.PATCH)) handler.Handle("GET /logout", middleware.Auth(logoutHandler.GET)) diff --git a/staging.sh b/staging.sh old mode 100644 new mode 100755 index 327f097..960967e --- a/staging.sh +++ b/staging.sh @@ -1,5 +1,5 @@ #!/bin/bash air & -npx tailwindcss -i ./public/input.css -o ./public/output.css --watch & -templ generate -watch -proxy=http://localhost:8000 +templ generate -watch & +npx tailwindcss -i ./public/input.css -o ./public/output.css --watch diff --git a/view/admin/index/index_templ.go b/view/admin/index/index_templ.go index 8ca0ebf..25151ff 100644 --- a/view/admin/index/index_templ.go +++ b/view/admin/index/index_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.778 +// templ: version: v0.2.786 package adminIndex //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -43,7 +43,7 @@ func Main() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

System Usage

Real-time metrics for your server.

0%
CPU Usage
0GB
Memory Usage
0Mbps
Upload Speed
0Mbps
Download Speed

User List

Manage your registered users.

NameEmailRoleActions
John Doe
john@example.com
Admin
Jane Smith
jane@example.com
Editor
Bob Johnson
bob@example.com
User

Server Control

Manage your server instances.

Server 1
192.168.1.100
Server 2
192.168.1.101
Server 3
192.168.1.102

Server Environment

Manage your server environment variables.

NODE_ENV
Environment mode
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/view/admin/layout/base_templ.go b/view/admin/layout/base_templ.go index 2c65a26..4498e7a 100644 --- a/view/admin/layout/base_templ.go +++ b/view/admin/layout/base_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.778 +// templ: version: v0.2.786 package layout //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -29,7 +29,7 @@ func Base() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Admin Page
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -37,7 +37,7 @@ func Base() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/view/client/auth/auth.templ b/view/client/auth/auth.templ index 02f5027..214f808 100644 --- a/view/client/auth/auth.templ +++ b/view/client/auth/auth.templ @@ -7,38 +7,27 @@ import ( templ form(err types.Message, title string) { @layout.Base(title){ -
-
-
-
-

Set Up Your Account

-

Enter your information to create a new account

- switch err.Code { - case 0: - - case 1: - - } +
+
+

Sign Up

+
+
+ +
-
- -
- - +
+ +
-
- - -
-
- - -
-
+
+ + +
+
+ - + +
-
- Already have an account? - - Sign in - +
+

+ Already have an account? + + Log in + +

+
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -118,9 +76,9 @@ func GoogleSetup(title string, err types.Message) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var5 := templ.GetChildren(ctx) - if templ_7745c5c3_Var5 == nil { - templ_7745c5c3_Var5 = templ.NopComponent + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) templ_7745c5c3_Err = form(err, title).Render(ctx, templ_7745c5c3_Buffer) diff --git a/view/client/forgotPassword/forgotPassword.templ b/view/client/auth/forgotPassword/forgotPassword.templ similarity index 76% rename from view/client/forgotPassword/forgotPassword.templ rename to view/client/auth/forgotPassword/forgotPassword.templ index feed80f..da77e98 100644 --- a/view/client/forgotPassword/forgotPassword.templ +++ b/view/client/auth/forgotPassword/forgotPassword.templ @@ -7,30 +7,43 @@ import ( templ content(title string, err types.Message) { @layout.Base(title){ -
-
-
-
-

Forgot password

-

Enter your email below to reset your password

- switch err.Code { - case 0: - - } -
-
-
-
- - -
- -
-
+
+
+

Forgot Password

+

Enter your email address and we'll send you instructions to reset your password.

+
+ switch err.Code { + case 0: + + } +
+ + +
+
+ +
+
+ +
} } diff --git a/view/client/forgotPassword/forgotPassword_templ.go b/view/client/auth/forgotPassword/forgotPassword_templ.go similarity index 53% rename from view/client/forgotPassword/forgotPassword_templ.go rename to view/client/auth/forgotPassword/forgotPassword_templ.go index 3ad1279..32f9e9c 100644 --- a/view/client/forgotPassword/forgotPassword_templ.go +++ b/view/client/auth/forgotPassword/forgotPassword_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.778 +// templ: version: v0.2.786 package forgotPasswordView //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -46,31 +46,31 @@ func content(title string, err types.Message) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Forgot Password

Enter your email address and we'll send you instructions to reset your password.

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } switch err.Code { case 0: - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Error! ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(err.Message) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/forgotPassword/forgotPassword.templ`, Line: 19, Col: 38} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/auth/forgotPassword/forgotPassword.templ`, Line: 19, Col: 75} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -146,31 +146,31 @@ func NewPasswordForm(title string, err types.Message) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Forgot password

Enter your email below to reset your password

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } switch err.Code { case 0: - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(err.Message) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/forgotPassword/forgotPassword.templ`, Line: 53, Col: 38} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/auth/forgotPassword/forgotPassword.templ`, Line: 66, Col: 38} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • Passwords do not match
  • Password must contain at least one uppercase letter
  • Password length must be at least 8 characters
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -217,7 +217,7 @@ func EmailSend(title string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Email Verification Sent

We've sent a verification email to your inbox. Please check your email and follow the instructions to change your password.

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -264,7 +264,7 @@ func ChangeSuccess(title string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Password Changed Successfully

Your password has been successfully updated. Feel free to continue enjoying our platform.

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/view/client/auth/signin/signin.templ b/view/client/auth/signin/signin.templ new file mode 100644 index 0000000..383f5da --- /dev/null +++ b/view/client/auth/signin/signin.templ @@ -0,0 +1,88 @@ +package signinView + +import ( +"github.com/fossyy/filekeeper/types" +"github.com/fossyy/filekeeper/view/client/layout" +) + +templ content(err types.Message, title string) { + @layout.Base(title){ +
+
+

Login

+ switch err.Code { + case 0: + + } +
+
+ + +
+
+ + +
+ +
+ +
+
+
+
+
+
+
+
+ Or continue with +
+
+ +
+
+

+ Don't have an account? + + Sign up + +

+
+
+
+ } +} + +templ Main(title string, err types.Message) { + @content(err, title) +} \ No newline at end of file diff --git a/view/client/auth/signin/signin_templ.go b/view/client/auth/signin/signin_templ.go new file mode 100644 index 0000000..055767c --- /dev/null +++ b/view/client/auth/signin/signin_templ.go @@ -0,0 +1,116 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.786 +package signinView + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +import ( + "github.com/fossyy/filekeeper/types" + "github.com/fossyy/filekeeper/view/client/layout" +) + +func content(err types.Message, title string) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Login

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + switch err.Code { + case 0: + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Error! ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(err.Message) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/auth/signin/signin.templ`, Line: 17, Col: 71} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Or continue with

Don't have an account? Sign up

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.Base(title).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func Main(title string, err types.Message) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = content(err, title).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +var _ = templruntime.GeneratedTemplate diff --git a/view/client/auth/signup/signup.templ b/view/client/auth/signup/signup.templ new file mode 100644 index 0000000..b4f03bb --- /dev/null +++ b/view/client/auth/signup/signup.templ @@ -0,0 +1,201 @@ +package signup + +import ( + "github.com/fossyy/filekeeper/types" + "github.com/fossyy/filekeeper/view/client/layout" +) + +templ form(err types.Message, title string) { + @layout.Base(title){ +
+
+

Sign Up

+ switch err.Code { + case 0: + + } +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+
+ Or continue with +
+
+ +
+
+

+ Already have an account? + + Log in + +

+
+
+
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.Base(title).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func Main(title string, err types.Message) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = form(err, title).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func EmailSend(title string) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Email Verification Sent

We've sent a verification email to your inbox. Please check your email and follow the instructions to verify your account.

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.Base(title).Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func VerifySuccess(title string) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var7 := templ.GetChildren(ctx) + if templ_7745c5c3_Var7 == nil { + templ_7745c5c3_Var7 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var8 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Account Verified

Your account has been successfully verified. You can now access all the features of our platform.

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.Base(title).Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +var _ = templruntime.GeneratedTemplate diff --git a/view/client/email/email_templ.go b/view/client/email/email_templ.go index 45d9eab..0d9f69d 100644 --- a/view/client/email/email_templ.go +++ b/view/client/email/email_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.778 +// templ: version: v0.2.786 package emailView //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -29,7 +29,7 @@ func RegistrationEmail(name string, link string) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Email Verification

Email Verification

Dear ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -42,7 +42,7 @@ func RegistrationEmail(name string, link string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(",

Please verify your email address by clicking the button below:

Verify Email

Or copy and paste this URL into a new tab of your browser:
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -73,7 +73,7 @@ func RegistrationEmail(name string, link string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

If you did not request this verification, please disregard this email.

Thank you,
The Filekeeper Team

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -102,7 +102,7 @@ func ForgotPassword(name string, link string) templ.Component { templ_7745c5c3_Var6 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Email Verification

Password Change Request

Dear ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -115,7 +115,7 @@ func ForgotPassword(name string, link string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(",

Please verify your password change request by clicking the button below:

Verify Password Change

Or copy and paste this URL into a new tab of your browser:
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -146,7 +146,7 @@ func ForgotPassword(name string, link string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

If you did not request this password change, please disregard this email.

Thank you,
The Filekeeper Team

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/view/client/error/error_templ.go b/view/client/error/error_templ.go index 1b74d1a..fb030d0 100644 --- a/view/client/error/error_templ.go +++ b/view/client/error/error_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.778 +// templ: version: v0.2.786 package errorView //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -43,7 +43,7 @@ func NotFound(title string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

404 Not Found

The page you are looking for does not exist. It might have been moved or deleted.

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -90,7 +90,7 @@ func InternalServerError(title string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"Cute

Oops! Something went wrong.

We're sorry, but an internal server error has occurred. Please try again later.

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/view/client/file/file_templ.go b/view/client/file/file_templ.go index d275161..e541613 100644 --- a/view/client/file/file_templ.go +++ b/view/client/file/file_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.778 +// templ: version: v0.2.786 package fileView //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -83,7 +83,7 @@ func MainContent(title string, files []types.FileData, user types.User, allowanc templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -96,7 +96,7 @@ func MainContent(title string, files []types.FileData, user types.User, allowanc if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -104,7 +104,7 @@ func MainContent(title string, files []types.FileData, user types.User, allowanc if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Back
File NameFile SizeDownloadsStatusAction
File Information Total Files: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -202,7 +202,7 @@ func MainContent(title string, files []types.FileData, user types.User, allowanc if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 14) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" Total Usage: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -215,7 +215,7 @@ func MainContent(title string, files []types.FileData, user types.User, allowanc if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 15) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" Total Allowance: ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -228,7 +228,7 @@ func MainContent(title string, files []types.FileData, user types.User, allowanc if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 16) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -238,8 +238,8 @@ func MainContent(title string, files []types.FileData, user types.User, allowanc func toggleDropDown() templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_toggleDropDown_17a3`, - Function: `function __templ_toggleDropDown_17a3(){const dropdowns = document.querySelectorAll('.dropdown'); + Name: `__templ_toggleDropDown_cca0`, + Function: `function __templ_toggleDropDown_cca0(){const dropdowns = document.querySelectorAll('.dropdown'); dropdowns.forEach(dropdown => { const button = dropdown.querySelector('.dropdown-button'); @@ -257,8 +257,8 @@ func toggleDropDown() templ.ComponentScript { } }); }`, - Call: templ.SafeScript(`__templ_toggleDropDown_17a3`), - CallInline: templ.SafeScriptInline(`__templ_toggleDropDown_17a3`), + Call: templ.SafeScript(`__templ_toggleDropDown_cca0`), + CallInline: templ.SafeScriptInline(`__templ_toggleDropDown_cca0`), } } @@ -314,7 +314,7 @@ func JustFile(file types.FileData) templ.Component { templ_7745c5c3_Var14 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 17) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if !file.Done { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 19) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -340,7 +340,7 @@ func JustFile(file types.FileData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 20) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -366,12 +366,12 @@ func JustFile(file types.FileData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 22) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Corrupted
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 23) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -379,7 +379,7 @@ func JustFile(file types.FileData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 24) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -405,12 +405,12 @@ func JustFile(file types.FileData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 26) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 27) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -423,7 +423,7 @@ func JustFile(file types.FileData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 28) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -436,22 +436,22 @@ func JustFile(file types.FileData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 29) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if file.IsPrivate { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 30) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Private
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 31) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Public
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 32) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -459,7 +459,7 @@ func JustFile(file types.FileData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 33) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -631,32 +631,32 @@ func FileIcon(fileType string) templ.Component { } ctx = templ.ClearChildren(ctx) if fileType == "jpg" || fileType == "jpeg" || fileType == "png" || fileType == "gif" || fileType == "bmp" || fileType == "tiff" { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 50) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("image-pictureCreated with Sketch Beta. ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else if fileType == "pdf" || fileType == "doc" || fileType == "docx" || fileType == "txt" || fileType == "odt" || fileType == "xls" || fileType == "xlsx" || fileType == "ppt" || fileType == "pptx" { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 51) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else if fileType == "zip" || fileType == "rar" || fileType == "tar" || fileType == "gz" || fileType == "7z" || fileType == "bz2" { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 52) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else if fileType == "exe" || fileType == "bin" || fileType == "sh" || fileType == "bat" || fileType == "cmd" || fileType == "msi" { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 53) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else if fileType == "apk" { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 54) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 55) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -667,8 +667,8 @@ func FileIcon(fileType string) templ.Component { func showDeletionModal(name string, id string) templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_showDeletionModal_42e1`, - Function: `function __templ_showDeletionModal_42e1(name, id){const modal = document.getElementById('deleteModal'); + Name: `__templ_showDeletionModal_fb10`, + Function: `function __templ_showDeletionModal_fb10(name, id){const modal = document.getElementById('deleteModal'); const modalContent = modal.querySelector('div'); const confirmDelete = document.getElementById('confirmDelete'); const fileNameToDelete = document.getElementById('fileNameToDelete'); @@ -683,15 +683,15 @@ func showDeletionModal(name string, id string) templ.ComponentScript { }, 50); fileNameToDelete.textContent = name; }`, - Call: templ.SafeScript(`__templ_showDeletionModal_42e1`, name, id), - CallInline: templ.SafeScriptInline(`__templ_showDeletionModal_42e1`, name, id), + Call: templ.SafeScript(`__templ_showDeletionModal_fb10`, name, id), + CallInline: templ.SafeScriptInline(`__templ_showDeletionModal_fb10`, name, id), } } func hideDeletionModal() templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_hideDeletionModal_0159`, - Function: `function __templ_hideDeletionModal_0159(){const modal = document.getElementById('deleteModal'); + Name: `__templ_hideDeletionModal_c0ab`, + Function: `function __templ_hideDeletionModal_c0ab(){const modal = document.getElementById('deleteModal'); const modalContent = modal.querySelector('div'); modal.classList.add('opacity-0'); @@ -700,15 +700,15 @@ func hideDeletionModal() templ.ComponentScript { modal.classList.add('hidden'); }, 300); }`, - Call: templ.SafeScript(`__templ_hideDeletionModal_0159`), - CallInline: templ.SafeScriptInline(`__templ_hideDeletionModal_0159`), + Call: templ.SafeScript(`__templ_hideDeletionModal_c0ab`), + CallInline: templ.SafeScriptInline(`__templ_hideDeletionModal_c0ab`), } } func showRenameModal(name string, id string) templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_showRenameModal_e95d`, - Function: `function __templ_showRenameModal_e95d(name, id){const rename = document.getElementById('renameModal'); + Name: `__templ_showRenameModal_c834`, + Function: `function __templ_showRenameModal_c834(name, id){const rename = document.getElementById('renameModal'); const renameModalContent = rename.querySelector('div'); const fileName = document.getElementById("newFileName"); const confirmRenameFile = document.getElementById("confirmRenameFile"); @@ -728,15 +728,15 @@ func showRenameModal(name string, id string) templ.ComponentScript { }, 50); fileName.value = name }`, - Call: templ.SafeScript(`__templ_showRenameModal_e95d`, name, id), - CallInline: templ.SafeScriptInline(`__templ_showRenameModal_e95d`, name, id), + Call: templ.SafeScript(`__templ_showRenameModal_c834`, name, id), + CallInline: templ.SafeScriptInline(`__templ_showRenameModal_c834`, name, id), } } func hideRenameModal() templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_hideRenameModal_e2c4`, - Function: `function __templ_hideRenameModal_e2c4(){const rename = document.getElementById('renameModal'); + Name: `__templ_hideRenameModal_8c56`, + Function: `function __templ_hideRenameModal_8c56(){const rename = document.getElementById('renameModal'); const renameModalContent = rename.querySelector('div'); rename.classList.add('opacity-0'); @@ -745,15 +745,15 @@ func hideRenameModal() templ.ComponentScript { rename.classList.add('hidden'); }, 300); }`, - Call: templ.SafeScript(`__templ_hideRenameModal_e2c4`), - CallInline: templ.SafeScriptInline(`__templ_hideRenameModal_e2c4`), + Call: templ.SafeScript(`__templ_hideRenameModal_8c56`), + CallInline: templ.SafeScriptInline(`__templ_hideRenameModal_8c56`), } } func showShareModal(isPrivate bool, fileID string) templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_showShareModal_8d68`, - Function: `function __templ_showShareModal_8d68(isPrivate, fileID){const shareModal = document.getElementById('shareModal'); + Name: `__templ_showShareModal_98bc`, + Function: `function __templ_showShareModal_98bc(isPrivate, fileID){const shareModal = document.getElementById('shareModal'); const shareModalContent = shareModal.querySelector('div'); const publicToggle = document.getElementById('public-toggle'); const lockDiv = document.getElementById('lockDiv'); @@ -797,15 +797,15 @@ func showShareModal(isPrivate bool, fileID string) templ.ComponentScript { shareModalContent.classList.remove('-translate-y-full', 'scale-95', 'opacity-0'); }, 50); }`, - Call: templ.SafeScript(`__templ_showShareModal_8d68`, isPrivate, fileID), - CallInline: templ.SafeScriptInline(`__templ_showShareModal_8d68`, isPrivate, fileID), + Call: templ.SafeScript(`__templ_showShareModal_98bc`, isPrivate, fileID), + CallInline: templ.SafeScriptInline(`__templ_showShareModal_98bc`, isPrivate, fileID), } } func hideShareModal() templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_hideShareModal_8359`, - Function: `function __templ_hideShareModal_8359(){const shareModal = document.getElementById('shareModal'); + Name: `__templ_hideShareModal_6000`, + Function: `function __templ_hideShareModal_6000(){const shareModal = document.getElementById('shareModal'); const shareModalContent = shareModal.querySelector('div'); shareModal.classList.add('opacity-0'); @@ -814,8 +814,8 @@ func hideShareModal() templ.ComponentScript { shareModal.classList.add('hidden'); }, 300); }`, - Call: templ.SafeScript(`__templ_hideShareModal_8359`), - CallInline: templ.SafeScriptInline(`__templ_hideShareModal_8359`), + Call: templ.SafeScript(`__templ_hideShareModal_6000`), + CallInline: templ.SafeScriptInline(`__templ_hideShareModal_6000`), } } diff --git a/view/client/index/index.templ b/view/client/index/index.templ index 62b6417..09d8ee3 100644 --- a/view/client/index/index.templ +++ b/view/client/index/index.templ @@ -22,7 +22,7 @@ templ content(title string, user types.User) { } else { + href="/auth/signup" hx-get="/auth/signup" hx-swap="innerHTML" hx-push-url="true" hx-target="#content"> Sign up for free } @@ -82,7 +82,7 @@ templ content(title string, user types.User) { } else { + href="/auth/signup" hx-get="/auth/signup" hx-swap="innerHTML" hx-push-url="true" hx-target="#content"> Create your free account } diff --git a/view/client/index/index_templ.go b/view/client/index/index_templ.go index 51a7ce8..67c0c31 100644 --- a/view/client/index/index_templ.go +++ b/view/client/index/index_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.778 +// templ: version: v0.2.786 package indexView //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -46,7 +46,7 @@ func content(title string, user types.User) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -54,37 +54,37 @@ func content(title string, user types.User) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Your files, always within reach

Store, access, and manage your files with ease. Filekeeper offers generous storage and seamless access from any device, completely free.

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if user.Authenticated { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Open Dashboard") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Sign up for free") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Easy Access

Access your files with just a few clicks, anytime you need them.

Generous Storage

Store all your important files with our spacious free storage.

Access Anywhere

Use Filekeeper on any device - computer, tablet, or smartphone.

Secure Storage

Rest easy knowing your files are stored securely in the cloud.

Why choose Filekeeper?

  • Completely free to use
  • Intuitive and user-friendly interface
  • Generous storage space for all your files
  • Access your files from any device, anywhere
  • Robust file organization and search capabilities
  • Dedicated customer support team

Get Started with Filekeeper

Join Filekeeper today and experience hassle-free file management - no credit card required!

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if user.Authenticated { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Open Dashboard") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Create your free account") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -92,7 +92,7 @@ func content(title string, user types.User) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/view/client/layout/base.templ b/view/client/layout/base.templ index 8b2e22c..0e17ae8 100644 --- a/view/client/layout/base.templ +++ b/view/client/layout/base.templ @@ -180,10 +180,10 @@ templ Navbar(user types.User) {
} else { - + Sign up - + Sign in } diff --git a/view/client/layout/base_templ.go b/view/client/layout/base_templ.go index 7797039..8af3413 100644 --- a/view/client/layout/base_templ.go +++ b/view/client/layout/base_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.778 +// templ: version: v0.2.786 package layout //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -31,7 +31,7 @@ func Base(title string) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -44,7 +44,7 @@ func Base(title string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -52,7 +52,7 @@ func Base(title string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -60,7 +60,7 @@ func Base(title string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -72,7 +72,7 @@ func Base(title string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -101,7 +101,7 @@ func BaseAuth(title string) templ.Component { templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -114,7 +114,7 @@ func BaseAuth(title string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -122,7 +122,7 @@ func BaseAuth(title string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -130,7 +130,7 @@ func BaseAuth(title string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -146,7 +146,7 @@ func BaseAuth(title string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -175,7 +175,7 @@ func modal() templ.Component { templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 11) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -204,7 +204,7 @@ func uploadBox() templ.Component { templ_7745c5c3_Var6 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 12) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Mengupload 1 item
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -233,7 +233,7 @@ func MainScript() templ.Component { templ_7745c5c3_Var7 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 13) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -262,7 +262,7 @@ func modalScript() templ.Component { templ_7745c5c3_Var8 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 14) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -291,12 +291,12 @@ func Navbar(user types.User) templ.Component { templ_7745c5c3_Var9 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 15) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if user.Authenticated { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 16) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 19) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Sign up Sign in") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 20) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -361,7 +361,7 @@ func Footer() templ.Component { templ_7745c5c3_Var12 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 21) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/view/client/signin/signin.templ b/view/client/signin/signin.templ deleted file mode 100644 index daf12ed..0000000 --- a/view/client/signin/signin.templ +++ /dev/null @@ -1,66 +0,0 @@ -package signinView - -import ( - "github.com/fossyy/filekeeper/types" - "github.com/fossyy/filekeeper/view/client/layout" -) - -templ content(err types.Message, title string) { - @layout.Base(title){ -
-
-
-
-

Sign In

-

Enter your email or username below to login to your account

- switch err.Code { - case 0: - - } -
-
-
-
- - -
-
- - -
- -
-
-

- OR -

-
- - Google-color Created with Sketch. - Continue with Google - -
- Don't have an account? - - Sign up - -
-
-
- } -} - -templ Main(title string, err types.Message) { - @content(err, title) -} \ No newline at end of file diff --git a/view/client/signin/signin_templ.go b/view/client/signin/signin_templ.go deleted file mode 100644 index 8d62c81..0000000 --- a/view/client/signin/signin_templ.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package signinView - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "github.com/fossyy/filekeeper/types" - "github.com/fossyy/filekeeper/view/client/layout" -) - -func content(err types.Message, title string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - switch err.Code { - case 0: - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(err.Message) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/signin/signin.templ`, Line: 19, Col: 38} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = layout.Base(title).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -func Main(title string, err types.Message) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = content(err, title).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/view/client/signup/signup.templ b/view/client/signup/signup.templ deleted file mode 100644 index f2f001e..0000000 --- a/view/client/signup/signup.templ +++ /dev/null @@ -1,159 +0,0 @@ -package signup - -import ( - "github.com/fossyy/filekeeper/types" - "github.com/fossyy/filekeeper/view/client/layout" -) - -templ form(err types.Message, title string) { - @layout.Base(title){ -
-
-
-
-

Sign Up

-

Enter your information to create an account

- switch err.Code { - case 0: - - case 1: - - } -
-
-
-
- - -
-
-
- -
- -
-
- - -
-
- - -
-
-
    -
  • -
    - - - - -
    - Passwords do not match -
  • -
  • -
    - - - - -
    - Password must contain at least one uppercase letter -
  • -
  • -
    - - - - -
    - Password length must be at least 8 characters -
  • -
-
- -
-
- Already have an account? - - Sign in - -
-
-
- ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -287,7 +287,7 @@ func MainContent(title string, user types.User, allowance *types.Allowance, List if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 20) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }