Selaa lähdekoodia

Remove frontend rendering logic from Go backend

Grav will be used to route and display all frontend pages instead of Go
to make pages easily modifiable and consistent with blogging CMS.
master
Immanuel Onyeka 1 vuosi sitten
vanhempi
commit
5a0b0f82b3
8 muutettua tiedostoa jossa 21 lisäystä ja 30 poistoa
  1. +1
    -1
      grav-admin/user/data/feed/21232f297a57a5a743894a0e4a801fc3.yaml
  2. +1
    -1
      grav-admin/user/data/flex/indexes/pages.json
  3. +1
    -1
      grav-admin/user/data/notifications/21232f297a57a5a743894a0e4a801fc3.yaml
  4. +5
    -0
      grav-admin/user/pages/07.app/app.md
  5. +0
    -5
      grav-admin/user/pages/07.login/form.md
  6. +12
    -0
      grav-admin/user/themes/quark/templates/app.html.twig
  7. +1
    -1
      grav-admin/user/themes/quark/templates/macros/macros.html.twig
  8. +0
    -21
      skouter.go

+ 1
- 1
grav-admin/user/data/feed/21232f297a57a5a743894a0e4a801fc3.yaml Näytä tiedosto

@@ -1,4 +1,4 @@
last_checked: 1710866946 last_checked: 1710870233
data: data:
- -
title: 'macOS 14.0 Sonoma Apache Setup: Upgrading Homebrew' title: 'macOS 14.0 Sonoma Apache Setup: Upgrading Homebrew'


+ 1
- 1
grav-admin/user/data/flex/indexes/pages.json Näytä tiedosto

