aboutsummaryrefslogtreecommitdiff
path: root/internal/license.go
blob: 7eead24b60775b167898b05d44f368e512b28ef5 (plain)
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
30
31
32
package internal

import (
	"fmt"
	"net/http"
	"os"

	"go4.org/legal"
	"within.website/x/cmd/license/licenses"
)

func init() {
	legal.RegisterLicense(licenses.CC0License)
	legal.RegisterLicense(licenses.SQLiteBlessing)

	http.HandleFunc("/.within/licenses", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, "Licenses for this program: %s\n", os.Args[0])

		for _, li := range legal.Licenses() {
			fmt.Fprintln(w)
			fmt.Fprintln(w, "---")
			fmt.Fprintln(w)
			fmt.Fprintln(w, li)
		}

		fmt.Fprintln(w)
		fmt.Fprintln(w, "---")
		fmt.Fprintln(w)

		fmt.Fprintln(w, "Be well, Creator.")
	})
}