summaryrefslogtreecommitdiff
path: root/internal/typeutils
diff options
context:
space:
mode:
Diffstat (limited to 'internal/typeutils')
-rw-r--r--internal/typeutils/internaltoas.go5
-rw-r--r--internal/typeutils/internaltofrontend.go13
2 files changed, 7 insertions, 11 deletions
diff --git a/internal/typeutils/internaltoas.go b/internal/typeutils/internaltoas.go
index d939ecc1c..81f4d9a31 100644
--- a/internal/typeutils/internaltoas.go
+++ b/internal/typeutils/internaltoas.go
@@ -26,7 +26,6 @@ import (
"net/url"
"github.com/sirupsen/logrus"
- "github.com/spf13/viper"
"github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
@@ -629,9 +628,9 @@ func (c *converter) MentionToAS(ctx context.Context, m *gtsmodel.Mention) (vocab
// name -- this should be the namestring of the mentioned user, something like @whatever@example.org
var domain string
if m.TargetAccount.Domain == "" {
- accountDomain := viper.GetString(config.Keys.AccountDomain)
+ accountDomain := config.GetAccountDomain()
if accountDomain == "" {
- accountDomain = viper.GetString(config.Keys.Host)
+ accountDomain = config.GetHost()
}
domain = accountDomain
} else {
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go
index 8ad601f0c..364e7152c 100644
--- a/internal/typeutils/internaltofrontend.go
+++ b/internal/typeutils/internaltofrontend.go
@@ -24,7 +24,6 @@ import (
"strings"
"github.com/sirupsen/logrus"
- "github.com/spf13/viper"
"github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/config"
@@ -575,9 +574,7 @@ func (c *converter) InstanceToAPIInstance(ctx context.Context, i *gtsmodel.Insta
}
// if the requested instance is *this* instance, we can add some extra information
- keys := config.Keys
- host := viper.GetString(keys.Host)
- if i.Domain == host {
+ if host := config.GetHost(); i.Domain == host {
userCount, err := c.db.CountInstanceUsers(ctx, host)
if err == nil {
mi.Stats["user_count"] = userCount
@@ -593,14 +590,14 @@ func (c *converter) InstanceToAPIInstance(ctx context.Context, i *gtsmodel.Insta
mi.Stats["domain_count"] = domainCount
}
- mi.Registrations = viper.GetBool(keys.AccountsRegistrationOpen)
- mi.ApprovalRequired = viper.GetBool(keys.AccountsApprovalRequired)
+ mi.Registrations = config.GetAccountsRegistrationOpen()
+ mi.ApprovalRequired = config.GetAccountsApprovalRequired()
mi.InvitesEnabled = false // TODO
- mi.MaxTootChars = uint(viper.GetInt(keys.StatusesMaxChars))
+ mi.MaxTootChars = uint(config.GetStatusesMaxChars())
mi.URLS = &model.InstanceURLs{
StreamingAPI: fmt.Sprintf("wss://%s", host),
}
- mi.Version = viper.GetString(keys.SoftwareVersion)
+ mi.Version = config.GetSoftwareVersion()
}
// get the instance account if it exists and just skip if it doesn't