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