summary refs log tree commit diff stats
path: root/svc/handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'svc/handlers.go')
-rw-r--r--svc/handlers.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/svc/handlers.go b/svc/handlers.go
index 5a46521..bd9ec62 100644
--- a/svc/handlers.go
+++ b/svc/handlers.go
@@ -141,6 +141,18 @@ func apiEndpointHandler(w http.ResponseWriter, r *http.Request) {
 		out, err = twtxtCache.QueryAllStatuses()
 		out = registry.ReduceToPage(page, out)
 
+	case "/api/plain/version":
+		etag := fmt.Sprintf("%x", sha256.Sum256([]byte(Vers)))
+		w.Header().Set("ETag", "\""+etag+"\"")
+		w.Header().Set("Content-Type", txtutf8)
+		_, err := w.Write([]byte(strings.TrimSpace("getwtxt " + Vers)))
+		if err != nil {
+			errHTTP(w, r, err, http.StatusInternalServerError)
+			return
+		}
+		log200(r)
+		return
+
 	default:
 		errHTTP(w, r, fmt.Errorf("endpoint not found"), http.StatusNotFound)
 		return