package web import "git.jmbit.de/jmb/scanfile/server/internal/sqlc" import "git.jmbit.de/jmb/scanfile/server/web/templui/components/table" import "encoding/hex" templ FileView(file sqlc.File, fileProperties sqlc.FileProperty) { @Base(file.Name) {

File Name: {file.Name}


@FileViewGenericTable(file, fileProperties) } } templ FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) {

Generic Information

@table.Table() { @table.Row() { @table.Cell() { Size } @table.Cell() { {file.Size} Bytes } } @table.Row() { @table.Cell() { Filetype } @table.Cell() { {file.Mimetype} } } @table.Row() { @table.Cell() { Blake2b Hash } @table.Cell() { {hex.EncodeToString(file.Blake2)} } } @table.Row() { @table.Cell() { SHA256 Hash } @table.Cell() { {hex.EncodeToString(fileProperties.Sha256)} } } @table.Row() { @table.Cell() { MD5 Hash } @table.Cell() { {hex.EncodeToString(fileProperties.Md5)} } } if fileProperties.LibmagicMime.Valid { @table.Row() { @table.Cell() { Mimetype } @table.Cell() { {fileProperties.LibmagicMime.String} } } } if fileProperties.LibmagicExtension.Valid { @table.Row() { @table.Cell() { File Extensions } @table.Cell() { {fileProperties.LibmagicExtension.String} } } } if fileProperties.LibmagicApple.Valid { @table.Row() { @table.Cell() { Apple Filetype } @table.Cell() { {fileProperties.LibmagicApple.String} } } } @table.Row() { @table.Cell() { Uploaded } @table.Cell() { {file.Created.Time.String()} } } }
}