feat: move upload page to home page

This commit is contained in:
jabuxas 2024-10-15 15:35:45 -03:00
parent 8bf4d7e5c4
commit bdab72dcac
4 changed files with 32 additions and 87 deletions

View File

@ -139,11 +139,6 @@ func (app *Application) uploadHandler(w http.ResponseWriter, r *http.Request) {
app.parserHandler(w, r) app.parserHandler(w, r)
return return
} }
tmpl := template.Must(template.ParseFiles("templates/upload.html"))
if err := tmpl.Execute(w, app.uploadHandler); err != nil {
slog.Warn(err.Error())
}
} }
func (app *Application) parserHandler(w http.ResponseWriter, r *http.Request) { func (app *Application) parserHandler(w http.ResponseWriter, r *http.Request) {

View File

@ -11,19 +11,20 @@
<body> <body>
<h1>abyss paste</h1> <h1>abyss paste</h1>
<div class="top-down"> <div>
<div> <a href="/tree">
<a href="/tree"> <button>all uploaded files</button>
<button>files uploaded</button> </a>
</a>
<a href="/upload">
<button>go to upload</button>
</a>
</div>
<a href="/last"> <a href="/last">
<button>last uploaded file</button> <button>last uploaded file</button>
</a> </a>
</div> </div>
<form action="/upload" method="POST">
<textarea name="content" placeholder="Enter your content here..."></textarea><br />
<button type="submit">upload</button>
</form>
<footer> <footer>
abyss paste - powered by abyss paste - powered by
<a href="https://github.com/jabuxas/abyss" target="_blank">abyss</a> <a href="https://github.com/jabuxas/abyss" target="_blank">abyss</a>

View File

@ -46,9 +46,27 @@ footer a {
div { div {
display: flex; display: flex;
gap: 10px; gap: 10px;
}
.top-down {
flex-direction: column;
align-items: center; align-items: center;
} }
form {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 30px;
gap: 10px;
}
textarea {
background-color: #333;
color: #fff;
border: 1px solid #555;
padding: 10px;
width: 400px;
height: 150px;
border-radius: 5px;
}
textarea::placeholder {
color: #bbb;
}

View File

@ -1,69 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>dir listing</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
h1 {
font-size: 24px;
margin-bottom: 10px;
}
header {
display: flex;
justify-content: center;
align-items: center;
}
.file-listing {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
.file-listing th,
.file-listing td {
border: 1px solid #ddd;
padding: 12px;
text-align: left;
}
.file-listing th {
background-color: #333;
color: white;
}
.file-listing tr:nth-child(even) {
background-color: #f9f9f9;
}
.file-listing tr:hover {
background-color: #f1f1f1;
}
.file-listing td a {
color: #0288d1;
text-decoration: none;
}
.file-listing td a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<form action="/upload" method="POST">
<textarea name="content" rows="10" cols="50" placeholder="Enter your content here..."></textarea><br /><br />
<button type="submit">Upload</button>
</form>
</body>
</html>