Add redirect uri to page
This commit is contained in:
parent
9e0d739162
commit
1af1ae164c
25
main.go
25
main.go
|
@ -80,7 +80,13 @@ type PagesRepository interface {
|
|||
RecentChanges() ([]Change, error)
|
||||
}
|
||||
|
||||
type pageBaseInfo struct {
|
||||
BaseURL string
|
||||
RedirectURI string
|
||||
}
|
||||
|
||||
type indexPage struct {
|
||||
pageBaseInfo
|
||||
Session *Session
|
||||
Title string
|
||||
Name string
|
||||
|
@ -89,6 +95,7 @@ type indexPage struct {
|
|||
}
|
||||
|
||||
type editPage struct {
|
||||
pageBaseInfo
|
||||
Session *Session
|
||||
Title string
|
||||
Content string
|
||||
|
@ -98,6 +105,7 @@ type editPage struct {
|
|||
}
|
||||
|
||||
type historyPage struct {
|
||||
pageBaseInfo
|
||||
Session *Session
|
||||
Title string
|
||||
Name string
|
||||
|
@ -105,6 +113,7 @@ type historyPage struct {
|
|||
}
|
||||
|
||||
type recentPage struct {
|
||||
pageBaseInfo
|
||||
Session *Session
|
||||
Title string
|
||||
Name string
|
||||
|
@ -273,6 +282,10 @@ func (h *historyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
err = t.Execute(w, historyPage{
|
||||
pageBaseInfo: pageBaseInfo{
|
||||
BaseURL: ClientID,
|
||||
RedirectURI: RedirectURI,
|
||||
},
|
||||
Session: sess,
|
||||
Title: "History of " + cleanTitle(page),
|
||||
Name: page,
|
||||
|
@ -383,6 +396,10 @@ func (h *editHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
data := editPage{
|
||||
pageBaseInfo: pageBaseInfo{
|
||||
BaseURL: ClientID,
|
||||
RedirectURI: RedirectURI,
|
||||
},
|
||||
Session: sess,
|
||||
Title: cleanTitle(page),
|
||||
Content: pageText,
|
||||
|
@ -484,6 +501,10 @@ func (h *indexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
pageText = md.RenderToString([]byte(pageText))
|
||||
|
||||
data := indexPage{
|
||||
pageBaseInfo: pageBaseInfo{
|
||||
BaseURL: ClientID,
|
||||
RedirectURI: RedirectURI,
|
||||
},
|
||||
Session: sess,
|
||||
Title: cleanTitle(page),
|
||||
Content: template.HTML(pageText),
|
||||
|
@ -554,6 +575,10 @@ func (h *recentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
err = t.Execute(w, recentPage{
|
||||
pageBaseInfo: pageBaseInfo{
|
||||
BaseURL: ClientID,
|
||||
RedirectURI: RedirectURI,
|
||||
},
|
||||
Session: sess,
|
||||
Title: "Recent changes",
|
||||
Name: "Recent changes",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="redirect_uri" href="{{ .RedirectURI }}" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css"/>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
||||
<title>{{ .Title }} - Wiki</title>
|
||||
|
@ -209,6 +210,11 @@
|
|||
{{ template "content" . }}
|
||||
</section>
|
||||
|
||||
<div class="h-app">
|
||||
<a href="/" class="u-url p-name">Wiki</a>
|
||||
— created by <a href="https://peterstuifzand.nl/">Peter Stuifzand</a>
|
||||
</div>
|
||||
|
||||
<div id="save-indicator" class="hidden"></div>
|
||||
</div>
|
||||
{{ block "footer_scripts" . }}
|
||||
|
|
Loading…
Reference in New Issue
Block a user