@@ -1 +1 @@
{"version":"1.5","timestamp":1710807003,"count":14,"index":{"":{"key":"","storage_key":"","template":null,"storage_timestamp":1705010337,"children":{"01.home":1704396086,"02.about":1704398516,"03.typography":1703638467,"04.pricing":1704400398,"05.blog":1703638467,"06.register":1705010214,"07.login":1704398231},"checksum":"eea3a7871f80727e2de9702b8f540707"},"01.home":{"key":"home","storage_key":"01.home","template":"modular","storage_timestamp":1704396086,"markdown":{"":{"modular":1703631506}},"children":{"01._hero":1703718436,"02._features":1703720151,"03._example":1703716188,"04._comparison-pdf":1703719134,"05._info":1703720014,"06._any_device":1704396086},"checksum":"dbbcfea030db5994b105e013be94b15c"},"01.home\/01._hero":{"key":"home\/_hero","storage_key":"01.home\/01._hero","template":"hero","storage_timestamp":1703718436,"markdown":{"":{"hero":1703718436}},"checksum":"45dc2f4a454b5f0609cbe09cfda09790"},"01.home\/02._features":{"key":"home\/_features","storage_key":"01.home\/02._features","template":"features","storage_timestamp":1703720151,"markdown":{"":{"features":1703720151}},"checksum":"ed7be750188fc4ed50ebcdc060f6fb53"},"01.home\/03._example":{"key":"home\/_example","storage_key":"01.home\/03._example","template":"text","storage_timestamp":1703716188,"markdown":{"":{"text":1703713545}},"checksum":"48b2ea373eba19040584a991b21c083c"},"01.home\/04._comparison-pdf":{"key":"home\/_comparison-pdf","storage_key":"01.home\/04._comparison-pdf","template":"text","storage_timestamp":1703719134,"markdown":{"":{"text":1703719134}},"checksum":"f323d6050403b0102c73c174d74b2f0a"},"01.home\/05._info":{"key":"home\/_info","storage_key":"01.home\/05._info","template":"features","storage_timestamp":1703720014,"markdown":{"":{"features":1703720014}},"checksum":"35c9bee0f74fe81449a491e31bf81bcb"},"01.home\/06._any_device":{"key":"home\/_any_device","storage_key":"01.home\/06._any_device","template":"text","storage_timestamp":1704397975,"markdown":{"":{"text":1704397975}},"checksum":"aabfe01503028954e8557c5bff37048d"},"02.about":{"key":"about","storage_key":"02.about","template":"default","storage_timestamp":1704398516,"markdown":{"":{"default":1704398516}},"checksum":"3d12d8cc95786aef7316b6c379752aa0"},"03.typography":{"key":"typography","storage_key":"03.typography","template":"default","storage_timestamp":1703638467,"markdown":{"":{"default":1696264967}},"checksum":"e18e25aa1028384a58d66d7b5c74b799"},"04.pricing":{"key":"pricing","storage_key":"04.pricing","template":"default","storage_timestamp":1704400398,"markdown":{"":{"default":1704400398}},"checksum":"76ddfc1dafa27268dca3f24db2ffa05a"},"05.blog":{"key":"blog","storage_key":"05.blog","template":"blog","storage_timestamp":1703638467,"markdown":{"":{"blog":1703636303}},"checksum":"88a8e8a7109dc2957e9dc3e1fd81fa85"},"06.register":{"key":"register","storage_key":"06.register","template":"registration","storage_timestamp":1710807003,"markdown":{"":{"registration":1710807003}},"checksum":"af484cd05f9e8645375ff24f629962b1"},"07.login":{"key":"login","storage_key":"07.login","template":"form","storage_timestamp":1704398231,"markdown":{"":{"form":1704398231}},"checksum":"77a4de225317558af65b6079dcc902fb"}}} {"version":"1.5","timestamp":1710872704,"count":14,"index":{"":{"key":"","storage_key":"","template":null,"storage_timestamp":1710870821,"children":{"01.home":1704396086,"02.about":1704398516,"03.typography":1703638467,"04.pricing":1704400398,"05.blog":1703638467,"06.register":1710807003,"07.app":1710870821},"checksum":"af9cfb7f72d2c560dc5493b5034ba005"},"01.home":{"key":"home","storage_key":"01.home","template":"modular","storage_timestamp":1704396086,"markdown":{"":{"modular":1703631506}},"children":{"01._hero":1703718436,"02._features":1703720151,"03._example":1703716188,"04._comparison-pdf":1703719134,"05._info":1703720014,"06._any_device":1704396086},"checksum":"dbbcfea030db5994b105e013be94b15c"},"01.home\/01._hero":{"key":"home\/_hero","storage_key":"01.home\/01._hero","template":"hero","storage_timestamp":1703718436,"markdown":{"":{"hero":1703718436}},"checksum":"45dc2f4a454b5f0609cbe09cfda09790"},"01.home\/02._features":{"key":"home\/_features","storage_key":"01.home\/02._features","template":"features","storage_timestamp":1703720151,"markdown":{"":{"features":1703720151}},"checksum":"ed7be750188fc4ed50ebcdc060f6fb53"},"01.home\/03._example":{"key":"home\/_example","storage_key":"01.home\/03._example","template":"text","storage_timestamp":1703716188,"markdown":{"":{"text":1703713545}},"checksum":"48b2ea373eba19040584a991b21c083c"},"01.home\/04._comparison-pdf":{"key":"home\/_comparison-pdf","storage_key":"01.home\/04._comparison-pdf","template":"text","storage_timestamp":1703719134,"markdown":{"":{"text":1703719134}},"checksum":"f323d6050403b0102c73c174d74b2f0a"},"01.home\/05._info":{"key":"home\/_info","storage_key":"01.home\/05._info","template":"features","storage_timestamp":1703720014,"markdown":{"":{"features":1703720014}},"checksum":"35c9bee0f74fe81449a491e31bf81bcb"},"01.home\/06._any_device":{"key":"home\/_any_device","storage_key":"01.home\/06._any_device","template":"text","storage_timestamp":1704397975,"markdown":{"":{"text":1704397975}},"checksum":"aabfe01503028954e8557c5bff37048d"},"02.about":{"key":"about","storage_key":"02.about","template":"default","storage_timestamp":1704398516,"markdown":{"":{"default":1704398516}},"checksum":"3d12d8cc95786aef7316b6c379752aa0"},"03.typography":{"key":"typography","storage_key":"03.typography","template":"default","storage_timestamp":1703638467,"markdown":{"":{"default":1696264967}},"checksum":"e18e25aa1028384a58d66d7b5c74b799"},"04.pricing":{"key":"pricing","storage_key":"04.pricing","template":"default","storage_timestamp":1704400398,"markdown":{"":{"default":1704400398}},"checksum":"76ddfc1dafa27268dca3f24db2ffa05a"},"05.blog":{"key":"blog","storage_key":"05.blog","template":"blog","storage_timestamp":1703638467,"markdown":{"":{"blog":1703636303}},"checksum":"88a8e8a7109dc2957e9dc3e1fd81fa85"},"06.register":{"key":"register","storage_key":"06.register","template":"registration","storage_timestamp":1710807003,"markdown":{"":{"registration":1710807003}},"checksum":"af484cd05f9e8645375ff24f629962b1"},"07.app":{"key":"app","storage_key":"07.app","template":"app","storage_timestamp":1710872704,"markdown":{"":{"app":1710871467}},"checksum":"63be85bdb5a595cc43cf9137122fc997"}}}

