This commit is contained in:
2026-02-27 13:59:06 +01:00
parent 19434b3fd0
commit 90ae94ef6f
4 changed files with 15 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import (
"io"
"os"
"path/filepath"
"strconv"
"time"
"github.com/gin-gonic/gin"
@@ -49,7 +50,14 @@ func uploadHandler(c *gin.Context) {
return
}
expiry := time.Now().Add(24 * time.Hour)
durationHours := 24 // default
if val := c.PostForm("duration"); val != "" {
fmt.Println("Duration provided:", val)
if parsed, err := strconv.Atoi(val); err == nil {
durationHours = parsed
}
}
expiry := time.Now().Add(time.Duration(durationHours) * time.Hour)
record := FileRecord{
ID: id,

View File

@@ -32,6 +32,7 @@ func main() {
router := gin.Default()
router.MaxMultipartMemory = 10 << 30
router.LoadHTMLGlob("templates/*")
router.StaticFS("/static", gin.Dir("./static", false))
// Public Routes
router.GET("/", func(c *gin.Context) { c.HTML(200, "index.html", nil) })

BIN
static/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

View File

@@ -91,8 +91,9 @@
</head>
<body class="min-h-screen flex items-center justify-center p-4">
<div class="w-full max-w-[493px] flex flex-col items-end">
<!--<div class="w-full max-w-[493px] flex flex-col items-end">-->
<div class="w-full max-w-[493px] flex flex-col items-center">
<img src="/static/logo.png" alt="Send.it logo" style="width:50%;" class="mb-2 border-black">
<div class="box">
<header class="mb-6 border-b-2 border-black pb-2 text-center">
<h1 class="text-xl font-bold uppercase">Send it</h1>
@@ -264,6 +265,8 @@
const fd = new FormData();
fd.append("file", file);
fd.append("once", document.getElementById("once").checked ? "true" : "false");
const hours = parseInt(document.getElementById("duration").value, 10);
fd.append("duration", hours * 3600); // convert hours to seconds
const xhr = new XMLHttpRequest();
currentXhr = xhr;