fileView looking nicer and having a "download" button

This commit is contained in:
Johannes Bülow 2025-07-24 20:10:32 +02:00
parent d1423e4af9
commit 61935cbaad
Signed by: jmb
GPG key ID: B56971CF7B8F83A6
5 changed files with 805 additions and 321 deletions

View file

@ -13,17 +13,20 @@ func FileViewWebHandler(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
slog.Error("Error getting File in FileViewWebHandler", "error", err, "file-uuid", r.PathValue("uuid")) slog.Error("Error getting File in FileViewWebHandler", "error", err, "file-uuid", r.PathValue("uuid"))
http.Error(w, err.Error(), http.StatusBadRequest) http.Error(w, err.Error(), http.StatusBadRequest)
return
} }
fileProperties, err := database.GetFileProperties(file.ID) fileProperties, err := database.GetFileProperties(file.ID)
if err != nil { if err != nil {
slog.Error("Error getting FileProperties in FileViewWebHandler", "error", err, "file-uuid", r.PathValue("uuid")) slog.Error("Error getting FileProperties in FileViewWebHandler", "error", err, "file-uuid", r.PathValue("uuid"))
http.Error(w, err.Error(), http.StatusBadRequest) http.Error(w, err.Error(), http.StatusBadRequest)
return
} }
component := FileView(file, fileProperties) component := FileView(file, fileProperties)
err = component.Render(r.Context(), w) err = component.Render(r.Context(), w)
if err != nil { if err != nil {
slog.Error("Error rendering in FileViewWebHandler", "error", err) slog.Error("Error rendering in FileViewWebHandler", "error", err)
http.Error(w, err.Error(), http.StatusBadRequest) http.Error(w, err.Error(), http.StatusBadRequest)
return
} }
} }
@ -32,20 +35,42 @@ func FileViewMSOWebHandler(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
slog.Error("Error getting Data in FileViewMSOWebHandler", "error", err, "file-uuid", r.PathValue("uuid")) slog.Error("Error getting Data in FileViewMSOWebHandler", "error", err, "file-uuid", r.PathValue("uuid"))
http.Error(w, err.Error(), http.StatusBadRequest) http.Error(w, err.Error(), http.StatusBadRequest)
return
} }
component := FileViewMsoffice(data) component := FileViewMsoffice(data)
err = component.Render(r.Context(), w) err = component.Render(r.Context(), w)
if err != nil { if err != nil {
slog.Error("Error rendering in FileViewMSOWebHandler", "error", err) slog.Error("Error rendering in FileViewMSOWebHandler", "error", err)
http.Error(w, err.Error(), http.StatusBadRequest) http.Error(w, err.Error(), http.StatusBadRequest)
return
} }
} }
func FileViewDeleteHandler(w http.ResponseWriter, r *http.Request) { func FileViewDeleteWebHandler(w http.ResponseWriter, r *http.Request) {
fileID := r.PathValue("uuid") fileID := r.PathValue("uuid")
err := store.DeleteFile(fileID) err := store.DeleteFile(fileID)
if err != nil { if err != nil {
slog.Error("Error deleting File in FileViewDeleteHandler", "error", err, "file-uuid", fileID) slog.Error("Error deleting File in FileViewDeleteHandler", "error", err, "file-uuid", fileID)
} }
w.Header().Set("HX-Redirect", "/")
} }
func FileViewDownloadWebHandler(w http.ResponseWriter, r *http.Request) {
file, err := database.GetFileByID(r.PathValue("uuid"))
if err != nil {
slog.Error("Error getting file info in FileViewDownloadWebHandler", "error", err, "file-uuid", r.PathValue("uuid"))
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
filePath, err := store.AbsPath(file.ID.String())
if err != nil {
slog.Error("Error getting absolute path in FileViewDownloadWebHandler", "error", err, "file-uuid", r.PathValue("uuid"))
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
w.Header().Set("Content-Disposition", "attachment; filename="+file.Name)
w.Header().Set("Content-Type", file.Mimetype)
http.ServeFile(w, r, filePath)
}

View file

@ -5,21 +5,29 @@ import "git.jmbit.de/jmb/scanfile/server/web/templui/components/table"
import "encoding/hex" import "encoding/hex"
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/button" import "git.jmbit.de/jmb/scanfile/server/web/templui/components/button"
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/modal" import "git.jmbit.de/jmb/scanfile/server/web/templui/components/modal"
import "git.jmbit.de/jmb/scanfile/server/internal/processing"
import "fmt"
templ FileView(file sqlc.File, fileProperties sqlc.FileProperty) { templ FileView(file sqlc.File, fileProperties sqlc.FileProperty) {
@Base(file.Name) { @Base(file.Name) {
<div class="w-full"> <div class="w-full">
<h1 class="text-4xl">File Name: {file.Name}</h1> <h1 class="text-4xl">File Name: {file.Name}</h1>
@FileViewDeleteModal(file.ID.String()) @FileViewDeleteModal(file.ID.String())
@FileViewDownloadModal(file.ID.String())
<br/> <br/>
</div> </div>
<div class="grid grid-cols-2 gap-4">
@FileViewGenericTable(file, fileProperties) @FileViewGenericTable(file, fileProperties)
if processing.TypeFromMime(file.Mimetype) == processing.TypeMSOffice {
@FileViewMsofficeLoader(file.ID.String())
}
</div>
} }
} }
templ FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) { templ FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) {
<div class=" max-w-min w-full"> <div class="w-full">
<h2 class="text-3xl">Generic Information</h2> <h2 class="text-3xl">Generic Information</h2>
@table.Table() { @table.Table() {
@table.Row() { @table.Row() {
@ -103,12 +111,12 @@ templ FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) {
} }
} }
</div> </div>
} }
templ FileViewDeleteModal(fileid string) { templ FileViewDeleteModal(fileid string) {
@modal.Trigger(modal.TriggerProps{ @modal.Trigger(modal.TriggerProps{
ModalID: "default-modal", ModalID: "delete-modal",
Class: "p-1",
}) { }) {
@button.Button(button.Props{ @button.Button(button.Props{
Variant: button.VariantDestructive, Variant: button.VariantDestructive,
@ -140,6 +148,7 @@ templ FileViewDeleteModal(fileid string) {
}) { }) {
@button.Button(button.Props{ @button.Button(button.Props{
Variant: button.VariantDestructive, Variant: button.VariantDestructive,
Href: fmt.Sprintf("/files/%s/delete", fileid),
}) { }) {
Delete Delete
} }
@ -147,5 +156,52 @@ templ FileViewDeleteModal(fileid string) {
</div> </div>
} }
} }
@modal.Script() @modal.Script()
}
templ FileViewDownloadModal(fileid string) {
@modal.Trigger(modal.TriggerProps{
ModalID: "download-modal",
Class: "p-1",
}) {
@button.Button(button.Props{
Variant: button.VariantDefault,
}) {
Download
}
}
@modal.Modal(modal.Props{
ID: "download-modal",
Class: "max-w-md",
}) {
@modal.Header() {
Download this file?
}
@modal.Body() {
files downloaded from scanfile can be harmful to your system. Are you sure you want to continue?
}
@modal.Footer() {
<div class="flex gap-2">
@modal.Close(modal.CloseProps{
ModalID: "download-modal",
}) {
@button.Button() {
Cancel
}
}
@modal.Close(modal.CloseProps{
ModalID: "download-modal",
}) {
@button.Button(button.Props{
Variant: button.VariantDestructive,
Href: fmt.Sprintf("/files/%s/download", fileid),
}) {
Download
}
}
</div>
}
}
@modal.Script()
} }

View file

@ -1,15 +1,26 @@
package web package web
import "git.jmbit.de/jmb/scanfile/server/internal/sqlc" import (
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/badge" "git.jmbit.de/jmb/scanfile/server/internal/sqlc"
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/icon" "git.jmbit.de/jmb/scanfile/server/web/templui/components/badge"
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/table" "git.jmbit.de/jmb/scanfile/server/web/templui/components/icon"
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/accordion" "git.jmbit.de/jmb/scanfile/server/web/templui/components/table"
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/code" "git.jmbit.de/jmb/scanfile/server/web/templui/components/accordion"
"git.jmbit.de/jmb/scanfile/server/web/templui/components/code"
"git.jmbit.de/jmb/scanfile/server/web/templui/components/skeleton"
"fmt"
)
// Loads MSOffice data if required
templ FileViewMsofficeLoader(fileid string) {
<div class="w-full" hx-get={fmt.Sprintf("/files/%s/msoffice", fileid)} hx-trigger="load">
@skeleton.Skeleton(skeleton.Props{Class: "h-12 w-12 rounded-full"})
<p> loading <a href={templ.URL(fmt.Sprintf("/files/%s/msoffice", fileid))}>Microsoft Office Info</a></p>
</div>
}
templ FileViewMsoffice(data sqlc.Msoffice) { templ FileViewMsoffice(data sqlc.Msoffice) {
<div class=" max-w-min w-full"> <div class="w-full">
<h2 class="text-3xl">Microsoft Office</h2> <h2 class="text-3xl">Microsoft Office</h2>
if data.Verdict.String == "suspicious" { if data.Verdict.String == "suspicious" {
@badge.Badge(badge.Props{ @badge.Badge(badge.Props{
@ -34,6 +45,7 @@ templ FileViewMsoffice(data sqlc.Msoffice) {
Encrypted Encrypted
} }
@table.Cell() { @table.Cell() {
{fmt.Sprintf("%v",data.Encrypted.Bool)}
} }
} }
@table.Row() { @table.Row() {
@ -41,6 +53,7 @@ templ FileViewMsoffice(data sqlc.Msoffice) {
File Format File Format
} }
@table.Cell() { @table.Cell() {
{data.FileFormat.String}
} }
} }
@table.Row() { @table.Row() {
@ -48,6 +61,7 @@ templ FileViewMsoffice(data sqlc.Msoffice) {
VBA Macros Result VBA Macros Result
} }
@table.Cell() { @table.Cell() {
{data.VbaMacros.String}
} }
} }
@ -56,6 +70,7 @@ templ FileViewMsoffice(data sqlc.Msoffice) {
XLM Macros Result XLM Macros Result
} }
@table.Cell() { @table.Cell() {
{data.XlmMacros.String}
} }
} }
@table.Row() { @table.Row() {
@ -63,6 +78,7 @@ templ FileViewMsoffice(data sqlc.Msoffice) {
VBA Stomping VBA Stomping
} }
@table.Cell() { @table.Cell() {
{fmt.Sprintf("%v",data.VbaStomping.Bool)}
} }
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -13,6 +13,8 @@ import "git.jmbit.de/jmb/scanfile/server/web/templui/components/table"
import "encoding/hex" import "encoding/hex"
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/button" import "git.jmbit.de/jmb/scanfile/server/web/templui/components/button"
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/modal" import "git.jmbit.de/jmb/scanfile/server/web/templui/components/modal"
import "git.jmbit.de/jmb/scanfile/server/internal/processing"
import "fmt"
func FileView(file sqlc.File, fileProperties sqlc.FileProperty) templ.Component { func FileView(file sqlc.File, fileProperties sqlc.FileProperty) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
@ -54,7 +56,7 @@ func FileView(file sqlc.File, fileProperties sqlc.FileProperty) templ.Component
var templ_7745c5c3_Var3 string var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 12, Col: 48} return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 14, Col: 48}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -68,7 +70,11 @@ func FileView(file sqlc.File, fileProperties sqlc.FileProperty) templ.Component
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<br></div>") templ_7745c5c3_Err = FileViewDownloadModal(file.ID.String()).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<br></div><div class=\"grid grid-cols-2 gap-4\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -76,6 +82,16 @@ func FileView(file sqlc.File, fileProperties sqlc.FileProperty) templ.Component
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
if processing.TypeFromMime(file.Mimetype) == processing.TypeMSOffice {
templ_7745c5c3_Err = FileViewMsofficeLoader(file.ID.String()).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil return nil
}) })
templ_7745c5c3_Err = Base(file.Name).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) templ_7745c5c3_Err = Base(file.Name).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
@ -107,7 +123,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
templ_7745c5c3_Var4 = templ.NopComponent templ_7745c5c3_Var4 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<div class=\" max-w-min w-full\"><h2 class=\"text-3xl\">Generic Information</h2>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<div class=\"w-full\"><h2 class=\"text-3xl\">Generic Information</h2>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -147,7 +163,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "Size") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "Size")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -157,7 +173,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -176,13 +192,13 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
var templ_7745c5c3_Var9 string var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(file.Size) templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(file.Size)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 30, Col: 22} return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 38, Col: 22}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, " Bytes") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, " Bytes")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -198,7 +214,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -226,7 +242,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "Filetype") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "Filetype")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -236,7 +252,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -255,7 +271,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
var templ_7745c5c3_Var13 string var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(file.Mimetype) templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(file.Mimetype)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 38, Col: 26} return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 46, Col: 26}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -273,7 +289,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -301,7 +317,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "Blake2b Hash") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "Blake2b Hash")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -311,7 +327,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -330,7 +346,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
var templ_7745c5c3_Var17 string var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(file.Blake2)) templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(file.Blake2))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 47, Col: 44} return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 55, Col: 44}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -348,7 +364,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -376,7 +392,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "SHA256 Hash") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "SHA256 Hash")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -386,7 +402,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -405,7 +421,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
var templ_7745c5c3_Var21 string var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(fileProperties.Sha256)) templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(fileProperties.Sha256))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 55, Col: 54} return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 63, Col: 54}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -423,7 +439,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -451,7 +467,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "MD5 Hash") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "MD5 Hash")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -461,7 +477,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -480,7 +496,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
var templ_7745c5c3_Var25 string var templ_7745c5c3_Var25 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(fileProperties.Md5)) templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(hex.EncodeToString(fileProperties.Md5))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 63, Col: 51} return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 71, Col: 51}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -498,7 +514,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -527,7 +543,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "Mimetype") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "Mimetype")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -537,7 +553,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -556,7 +572,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
var templ_7745c5c3_Var29 string var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicMime.String) templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicMime.String)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 72, Col: 49} return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 80, Col: 49}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -575,7 +591,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -604,7 +620,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "File Extensions") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "File Extensions")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -614,7 +630,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -633,7 +649,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
var templ_7745c5c3_Var33 string var templ_7745c5c3_Var33 string
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicExtension.String) templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicExtension.String)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 82, Col: 54} return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 90, Col: 54}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -652,7 +668,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -681,7 +697,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "Apple Filetype") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "Apple Filetype")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -691,7 +707,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -710,7 +726,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
var templ_7745c5c3_Var37 string var templ_7745c5c3_Var37 string
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicApple.String) templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(fileProperties.LibmagicApple.String)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 92, Col: 50} return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 100, Col: 50}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -729,7 +745,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -757,7 +773,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "Uploaded") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "Uploaded")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -767,7 +783,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -786,7 +802,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
var templ_7745c5c3_Var41 string var templ_7745c5c3_Var41 string
templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(file.Created.Time.String()) templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(file.Created.Time.String())
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 101, Col: 39} return templ.Error{Err: templ_7745c5c3_Err, FileName: `server/web/fileView.templ`, Line: 109, Col: 39}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -810,7 +826,7 @@ func FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) temp
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "</div>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "</div>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -863,7 +879,7 @@ func FileViewDeleteModal(fileid string) templ.Component {
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "Delete") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "Delete")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -878,7 +894,8 @@ func FileViewDeleteModal(fileid string) templ.Component {
return nil return nil
}) })
templ_7745c5c3_Err = modal.Trigger(modal.TriggerProps{ templ_7745c5c3_Err = modal.Trigger(modal.TriggerProps{
ModalID: "default-modal", ModalID: "delete-modal",
Class: "p-1",
}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var43), templ_7745c5c3_Buffer) }).Render(templ.WithChildren(ctx, templ_7745c5c3_Var43), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
@ -907,7 +924,7 @@ func FileViewDeleteModal(fileid string) templ.Component {
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "Are you sure you want to delete this file?") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "Are you sure you want to delete this file?")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -917,7 +934,7 @@ func FileViewDeleteModal(fileid string) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -933,7 +950,7 @@ func FileViewDeleteModal(fileid string) templ.Component {
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "This action cannot be undone. This will permanently delete the file from the server.\t\t\t\t") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "This action cannot be undone. This will permanently delete the file from the server.\t\t\t\t")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -943,7 +960,7 @@ func FileViewDeleteModal(fileid string) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, " ") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, " ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -959,7 +976,7 @@ func FileViewDeleteModal(fileid string) templ.Component {
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "<div class=\"flex gap-2\">") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<div class=\"flex gap-2\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -987,7 +1004,7 @@ func FileViewDeleteModal(fileid string) templ.Component {
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "Cancel") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "Cancel")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -1029,7 +1046,7 @@ func FileViewDeleteModal(fileid string) templ.Component {
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "Delete") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "Delete")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -1037,6 +1054,7 @@ func FileViewDeleteModal(fileid string) templ.Component {
}) })
templ_7745c5c3_Err = button.Button(button.Props{ templ_7745c5c3_Err = button.Button(button.Props{
Variant: button.VariantDestructive, Variant: button.VariantDestructive,
Href: fmt.Sprintf("/files/%s/delete", fileid),
}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var52), templ_7745c5c3_Buffer) }).Render(templ.WithChildren(ctx, templ_7745c5c3_Var52), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
@ -1049,7 +1067,7 @@ func FileViewDeleteModal(fileid string) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "</div>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "</div>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -1076,4 +1094,264 @@ func FileViewDeleteModal(fileid string) templ.Component {
}) })
} }
func FileViewDownloadModal(fileid 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_Var53 := templ.GetChildren(ctx)
if templ_7745c5c3_Var53 == nil {
templ_7745c5c3_Var53 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var54 := 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_Var55 := 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "Download")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = button.Button(button.Props{
Variant: button.VariantDefault,
}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var55), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = modal.Trigger(modal.TriggerProps{
ModalID: "download-modal",
Class: "p-1",
}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var54), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Var56 := 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_Var57 := 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "Download this file?")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = modal.Header().Render(templ.WithChildren(ctx, templ_7745c5c3_Var57), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Var58 := 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "files downloaded from scanfile can be harmful to your system. Are you sure you want to continue?")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = modal.Body().Render(templ.WithChildren(ctx, templ_7745c5c3_Var58), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, " ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Var59 := 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "<div class=\"flex gap-2\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Var60 := 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_Var61 := 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "Cancel")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = button.Button().Render(templ.WithChildren(ctx, templ_7745c5c3_Var61), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = modal.Close(modal.CloseProps{
ModalID: "download-modal",
}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var60), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Var62 := 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_Var63 := 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "Download")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = button.Button(button.Props{
Variant: button.VariantDestructive,
Href: fmt.Sprintf("/files/%s/download", fileid),
}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var63), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = modal.Close(modal.CloseProps{
ModalID: "download-modal",
}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var62), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = modal.Footer().Render(templ.WithChildren(ctx, templ_7745c5c3_Var59), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
templ_7745c5c3_Err = modal.Modal(modal.Props{
ID: "download-modal",
Class: "max-w-md",
}).Render(templ.WithChildren(ctx, templ_7745c5c3_Var56), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modal.Script().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate var _ = templruntime.GeneratedTemplate