summaryrefslogtreecommitdiff
path: root/internal/calfeed/json.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/calfeed/json.go')
-rw-r--r--internal/calfeed/json.go21
1 files changed, 16 insertions, 5 deletions
diff --git a/internal/calfeed/json.go b/internal/calfeed/json.go
index c1a50ca..1cb0b6f 100644
--- a/internal/calfeed/json.go
+++ b/internal/calfeed/json.go
@@ -1,17 +1,28 @@
package calfeed
-import "encoding/json"
+import (
+ "encoding/json"
+
+ "github.com/lukaszkasprzak/lectio/internal/config"
+)
const Schema = "lectio.calendar/1"
// JSON renders days as the stable lectio.calendar/1 envelope.
+//
+// "source" and "license" carry the AGPL-3.0 ยง13 offer to consumers who only
+// ever see this endpoint and never load the HTML UI. They are envelope
+// metadata, not day data -- adding them does not change the schema version,
+// since existing consumers read "days".
func JSON(form string, days []DayView) ([]byte, error) {
if days == nil {
days = []DayView{}
}
return json.MarshalIndent(struct {
- Schema string `json:"schema"`
- Form string `json:"form"`
- Days []DayView `json:"days"`
- }{Schema, form, days}, "", " ")
+ Schema string `json:"schema"`
+ Form string `json:"form"`
+ Source string `json:"source"`
+ License string `json:"license"`
+ Days []DayView `json:"days"`
+ }{Schema, form, config.SourceURL, config.License, days}, "", " ")
}