sfw url stuff
This commit is contained in:
parent
695956f9bd
commit
dba84638c9
@ -74,8 +74,12 @@ func (self *catalogModel) Navbar() string {
|
|||||||
param["name"] = fmt.Sprintf("Catalog for %s", self.board)
|
param["name"] = fmt.Sprintf("Catalog for %s", self.board)
|
||||||
param["frontend"] = self.frontend
|
param["frontend"] = self.frontend
|
||||||
var links []LinkModel
|
var links []LinkModel
|
||||||
|
var sfw int
|
||||||
|
if self.SFW {
|
||||||
|
sfw = 1
|
||||||
|
}
|
||||||
links = append(links, linkModel{
|
links = append(links, linkModel{
|
||||||
link: fmt.Sprintf("%sb/%s/?lang=%s", self.prefix, self.board, self._i18n.Name),
|
link: fmt.Sprintf("%sb/%s/?lang=%s&sfw=%d", self.prefix, self.board, self._i18n.Name, sfw),
|
||||||
text: "Board index",
|
text: "Board index",
|
||||||
})
|
})
|
||||||
param["prefix"] = self.prefix
|
param["prefix"] = self.prefix
|
||||||
@ -192,6 +196,9 @@ func (self *boardModel) PageList() []LinkModel {
|
|||||||
if i == 0 {
|
if i == 0 {
|
||||||
board = fmt.Sprintf("%sb/%s/?lang=%s", self.prefix, self.board, self._i18n.Name)
|
board = fmt.Sprintf("%sb/%s/?lang=%s", self.prefix, self.board, self._i18n.Name)
|
||||||
}
|
}
|
||||||
|
if self.SFW {
|
||||||
|
board += "&sfw=1"
|
||||||
|
}
|
||||||
links = append(links, linkModel{
|
links = append(links, linkModel{
|
||||||
link: board,
|
link: board,
|
||||||
text: fmt.Sprintf("[ %d ]", i),
|
text: fmt.Sprintf("[ %d ]", i),
|
||||||
@ -525,7 +532,12 @@ func (self *post) PostURL() string {
|
|||||||
if i18n == nil {
|
if i18n == nil {
|
||||||
i18n = I18nProvider
|
i18n = I18nProvider
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%st/%s/?lang=%s#%s", self.Prefix(), HashMessageID(self.Parent), i18n.Name, self.PostHash())
|
u := fmt.Sprintf("%st/%s/?lang=%s", self.Prefix(), HashMessageID(self.Parent), i18n.Name)
|
||||||
|
if self.SFW {
|
||||||
|
u += "&sfw=1"
|
||||||
|
}
|
||||||
|
u += "#" + self.PostHash()
|
||||||
|
return u
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *post) Prefix() string {
|
func (self *post) Prefix() string {
|
||||||
@ -683,7 +695,11 @@ func (self *thread) BoardURL() string {
|
|||||||
if i18n == nil {
|
if i18n == nil {
|
||||||
i18n = I18nProvider
|
i18n = I18nProvider
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%sb/%s/?lang=%s", self.Prefix(), self.Board(), i18n.Name)
|
u := fmt.Sprintf("%sb/%s/?lang=%s", self.Prefix(), self.Board(), i18n.Name)
|
||||||
|
if self.SFW {
|
||||||
|
u += "&sfw=1"
|
||||||
|
}
|
||||||
|
return u
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *thread) PostCount() int {
|
func (self *thread) PostCount() int {
|
||||||
@ -725,6 +741,7 @@ func (self *thread) Replies() []PostModel {
|
|||||||
for idx, post := range self.Posts[1:] {
|
for idx, post := range self.Posts[1:] {
|
||||||
if post != nil {
|
if post != nil {
|
||||||
post.SetIndex(idx + 1)
|
post.SetIndex(idx + 1)
|
||||||
|
post.MarkSFW(self.SFW)
|
||||||
replies = append(replies, post)
|
replies = append(replies, post)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -756,6 +773,7 @@ func (self *thread) Truncate() ThreadModel {
|
|||||||
for _, p := range t.Posts {
|
for _, p := range t.Posts {
|
||||||
imgs += p.NumAttachments()
|
imgs += p.NumAttachments()
|
||||||
}
|
}
|
||||||
|
t.SFW = self.SFW
|
||||||
t.truncatedPostCount = len(self.Posts) - trunc
|
t.truncatedPostCount = len(self.Posts) - trunc
|
||||||
t.truncatedImageCount = self.ImageCount() - imgs
|
t.truncatedImageCount = self.ImageCount() - imgs
|
||||||
return t
|
return t
|
||||||
@ -789,6 +807,7 @@ func (self *thread) BumpLock() bool {
|
|||||||
func (self *thread) Update(db Database) {
|
func (self *thread) Update(db Database) {
|
||||||
root := self.Posts[0].MessageID()
|
root := self.Posts[0].MessageID()
|
||||||
self.Posts = append([]PostModel{self.Posts[0]}, db.GetThreadReplyPostModels(self.prefix, root, 0, 0)...)
|
self.Posts = append([]PostModel{self.Posts[0]}, db.GetThreadReplyPostModels(self.prefix, root, 0, 0)...)
|
||||||
|
self.MarkSFW(self.SFW)
|
||||||
self.dirty = false
|
self.dirty = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ func (self *PostgresDatabase) upgrade7to8() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *PostgresDatabase) upgrade8to9() {
|
func (self *PostgresDatabase) upgrade8to9() {
|
||||||
cmds := []string {
|
cmds := []string{
|
||||||
"ALTER TABLE ArticlePosts ADD COLUMN frontendpubkey TEXT",
|
"ALTER TABLE ArticlePosts ADD COLUMN frontendpubkey TEXT",
|
||||||
"CREATE TABLE IF NOT EXISTS nntpchan_pubkeys(status VARCHAR(16) NOT NULL, pubkey VARCHAR(64) PRIMARY KEY)",
|
"CREATE TABLE IF NOT EXISTS nntpchan_pubkeys(status VARCHAR(16) NOT NULL, pubkey VARCHAR(64) PRIMARY KEY)",
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user