diff --git a/db/database.go b/db/database.go index 4eeabe2..9b6774a 100644 --- a/db/database.go +++ b/db/database.go @@ -275,6 +275,15 @@ func (db *mySQLdb) IncrementDownloadCount(fileID string) error { return nil } +func (db *mySQLdb) ChangeFileVisibility(fileID string) error { + err := db.DB.Model(&models.File{}).Where("id = ?", fileID).Select("is_private"). + Updates(map[string]interface{}{"is_private": gorm.Expr("NOT is_private")}).Error + + if err != nil { + return err + } + return nil +} func (db *mySQLdb) InitializeTotp(email string, secret string) error { var user models.User err := db.DB.Table("users").Where("email = ?", email).First(&user).Error @@ -426,6 +435,16 @@ func (db *postgresDB) IncrementDownloadCount(fileID string) error { return nil } +func (db *postgresDB) ChangeFileVisibility(fileID string) error { + err := db.DB.Model(&models.File{}).Where("id = $1", fileID).Select("is_private"). + Updates(map[string]interface{}{"is_private": gorm.Expr("NOT is_private")}).Error + + if err != nil { + return err + } + return nil +} + func (db *postgresDB) InitializeTotp(email string, secret string) error { var user models.User err := db.DB.Table("users").Where("email = $1", email).First(&user).Error diff --git a/handler/file/download/download.go b/handler/file/download/download.go index 5d7a9cb..33ef009 100644 --- a/handler/file/download/download.go +++ b/handler/file/download/download.go @@ -3,6 +3,7 @@ package downloadHandler import ( "fmt" "github.com/fossyy/filekeeper/app" + "github.com/fossyy/filekeeper/session" "github.com/fossyy/filekeeper/types/models" "io" "net/http" @@ -21,6 +22,17 @@ func GET(w http.ResponseWriter, r *http.Request) { return } + status, userSession, _ := session.GetSession(r) + if file.IsPrivate { + if status == session.Unauthorized || status == session.InvalidSession { + w.WriteHeader(http.StatusForbidden) + return + } else if file.OwnerID != userSession.UserID { + w.WriteHeader(http.StatusUnauthorized) + return + } + } + uploadDir := "uploads" currentDir, _ := os.Getwd() basePath := filepath.Join(currentDir, uploadDir) diff --git a/handler/file/file.go b/handler/file/file.go index b71315b..785d696 100644 --- a/handler/file/file.go +++ b/handler/file/file.go @@ -25,13 +25,14 @@ func GET(w http.ResponseWriter, r *http.Request) { ID: files[i].ID.String(), Name: files[i].Name, Size: utils.ConvertFileSize(files[i].Size), + IsPrivate: files[i].IsPrivate, Downloaded: strconv.FormatUint(files[i].Downloaded, 10), }) } var component templ.Component if r.Header.Get("hx-request") == "true" { - component = fileView.MainContent(filesData) + component = fileView.MainContent(filesData, userSession) } else { component = fileView.Main("File Dashboard", filesData, userSession) } diff --git a/handler/file/visibility/visibility.go b/handler/file/visibility/visibility.go new file mode 100644 index 0000000..316aba1 --- /dev/null +++ b/handler/file/visibility/visibility.go @@ -0,0 +1,46 @@ +package visibilityHandler + +import ( + "github.com/fossyy/filekeeper/app" + "github.com/fossyy/filekeeper/types" + "github.com/fossyy/filekeeper/utils" + fileView "github.com/fossyy/filekeeper/view/client/file" + "net/http" + "strconv" +) + +func PUT(w http.ResponseWriter, r *http.Request) { + fileID := r.PathValue("id") + userSession := r.Context().Value("user").(types.User) + file, err := app.Server.Database.GetFile(fileID) + if err != nil { + http.Error(w, "Internal Server Error", http.StatusInternalServerError) + app.Server.Logger.Error(err.Error()) + return + } + + if file.OwnerID != userSession.UserID { + w.WriteHeader(http.StatusForbidden) + return + } + + err = app.Server.Database.ChangeFileVisibility(fileID) + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + app.Server.Logger.Error(err.Error()) + return + } + fileData := types.FileData{ + ID: file.ID.String(), + Name: file.Name, + Size: utils.ConvertFileSize(file.Size), + IsPrivate: !file.IsPrivate, + Downloaded: strconv.FormatUint(file.Downloaded, 10), + } + component := fileView.JustFile(fileData) + err = component.Render(r.Context(), w) + if err != nil { + w.WriteHeader(http.StatusInternalServerError) + return + } +} diff --git a/routes/client/routes.go b/routes/client/routes.go index 72b92f7..fec6b44 100644 --- a/routes/client/routes.go +++ b/routes/client/routes.go @@ -8,6 +8,7 @@ import ( fileHandler "github.com/fossyy/filekeeper/handler/file" downloadHandler "github.com/fossyy/filekeeper/handler/file/download" 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" @@ -121,6 +122,10 @@ func SetupRoutes() *http.ServeMux { downloadHandler.GET(w, r) }) + handler.HandleFunc("PUT /file/{id}", func(w http.ResponseWriter, r *http.Request) { + middleware.Auth(visibilityHandler.PUT, w, r) + }) + handler.HandleFunc("GET /logout", func(w http.ResponseWriter, r *http.Request) { middleware.Auth(logoutHandler.GET, w, r) }) diff --git a/types/models/models.go b/types/models/models.go index 68978bc..2224ada 100644 --- a/types/models/models.go +++ b/types/models/models.go @@ -18,6 +18,7 @@ type File struct { TotalChunk uint64 `gorm:"not null"` StartHash string `gorm:"type:text;not null"` EndHash string `gorm:"type:text;not null"` + IsPrivate bool `gorm:"not null;default:true"` Downloaded uint64 `gorm:"not null;default:0"` Owner *User `gorm:"foreignKey:OwnerID;constraint:OnDelete:CASCADE;"` } diff --git a/types/types.go b/types/types.go index 636e7c5..a53cac4 100644 --- a/types/types.go +++ b/types/types.go @@ -30,6 +30,7 @@ type FileData struct { ID string Name string Size string + IsPrivate bool Downloaded string } @@ -60,6 +61,7 @@ type Database interface { GetUserFile(name string, ownerID string) (*models.File, error) GetFiles(ownerID string) ([]*models.File, error) IncrementDownloadCount(fileID string) error + ChangeFileVisibility(fileID string) error InitializeTotp(email string, secret string) error } diff --git a/view/admin/index/index_templ.go b/view/admin/index/index_templ.go index db05664..a4a91b9 100644 --- a/view/admin/index/index_templ.go +++ b/view/admin/index/index_templ.go @@ -31,7 +31,7 @@ func Main() templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - 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.

Name\rEmail\rRole\rActions\r
John Doe
john@example.com
Admin\r
Jane Smith
jane@example.com
Editor\r
Bob Johnson
bob@example.com
User\r

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 a2010ab..8f70e90 100644 --- a/view/admin/layout/base_templ.go +++ b/view/admin/layout/base_templ.go @@ -23,7 +23,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 } @@ -31,7 +31,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.go b/view/client/auth/auth_templ.go index d22ac2c..ee59e7e 100644 --- a/view/client/auth/auth_templ.go +++ b/view/client/auth/auth_templ.go @@ -34,13 +34,13 @@ func form(err types.Message, title string) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Set Up Your Account

