This commit is contained in:
Henrique Dias 2016-11-02 19:29:29 +00:00
parent 6b0a132161
commit 28ea0de82e
4 changed files with 21 additions and 24 deletions

View File

@ -922,4 +922,4 @@ document.addEventListener("DOMContentLoaded", function(event) {
}
return false;
});
});

View File

@ -7,6 +7,11 @@
<i class="material-icons" title="Edit">mode_edit</i>
</div>
{{ end }}
<!-- {{ if .IsDir }}
<div class="action" id="info">
<i class="material-icons">info</i>
</div> -->
{{ end }}
<div class="action" id="download">
<a href="?download=true">
<i class="material-icons" title="Download">file_download</i> <span>Download</span>

View File

@ -93,31 +93,23 @@
{{ if .IsDir }}
<div id="toolbar">
<div>
<div class="action" id="back">
<i class="material-icons" title="Back">arrow_back</i>
</div>
<p>
<span id="selected-number">0</span>
selected.</p>
</div>
<div>
{{ template "actions" . }}
</div>
<div>
<div class="action" id="back">
<i class="material-icons" title="Back">arrow_back</i>
</div>
<p><span id="selected-number">0</span> selected.</p>
</div>
<div>
{{ template "actions" . }}
</div>
</div>
{{ end }}
<main>
{{ template "content" . }}
{{ template "content" . }}
</main>
<footer>
Served with
<a rel="noopener noreferrer" href="https://caddyserver.com">Caddy</a>
and
<a rel="noopener noreferrer" href="https://github.com/hacdias/caddy-filemanager">File Manager</a>.
</footer>
<footer>Served with <a rel="noopener noreferrer" href="https://caddyserver.com">Caddy</a> and <a rel="noopener noreferrer" href="https://github.com/hacdias/caddy-filemanager">File Manager</a>.</footer>
<!-- SCRIPTS -->
<!-- User Data and Permissions; WebDavURL -->

View File

@ -43,10 +43,6 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
return f.Next.ServeHTTP(w, r)
}
w.Header().Set("x-frame-options", "SAMEORIGIN")
w.Header().Set("x-content-type", "nosniff")
w.Header().Set("x-xss-protection", "1; mode=block")
c = &f.Configs[i]
// Checks if the URL matches the Assets URL. Returns the asset if the
@ -96,6 +92,10 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
return 0, nil
}
w.Header().Set("x-frame-options", "SAMEORIGIN")
w.Header().Set("x-content-type", "nosniff")
w.Header().Set("x-xss-protection", "1; mode=block")
// Checks if the User is allowed to access this file
if !user.Allowed(strings.TrimPrefix(r.URL.Path, c.BaseURL)) {
if r.Method == http.MethodGet {