Added bbCode support to pages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module github.com/CalebQ42/darkstorm-server
|
||||
|
||||
go 1.21.4
|
||||
go 1.21.5
|
||||
|
||||
require (
|
||||
github.com/1lann/udp-forward v0.0.0-20191015034046-6b774a53ea39
|
||||
@@ -8,6 +8,7 @@ require (
|
||||
github.com/CalebQ42/stupid-backend/v2 v2.0.1
|
||||
github.com/CalebQ42/swassistant-backend v0.2.0
|
||||
go.mongodb.org/mongo-driver v1.13.0
|
||||
github.com/CalebQ42/bbConvert v1.0.0
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
github.com/1lann/udp-forward v0.0.0-20191015034046-6b774a53ea39 h1:wAEqazqaAqb7wwijTl14KruBl7cvYytD3SkhXT9v5zs=
|
||||
github.com/1lann/udp-forward v0.0.0-20191015034046-6b774a53ea39/go.mod h1:zK6NTEHRcxPf9N4gcm0WXvE8RpsJfg/a8hMSW6dAQ0c=
|
||||
github.com/CalebQ42/bbConvert v1.0.0 h1:2WSAxVKhCCMReuU30r3ehLtL6m9aH8sY3wugp9yUdzg=
|
||||
github.com/CalebQ42/bbConvert v1.0.0/go.mod h1:QJevnlhzUdL3EJB5Lgqoi7rdgtzt/UEamn/QGNoVgkM=
|
||||
github.com/CalebQ42/cdr-backend v0.1.0 h1:9245aooAyLxAFO5gfXPgpqOHaYr6NAkMI75v2IlPOVA=
|
||||
github.com/CalebQ42/cdr-backend v0.1.0/go.mod h1:N7A+ia+4GDsDMZ3gb5IRZ6CY07gdFfJECtR9csKh5nI=
|
||||
github.com/CalebQ42/stupid-backend/v2 v2.0.1 h1:BACdi/3BEDE/vZsKvhZl1OAA74QnP/Zd5Hb8uNQCjrg=
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/CalebQ42/bbConvert"
|
||||
"github.com/CalebQ42/stupid-backend/v2"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
@@ -18,12 +19,16 @@ import (
|
||||
|
||||
type DarkstormTech struct {
|
||||
stupid.UnKeyedApp
|
||||
bb *bbConvert.HTMLConverter
|
||||
DB *mongo.Database
|
||||
filesFolder string
|
||||
}
|
||||
|
||||
func NewDarkstormTech(c *mongo.Client, filesFolder string) *DarkstormTech {
|
||||
bb := &bbConvert.HTMLConverter{}
|
||||
bb.ImplementDefaults()
|
||||
return &DarkstormTech{
|
||||
bb: bb,
|
||||
DB: c.Database("darkstormtech"),
|
||||
filesFolder: filesFolder,
|
||||
}
|
||||
@@ -60,7 +65,7 @@ func (d *DarkstormTech) HandleReqest(req *stupid.Request) bool {
|
||||
req.Resp.WriteHeader(http.StatusInternalServerError)
|
||||
return true
|
||||
}
|
||||
_, err = req.Resp.Write([]byte(pag.Content))
|
||||
_, err = req.Resp.Write([]byte(d.bb.Convert(pag.Content)))
|
||||
if err != nil {
|
||||
log.Println("Error while writing response:", err)
|
||||
req.Resp.WriteHeader(http.StatusInternalServerError)
|
||||
|
||||
Reference in New Issue
Block a user