diff --git a/garden-app/server/api.go b/garden-app/server/api.go index 4b94b50f..61f9f9a4 100644 --- a/garden-app/server/api.go +++ b/garden-app/server/api.go @@ -48,6 +48,14 @@ func NewAPI() *API { api.API. AddCustomRoute(http.MethodGet, "/metrics", promhttp.Handler()). AddCustomRoute(http.MethodGet, "/", http.RedirectHandler("/gardens", http.StatusFound)). + AddCustomRoute(http.MethodGet, "/manifest.json", http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + // manifest.json enables PWA for mobile devices + _, _ = w.Write([]byte(`{ + "name": "Garden App", + "start_url": "/gardens", + "display": "standalone" + }`)) + })). AddNestedAPI(api.gardens). AddNestedAPI(api.weatherClients). AddNestedAPI(api.notificationClients). diff --git a/garden-app/server/templates/base.html b/garden-app/server/templates/base.html index 593209d9..6eac06ea 100644 --- a/garden-app/server/templates/base.html +++ b/garden-app/server/templates/base.html @@ -6,6 +6,7 @@ Garden App + @@ -59,4 +60,4 @@ -{{ end }} \ No newline at end of file +{{ end }} diff --git a/garden-app/server/vcr/testdata/vcr_server/fixtures/create_and_delete_waterschedule.yaml b/garden-app/server/vcr/testdata/vcr_server/fixtures/create_and_delete_waterschedule.yaml index 7cd372fe..649b55e9 100644 --- a/garden-app/server/vcr/testdata/vcr_server/fixtures/create_and_delete_waterschedule.yaml +++ b/garden-app/server/vcr/testdata/vcr_server/fixtures/create_and_delete_waterschedule.yaml @@ -96,7 +96,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -287,7 +287,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -830,7 +830,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 diff --git a/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_simple.yaml b/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_simple.yaml index 8da38471..6acf8367 100644 --- a/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_simple.yaml +++ b/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_simple.yaml @@ -96,7 +96,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -337,7 +337,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n

New Garden

\n\n
\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n

New Garden

\n\n
\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 diff --git a/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_with_light_schedule.yaml b/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_with_light_schedule.yaml index 8cd53789..ccaf666c 100644 --- a/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_with_light_schedule.yaml +++ b/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_with_light_schedule.yaml @@ -96,7 +96,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -337,7 +337,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n

New Garden

\n\n
\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n

New Garden

\n\n
\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -441,7 +441,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n \n
\n
\n
\n
\n

\n New Garden\n

\n \n
\n \n \n
\n\n
\n
\n \n \n\n\n\n N/A\n\n
\n

Post "http://localhost:8086/api/v2/query?org=garden": dial tcp [::1]:8086: connect: connection refused

\n
\n\n \n\n \n 0 Zones \n \n\n \n \n

\n \n \n \n \n Light will turn OFF at 6:00PM\n

\n\n

\n \n 10h\n 8:00AM\n \n

\n\n \n\n \n
\n
\n
\n
\n \n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n \n
\n

cqsnecmiuvoqlhrmf2jg

\n

Topic prefix: new-garden

\n
\n
\n\n
\n
\n
\n
\n
\n\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n \n
\n
\n
\n
\n

\n New Garden\n

\n \n
\n \n \n
\n\n
\n
\n \n \n\n\n\n N/A\n\n
\n

Post "http://localhost:8086/api/v2/query?org=garden": dial tcp [::1]:8086: connect: connection refused

\n
\n\n \n\n \n 0 Zones \n \n\n \n \n

\n \n \n \n \n Light will turn OFF at 6:00PM\n

\n\n

\n \n 10h\n 8:00AM\n \n

\n\n \n\n \n
\n
\n
\n
\n \n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n \n
\n

cqsnecmiuvoqlhrmf2jg

\n

Topic prefix: new-garden

\n
\n
\n\n
\n
\n
\n
\n
\n\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 diff --git a/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_ws_zone.yaml b/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_ws_zone.yaml index 9bb3e7a1..4a98a538 100644 --- a/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_ws_zone.yaml +++ b/garden-app/server/vcr/testdata/vcr_server/fixtures/create_garden_ws_zone.yaml @@ -96,7 +96,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -527,7 +527,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -631,7 +631,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n \n
\n
\n
\n
\n

\n New Garden\n

\n \n
\n \n \n
\n\n
\n
\n \n \n\n\n\n N/A\n\n
\n

Post "http://localhost:8086/api/v2/query?org=garden": dial tcp [::1]:8086: connect: connection refused

\n
\n\n \n\n \n 0 Zones \n \n\n \n\n \n
\n
\n
\n
\n \n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n \n
\n

cqsnecmiuvoqlhrmf2jg

\n

Topic prefix: new-garden

\n
\n
\n\n
\n
\n
\n
\n
\n\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n \n
\n
\n
\n
\n

\n New Garden\n

\n \n
\n \n \n
\n\n
\n
\n \n \n\n\n\n N/A\n\n
\n

Post "http://localhost:8086/api/v2/query?org=garden": dial tcp [::1]:8086: connect: connection refused

\n
\n\n \n\n \n 0 Zones \n \n\n \n\n \n
\n
\n
\n
\n \n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n \n
\n

cqsnecmiuvoqlhrmf2jg

\n

Topic prefix: new-garden

\n
\n
\n\n
\n
\n
\n
\n
\n\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -682,7 +682,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n

New Garden

\n\n
\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n

New Garden

\n\n
\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -861,7 +861,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n

New Zone

\n
\n \n
\n
\n
\n
\n

Actions

\n
\n \n \n
\n
\n
\n
\n
\n
\n

\n \n Water Schedule\n \n

\n \n\n\n\n\n
\n

no active WaterSchedules

\n
\n\n\n\n
\n
\n
\n
\n

Details

\n \n

Zone!

\n

\n \n
\n
\n
\n
\n\n \n
\n
\n
\n

Water History

\n
\n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n
TimeDuration
Post "http://localhost:8086/api/v2/query?org=garden": dial tcp [::1]:8086: connect: connection refused
\n
\n
\n\n
\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n

New Zone

\n
\n \n
\n
\n
\n
\n

Actions

\n
\n \n \n
\n
\n
\n
\n
\n
\n

\n \n Water Schedule\n \n

\n \n\n\n\n\n
\n

no active WaterSchedules

\n
\n\n\n\n
\n
\n
\n
\n

Details

\n \n

Zone!

\n

\n \n
\n
\n
\n
\n\n \n
\n
\n
\n

Water History

\n
\n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n
TimeDuration
Post "http://localhost:8086/api/v2/query?org=garden": dial tcp [::1]:8086: connect: connection refused
\n
\n
\n\n
\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -967,7 +967,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -1263,7 +1263,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n \n
\n
\n
\n
\n

\n New Garden\n

\n \n
\n \n \n
\n\n
\n
\n \n \n\n\n\n N/A\n\n
\n

Post "http://localhost:8086/api/v2/query?org=garden": dial tcp [::1]:8086: connect: connection refused

\n
\n\n \n\n \n 1 Zones \n \n\n \n\n \n
\n
\n
\n
\n \n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n \n
\n

cqsnecmiuvoqlhrmf2jg

\n

Topic prefix: new-garden

\n
\n
\n\n
\n
\n
\n
\n
\n\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n
\n \n \n
\n
\n
\n
\n

\n New Garden\n

\n \n
\n \n \n
\n\n
\n
\n \n \n\n\n\n N/A\n\n
\n

Post "http://localhost:8086/api/v2/query?org=garden": dial tcp [::1]:8086: connect: connection refused

\n
\n\n \n\n \n 1 Zones \n \n\n \n\n \n
\n
\n
\n
\n \n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n \n
\n

cqsnecmiuvoqlhrmf2jg

\n

Topic prefix: new-garden

\n
\n
\n\n
\n
\n
\n
\n
\n\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -1314,7 +1314,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n

New Garden

\n\n
\n \n \n
\n
\n
\n
\n

\n New Zone\n

\n \n
\n \n \n
\n\n
\n
\n \n\n
\n
\n
\n\n\n
\n
\n
\n
\n \n
\n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n
\n

cqsnecmiuvoqlhrmf2k0

\n

Position: 0

\n

Water Schedules: []

\n
\n
\n\n
\n
\n
\n
\n
\n\n \n
\n\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n

New Garden

\n\n
\n \n \n
\n
\n
\n
\n

\n New Zone\n

\n \n
\n \n \n
\n\n
\n
\n \n\n
\n
\n
\n\n\n
\n
\n
\n
\n \n
\n
\n \n
\n \n
\n
\n\n
\n
\n \n
\n
\n

cqsnecmiuvoqlhrmf2k0

\n

Position: 0

\n

Water Schedules: []

\n
\n
\n\n
\n
\n
\n
\n
\n\n \n
\n\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8 @@ -1495,7 +1495,7 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n

New Zone

\n
\n \n
\n
\n
\n
\n

Actions

\n
\n \n \n
\n
\n
\n
\n
\n
\n

\n \n \n Water Schedule\n \n \n

\n \n\n\n
\n Watering for\n 10m\n on Thursday, 24 Aug at 7:00AM\n
\n\n\n\n\n\n
\n
\n
\n
\n

Details

\n \n

Now with watering

\n

\n \n
\n
\n
\n
\n\n \n
\n
\n
\n

Water History

\n
\n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n
TimeDuration
Post "http://localhost:8086/api/v2/query?org=garden": dial tcp [::1]:8086: connect: connection refused
\n
\n
\n\n
\n\n\n\n\n\n" + body: "\n\n\n\n\n\n \n \n Garden App\n \n \n \n \n \n \n\n\n\n\n\n
\n \n \n\n

New Zone

\n
\n \n
\n
\n
\n
\n

Actions

\n
\n \n \n
\n
\n
\n
\n
\n
\n

\n \n \n Water Schedule\n \n \n

\n \n\n\n
\n Watering for\n 10m\n on Thursday, 24 Aug at 7:00AM\n
\n\n\n\n\n\n
\n
\n
\n
\n

Details

\n \n

Now with watering

\n

\n \n
\n
\n
\n
\n\n \n
\n
\n
\n

Water History

\n
\n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n
TimeDuration
Post "http://localhost:8086/api/v2/query?org=garden": dial tcp [::1]:8086: connect: connection refused
\n
\n
\n\n
\n\n\n\n\n\n" headers: Content-Type: - text/html; charset=utf-8