2017-09-03 04:50:31 +00:00
/ *
*
* Gosora Installer
* Copyright Azareal 2017 - 2018
*
* /
2017-01-10 06:51:28 +00:00
package main
2017-06-06 08:47:33 +00:00
import (
"bufio"
2017-10-14 07:39:22 +00:00
"errors"
2017-09-03 04:50:31 +00:00
"fmt"
"os"
2017-07-12 11:05:18 +00:00
"runtime/debug"
2017-09-03 04:50:31 +00:00
"strconv"
2017-10-14 07:39:22 +00:00
"./install"
2017-06-06 08:47:33 +00:00
)
2017-01-10 06:51:28 +00:00
var scanner * bufio . Scanner
2017-07-12 11:05:18 +00:00
Added Quick Topic.
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!
2017-10-05 10:20:28 +00:00
var siteShortName string
var siteName string
var siteURL string
var serverPort string
2017-09-03 04:50:31 +00:00
var defaultAdapter = "mysql"
var defaultHost = "localhost"
var defaultUsername = "root"
var defaultDbname = "gosora"
Added Quick Topic.
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!
2017-10-05 10:20:28 +00:00
var defaultSiteShortName = "SN"
2017-09-03 04:50:31 +00:00
var defaultSiteName = "Site Name"
var defaultsiteURL = "localhost"
var defaultServerPort = "80" // 8080's a good one, if you're testing and don't want it to clash with port 80
2017-01-10 06:51:28 +00:00
func main ( ) {
2017-10-14 07:39:22 +00:00
// Capture panics instead of closing the window at a superhuman speed before the user can read the message on Windows
2017-07-12 11:05:18 +00:00
defer func ( ) {
r := recover ( )
if r != nil {
fmt . Println ( r )
debug . PrintStack ( )
2017-09-03 04:50:31 +00:00
pressAnyKey ( )
2017-07-12 11:05:18 +00:00
return
}
} ( )
2017-09-03 04:50:31 +00:00
2017-01-10 06:51:28 +00:00
scanner = bufio . NewScanner ( os . Stdin )
fmt . Println ( "Welcome to Gosora's Installer" )
fmt . Println ( "We're going to take you through a few steps to help you get started :)" )
2017-10-14 07:39:22 +00:00
adap , ok := handleDatabaseDetails ( )
if ! ok {
2017-01-10 06:51:28 +00:00
err := scanner . Err ( )
if err != nil {
fmt . Println ( err )
} else {
2017-10-14 07:39:22 +00:00
err = errors . New ( "Something went wrong!" )
2017-01-10 06:51:28 +00:00
}
2017-10-14 07:39:22 +00:00
abortError ( err )
2017-01-10 06:51:28 +00:00
return
}
2017-06-06 08:47:33 +00:00
2017-09-03 04:50:31 +00:00
if ! getSiteDetails ( ) {
2017-01-10 06:51:28 +00:00
err := scanner . Err ( )
if err != nil {
fmt . Println ( err )
} else {
2017-10-14 07:39:22 +00:00
err = errors . New ( "Something went wrong!" )
2017-01-10 06:51:28 +00:00
}
2017-10-14 07:39:22 +00:00
abortError ( err )
2017-01-10 06:51:28 +00:00
return
}
2017-09-03 04:50:31 +00:00
2017-10-14 07:39:22 +00:00
err := adap . InitDatabase ( )
2017-01-10 06:51:28 +00:00
if err != nil {
2017-10-14 07:39:22 +00:00
abortError ( err )
2017-01-10 06:51:28 +00:00
return
}
2017-09-03 04:50:31 +00:00
2017-10-14 07:39:22 +00:00
err = adap . TableDefs ( )
2017-07-12 11:05:18 +00:00
if err != nil {
2017-10-14 07:39:22 +00:00
abortError ( err )
2017-01-10 06:51:28 +00:00
return
}
2017-09-03 04:50:31 +00:00
2017-10-14 07:39:22 +00:00
err = adap . CreateAdmin ( )
2017-07-12 11:05:18 +00:00
if err != nil {
2017-10-14 07:39:22 +00:00
abortError ( err )
2017-07-12 11:05:18 +00:00
return
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
2017-10-14 07:39:22 +00:00
err = adap . InitialData ( )
2017-01-10 06:51:28 +00:00
if err != nil {
2017-10-14 07:39:22 +00:00
abortError ( err )
2017-01-10 06:51:28 +00:00
return
}
2017-09-03 04:50:31 +00:00
2017-01-10 06:51:28 +00:00
configContents := [ ] byte ( ` package main
2017-11-11 04:06:16 +00:00
import "./common"
2017-07-17 10:23:42 +00:00
func init ( ) {
Added Quick Topic.
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!
2017-10-05 10:20:28 +00:00
// Site Info
2017-11-11 04:06:16 +00:00
common . Site . ShortName = "` + siteShortName + `" // This should be less than three letters to fit in the navbar
common . Site . Name = "` + siteName + `"
common . Site . Email = ""
common . Site . URL = "` + siteURL + `"
common . Site . Port = "` + serverPort + `"
common . Site . EnableSsl = false
common . Site . EnableEmails = false
common . Site . HasProxy = false // Cloudflare counts as this, if it's sitting in the middle
common . Config . SslPrivkey = ""
common . Config . SslFullchain = ""
common . Site . Language = "english"
Added Quick Topic.
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!
2017-10-05 10:20:28 +00:00
// Database details
2017-11-11 04:06:16 +00:00
common . DbConfig . Host = "` + adap.DBHost() + `"
common . DbConfig . Username = "` + adap.DBUsername() + `"
common . DbConfig . Password = "` + adap.DBPassword() + `"
common . DbConfig . Dbname = "` + adap.DBName() + `"
common . DbConfig . Port = "` + adap.DBPort() + `" // You probably won't need to change this
2017-10-14 07:39:22 +00:00
// Test Database details
2017-11-11 04:06:16 +00:00
common . DbConfig . TestHost = ""
common . DbConfig . TestUsername = ""
common . DbConfig . TestPassword = ""
common . DbConfig . TestDbname = "" // The name of the test database, leave blank to disable. DON'T USE YOUR PRODUCTION DATABASE FOR THIS. LEAVE BLANK IF YOU DON'T KNOW WHAT THIS MEANS.
common . DbConfig . TestPort = ""
Added Quick Topic.
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!
2017-10-05 10:20:28 +00:00
// Limiters
2017-11-11 04:06:16 +00:00
common . Config . MaxRequestSize = 5 * common . Megabyte
Added Quick Topic.
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!
2017-10-05 10:20:28 +00:00
// Caching
2017-11-11 04:06:16 +00:00
common . Config . CacheTopicUser = common . CACHE_STATIC
common . Config . UserCacheCapacity = 120 // The max number of users held in memory
common . Config . TopicCacheCapacity = 200 // The max number of topics held in memory
Added Quick Topic.
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!
2017-10-05 10:20:28 +00:00
// Email
2017-11-11 04:06:16 +00:00
common . Config . SMTPServer = ""
common . Config . SMTPUsername = ""
common . Config . SMTPPassword = ""
common . Config . SMTPPort = "25"
Added Quick Topic.
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!
2017-10-05 10:20:28 +00:00
// Misc
2018-02-10 15:07:21 +00:00
common . Config . DefaultRoute = "routes.TopicList"
2017-11-11 04:06:16 +00:00
common . Config . DefaultGroup = 3 // Should be a setting in the database
common . Config . ActivationGroup = 5 // Should be a setting in the database
common . Config . StaffCSS = "staff_post"
common . Config . DefaultForum = 2
common . Config . MinifyTemplates = true
2018-04-03 04:34:07 +00:00
common . Config . BuildSlugs = true
2018-02-15 13:15:27 +00:00
common . Config . ServerCount = 1 // Experimental: Enable Cross-Server Synchronisation and several other features
2017-11-11 04:06:16 +00:00
//common.Config.Noavatar = "https://api.adorable.io/avatars/{width}/{id}@{site_url}.png"
common . Config . Noavatar = "https://api.adorable.io/avatars/285/{id}@{site_url}.png"
common . Config . ItemsPerPage = 25
Added Quick Topic.
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!
2017-10-05 10:20:28 +00:00
// Developer flags
2017-11-11 04:06:16 +00:00
common . Dev . DebugMode = true
//common.Dev.SuperDebug = true
//common.Dev.TemplateDebug = true
//common.Dev.Profiling = true
//common.Dev.TestDB = true
2017-07-17 10:23:42 +00:00
}
2017-01-10 06:51:28 +00:00
` )
2017-06-06 08:47:33 +00:00
2017-01-10 06:51:28 +00:00
fmt . Println ( "Opening the configuration file" )
configFile , err := os . Create ( "./config.go" )
if err != nil {
2017-10-14 07:39:22 +00:00
abortError ( err )
2017-01-10 06:51:28 +00:00
return
}
2017-06-06 08:47:33 +00:00
2017-01-10 06:51:28 +00:00
fmt . Println ( "Writing to the configuration file..." )
_ , err = configFile . Write ( configContents )
if err != nil {
2017-10-14 07:39:22 +00:00
abortError ( err )
2017-01-10 06:51:28 +00:00
return
}
2017-06-06 08:47:33 +00:00
2017-01-10 06:51:28 +00:00
configFile . Sync ( )
configFile . Close ( )
fmt . Println ( "Finished writing to the configuration file" )
2017-06-06 08:47:33 +00:00
2017-01-10 06:51:28 +00:00
fmt . Println ( "Yay, you have successfully installed Gosora!" )
fmt . Println ( "Your name is Admin and you can login with the password 'password'. Don't forget to change it! Seriously. It's really insecure." )
2017-09-03 04:50:31 +00:00
pressAnyKey ( )
2017-01-10 06:51:28 +00:00
}
2017-10-14 07:39:22 +00:00
func abortError ( err error ) {
fmt . Println ( err )
fmt . Println ( "Aborting installation..." )
pressAnyKey ( )
}
func handleDatabaseDetails ( ) ( adap install . InstallAdapter , ok bool ) {
2017-10-31 00:33:14 +00:00
var dbAdapter string
2017-10-14 07:39:22 +00:00
var dbHost string
var dbUsername string
var dbPassword string
var dbName string
2018-03-21 05:56:33 +00:00
// TODO: Let the admin set the database port?
//var dbPort string
2017-10-14 07:39:22 +00:00
for {
2017-10-30 23:34:38 +00:00
fmt . Println ( "Which database adapter do you wish to use? mysql, mssql, or mysql? Default: mysql" )
2017-10-14 07:39:22 +00:00
if ! scanner . Scan ( ) {
return nil , false
}
dbAdapter := scanner . Text ( )
if dbAdapter == "" {
dbAdapter = defaultAdapter
}
adap , ok = install . Lookup ( dbAdapter )
if ok {
break
}
fmt . Println ( "That adapter doesn't exist" )
2017-07-12 11:05:18 +00:00
}
2017-09-03 04:50:31 +00:00
fmt . Println ( "Set database adapter to " + dbAdapter )
fmt . Println ( "Database Host? Default: " + defaultHost )
2017-01-10 06:51:28 +00:00
if ! scanner . Scan ( ) {
2017-10-14 07:39:22 +00:00
return nil , false
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
dbHost = scanner . Text ( )
if dbHost == "" {
dbHost = defaultHost
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
fmt . Println ( "Set database host to " + dbHost )
2017-06-06 08:47:33 +00:00
2017-09-03 04:50:31 +00:00
fmt . Println ( "Database Username? Default: " + defaultUsername )
2017-01-10 06:51:28 +00:00
if ! scanner . Scan ( ) {
2017-10-14 07:39:22 +00:00
return nil , false
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
dbUsername = scanner . Text ( )
if dbUsername == "" {
dbUsername = defaultUsername
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
fmt . Println ( "Set database username to " + dbUsername )
2017-06-06 08:47:33 +00:00
2017-01-10 06:51:28 +00:00
fmt . Println ( "Database Password? Default: ''" )
if ! scanner . Scan ( ) {
2017-10-14 07:39:22 +00:00
return nil , false
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
dbPassword = scanner . Text ( )
if len ( dbPassword ) == 0 {
fmt . Println ( "You didn't set a password for this user. This won't block the installation process, but it might create security issues in the future." )
fmt . Println ( "" )
2017-01-10 06:51:28 +00:00
} else {
2017-09-03 04:50:31 +00:00
fmt . Println ( "Set password to " + obfuscatePassword ( dbPassword ) )
2017-01-10 06:51:28 +00:00
}
2017-06-06 08:47:33 +00:00
2017-09-03 04:50:31 +00:00
fmt . Println ( "Database Name? Pick a name you like or one provided to you. Default: " + defaultDbname )
2017-01-10 06:51:28 +00:00
if ! scanner . Scan ( ) {
2017-10-14 07:39:22 +00:00
return nil , false
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
dbName = scanner . Text ( )
if dbName == "" {
dbName = defaultDbname
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
fmt . Println ( "Set database name to " + dbName )
2017-10-14 07:39:22 +00:00
adap . SetConfig ( dbHost , dbUsername , dbPassword , dbName , adap . DefaultPort ( ) )
return adap , true
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
func getSiteDetails ( ) bool {
2017-01-10 06:51:28 +00:00
fmt . Println ( "Okay. We also need to know some actual information about your site!" )
2017-09-03 04:50:31 +00:00
fmt . Println ( "What's your site's name? Default: " + defaultSiteName )
2017-01-10 06:51:28 +00:00
if ! scanner . Scan ( ) {
return false
}
2017-09-03 04:50:31 +00:00
siteName = scanner . Text ( )
if siteName == "" {
siteName = defaultSiteName
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
fmt . Println ( "Set the site name to " + siteName )
2017-06-06 08:47:33 +00:00
Added Quick Topic.
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!
2017-10-05 10:20:28 +00:00
// ? - We could compute this based on the first letter of each word in the site's name, if it's name spans multiple words. I'm not sure how to do this for single word names.
fmt . Println ( "Can we have a short abbreviation for your site? Default: " + defaultSiteShortName )
if ! scanner . Scan ( ) {
return false
}
siteShortName = scanner . Text ( )
if siteShortName == "" {
siteShortName = defaultSiteShortName
}
2017-10-30 23:34:38 +00:00
fmt . Println ( "Set the short name to " + siteShortName )
Added Quick Topic.
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!
2017-10-05 10:20:28 +00:00
2017-09-03 04:50:31 +00:00
fmt . Println ( "What's your site's url? Default: " + defaultsiteURL )
2017-01-10 06:51:28 +00:00
if ! scanner . Scan ( ) {
return false
}
2017-09-03 04:50:31 +00:00
siteURL = scanner . Text ( )
if siteURL == "" {
siteURL = defaultsiteURL
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
fmt . Println ( "Set the site url to " + siteURL )
2017-06-06 08:47:33 +00:00
2017-09-03 04:50:31 +00:00
fmt . Println ( "What port do you want the server to listen on? If you don't know what this means, you should probably leave it on the default. Default: " + defaultServerPort )
2017-01-10 06:51:28 +00:00
if ! scanner . Scan ( ) {
return false
}
2017-09-03 04:50:31 +00:00
serverPort = scanner . Text ( )
if serverPort == "" {
serverPort = defaultServerPort
2017-01-10 06:51:28 +00:00
}
2017-09-03 04:50:31 +00:00
_ , err := strconv . Atoi ( serverPort )
2017-01-12 02:55:08 +00:00
if err != nil {
fmt . Println ( "That's not a valid number!" )
return false
}
2017-09-03 04:50:31 +00:00
fmt . Println ( "Set the server port to " + serverPort )
2017-01-10 06:51:28 +00:00
return true
}
2017-09-03 04:50:31 +00:00
func obfuscatePassword ( password string ) ( out string ) {
2017-01-10 06:51:28 +00:00
for i := 0 ; i < len ( password ) ; i ++ {
out += "*"
}
return out
}
2017-09-03 04:50:31 +00:00
func pressAnyKey ( ) {
2017-01-10 06:51:28 +00:00
//fmt.Println("Press any key to exit...")
fmt . Println ( "Please press enter to exit..." )
for scanner . Scan ( ) {
_ = scanner . Text ( )
return
}
2017-06-06 08:47:33 +00:00
}