Enter your information to create a new account

") 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("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -53,12 +53,12 @@ func form(err types.Message, 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 } case 1: - 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 } @@ -71,12 +71,12 @@ func form(err types.Message, 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 } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) + _, 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
Already have an account? Sign in
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/view/client/email/email_templ.go b/view/client/email/email_templ.go index e263bc9..e2fd38c 100644 --- a/view/client/email/email_templ.go +++ b/view/client/email/email_templ.go @@ -23,7 +23,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 } @@ -36,7 +36,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 } @@ -67,7 +67,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 } @@ -91,7 +91,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 } @@ -104,7 +104,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 } @@ -135,7 +135,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 ce8a709..8b53f96 100644 --- a/view/client/error/error_templ.go +++ b/view/client/error/error_templ.go @@ -31,7 +31,7 @@ func NotFound(title string) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - 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 } @@ -70,7 +70,7 @@ func InternalServerError(title string) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - 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 b/view/client/file/file.templ index 8bbe814..40d54de 100644 --- a/view/client/file/file.templ +++ b/view/client/file/file.templ @@ -7,12 +7,12 @@ import ( templ component(title string, files []types.FileData, user types.User) { @layout.BaseAuth(title) { - @layout.Navbar(user) - @MainContent(files) + @MainContent(files, user) } } -templ MainContent(files []types.FileData) { +templ MainContent(files []types.FileData, user types.User) { + @layout.Navbar(user)
-
+
- - + + + for _, file := range files { - + + + } @@ -131,6 +232,155 @@ templ MainContent(files []types.FileData) { await handleFile(file) }); + +} + +templ JustFile(file types.FileData) { + + + + + + + + } templ Main(title string, files []types.FileData, user types.User) { diff --git a/view/client/file/file_templ.go b/view/client/file/file_templ.go index e1a985a..c464851 100644 --- a/view/client/file/file_templ.go +++ b/view/client/file/file_templ.go @@ -34,15 +34,7 @@ func component(title string, files []types.FileData, user types.User) templ.Comp templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - templ_7745c5c3_Err = layout.Navbar(user).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = MainContent(files).Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = MainContent(files, user).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -62,7 +54,7 @@ func component(title string, files []types.FileData, user types.User) templ.Comp }) } -func MainContent(files []types.FileData) templ.Component { +func MainContent(files []types.FileData, user types.User) templ.Component { return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) if !templ_7745c5c3_IsBuffer { @@ -75,34 +67,51 @@ func MainContent(files []types.FileData) templ.Component { templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + templ_7745c5c3_Err = layout.Navbar(user).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, file := range files { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs("file-" + file.ID) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 75, Col: 44} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 69, Col: 52} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) 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 + } + var templ_7745c5c3_Var5 string + templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 76, Col: 44} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + 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 } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(file.Size) + var templ_7745c5c3_Var6 string + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(file.Size) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 77, Col: 65} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 78, Col: 65} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -110,12 +119,12 @@ func MainContent(files []types.FileData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(file.Downloaded) + var templ_7745c5c3_Var7 string + templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(file.Downloaded) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 85, Col: 60} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 86, Col: 60} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -123,17 +132,266 @@ func MainContent(files []types.FileData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var7 templ.SafeURL = templ.SafeURL("/file/" + file.ID) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var7))) + if file.IsPrivate { + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + var templ_7745c5c3_Var8 templ.SafeURL = templ.SafeURL("/file/" + file.ID) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var8))) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if file.IsPrivate { + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 11) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var9 string + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 142, Col: 207} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 12) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var10 string + templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 142, Col: 236} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 13) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 14) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var11 string + templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 159, Col: 207} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 15) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var12 string + templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 159, Col: 236} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 16) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 17) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 18) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func JustFile(file types.FileData) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var13 := templ.GetChildren(ctx) + if templ_7745c5c3_Var13 == nil { + templ_7745c5c3_Var13 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 19) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var14 string + templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs("file-" + file.ID) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 261, Col: 27} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 20) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var15 string + templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 268, Col: 16} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 21) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var16 string + templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(file.Size) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 270, Col: 37} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 22) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var17 string + templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(file.Downloaded) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 278, Col: 32} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 23) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if file.IsPrivate { + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 24) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 25) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 26) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var18 templ.SafeURL = templ.SafeURL("/file/" + file.ID) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var18))) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 27) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if file.IsPrivate { + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 28) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var19 string + templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 334, Col: 179} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 29) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var20 string + templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 334, Col: 208} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 30) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 31) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var21 string + templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 351, Col: 179} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 32) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var22 string + templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `view\client\file\file.templ`, Line: 351, Col: 208} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 33) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 34) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -152,9 +410,9 @@ func Main(title string, files []types.FileData, user types.User) templ.Component defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var8 := templ.GetChildren(ctx) - if templ_7745c5c3_Var8 == nil { - templ_7745c5c3_Var8 = templ.NopComponent + templ_7745c5c3_Var23 := templ.GetChildren(ctx) + if templ_7745c5c3_Var23 == nil { + templ_7745c5c3_Var23 = templ.NopComponent } ctx = templ.ClearChildren(ctx) templ_7745c5c3_Err = component(title, files, user).Render(ctx, templ_7745c5c3_Buffer) diff --git a/view/client/forgotPassword/forgotPassword_templ.go b/view/client/forgotPassword/forgotPassword_templ.go index 4fb593c..1777c92 100644 --- a/view/client/forgotPassword/forgotPassword_templ.go +++ b/view/client/forgotPassword/forgotPassword_templ.go @@ -34,13 +34,13 @@ func content(title string, err types.Message) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, 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, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -53,12 +53,12 @@ func content(title string, err types.Message) 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 } } - 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 } @@ -121,13 +121,13 @@ func NewPasswordForm(title string, err types.Message) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - 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 } @@ -140,12 +140,12 @@ func NewPasswordForm(title string, err types.Message) 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 } } - 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 } @@ -184,7 +184,7 @@ func EmailSend(title string) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - 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 } @@ -223,7 +223,7 @@ func ChangeSuccess(title string) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - 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/index/index_templ.go b/view/client/index/index_templ.go index 6b0ba1f..198b6e8 100644 --- a/view/client/index/index_templ.go +++ b/view/client/index/index_templ.go @@ -34,7 +34,7 @@ func content(title string, user types.User) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - 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 } @@ -42,22 +42,22 @@ 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 share your files from anywhere. We offer secure and reliable file storage, so you can focus on what matters most.

