diff --git a/README.md b/README.md index f7dae832..ae00bd50 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ The initial code-base was forked from one of my side projects, but has now gone Discord Server: https://discord.gg/eyYvtTf +If you like this software, please give it a star and give us some feedback :) + +If you dislike it, please give us some feedback on how to make it better! We're always looking for feedback. We love hearing your opinions. If there's something missing or something doesn't look quite right, don't worry! We plan to change many things before the alpha! + # Features Basic Forum Functionality. All of the little things you would expect of any forum software. E.g. Moderation, Custom Themes, Avatars, and so on. diff --git a/images/cosmo-profiles.PNG b/images/cosmo-profiles.PNG new file mode 100644 index 00000000..1511d67c Binary files /dev/null and b/images/cosmo-profiles.PNG differ diff --git a/images/plugin_bbcode_invalidurl.PNG b/images/plugin_bbcode_invalidurl.PNG new file mode 100644 index 00000000..9366c13f Binary files /dev/null and b/images/plugin_bbcode_invalidurl.PNG differ diff --git a/images/profiles.PNG b/images/profiles.PNG deleted file mode 100644 index 1e63c3f8..00000000 Binary files a/images/profiles.PNG and /dev/null differ diff --git a/images/tempra-conflux-mobile-320px.png b/images/tempra-conflux-mobile-320px.png new file mode 100644 index 00000000..26a786ef Binary files /dev/null and b/images/tempra-conflux-mobile-320px.png differ diff --git a/images/laptop-1440px.PNG b/images/tempra-simple-laptop-1440px.png similarity index 100% rename from images/laptop-1440px.PNG rename to images/tempra-simple-laptop-1440px.png diff --git a/images/mobile-320px.PNG b/images/tempra-simple-mobile-320px.png similarity index 100% rename from images/mobile-320px.PNG rename to images/tempra-simple-mobile-320px.png diff --git a/images/mobile-375px.PNG b/images/tempra-simple-mobile-375px.png similarity index 100% rename from images/mobile-375px.PNG rename to images/tempra-simple-mobile-375px.png diff --git a/images/mobile-425px.PNG b/images/tempra-simple-mobile-425px.png similarity index 100% rename from images/mobile-425px.PNG rename to images/tempra-simple-mobile-425px.png diff --git a/images/tempra-simple-profiles.PNG b/images/tempra-simple-profiles.PNG new file mode 100644 index 00000000..c6cd0f05 Binary files /dev/null and b/images/tempra-simple-profiles.PNG differ diff --git a/images/tempra-simple-profiles2.png b/images/tempra-simple-profiles2.png new file mode 100644 index 00000000..c08fa6a2 Binary files /dev/null and b/images/tempra-simple-profiles2.png differ diff --git a/images/tablet-1024px.PNG b/images/tempra-simple-tablet-1024px.png similarity index 100% rename from images/tablet-1024px.PNG rename to images/tempra-simple-tablet-1024px.png diff --git a/images/tablet-768px.PNG b/images/tempra-simple-tablet-768px.png similarity index 100% rename from images/tablet-768px.PNG rename to images/tempra-simple-tablet-768px.png diff --git a/plugin_bbcode.go b/plugin_bbcode.go index 4caa8d40..ce230aa0 100644 --- a/plugin_bbcode.go +++ b/plugin_bbcode.go @@ -1,7 +1,14 @@ package main +//import "log" +//import "fmt" +import "bytes" //import "strings" import "regexp" +var bbcode_invalid_url []byte +var bbcode_url_open []byte +var bbcode_url_open2 []byte +var bbcode_url_close []byte var bbcode_bold *regexp.Regexp var bbcode_italic *regexp.Regexp var bbcode_underline *regexp.Regexp @@ -14,8 +21,13 @@ func init() { } func init_bbcode() { - plugins["bbcode"].AddHook("parse_assign", bbcode_parse_without_code) - //plugins["bbcode"].AddHook("parse_assign", bbcode_full_parse) + //plugins["bbcode"].AddHook("parse_assign", bbcode_parse_without_code) + plugins["bbcode"].AddHook("parse_assign", bbcode_full_parse) + + bbcode_invalid_url = []byte("[Invalid URL]") + bbcode_url_open = []byte("") + bbcode_url_close = []byte("") bbcode_bold = regexp.MustCompile(`(?s)\[b\](.*)\[/b\]`) bbcode_italic = regexp.MustCompile(`(?s)\[i\](.*)\[/i\]`) @@ -27,8 +39,8 @@ func init_bbcode() { } func deactivate_bbcode() { - plugins["bbcode"].RemoveHook("parse_assign", bbcode_parse_without_code) - //plugins["bbcode"].RemoveHook("parse_assign", bbcode_full_parse) + //plugins["bbcode"].RemoveHook("parse_assign", bbcode_parse_without_code) + plugins["bbcode"].RemoveHook("parse_assign", bbcode_full_parse) } func bbcode_regex_parse(data interface{}) interface{} { @@ -147,13 +159,12 @@ func bbcode_parse_without_code(data interface{}) interface{} { closer := []byte("") msgbytes = append(msgbytes, closer...) } - msg = string(msgbytes) if complex_bbc { msg = bbcode_url.ReplaceAllString(msg,"$1$2//$3") msg = bbcode_url_label.ReplaceAllString(msg,"$4") } - return msg + return string(msgbytes) } // Does every type of BBCode @@ -233,13 +244,73 @@ func bbcode_full_parse(data interface{}) interface{} { closer := []byte("") msgbytes = append(msgbytes, closer...) } - msg = string(msgbytes) if complex_bbc { - msg = bbcode_url.ReplaceAllString(msg,"$1$2//$3") + var start int + var lastTag int + var outbytes []byte + for i := 0; i < len(msgbytes); i++ { + MainLoop: + if msgbytes[i] == '[' { + OuterComplex: + if msgbytes[i + 1] == 'u' { + if msgbytes[i + 2] == 'r' && msgbytes[i + 3] == 'l' && msgbytes[i + 4] == ']' { + outbytes = append(outbytes, msgbytes[lastTag:i]...) + start = i + 5 + i = start + if msgbytes[i] == 'h' { + if msgbytes[i + 1] == 't' && msgbytes[i + 2] == 't' && msgbytes[i + 3] == 'p' { + if bytes.Equal(msgbytes[i + 4:i + 7],[]byte("s://")) { + i += 7 + } else if msgbytes[i + 4] == ':' && msgbytes[i + 5] == '/' && msgbytes[i + 6] == '/' { + i += 6 + } else { + outbytes = append(outbytes, bbcode_invalid_url...) + continue + } + } + } else if msgbytes[i] == 'f' { + if bytes.Equal(msgbytes[i + 1:i + 5],[]byte("tp://")) { + i += 5 + } + } + + for ;; i++ { + if msgbytes[i] == '[' { + if !bytes.Equal(msgbytes[i + 1:i + 6],[]byte("/url]")) { + //log.Print("Not the URL closing tag!") + //fmt.Println(msgbytes[i + 1:i + 6]) + goto OuterComplex + } + break + } else if msgbytes[i] != '\\' && msgbytes[i] != '_' && !(msgbytes[i] > 44 && msgbytes[i] < 58) && !(msgbytes[i] > 64 && msgbytes[i] < 91) && !(msgbytes[i] > 96 && msgbytes[i] < 123) { + outbytes = append(outbytes, bbcode_invalid_url...) + //log.Print("Weird character") + //fmt.Println(msgbytes[i]) + goto MainLoop + } + } + outbytes = append(outbytes, bbcode_url_open...) + outbytes = append(outbytes, msgbytes[start:i]...) + outbytes = append(outbytes, bbcode_url_open2...) + outbytes = append(outbytes, msgbytes[start:i]...) + outbytes = append(outbytes, bbcode_url_close...) + i += 6 + lastTag = i + } + } + } + } + if len(outbytes) != 0 { + return string(outbytes) + } + + msg = string(msgbytes) + //msg = bbcode_url.ReplaceAllString(msg,"$1$2//$3") msg = bbcode_url_label.ReplaceAllString(msg,"$4") - //msg = strings.Replace(msg,"[code]","",-1) - //msg = strings.Replace(msg,"[/code]","",-1) + // Convert [code] into class="codequotes" + } else { + msg = string(msgbytes) } return msg } \ No newline at end of file diff --git a/routes.go b/routes.go index f076f5c8..c5bb014a 100644 --- a/routes.go +++ b/routes.go @@ -109,7 +109,7 @@ func route_topics(w http.ResponseWriter, r *http.Request){ } if topicItem.Is_Closed { - topicItem.Status = "shut" + topicItem.Status = "closed" } else { topicItem.Status = "open" } @@ -183,7 +183,7 @@ func route_forum(w http.ResponseWriter, r *http.Request){ } if topicItem.Is_Closed { - topicItem.Status = "shut" + topicItem.Status = "closed" } else { topicItem.Status = "open" } @@ -297,7 +297,7 @@ func route_topic_id(w http.ResponseWriter, r *http.Request){ topic.ContentLines = strings.Count(content,"\n") if topic.Is_Closed { - topic.Status = "shut" + topic.Status = "closed" // We don't want users posting in locked topics... if !user.Is_Mod { diff --git a/template_forum.go b/template_forum.go index 36b87421..89cc1ca9 100644 --- a/template_forum.go +++ b/template_forum.go @@ -86,7 +86,7 @@ w.Write([]byte(`background-color: #eaeaea;`)) w.Write([]byte(`"> ` + item.Title + ` `)) if item.Is_Closed { -w.Write([]byte(`shut +w.Write([]byte(`closed `)) } else { w.Write([]byte(` `)) diff --git a/template_profile.go b/template_profile.go index 18abf87c..5c02a28d 100644 --- a/template_profile.go +++ b/template_profile.go @@ -66,7 +66,7 @@ w.Write([]byte(`