mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-12-22 19:33:33 +02:00
true remote timeline params tweaks
This commit is contained in:
parent
fc43de6012
commit
18c37c0c2f
1 changed files with 16 additions and 2 deletions
|
@ -108,6 +108,7 @@ type MisskeyStatus struct {
|
|||
|
||||
type AccountMisskey struct {
|
||||
ID string `json:"id"`
|
||||
Host string `json:"host"`
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
AvatarURL string `json:"avatarUrl"`
|
||||
|
@ -272,12 +273,17 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, instan
|
|||
}
|
||||
withFiles := "false"
|
||||
withReplies := "false"
|
||||
globalTimeline := false
|
||||
for _, instanceParam := range instanceParams {
|
||||
switch instanceParam {
|
||||
case "withFiles":
|
||||
withFiles = "true"
|
||||
params.Set("only_media", "true")
|
||||
case "withReplies":
|
||||
withReplies = "true"
|
||||
case "remote":
|
||||
globalTimeline = true
|
||||
params.Set(instanceParam, "true")
|
||||
default:
|
||||
params.Set(instanceParam, "true")
|
||||
}
|
||||
|
@ -288,7 +294,11 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, instan
|
|||
var bytesAttach []byte
|
||||
switch instance_type {
|
||||
case "misskey":
|
||||
perform.Path = "api/notes/local-timeline"
|
||||
if globalTimeline {
|
||||
perform.Path = "api/notes/global-timeline"
|
||||
} else {
|
||||
perform.Path = "api/notes/local-timeline"
|
||||
}
|
||||
perform.RawQuery = ""
|
||||
method = http.MethodPost
|
||||
ContentType = "application/json"
|
||||
|
@ -335,7 +345,11 @@ func (c *Client) TrueRemoteTimeline(ctx context.Context, instance string, instan
|
|||
status.ID = statusMisskey.ID
|
||||
status.Account.ID = statusMisskey.User.ID
|
||||
status.Account.DisplayName = statusMisskey.User.Name
|
||||
status.Account.Acct = statusMisskey.User.Username
|
||||
if statusMisskey.User.Host != "" {
|
||||
status.Account.Acct = statusMisskey.User.Username + "@" + statusMisskey.User.Host
|
||||
} else {
|
||||
status.Account.Acct = statusMisskey.User.Username
|
||||
}
|
||||
status.Account.Username = statusMisskey.User.Username
|
||||
status.Account.Avatar = statusMisskey.User.AvatarURL
|
||||
status.CreatedAt = statusMisskey.CreatedAt
|
||||
|
|
Loading…
Reference in a new issue