From 75e1481287c007fafc5d7897d03cbcbc58eb0da7 Mon Sep 17 00:00:00 2001 From: Tolmachev Igor Date: Fri, 15 May 2026 22:50:00 +0300 Subject: Add template --- browse.html | 1181 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1181 insertions(+) create mode 100644 browse.html (limited to 'browse.html') diff --git a/browse.html b/browse.html new file mode 100644 index 0000000..45d3915 --- /dev/null +++ b/browse.html @@ -0,0 +1,1181 @@ +{{ $nonce := uuidv4 -}} +{{ $nonceAttribute := print "nonce=" (quote $nonce) -}} +{{ $csp := printf "default-src 'none'; img-src 'self' data:; object-src 'none'; base-uri 'none'; script-src 'nonce-%s'; style-src 'nonce-%s' fonts.googleapis.com; font-src fonts.gstatic.com; frame-ancestors 'none'; form-action 'none';" $nonce $nonce -}} +{{/* To disable the Content-Security-Policy, set this to false */}}{{ $enableCsp := true -}} +{{ if $enableCsp -}} + {{- .RespHeader.Set "Content-Security-Policy" $csp -}} +{{ end -}} +{{- /* Helper: emit &limit=…&offset=… only when set. Use as {{template "qs" .}} */ -}} +{{- define "qs" -}} +{{- if ne 0 .Limit}}&limit={{.Limit}}{{end -}} +{{- if ne 0 .Offset}}&offset={{.Offset}}{{end -}} +{{- end -}} +{{- define "icon"}} + {{- if .IsDir}} + {{- if .IsSymlink}} + + {{- else}} + + {{- end}} + {{- else if or (eq .Name "LICENSE") (eq .Name "README")}} + + {{- else if .HasExt ".jpg" ".jpeg" ".png" ".gif" ".webp" ".tiff" ".bmp" ".heif" ".heic" ".svg" ".avif"}} + {{- if eq .Tpl.Layout "grid"}} + + {{- else}} + + {{- end}} + {{- else if .HasExt ".mp4" ".mov" ".m4v" ".mpeg" ".mpg" ".avi" ".ogg" ".webm" ".mkv" ".vob" ".gifv" ".3gp"}} + + {{- else if .HasExt ".mp3" ".m4a" ".aac" ".ogg" ".flac" ".wav" ".wma" ".midi" ".cda"}} + + {{- else if .HasExt ".pdf"}} + + {{- else if .HasExt ".csv" ".tsv"}} + + {{- else if .HasExt ".txt" ".doc" ".docx" ".odt" ".fodt" ".rtf"}} + + {{- else if .HasExt ".xls" ".xlsx" ".ods" ".fods"}} + + {{- else if .HasExt ".ppt" ".pptx" ".odp" ".fodp"}} + + {{- else if .HasExt ".zip" ".gz" ".xz" ".tar" ".7z" ".rar" ".xz" ".zst"}} + + {{- else if .HasExt ".deb" ".dpkg"}} + + {{- else if .HasExt ".rpm" ".exe" ".flatpak" ".appimage" ".jar" ".msi" ".apk"}} + + {{- else if .HasExt ".ps1"}} + + {{- else if .HasExt ".py" ".pyc" ".pyo"}} + + {{- else if .HasExt ".bash" ".sh" ".com" ".bat" ".dll" ".so"}} + + {{- else if .HasExt ".dmg"}} + + {{- else if .HasExt ".iso" ".img"}} + + {{- else if .HasExt ".md" ".mdown" ".markdown"}} + + {{- else if .HasExt ".ttf" ".otf" ".woff" ".woff2" ".eof"}} + + {{- else if .HasExt ".go"}} + + {{- else if .HasExt ".html" ".htm"}} + + {{- else if .HasExt ".js"}} + + {{- else if .HasExt ".css"}} + + {{- else if .HasExt ".json" ".json5" ".jsonc"}} + + {{- else if .HasExt ".ts"}} + + {{- else if .HasExt ".sql"}} + + {{- else if .HasExt ".db" ".sqlite" ".bak" ".mdb"}} + + {{- else if .HasExt ".eml" ".email" ".mailbox" ".mbox" ".msg"}} + + {{- else if .HasExt ".crt" ".pem" ".x509" ".cer" ".ca-bundle"}} + + {{- else if .HasExt ".key" ".keystore" ".jks" ".p12" ".pfx" ".pub"}} + + {{- else}} + {{- if .IsSymlink}} + + {{- else}} + + {{- end}} + {{- end}} +{{- end}} + + + + ~{{html .Path}} + + + + + + + +{{- if eq .Layout "grid"}} + +{{- end}} + + + + +
+
+
+ + {{.NumDirs}} director{{if eq 1 .NumDirs}}y{{else}}ies{{end}} + + + {{.NumFiles}} file{{if ne 1 .NumFiles}}s{{end}} + + + {{.HumanTotalFileSize}} total + + {{- if ne 0 .Limit}} + + (showing {{.Limit}}) + + {{- end}} +
+
+ + + {{- if and (eq .Layout "grid") (eq .Sort "name") (ne .Order "asc")}} + + + + {{- else if and (eq .Layout "grid") (eq .Sort "name") (ne .Order "desc")}} + + + + {{- else if and (eq .Layout "grid")}} + + + + {{- end}} + {{- if and (eq .Layout "grid") (eq .Sort "size") (ne .Order "asc")}} + + + + {{- else if and (eq .Layout "grid") (eq .Sort "size") (ne .Order "desc")}} + + + + {{- else if and (eq .Layout "grid")}} + + + + {{- end}} + {{- if and (eq .Layout "grid") (eq .Sort "time") (ne .Order "asc")}} + + + + {{- else if and (eq .Layout "grid") (eq .Sort "time") (ne .Order "desc")}} + + + + {{- else if and (eq .Layout "grid")}} + + + + {{- end}} +
+ + +
+
+
+
+ +
+
+ {{- if eq (len .Items) 0}} +
+ +
This directory is empty.
+
+ {{- else if eq .Layout "grid"}} + {{- range .Items}} +
+ + {{template "icon" .}} +
{{html .Name}}
+
{{.HumanSize}}
+
+
+ {{- end}} + {{- else}} + + + + + + + + + + {{- if .CanGoUp}} + + + + + + {{- end}} + {{- range .Items}} + + + {{- if .IsDir}} + + {{- else}} + + {{- end}} + + + {{- end}} + +
+ {{- if and (eq .Sort "namedirfirst") (ne .Order "desc")}} + + + + {{- else if and (eq .Sort "namedirfirst") (ne .Order "asc")}} + + + + {{- else}} + + + + {{- end}} + {{- if and (eq .Sort "name") (ne .Order "desc")}} + + Name + + + {{- else if and (eq .Sort "name") (ne .Order "asc")}} + + Name + + + {{- else}} + + Name + + {{- end}} + + {{- if and (eq .Sort "size") (ne .Order "desc")}} + + Size + + + {{- else if and (eq .Sort "size") (ne .Order "asc")}} + + Size + + + {{- else}} + + Size + + {{- end}} + + {{- if and (eq .Sort "time") (ne .Order "desc")}} + + Modified + + + {{- else if and (eq .Sort "time") (ne .Order "asc")}} + + Modified + + + {{- else}} + + Modified + + {{- end}} +
+ + + Up + + -
+ + {{template "icon" .}} + {{- if not .SymlinkPath}} + {{html .Name}} + {{- else}} + {{html .Name}} {{html .SymlinkPath}} + {{- end}} + + - +
+
+
+ {{if .IsSymlink}}↱ {{end}}{{.HumanSize}} +
+
+
+ +
+ {{- end}} +
+
+ + + + + + -- cgit v1.3