run go fmt
This commit is contained in:
parent
bcf9fe41c2
commit
965b515db4
|
@ -288,7 +288,7 @@ type Flags struct {
|
||||||
DbDatabase string
|
DbDatabase string
|
||||||
|
|
||||||
TemplateBaseDir string
|
TemplateBaseDir string
|
||||||
AssetBaseDir string
|
AssetBaseDir string
|
||||||
|
|
||||||
AccountsOpenRegistration string
|
AccountsOpenRegistration string
|
||||||
AccountsApprovalRequired string
|
AccountsApprovalRequired string
|
||||||
|
@ -332,7 +332,7 @@ type Defaults struct {
|
||||||
DbDatabase string
|
DbDatabase string
|
||||||
|
|
||||||
TemplateBaseDir string
|
TemplateBaseDir string
|
||||||
AssetBaseDir string
|
AssetBaseDir string
|
||||||
|
|
||||||
AccountsOpenRegistration bool
|
AccountsOpenRegistration bool
|
||||||
AccountsRequireApproval bool
|
AccountsRequireApproval bool
|
||||||
|
@ -378,7 +378,7 @@ func GetFlagNames() Flags {
|
||||||
DbDatabase: "db-database",
|
DbDatabase: "db-database",
|
||||||
|
|
||||||
TemplateBaseDir: "template-basedir",
|
TemplateBaseDir: "template-basedir",
|
||||||
AssetBaseDir: "asset-basedir",
|
AssetBaseDir: "asset-basedir",
|
||||||
|
|
||||||
AccountsOpenRegistration: "accounts-open-registration",
|
AccountsOpenRegistration: "accounts-open-registration",
|
||||||
AccountsApprovalRequired: "accounts-approval-required",
|
AccountsApprovalRequired: "accounts-approval-required",
|
||||||
|
@ -425,7 +425,7 @@ func GetEnvNames() Flags {
|
||||||
DbDatabase: "GTS_DB_DATABASE",
|
DbDatabase: "GTS_DB_DATABASE",
|
||||||
|
|
||||||
TemplateBaseDir: "GTS_TEMPLATE_BASEDIR",
|
TemplateBaseDir: "GTS_TEMPLATE_BASEDIR",
|
||||||
AssetBaseDir: "GTS_ASSET_BASEDIR",
|
AssetBaseDir: "GTS_ASSET_BASEDIR",
|
||||||
|
|
||||||
AccountsOpenRegistration: "GTS_ACCOUNTS_OPEN_REGISTRATION",
|
AccountsOpenRegistration: "GTS_ACCOUNTS_OPEN_REGISTRATION",
|
||||||
AccountsApprovalRequired: "GTS_ACCOUNTS_APPROVAL_REQUIRED",
|
AccountsApprovalRequired: "GTS_ACCOUNTS_APPROVAL_REQUIRED",
|
||||||
|
|
|
@ -18,7 +18,7 @@ func TestDefault() *Config {
|
||||||
ApplicationName: defaults.ApplicationName,
|
ApplicationName: defaults.ApplicationName,
|
||||||
},
|
},
|
||||||
TemplateConfig: &TemplateConfig{
|
TemplateConfig: &TemplateConfig{
|
||||||
BaseDir: defaults.TemplateBaseDir,
|
BaseDir: defaults.TemplateBaseDir,
|
||||||
AssetBaseDir: defaults.AssetBaseDir,
|
AssetBaseDir: defaults.AssetBaseDir,
|
||||||
},
|
},
|
||||||
AccountsConfig: &AccountsConfig{
|
AccountsConfig: &AccountsConfig{
|
||||||
|
@ -72,7 +72,7 @@ func Default() *Config {
|
||||||
ApplicationName: defaults.ApplicationName,
|
ApplicationName: defaults.ApplicationName,
|
||||||
},
|
},
|
||||||
TemplateConfig: &TemplateConfig{
|
TemplateConfig: &TemplateConfig{
|
||||||
BaseDir: defaults.TemplateBaseDir,
|
BaseDir: defaults.TemplateBaseDir,
|
||||||
AssetBaseDir: defaults.AssetBaseDir,
|
AssetBaseDir: defaults.AssetBaseDir,
|
||||||
},
|
},
|
||||||
AccountsConfig: &AccountsConfig{
|
AccountsConfig: &AccountsConfig{
|
||||||
|
@ -126,7 +126,7 @@ func GetDefaults() Defaults {
|
||||||
DbDatabase: "postgres",
|
DbDatabase: "postgres",
|
||||||
|
|
||||||
TemplateBaseDir: "./web/template/",
|
TemplateBaseDir: "./web/template/",
|
||||||
AssetBaseDir: "./web/assets/",
|
AssetBaseDir: "./web/assets/",
|
||||||
|
|
||||||
AccountsOpenRegistration: true,
|
AccountsOpenRegistration: true,
|
||||||
AccountsRequireApproval: true,
|
AccountsRequireApproval: true,
|
||||||
|
|
|
@ -22,6 +22,6 @@ package config
|
||||||
type TemplateConfig struct {
|
type TemplateConfig struct {
|
||||||
// Directory from which gotosocial will attempt to load html templates (.tmpl files).
|
// Directory from which gotosocial will attempt to load html templates (.tmpl files).
|
||||||
BaseDir string `yaml:"baseDir"`
|
BaseDir string `yaml:"baseDir"`
|
||||||
// Directory from which static files are served
|
// Directory from which static files are served
|
||||||
AssetBaseDir string `yaml:"assetDir"`
|
AssetBaseDir string `yaml:"assetDir"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -810,7 +810,7 @@ func (ps *postgresService) Follows(sourceAccount *gtsmodel.Account, targetAccoun
|
||||||
if sourceAccount == nil || targetAccount == nil {
|
if sourceAccount == nil || targetAccount == nil {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return ps.conn.Model(>smodel.Follow{}).Where("account_id = ?", sourceAccount.ID).Where("target_account_id = ?", targetAccount.ID).Exists()
|
return ps.conn.Model(>smodel.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 {
|
if sourceAccount == nil || targetAccount == nil {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return ps.conn.Model(>smodel.FollowRequest{}).Where("account_id = ?", sourceAccount.ID).Where("target_account_id = ?", targetAccount.ID).Exists()
|
return ps.conn.Model(>smodel.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 {
|
if account1 == nil || account2 == nil {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure account 1 follows account 2
|
// make sure account 1 follows account 2
|
||||||
f1, err := ps.conn.Model(>smodel.Follow{}).Where("account_id = ?", account1.ID).Where("target_account_id = ?", account2.ID).Exists()
|
f1, err := ps.conn.Model(>smodel.Follow{}).Where("account_id = ?", account1.ID).Where("target_account_id = ?", account2.ID).Exists()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -154,18 +154,18 @@ func New(config *config.Config, logger *logrus.Logger) (Router, error) {
|
||||||
// serve static files from /assets
|
// serve static files from /assets
|
||||||
// FIXME: why doesn't this config var work??
|
// FIXME: why doesn't this config var work??
|
||||||
// assetPath := filepath.Join(cwd, config.TemplateConfig.AssetBaseDir);
|
// assetPath := filepath.Join(cwd, config.TemplateConfig.AssetBaseDir);
|
||||||
engine.Static("/assets", "./web/assets");
|
engine.Static("/assets", "./web/assets")
|
||||||
|
|
||||||
// FIXME: actual variables
|
// FIXME: actual variables
|
||||||
engine.GET("/", func(c *gin.Context) {
|
engine.GET("/", func(c *gin.Context) {
|
||||||
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
||||||
"instancename": "GoToSocial Test Instance",
|
"instancename": "GoToSocial Test Instance",
|
||||||
"countUsers": 3,
|
"countUsers": 3,
|
||||||
"countStatuses": 42069,
|
"countStatuses": 42069,
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"adminUsername": "@admin",
|
"adminUsername": "@admin",
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
// create the actual http server here
|
// create the actual http server here
|
||||||
s := &http.Server{
|
s := &http.Server{
|
||||||
|
|
Loading…
Reference in New Issue