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