summary refs log tree commit diff stats
path: root/svc/handlers.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-12-19 21:21:56 -0500
committerBen Morrison <ben@gbmor.dev>2019-12-19 21:21:56 -0500
commite53b843a93922f21289b9fc4958f1dfc47a49bdf (patch)
treea98cc9358ccf773a7615b42802bb825d7be0bc0d /svc/handlers.go
parent7db28dd705dd5463b5e2e9cf6f5fc87db25533ad (diff)
downloadgetwtxt-e53b843a93922f21289b9fc4958f1dfc47a49bdf.tar.gz
some functions were missing comments. added those in where needed.
Diffstat (limited to 'svc/handlers.go')
-rw-r--r--svc/handlers.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/svc/handlers.go b/svc/handlers.go
index cd0d920..ee58622 100644
--- a/svc/handlers.go
+++ b/svc/handlers.go
@@ -31,6 +31,8 @@ import (
 	"github.com/gorilla/mux"
 )
 
+// Takes the modtime of one of the static files, derives
+// an FNV hash from it, then truncates it.
 func getEtagFromTime(modtime time.Time) string {
 	shabytes, err := modtime.MarshalText()
 	errLog("", err)
@@ -38,11 +40,15 @@ func getEtagFromTime(modtime time.Time) string {
 	return fmt.Sprintf("%x", bytes[:16])
 }
 
+// Takes the body of a response to a request, derives an
+// FNV hash from it, then truncates it. Used for non-static
+// responses.
 func getEtag(data []byte) string {
 	bytes := fnv.New32().Sum(data)
 	return fmt.Sprintf("%x", bytes[:16])
 }
 
+// Serves index.html and the stylesheet to go with it.
 func servStatic(w http.ResponseWriter, isCSS bool) error {
 	pingAssets()
 	staticCache.mu.RLock()
@@ -89,6 +95,7 @@ func apiFormatHandler(w http.ResponseWriter, r *http.Request) {
 	staticHandler(w, r)
 }
 
+// Serves all tweets without pagination.
 func apiAllTweetsHandler(w http.ResponseWriter, r *http.Request) {
 	out, err := twtxtCache.QueryAllStatuses()
 	if err != nil {
d1b10f1dde2c287ebe84ef37'>a654e4ec ^
e5c11a51 ^
4690ce81 ^
a654e4ec ^
e5c11a51 ^
9e751bb8 ^
dbe12410 ^

a654e4ec ^



e5c11a51 ^






















a654e4ec ^

dbe12410 ^
e5c11a51 ^
a654e4ec ^
204dae92 ^



97eb971b ^
204dae92 ^


9e751bb8 ^



204dae92 ^



dbe12410 ^


a654e4ec ^
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79