diff --git a/controllers/index.go b/controllers/index.go index 01cd29e..a5fc36b 100644 --- a/controllers/index.go +++ b/controllers/index.go @@ -12,5 +12,5 @@ func HandleIndex(c *gin.Context) { if baseURL == "" { baseURL = "http://localhost:8080" } - c.HTML(http.StatusOK, "index.html", gin.H{"BaseURL": baseURL}) + c.HTML(http.StatusOK, "layout.html", gin.H{"BaseURL": baseURL, "Title": "Home"}) } diff --git a/main.go b/main.go index f6af0aa..790d320 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ func main() { r := gin.Default() - tmpl := template.Must(template.New("").ParseFS(viewsFS, "views/*.html")) + tmpl := template.Must(template.New("").ParseFS(viewsFS, "views/*.html", "views/partials/*.html")) r.SetHTMLTemplate(tmpl) r.GET("/", controllers.HandleIndex) diff --git a/views/index.html b/views/index.html index a83590d..9da438e 100644 --- a/views/index.html +++ b/views/index.html @@ -1,391 +1,9 @@ - - -
- - -Simple file upload and download service for developers using HTTP requests in CLI.
-Contact me on Matrix: @root@adhd.sh or via Discord: nu11ed
- -- This resets after 24h -
- -Description: Upload a file
-cURL example:
-curl -X POST -F "file=@/path/to/your/file.txt" {{.BaseURL}}/upload
- Description: Download a file using the ID and filename from upload response
-cURL example:
-curl -O {{.BaseURL}}/uploads/{fileID}/{filename}
- Description: Check storage usage and capacity
-cURL example:
-curl {{.BaseURL}}/storage
- Description: Check service health
-cURL example:
-curl {{.BaseURL}}/health
- # 1. Upload a file
-curl -X POST -F "file=@myfile.txt" {{.BaseURL}}/upload
-
-# Response will include:
-# {
-# "id": "abc123...",
-# "filename": "myfile.txt",
-# "url": "{{.BaseURL}}/uploads/abc123.../myfile.txt"
-# }
-
-# 2. Download the file
-curl -O {{.BaseURL}}/uploads/abc123.../myfile.txt
- Description: Upload a file
+cURL example:
+curl -X POST -F "file=@/path/to/your/file.txt" {{.BaseURL}}/upload
+Description: Download a file using the ID and filename from upload response
+cURL example:
+curl -O {{.BaseURL}}/uploads/{fileID}/{filename}
+Description: Check storage usage and capacity
+cURL example:
+curl {{.BaseURL}}/storage
+Description: Check service health
+cURL example:
+curl {{.BaseURL}}/health
+Simple file upload and download service for developers using HTTP requests in CLI.
+Contact me on Matrix: @root@adhd.sh or via Discord: nu11ed
+{{end}} \ No newline at end of file diff --git a/views/partials/storage-info.html b/views/partials/storage-info.html new file mode 100644 index 0000000..361f5da --- /dev/null +++ b/views/partials/storage-info.html @@ -0,0 +1,16 @@ +{{define "storage-info"}} ++ This resets after 24h +
+ +# 1. Upload a file
+curl -X POST -F "file=@myfile.txt" {{.BaseURL}}/upload
+
+# Response will include:
+# {
+# "id": "abc123...",
+# "filename": "myfile.txt",
+# "url": "{{.BaseURL}}/uploads/abc123.../myfile.txt"
+# }
+
+# 2. Download the file
+curl -O {{.BaseURL}}/uploads/abc123.../myfile.txt
+{{end}}
\ No newline at end of file