From 282c26ce8411e17d75c3ca47fbd3876a9e1c9cb9 Mon Sep 17 00:00:00 2001 From: veradec Date: Thu, 12 Nov 2026 09:52:07 +0530 Subject: add: html for the website --- index.html | 28 ++++++++++++++++++++++++++++ main.go | 13 ++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..2869c13 --- /dev/null +++ b/index.html @@ -0,0 +1,28 @@ + + + + + + + UxU + + + +

Welcome to UxU

+ +

Yes! UxU is a File Hosting service, but not in it's traditional sense. There is no Upload Button. + You need to move to the cultured way of doing it -- using curl.

+

+ curl -X POST -F "file=@file.png" +

and the reponse will be a link with your Filename (sanitized ofcourse) + + + + diff --git a/main.go b/main.go index c0ba6a5..9af9e21 100644 --- a/main.go +++ b/main.go @@ -3,14 +3,11 @@ package main import ( "net/http" "fmt" + "log" "path/filepath" "github.com/gin-gonic/gin" ) -func index(c *gin.Context){ - -} - func main(){ router := gin.Default() @@ -21,15 +18,17 @@ func main(){ c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) return } - fmt.Println(file.Filename) + log.Println(file.Filename) dst := filepath.Join("./files/", filepath.Base(file.Filename)) c.SaveUploadedFile(file, dst) - c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!\n", file.Filename)) + c.String(http.StatusOK, fmt.Sprintf("%s/%s\n", domain , file.Filename)) }) + router.LoadHTMLFiles("index.html") + router.GET("/", func(c *gin.Context) { - c.String(http.StatusOK, fmt.Sprintf("HTTP WORKS TOO!")) + c.HTML(http.StatusOK, "index.html", gin.H{}) }) var safeFS http.FileSystem = http.Dir("./files") -- cgit v1.2.3