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() { func main() {
if len(os.Args) < 2 { printHelp() } if len(os.Args) < 2 { printHelp() }
@ -41,7 +44,7 @@ func main() {
port := 8080 port := 8080
root := "/" root := "/"
filesDir := "." filesDir := ""
i := 1 i := 1
for { for {
if i >= len(os.Args) { break } if i >= len(os.Args) { break }
@ -83,11 +86,19 @@ func main() {
if !strings.HasSuffix(root, "/") { root += "/" } if !strings.HasSuffix(root, "/") { root += "/" }
default: default:
if len(filesDir) > 0 {
fmt.Fprintf(os.Stderr, "unsupported argument: %s\n", os.Args[i])
os.Exit(1)
}
filesDir = os.Args[i] filesDir = os.Args[i]
} }
i++ i++
} }
if len(filesDir) == 0 {
filesDir = "."
}
ignoredFiles := []string{ ignoredFiles := []string{
".", ".",
".DS_Store", ".DS_Store",

View file

@ -9,6 +9,7 @@ html {
background: #101010; background: #101010;
color: #f0f0f0; color: #f0f0f0;
font-family: 'Monaspace Argon', monospace; font-family: 'Monaspace Argon', monospace;
font-size: 16px;
} }
body { body {
@ -55,6 +56,21 @@ a:hover {
footer { footer {
padding: 1em 0; 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> </style>
</head> </head>
<body> <body>