@@ -88,21 +88,14 @@ def do_list
88
88
89
89
tbl = Rex ::Text ::Table . new (
90
90
'Header' => "Posts at #{ full_uri } (REST API: #{ get_rest_api } )" ,
91
- 'Columns' => %w{ ID Title URL Status Password }
91
+ 'Columns' => %w{ ID Title URL Password }
92
92
)
93
93
94
94
posts_to_list . each do |post |
95
- if post [ :status ] == 'publish'
96
- status = 'Published'
97
- else
98
- status = post [ :status ] . capitalize
99
- end
100
-
101
95
tbl << [
102
96
post [ :id ] ,
103
97
Rex ::Text . html_decode ( post [ :title ] ) ,
104
98
post [ :url ] ,
105
- status ,
106
99
post [ :password ] ? 'Yes' : 'No'
107
100
]
108
101
end
@@ -146,27 +139,24 @@ def do_update
146
139
def list_posts
147
140
posts = [ ]
148
141
149
- %w{ publish future draft pending private } . each do |status |
150
- res = send_request_cgi ( {
151
- 'method' => 'GET' ,
152
- 'uri' => normalize_uri ( get_rest_api , 'posts' ) ,
153
- 'vars_get' => {
154
- 'status' => status ,
155
- 'per_page' => datastore [ 'PostCount' ] ,
156
- 'search' => datastore [ 'SearchTerm' ]
157
- }
158
- } , 3.5 )
142
+ res = send_request_cgi ( {
143
+ 'method' => 'GET' ,
144
+ 'uri' => normalize_uri ( get_rest_api , 'posts' ) ,
145
+ 'vars_get' => {
146
+ 'status' => status ,
147
+ 'per_page' => datastore [ 'PostCount' ] ,
148
+ 'search' => datastore [ 'SearchTerm' ]
149
+ }
150
+ } , 3.5 )
159
151
160
- if res && res . code == 200
161
- res . get_json_document . each do |post |
162
- posts << {
163
- id : post [ 'id' ] ,
164
- title : post [ 'title' ] [ 'rendered' ] ,
165
- url : post [ 'link' ] ,
166
- status : status ,
167
- password : post [ 'content' ] [ 'protected' ]
168
- }
169
- end
152
+ if res && res . code == 200
153
+ res . get_json_document . each do |post |
154
+ posts << {
155
+ id : post [ 'id' ] ,
156
+ title : post [ 'title' ] [ 'rendered' ] ,
157
+ url : post [ 'link' ] ,
158
+ password : post [ 'content' ] [ 'protected' ]
159
+ }
170
160
end
171
161
end
172
162
0 commit comments