") 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("Get started") 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("

Unlimited Storage

Store as many files as you need with our generous storage limits.

Secure Encryption

Your files are encrypted with the latest security protocols to keep them safe.

Easy Sharing

Quickly share files with friends, family, or colleagues with shareable links.

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/view/client/layout/base_templ.go b/view/client/layout/base_templ.go index 4d155e4..770ba32 100644 --- a/view/client/layout/base_templ.go +++ b/view/client/layout/base_templ.go @@ -25,7 +25,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 } @@ -38,7 +38,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 } @@ -46,7 +46,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 } @@ -54,7 +54,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 } @@ -62,7 +62,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 } @@ -86,7 +86,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 } @@ -99,7 +99,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 } @@ -107,7 +107,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 } @@ -115,7 +115,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("
Mengupload 1 item
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -127,7 +127,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 } @@ -151,7 +151,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 } @@ -175,7 +175,7 @@ func MainScript() 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("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -199,7 +199,7 @@ func modalScript() 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 } @@ -223,12 +223,12 @@ func Navbar(user types.User) 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 } if user.Authenticated { - 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 } } else { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 18) + _, 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, 19) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -288,7 +288,7 @@ func Footer() templ.Component { templ_7745c5c3_Var11 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - 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 } diff --git a/view/client/signin/signin_templ.go b/view/client/signin/signin_templ.go index 6160172..a7f83df 100644 --- a/view/client/signin/signin_templ.go +++ b/view/client/signin/signin_templ.go @@ -34,13 +34,13 @@ func content(err types.Message, title string) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Sign In

Enter your email or username below to login to your account

") 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("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -53,12 +53,12 @@ func content(err types.Message, 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 } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

OR

Google-colorCreated with Sketch. Continue with Google
Don't have an account? Sign up
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/view/client/signup/signup_templ.go b/view/client/signup/signup_templ.go index f802ed2..a589278 100644 --- a/view/client/signup/signup_templ.go +++ b/view/client/signup/signup_templ.go @@ -34,13 +34,13 @@ func form(err types.Message, title string) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Sign Up

Enter your information to create an account

") 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("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -53,12 +53,12 @@ func form(err types.Message, 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 } case 1: - 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 } @@ -71,12 +71,12 @@ func form(err types.Message, 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 } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) + _, 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
Already have an account? Sign in
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -139,7 +139,7 @@ func EmailSend(title string) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + _, 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 } @@ -178,7 +178,7 @@ func VerifySuccess(title string) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) + _, 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 } diff --git a/view/client/totp/totp_templ.go b/view/client/totp/totp_templ.go index 195f156..2da0320 100644 --- a/view/client/totp/totp_templ.go +++ b/view/client/totp/totp_templ.go @@ -34,13 +34,13 @@ func content(title string, msg types.Message) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - 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 } switch msg.Code { case 0: - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Info
Error! ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -53,12 +53,12 @@ func content(title string, msg types.Message) 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 } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Verify Your Identity

