mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
parent
f166697ef5
commit
1c36d0d511
@ -72,6 +72,11 @@ i.spin {
|
|||||||
animation: 1s spin linear infinite;
|
animation: 1s spin linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pdf {
|
||||||
|
width: 100%;
|
||||||
|
height: calc(100vh - 13em);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * *
|
||||||
* EDITOR *
|
* EDITOR *
|
||||||
@ -1200,4 +1205,4 @@ footer a:hover {
|
|||||||
-webkit-transform: rotate(-360deg);
|
-webkit-transform: rotate(-360deg);
|
||||||
transform: rotate(-360deg);
|
transform: rotate(-360deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,23 @@
|
|||||||
{{ define "content" }}
|
{{ define "content" }}
|
||||||
{{ with .Data}}
|
{{ with .Data}}
|
||||||
<main class="container">
|
<main class="container">
|
||||||
{{ if eq .Type "image" }}
|
{{ if eq .Type "image" }}
|
||||||
<center><img src="{{ .URL }}?raw=true"></center>
|
<center><img src="{{ .URL }}?raw=true"></center>
|
||||||
{{ else if eq .Type "audio" }}
|
{{ else if eq .Type "audio" }}
|
||||||
<audio src="{{ .URL }}?raw=true" controls></audio>
|
<audio src="{{ .URL }}?raw=true" controls></audio>
|
||||||
{{ else if eq .Type "video" }}
|
{{ else if eq .Type "video" }}
|
||||||
<video src="{{ .URL }}?raw=true" controls>
|
<video src="{{ .URL }}?raw=true" controls>
|
||||||
Sorry, your browser doesn't support embedded videos,
|
Sorry, your browser doesn't support embedded videos,
|
||||||
but don't worry, you can <a href="?download=true">download it</a>
|
but don't worry, you can <a href="?download=true">download it</a>
|
||||||
and watch it with your favorite video player!
|
and watch it with your favorite video player!
|
||||||
</video>
|
</video>
|
||||||
{{ else if eq .Type "blob" }}
|
{{ else if eq .Extension ".pdf" }}
|
||||||
<a href="?download=true"><h2 class="message">Download <i class="material-icons">file_download</i></h2></a>
|
<object class="pdf" data="{{ .URL }}?raw=true"></object>
|
||||||
{{ else}}
|
{{ else if eq .Type "blob" }}
|
||||||
<pre>{{ .StringifyContent }}</pre>
|
<a href="?download=true"><h2 class="message">Download <i class="material-icons">file_download</i></h2></a>
|
||||||
|
{{ else}}
|
||||||
|
<pre>{{ .StringifyContent }}</pre>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</main>
|
</main>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -20,6 +20,7 @@ type Info struct {
|
|||||||
Name string
|
Name string
|
||||||
Size int64
|
Size int64
|
||||||
URL string
|
URL string
|
||||||
|
Extension string
|
||||||
ModTime time.Time
|
ModTime time.Time
|
||||||
Mode os.FileMode
|
Mode os.FileMode
|
||||||
IsDir bool
|
IsDir bool
|
||||||
@ -55,7 +56,7 @@ func GetInfo(url *url.URL, c *config.Config, u *config.User) (*Info, int, error)
|
|||||||
i.Mode = info.Mode()
|
i.Mode = info.Mode()
|
||||||
i.IsDir = info.IsDir()
|
i.IsDir = info.IsDir()
|
||||||
i.Size = info.Size()
|
i.Size = info.Size()
|
||||||
|
i.Extension = filepath.Ext(i.Name)
|
||||||
return i, 0, nil
|
return i, 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +80,7 @@ var textExtensions = [...]string{
|
|||||||
// RetrieveFileType obtains the mimetype and a simplified internal Type
|
// RetrieveFileType obtains the mimetype and a simplified internal Type
|
||||||
// using the first 512 bytes from the file.
|
// using the first 512 bytes from the file.
|
||||||
func (i *Info) RetrieveFileType() error {
|
func (i *Info) RetrieveFileType() error {
|
||||||
i.Mimetype = mime.TypeByExtension(filepath.Ext(i.Name))
|
i.Mimetype = mime.TypeByExtension(i.Extension)
|
||||||
|
|
||||||
if i.Mimetype == "" {
|
if i.Mimetype == "" {
|
||||||
err := i.Read()
|
err := i.Read()
|
||||||
|
Loading…
Reference in New Issue
Block a user