fiddle with instance display
This commit is contained in:
parent
69000ed68e
commit
7d2bfd8537
|
@ -34,5 +34,6 @@ func New(config *config.Config, processor processing.Processor, log *logrus.Logg
|
|||
// Route satisfies the ClientModule interface
|
||||
func (m *Module) Route(s router.Router) error {
|
||||
s.AttachHandler(http.MethodGet, InstanceInformationPath, m.InstanceInformationGETHandler)
|
||||
s.AttachHandler(http.MethodPatch, InstanceInformationPath, m.InstanceUpdatePATCHHandler)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ func (ps *postgresService) GetStatusCountForInstance(domain string) (int, error)
|
|||
} else {
|
||||
// join on the domain of the account
|
||||
q = q.Join("JOIN accounts AS account ON account.id = status.account_id").
|
||||
Where("account.domain = ?", domain)
|
||||
Where("account.domain = ?", domain)
|
||||
}
|
||||
|
||||
return q.Count()
|
||||
|
|
|
@ -90,7 +90,7 @@ func (p *processor) InstancePatch(form *apimodel.InstanceSettingsUpdateRequest)
|
|||
return nil, gtserror.NewErrorBadRequest(err, err.Error())
|
||||
}
|
||||
// contact account user must be admin or moderator otherwise what's the point of contacting them
|
||||
if !contactUser.Admin || !contactUser.Moderator {
|
||||
if !contactUser.Admin && !contactUser.Moderator {
|
||||
err := fmt.Errorf("user of selected contact account %s is neither admin nor moderator", contactAccount.Username)
|
||||
return nil, gtserror.NewErrorBadRequest(err, err.Error())
|
||||
}
|
||||
|
|
|
@ -512,6 +512,7 @@ func (c *converter) InstanceToMasto(i *gtsmodel.Instance) (*model.Instance, erro
|
|||
Email: i.ContactEmail,
|
||||
Version: i.Version,
|
||||
Stats: make(map[string]int),
|
||||
ContactAccount: &model.Account{},
|
||||
}
|
||||
|
||||
// if the requested instance is *this* instance, we can add some extra information
|
||||
|
@ -542,7 +543,18 @@ func (c *converter) InstanceToMasto(i *gtsmodel.Instance) (*model.Instance, erro
|
|||
mi.URLS = &model.InstanceURLs{
|
||||
StreamingAPI: fmt.Sprintf("wss://%s", c.config.Host),
|
||||
}
|
||||
}aaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
}
|
||||
|
||||
// get the instance account if it exists and just skip if it doesn't
|
||||
ia := >smodel.Account{}
|
||||
if err := c.db.GetWhere([]db.Where{{Key: "username", Value: i.Domain}}, ia); err == nil {
|
||||
// instance account exists, get the header for the account if it exists
|
||||
attachment := >smodel.MediaAttachment{}
|
||||
if err := c.db.GetHeaderForAccountID(attachment, ia.ID); err == nil {
|
||||
// header exists, set it on the api model
|
||||
mi.Thumbnail = attachment.URL
|
||||
}
|
||||
}
|
||||
|
||||
// contact account is optional but let's try to get it
|
||||
if i.ContactAccountID != "" {
|
||||
|
|
|
@ -24,7 +24,6 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
maximumEmailLength = 256
|
||||
maximumUsernameLength = 64
|
||||
maximumEmojiShortcodeLength = 30
|
||||
maximumHashtagLength = 30
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
<a href="https://github.com/superseriousbusiness/gotosocial">Source Code</a>
|
||||
</div>
|
||||
<div id="contact">
|
||||
Contact: <a href="/{{.instance.ContactAccount}}" class="nounderline">{{.instance.ContactAccount}}</a><br>
|
||||
<!-- <a href="/moderation">Moderation team</a> -->
|
||||
Contact: <a href="{{.instance.ContactAccount.URL}}" class="nounderline">{{.instance.ContactAccount.Username}}</a><br>
|
||||
</div>
|
||||
<div id="email">
|
||||
Email: <a href="mailto:{{.instance.Email}}" class="nounderline">{{.instance.Email}}</a><br>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
|
|
|
@ -8,16 +8,14 @@
|
|||
federating with <span class="count">{{.instance.Stats.domain_count}}</span> other instances.</h1>
|
||||
|
||||
<h3>This is the default landing page, you can edit it from <span class="accent">./web/template/index.tmpl</span></h1>
|
||||
<ul>
|
||||
<li>Some explanation about the instance (description) with instance header and profile images.</li>
|
||||
<li>Instructions for registering.</li>
|
||||
<li>Etc.</li>
|
||||
</ul>
|
||||
<p>
|
||||
{{.instance.ShortDescription}}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section class="apps">
|
||||
<p>
|
||||
GoToSocial does not provide it's own frontend, but implements the Mastodon client API.
|
||||
GoToSocial does not provide its own frontend, but implements the Mastodon client API.
|
||||
You can use this server through a variety of clients:
|
||||
</p>
|
||||
<div class="applist">
|
||||
|
|
Loading…
Reference in New Issue