Please enter the 6-digit code generated by your authentication app to complete the login process.

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/view/client/user/totp/setup_templ.go b/view/client/user/totp/setup_templ.go index 0599b77..8a9a4ca 100644 --- a/view/client/user/totp/setup_templ.go +++ b/view/client/user/totp/setup_templ.go @@ -71,13 +71,13 @@ func MainContent(qrcode string, code string, user types.User, msg types.Message) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Back

Set up Two-Factor Authentication

Secure your account with time-based one-time passwords (TOTP).

Here's how to set up the Google Authenticator app:

  1. Download the Google Authenticator app on your mobile device.
  2. Open the app and tap \"Begin Setup\".
  3. Select \"Scan a barcode\" and point your camera at the QR code below.
  4. The app will automatically add your account and display a 6-digit code.
  5. Enter this code on the website to complete the setup.
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } switch msg.Code { case 0: - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Info
Error! ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -90,12 +90,12 @@ func MainContent(qrcode string, code string, user types.User, msg types.Message) 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 } case 1: - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Info
Success! ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -108,12 +108,12 @@ func MainContent(qrcode string, code string, user types.User, msg types.Message) 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 } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"QR

Backup Code:

----|----

TOTP Secret:

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -139,7 +139,7 @@ func MainContent(qrcode string, code string, user types.User, msg types.Message) 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 } diff --git a/view/client/user/user_templ.go b/view/client/user/user_templ.go index 41385bf..516c54c 100644 --- a/view/client/user/user_templ.go +++ b/view/client/user/user_templ.go @@ -72,7 +72,7 @@ func MainContent(user types.User, allowance *types.Allowance, ListSession []*ses if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Profile

JL

Session Management

Setup\r
File NameFile SizeDownloadsFile SizeDownloadsStatus Action
@@ -86,9 +87,109 @@ templ MainContent(files []types.FileData) { - - Download - +
+ if file.IsPrivate { +
+ + + + Private +
+ } else { +
+ + + + Public +
+ } +
+
+
+ + + + + + {file.Name} + {file.Size} +
+ + + + + + {file.Downloaded} +
+
+
+ if file.IsPrivate { +
+ + + + Private +
+ } else { +
+ + + + Public +
+ } +
+
+ +
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, ses := range ListSession { - 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 } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
IP Address\rBrowser\rDevice\rActions\r
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -116,7 +116,7 @@ func MainContent(user types.User, allowance *types.Allowance, ListSession []*ses 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 } @@ -129,7 +129,7 @@ func MainContent(user types.User, allowance *types.Allowance, ListSession []*ses if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - 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 } @@ -142,7 +142,7 @@ func MainContent(user types.User, allowance *types.Allowance, ListSession []*ses 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("

Reset Password

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } switch message.Code { case 0: - 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 } @@ -179,12 +179,12 @@ func MainContent(user types.User, allowance *types.Allowance, ListSession []*ses if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - 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 } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 12) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • New Passwords do not match
  • New Password must contain at least one uppercase letter
  • New Password length must be at least 8 characters

Click to log out or terminate the current session.\r

Storage Usage

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -197,7 +197,7 @@ func MainContent(user types.User, allowance *types.Allowance, ListSession []*ses if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - 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 } @@ -210,7 +210,7 @@ func MainContent(user types.User, allowance *types.Allowance, ListSession []*ses 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("
Manage\r

Upgrade Storage\r

Pro Plan

50GB of storage for $9.99/month

Upgrade\r

Enterprise Plan

1TB of storage for $49.99/month

Upgrade\r
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -222,7 +222,7 @@ func MainContent(user types.User, allowance *types.Allowance, ListSession []*ses 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("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -230,7 +230,7 @@ func MainContent(user types.User, allowance *types.Allowance, ListSession []*ses 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 } @@ -254,12 +254,12 @@ func SessionTable(ListSession []*session.SessionInfo) templ.Component { templ_7745c5c3_Var13 = 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 } for _, ses := range ListSession { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 18) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -272,7 +272,7 @@ func SessionTable(ListSession []*session.SessionInfo) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - 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 } @@ -285,7 +285,7 @@ func SessionTable(ListSession []*session.SessionInfo) 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 } @@ -298,7 +298,7 @@ func SessionTable(ListSession []*session.SessionInfo) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - 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 } } - 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 }