+ 1
- 1
grav-admin/user/data/notifications/21232f297a57a5a743894a0e4a801fc3.yaml Näytä tiedosto

@@ -1,4 +1,4 @@
last_checked: 1710866946 last_checked: 1710872256
data: data:
feed: feed:
- -


+ 5
- 0
grav-admin/user/pages/07.app/app.md Näytä tiedosto

@@ -0,0 +1,5 @@
---
title: App
---

## Welcome

+ 0
- 5
grav-admin/user/pages/07.login/form.md Näytä tiedosto

@@ -1,5 +0,0 @@
---
title: Login
---

## Welcome

+ 12
- 0
grav-admin/user/themes/quark/templates/app.html.twig Näytä tiedosto

@@ -0,0 +1,12 @@
{% extends 'partials/base.html.twig' %}

{% block javascripts %}
{{ parent() }}
{% do assets.add('theme://js/bricklayer.min.js') %}
{% do assets.add('theme://assets/app.js', {group:'bottom'}) %}
{% endblock %}

{% block content %}
{{ page.content|raw }}
<div id="app"></div>
{% endblock %}

+ 1
- 1
grav-admin/user/themes/quark/templates/macros/macros.html.twig Näytä tiedosto

@@ -20,7 +20,7 @@
{% set active_page = (p.active or p.activeChild) ? 'active' : '' %} {% set active_page = (p.active or p.activeChild) ? 'active' : '' %}
<li> <li>
<a href="{{ p.url }}" class="{{ active_page }}"> <a href="{{ p.url }}" class="{{ active_page }}">
{{ p.menu }} {{p.header.access.onlyguests}} {{ p.menu }}
</a> </a>
{% if p.children.visible.count > 0 %} {% if p.children.visible.count > 0 %}
<ul> <ul>


+ 0
- 21
skouter.go Näytä tiedosto

@@ -3715,26 +3715,6 @@ func api(w http.ResponseWriter, r *http.Request) {
db.Close() db.Close()
} }


func route(w http.ResponseWriter, r *http.Request) {
var page Page
var args []string
p := r.URL.Path

switch {
case r.Method == "GET" && match(p, "/", &args):
page = pages["home"]
case match(p, "/terms", &args):
page = pages["terms"]
case match(p, "/app", &args):
page = pages["app"]
default:
http.NotFound(w, r)
return
}

page.Render(w)
}

// The grav frontend does not have controllers to communicate state // The grav frontend does not have controllers to communicate state
// with backend so the user's login status must be represented by a // with backend so the user's login status must be represented by a
// query parameter during proxy. // query parameter during proxy.
@@ -3768,7 +3748,6 @@ func serve() {


http.Handle("/assets/", files) http.Handle("/assets/", files)
http.HandleFunc("/api/", api) http.HandleFunc("/api/", api)
http.HandleFunc("/app", route)
http.Handle("/", proxy) http.Handle("/", proxy)
log.Fatal(http.ListenAndServe(address, nil)) log.Fatal(http.ListenAndServe(address, nil))
} }


||||||
x
 
000:0
Loading…
Peruuta
Tallenna