aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel0 <77419041+FChannel0@users.noreply.github.com>2021-07-01 00:48:26 +0000
committerGitHub <noreply@github.com>2021-07-01 00:48:26 +0000
commit26e38b0e9ac4a9dd2e01312818eba4e84b02f1ca (patch)
tree718ae122dda4faf79ddff3c29c86205f968ece6f
parent0f7e3a6cf9ef67f7c0f8472925dcd24602224e4c (diff)
parent0fdc5e20c4de901d3042d88ae90a29092932ca92 (diff)
Merge pull request #22 from knotteye/master
return user to catalog when posting from catalog
-rw-r--r--client.go6
-rw-r--r--main.go6
-rw-r--r--static/bottom.html1
-rw-r--r--static/top.html1
4 files changed, 12 insertions, 2 deletions
diff --git a/client.go b/client.go
index cfa6b7f..49c7d0c 100644
--- a/client.go
+++ b/client.go
@@ -47,6 +47,7 @@ type PageData struct {
PostId string
Instance Actor
InstanceIndex []ObjectBase
+ ReturnTo string
}
type AdminPage struct {
@@ -103,7 +104,7 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co
postNum := strings.Replace(r.URL.EscapedPath(), "/" + actor.Name + "/", "", 1)
page, _ := strconv.Atoi(postNum)
-
+
var returnData PageData
returnData.Board.Name = actor.Name
@@ -116,6 +117,7 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co
returnData.Board.Domain = Domain
returnData.Board.Restricted = actor.Restricted
returnData.CurrentPage = page
+ returnData.ReturnTo = "feed"
returnData.Board.Post.Actor = actor.Id
@@ -159,6 +161,7 @@ func CatalogGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection C
returnData.Board.Domain = Domain
returnData.Board.Restricted = actor.Restricted
returnData.Key = *Key
+ returnData.ReturnTo = "catalog"
returnData.Board.Post.Actor = actor.Id
@@ -196,6 +199,7 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){
returnData.Board.ModCred, _ = GetPasswordFromSession(r)
returnData.Board.Domain = Domain
returnData.Board.Restricted = actor.Restricted
+ returnData.ReturnTo = "feed"
returnData.Board.Captcha = Domain + "/" + GetRandomCaptcha(db)
returnData.Board.CaptchaCode = GetCaptchaCode(returnData.Board.Captcha)
diff --git a/main.go b/main.go
index 76da453..6b40399 100644
--- a/main.go
+++ b/main.go
@@ -393,7 +393,11 @@ func main() {
}
}
- http.Redirect(w, r, Domain + "/" + r.FormValue("boardName"), http.StatusMovedPermanently)
+ if(r.FormValue("returnTo") == "catalog"){
+ http.Redirect(w, r, Domain + "/" + r.FormValue("boardName") + "/catalog", http.StatusMovedPermanently)
+ } else {
+ http.Redirect(w, r, Domain + "/" + r.FormValue("boardName"), http.StatusMovedPermanently)
+ }
return
}
diff --git a/static/bottom.html b/static/bottom.html
index 28750c8..db9606d 100644
--- a/static/bottom.html
+++ b/static/bottom.html
@@ -11,6 +11,7 @@
<input type="hidden" id="sendTo" name="sendTo" value="{{ .Board.To }}">
<input type="hidden" id="boardName" name="boardName" value="{{ .Board.Name }}">
<input type="hidden" id="captchaCode" name="captchaCode" value="{{ .Board.CaptchaCode }}">
+ <input type="hidden" id="returnTo" name="returnTo" value="{{ .ReturnTo }}">
<input type="checkbox" name="sensitive"><span>Mark attachment as sensitive</span><br><br>
<div style="width: 202px; margin: 0 auto; padding-top: 12px;">
<label for="captcha">Captcha:</label><br>
diff --git a/static/top.html b/static/top.html
index e2612e8..e55ce89 100644
--- a/static/top.html
+++ b/static/top.html
@@ -24,6 +24,7 @@
<input type="hidden" id="sendTo" name="sendTo" value="{{ .Board.To }}">
<input type="hidden" id="boardName" name="boardName" value="{{ .Board.Name }}">
<input type="hidden" id="captchaCode" name="captchaCode" value="{{ .Board.CaptchaCode }}">
+ <input type="hidden" id="returnTo" name="returnTo" value="{{ .ReturnTo }}">
<input type="file" id="file" name="file" {{ if gt $len 1 }} required {{ else }} {{ if eq $len 0 }} required {{ end }} {{ end }} ><br><br>
<input type="checkbox" name="sensitive"><span>Mark attachment as sensitive</span><br><br>
<label stye="display: inline-block;" for="captcha">Captcha:</label>