run go fmt

This commit is contained in:
f0x 2021-06-19 00:25:43 +02:00
parent bcf9fe41c2
commit 965b515db4
5 changed files with 16 additions and 16 deletions

View File

@ -288,7 +288,7 @@ type Flags struct {
DbDatabase string
TemplateBaseDir string
AssetBaseDir string
AssetBaseDir string
AccountsOpenRegistration string
AccountsApprovalRequired string
@ -332,7 +332,7 @@ type Defaults struct {
DbDatabase string
TemplateBaseDir string
AssetBaseDir string
AssetBaseDir string
AccountsOpenRegistration bool
AccountsRequireApproval bool
@ -378,7 +378,7 @@ func GetFlagNames() Flags {
DbDatabase: "db-database",
TemplateBaseDir: "template-basedir",
AssetBaseDir: "asset-basedir",
AssetBaseDir: "asset-basedir",
AccountsOpenRegistration: "accounts-open-registration",
AccountsApprovalRequired: "accounts-approval-required",
@ -425,7 +425,7 @@ func GetEnvNames() Flags {
DbDatabase: "GTS_DB_DATABASE",
TemplateBaseDir: "GTS_TEMPLATE_BASEDIR",
AssetBaseDir: "GTS_ASSET_BASEDIR",
AssetBaseDir: "GTS_ASSET_BASEDIR",
AccountsOpenRegistration: "GTS_ACCOUNTS_OPEN_REGISTRATION",
AccountsApprovalRequired: "GTS_ACCOUNTS_APPROVAL_REQUIRED",

View File

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

View File

@ -22,6 +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
// Directory from which static files are served
AssetBaseDir string `yaml:"assetDir"`
}

View File

@ -810,7 +810,7 @@ func (ps *postgresService) Follows(sourceAccount *gtsmodel.Account, targetAccoun
if sourceAccount == nil || targetAccount == nil {
return false, nil
}
return ps.conn.Model(&gtsmodel.Follow{}).Where("account_id = ?", sourceAccount.ID).Where("target_account_id = ?", targetAccount.ID).Exists()
}
@ -818,7 +818,7 @@ func (ps *postgresService) FollowRequested(sourceAccount *gtsmodel.Account, targ
if sourceAccount == nil || targetAccount == nil {
return false, nil
}
return ps.conn.Model(&gtsmodel.FollowRequest{}).Where("account_id = ?", sourceAccount.ID).Where("target_account_id = ?", targetAccount.ID).Exists()
}
@ -826,7 +826,7 @@ func (ps *postgresService) Mutuals(account1 *gtsmodel.Account, account2 *gtsmode
if account1 == nil || account2 == nil {
return false, nil
}
// make sure account 1 follows account 2
f1, err := ps.conn.Model(&gtsmodel.Follow{}).Where("account_id = ?", account1.ID).Where("target_account_id = ?", account2.ID).Exists()
if err != nil {

View File

@ -154,18 +154,18 @@ func New(config *config.Config, logger *logrus.Logger) (Router, error) {
// serve static files from /assets
// FIXME: why doesn't this config var work??
// assetPath := filepath.Join(cwd, config.TemplateConfig.AssetBaseDir);
engine.Static("/assets", "./web/assets");
engine.Static("/assets", "./web/assets")
// FIXME: actual variables
engine.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.tmpl", gin.H{
"instancename": "GoToSocial Test Instance",
"countUsers": 3,
"instancename": "GoToSocial Test Instance",
"countUsers": 3,
"countStatuses": 42069,
"version": "1.0.0",
"version": "1.0.0",
"adminUsername": "@admin",
})
});
})
// create the actual http server here
s := &http.Server{