new styling for frontpage, update login and authorize templates (#46)

* new styling for frontpage, update login and authorize templates

* run go fmt

* add AssetBaseDir to command flag parsing

* untested: move landing page to it's own router

* go fmt, fix typo

* fix package, adapt to proper Route structure
This commit is contained in:
f0x52
2021-06-21 19:46:10 +02:00
committed by GitHub
parent a5fd6f427b
commit f9bc305aca
22 changed files with 963 additions and 62 deletions

View File

@ -170,6 +170,11 @@ func (c *Config) ParseCLIFlags(f KeyedFlags) error {
c.TemplateConfig.BaseDir = f.String(fn.TemplateBaseDir)
}
// template flags
if c.TemplateConfig.AssetBaseDir == "" || f.IsSet(fn.AssetBaseDir) {
c.TemplateConfig.AssetBaseDir = f.String(fn.AssetBaseDir)
}
// accounts flags
if f.IsSet(fn.AccountsOpenRegistration) {
c.AccountsConfig.OpenRegistration = f.Bool(fn.AccountsOpenRegistration)
@ -283,6 +288,7 @@ type Flags struct {
DbDatabase string
TemplateBaseDir string
AssetBaseDir string
AccountsOpenRegistration string
AccountsApprovalRequired string
@ -326,6 +332,7 @@ type Defaults struct {
DbDatabase string
TemplateBaseDir string
AssetBaseDir string
AccountsOpenRegistration bool
AccountsRequireApproval bool
@ -371,6 +378,7 @@ func GetFlagNames() Flags {
DbDatabase: "db-database",
TemplateBaseDir: "template-basedir",
AssetBaseDir: "asset-basedir",
AccountsOpenRegistration: "accounts-open-registration",
AccountsApprovalRequired: "accounts-approval-required",
@ -417,6 +425,7 @@ func GetEnvNames() Flags {
DbDatabase: "GTS_DB_DATABASE",
TemplateBaseDir: "GTS_TEMPLATE_BASEDIR",
AssetBaseDir: "GTS_ASSET_BASEDIR",
AccountsOpenRegistration: "GTS_ACCOUNTS_OPEN_REGISTRATION",
AccountsApprovalRequired: "GTS_ACCOUNTS_APPROVAL_REQUIRED",

View File

@ -18,7 +18,8 @@ func TestDefault() *Config {
ApplicationName: defaults.ApplicationName,
},
TemplateConfig: &TemplateConfig{
BaseDir: defaults.TemplateBaseDir,
BaseDir: defaults.TemplateBaseDir,
AssetBaseDir: defaults.AssetBaseDir,
},
AccountsConfig: &AccountsConfig{
OpenRegistration: defaults.AccountsOpenRegistration,
@ -71,7 +72,8 @@ func Default() *Config {
ApplicationName: defaults.ApplicationName,
},
TemplateConfig: &TemplateConfig{
BaseDir: defaults.TemplateBaseDir,
BaseDir: defaults.TemplateBaseDir,
AssetBaseDir: defaults.AssetBaseDir,
},
AccountsConfig: &AccountsConfig{
OpenRegistration: defaults.AccountsOpenRegistration,
@ -124,6 +126,7 @@ func GetDefaults() Defaults {
DbDatabase: "postgres",
TemplateBaseDir: "./web/template/",
AssetBaseDir: "./web/assets/",
AccountsOpenRegistration: true,
AccountsRequireApproval: true,

View File

@ -22,4 +22,6 @@ package config
type TemplateConfig struct {
// Directory from which gotosocial will attempt to load html templates (.tmpl files).
BaseDir string `yaml:"baseDir"`
// Directory from which static files are served
AssetBaseDir string `yaml:"assetDir"`
}