22650aad27
Added Attachments. Added Attachment Media Embeds. Renamed a load of *Store and *Cache methods to reduce the amount of unneccesary typing. Added petabytes as a unit and cleaned up a few of the friendly units. Refactored the username change logic to make it easier to maintain. Refactored the avatar change logic to make it easier to maintain. Shadow now uses CSS Variables for most of it's colours. We have plans to transpile this to support older browsers later on! Snuck some CSS Variables into Tempra Conflux. Added the GroupCache interface to MemoryGroupStore. Added the Length method to MemoryGroupStore. Added support for a site short name. Added the UploadFiles permission. Renamed more functions. Fixed the background for the left gutter on the postbit for Tempra Simple and Shadow. Added support for if statements operating on int8, int16, int32, int32, int64, uint, uint8, uint16, uint32, uint64, float32, and float64 for the template compiler. Added support for if statements operating on slices and maps for the template compiler. Fixed a security exploit in reply editing. Fixed a bug in the URL detector in the parser where it couldn't find URLs with non-standard ports. Fixed buttons having blue outlines on focus on Shadow. Refactored the topic creation logic to make it easier to maintain. Made a few responsive fixes, but there's still more to do in the following commits!
83 lines
2.1 KiB
Go
83 lines
2.1 KiB
Go
package main
|
|
|
|
import (
|
|
"errors"
|
|
"net/http"
|
|
"strings"
|
|
)
|
|
|
|
var site = &Site{Name: "Magical Fairy Land", Language: "english"}
|
|
var dbConfig = DBConfig{Host: "localhost"}
|
|
var config Config
|
|
var dev DevConfig
|
|
|
|
type Site struct {
|
|
ShortName string
|
|
Name string // ? - Move this into the settings table? Should we make a second version of this for the abbreviation shown in the navbar?
|
|
Email string // ? - Move this into the settings table?
|
|
URL string
|
|
Port string
|
|
EnableSsl bool
|
|
EnableEmails bool
|
|
HasProxy bool
|
|
Language string // ? - Move this into the settings table?
|
|
}
|
|
|
|
type DBConfig struct {
|
|
Host string
|
|
Username string
|
|
Password string
|
|
Dbname string
|
|
Port string
|
|
}
|
|
|
|
type Config struct {
|
|
SslPrivkey string
|
|
SslFullchain string
|
|
|
|
MaxRequestSize int
|
|
CacheTopicUser int
|
|
UserCacheCapacity int
|
|
TopicCacheCapacity int
|
|
|
|
SMTPServer string
|
|
SMTPUsername string
|
|
SMTPPassword string
|
|
SMTPPort string
|
|
|
|
DefaultRoute func(http.ResponseWriter, *http.Request, User)
|
|
DefaultGroup int
|
|
ActivationGroup int
|
|
StaffCSS string // ? - Move this into the settings table? Might be better to implement this as Group CSS
|
|
DefaultForum int // The forum posts go in by default, this used to be covered by the Uncategorised Forum, but we want to replace it with a more robust solution. Make this a setting?
|
|
MinifyTemplates bool
|
|
MultiServer bool
|
|
|
|
Noavatar string // ? - Move this into the settings table?
|
|
ItemsPerPage int // ? - Move this into the settings table?
|
|
}
|
|
|
|
type DevConfig struct {
|
|
DebugMode bool
|
|
SuperDebug bool
|
|
TemplateDebug bool
|
|
Profiling bool
|
|
}
|
|
|
|
func processConfig() {
|
|
config.Noavatar = strings.Replace(config.Noavatar, "{site_url}", site.URL, -1)
|
|
if site.Port != "80" && site.Port != "443" {
|
|
site.URL = strings.TrimSuffix(site.URL, "/")
|
|
site.URL = strings.TrimSuffix(site.URL, "\\")
|
|
site.URL = strings.TrimSuffix(site.URL, ":")
|
|
site.URL = site.URL + ":" + site.Port
|
|
}
|
|
}
|
|
|
|
func verifyConfig() error {
|
|
if !fstore.Exists(config.DefaultForum) {
|
|
return errors.New("Invalid default forum")
|
|
}
|
|
return nil
|
|
}
|