/
mast-items.go
213 lines (190 loc) · 5 KB
/
mast-items.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
package lodge
import (
// "path"
// "path/filepath"
"fmt"
// "io"
"strconv"
// "net/http"
// "time"
// "strings"
"math/rand"
"gopkg.in/loremipsum.v1"
)
var Letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
type Tag struct {
Name string
Url string
}
type Actor struct {
Id uint64
Username string
Acct string
Display_name string
Locked bool
Bot bool
Discoverable bool
Group bool
Created_at string
Note string
Url string
Avatar string
Avatar_static string
Header string
Header_static string
Followers_count int
Following_count int
Statuses_count int
Last_status_at string
Emojis []string
Fields []string
}
func (a * Actor) Fake() {
lg := loremipsum.New()
a.Id = rand.Uint64()
a.Username = lg.Word()
a.Acct = fmt.Sprintf("%s_%s@%s.%s.org",a.Username,lg.Word(),lg.Word(),lg.Word())
a.Display_name = a.Username
a.Locked = false
a.Bot = false
a.Discoverable = true
a.Group = false
a.Created_at = "2022-11-05T00:00:00.000Z"
a.Note = fmt.Sprintf("%s %s %s %s",lg.Word(),lg.Word(),lg.Word(),lg.Word())
a.Url = fmt.Sprintf("https://%s.%s.org/@%s",lg.Word(),lg.Word(),a.Username)
a.Avatar = ""
a.Avatar_static = ""
a.Header = ""
a.Header_static = ""
a.Followers_count = rand.Int() % 30
a.Following_count = rand.Int() % 60
a.Statuses_count = rand.Int() % 400
a.Last_status_at = "2023-01-17"
a.Emojis = nil
a.Fields = nil
}
func (a Actor) JSON() string {
return fmt.Sprint("{" +
"\"id\": \""+strconv.FormatUint(a.Id, 10)+"\","+
"\"username\": \""+a.Username+"\","+
"\"acct\": \""+a.Acct+"\","+
"\"display_name\": \""+a.Display_name+"\","+
"\"locked\": false,"+
"\"bot\": false,"+
"\"discoverable\": true,"+
"\"group\": false,"+
"\"created_at\": \""+a.Created_at+"\","+
"\"note\": \""+a.Note+"\","+
"\"url\": \""+a.Url+"\","+
"\"avatar\": \""+a.Avatar+"\","+
"\"avatar_static\": \""+a.Avatar_static+"\","+
"\"header\": \""+a.Header+"\","+
"\"header_static\": \""+a.Header_static+"\","+
"\"followers_count\": "+strconv.FormatInt(int64(a.Followers_count),10)+","+
"\"following_count\": "+strconv.FormatInt(int64(a.Following_count),10)+","+
"\"statuses_count\": "+strconv.FormatInt(int64(a.Statuses_count),10)+","+
"\"last_status_at\": \""+a.Last_status_at+"\","+
"\"emojis\": [],"+
"\"fields\": [] }")
}
type Post struct {
Id uint64
Created_at string
In_reply_to_id uint64
In_reply_to_account_id uint64
Sensitive bool
Spoiler_text string
Visibility int
Language string
Uri string
Url string
Replies_count int
Reblogs_count int
Favourites_count int
Edited_at string
Favourited bool
Reblogged bool
Muted bool
Bookmarked bool
Content string
Filtered []string
Reblog string
Account Actor
Media_attachments []string
Mentions []string
Tags []Tag
Emojis []string
Card string
Poll string
}
func (p * Post) Fake(a Actor){
lg := loremipsum.New()
p.Id = rand.Uint64()
p.Created_at = "2023-01-16T16:39:44.000Z"
p.In_reply_to_id = 0
p.In_reply_to_account_id = 0
p.Sensitive = false
p.Spoiler_text = ""
p.Visibility = 1
p.Language = "en"
p.Uri = "https://mastodon.social/users/Gargron/statuses/103270115826048975"
p.Url = "https://mastodon.social/@Gargron/103270115826048975"
p.Replies_count = 0
p.Reblogs_count = 0
p.Favourites_count = 0
p.Edited_at = ""
p.Favourited = false
p.Reblogged = false
p.Muted = false
p.Bookmarked = false
p.Content = fmt.Sprintf("<p>%s</p>",lg.Paragraph())
p.Filtered = nil
p.Reblog = ""
p.Account = a
p.Media_attachments = nil
p.Mentions = nil
p.Tags = nil
p.Emojis = nil
p.Card = ""
p.Poll = ""
}
func (p Post) JSON(acc Actor) string {
return fmt.Sprint("{" +
"\"id\": \""+strconv.FormatUint(p.Id, 10)+"\","+
"\"created_at\": \""+p.Created_at+"\","+
"\"in_reply_to_id\": null,"+
"\"in_reply_to_account_id\": null,"+
"\"sensitive\": false,"+
"\"spoiler_text\": \""+p.Spoiler_text+"\","+
"\"visibility\": \"public\","+
"\"language\": \"en\","+
"\"uri\": \""+p.Uri+"\","+
"\"url\": \""+p.Url+"\","+
"\"replies_count\": 5,"+
"\"reblogs_count\": 6,"+
"\"favourites_count\": 11,"+
"\"favourited\": false,"+
"\"reblogged\": false,"+
"\"muted\": false,"+
"\"bookmarked\": false,"+
"\"content\": \""+p.Content+"\","+
"\"filtered\": [],"+
"\"reblog\": null,"+
"\"account\": "+ acc.JSON() + ","+
"\"media_attachments\": [],"+
"\"mentions\": [],"+
"\"tags\": [],"+
"\"emojis\": [],"+
"\"card\": null,"+
"\"poll\": null }")
}
type App struct {
Id int
Cn string
Ru string
Sc string
Ws string
Clid string
Csec string
Vkey string
}