mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-10 13:58:46 +00:00
add expires status and language code
This commit is contained in:
parent
44f8a72a76
commit
4cd8fb2ddb
5 changed files with 23 additions and 2 deletions
|
@ -988,7 +988,7 @@ func (s *service) Signout(c *client) (err error) {
|
|||
|
||||
func (s *service) Post(c *client, content string, replyToID string,
|
||||
format string, visibility string, isNSFW bool, spoilerText string,
|
||||
files []*multipart.FileHeader, edit string) (id string, err error) {
|
||||
files []*multipart.FileHeader, edit string, language string, expiresIn int) (id string, err error) {
|
||||
|
||||
var mediaIDs []string
|
||||
for _, f := range files {
|
||||
|
@ -999,6 +999,8 @@ func (s *service) Post(c *client, content string, replyToID string,
|
|||
mediaIDs = append(mediaIDs, a.ID)
|
||||
}
|
||||
|
||||
expiresIn = expiresIn * 3600
|
||||
|
||||
tweet := &mastodon.Toot{
|
||||
SpoilerText: spoilerText,
|
||||
Status: content,
|
||||
|
@ -1008,7 +1010,10 @@ func (s *service) Post(c *client, content string, replyToID string,
|
|||
Visibility: visibility,
|
||||
Sensitive: isNSFW,
|
||||
Edit: edit,
|
||||
Language: language,
|
||||
ExpiresIn: expiresIn, // pleroma compatible
|
||||
}
|
||||
|
||||
st, err := c.PostStatus(c.ctx, tweet)
|
||||
if err != nil {
|
||||
return
|
||||
|
|
|
@ -314,8 +314,13 @@ func NewHandler(s *service, verbose bool, staticDir string) http.Handler {
|
|||
quickReply := c.r.FormValue("quickreply") == "true"
|
||||
files := c.r.MultipartForm.File["attachments"]
|
||||
edit := c.r.FormValue("edit-status-id")
|
||||
language := c.r.FormValue("lang-code")
|
||||
expiresIn, err := strconv.Atoi(c.r.FormValue("expires-in"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
id, err := s.Post(c, content, replyToID, format, visibility, isNSFW, spoilerText, files, edit)
|
||||
id, err := s.Post(c, content, replyToID, format, visibility, isNSFW, spoilerText, files, edit, language, expiresIn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue