-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlegal.go
More file actions
29 lines (25 loc) · 840 Bytes
/
legal.go
File metadata and controls
29 lines (25 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package peerdb
import (
"net/http"
"gitlab.com/tozd/waf"
)
// LicenseGet serves the LICENSE file to the client.
func (s *Service) LicenseGet(w http.ResponseWriter, req *http.Request, _ waf.Params) {
if s.ProxyStaticTo != "" {
// This really serves the LICENSE file from the root directory and not /public/LICENSE.txt,
// but that is fine, they are the same (they are symlinked).
s.Proxy(w, req)
} else {
s.ServeStaticFile(w, req, "/LICENSE.txt")
}
}
// NoticeGet serves the NOTICE file to the client.
func (s *Service) NoticeGet(w http.ResponseWriter, req *http.Request, _ waf.Params) {
if s.ProxyStaticTo != "" {
// rollup-plugin-license does not make the file available during development,
// so we just return empty response.
w.WriteHeader(http.StatusOK)
} else {
s.ServeStaticFile(w, req, "/NOTICE.txt")
}
}