Merge branch 'main' of forge:ari/indir

This commit is contained in:
ari melody 2026-03-16 18:30:16 +00:00
commit cf03c723d0
Signed by: ari
GPG key ID: 60B5F0386E3DDB7E
2 changed files with 28 additions and 1 deletions

13
main.go
View file

@ -34,6 +34,9 @@ type (
}
)
//go:embed templates/dir.html
var dirHTML string
func main() {
if len(os.Args) < 2 { printHelp() }
@ -41,7 +44,7 @@ func main() {
port := 8080
root := "/"
filesDir := "."
filesDir := ""
i := 1
for {
if i >= len(os.Args) { break }
@ -83,11 +86,19 @@ func main() {
if !strings.HasSuffix(root, "/") { root += "/" }
default:
if len(filesDir) > 0 {
fmt.Fprintf(os.Stderr, "unsupported argument: %s\n", os.Args[i])
os.Exit(1)
}
filesDir = os.Args[i]
}
i++
}
if len(filesDir) == 0 {
filesDir = "."
}
ignoredFiles := []string{
".",
".DS_Store",

View file

@ -9,6 +9,7 @@ html {
background: #101010;
color: #f0f0f0;
font-family: 'Monaspace Argon', monospace;
font-size: 16px;
}
body {
@ -55,6 +56,21 @@ a:hover {
footer {
padding: 1em 0;
}
@media screen and (max-width: 700px) {
body {
font-size: 12px;
}
td {
width: auto;
}
td:last-of-type,
th:last-of-type {
display: none;
}
}
</style>
</head>
<body>