once again
This commit is contained in:
parent
b6b58e8895
commit
ef516ce396
|
@ -106,16 +106,15 @@ Future<void> _postOnMastodon(reqJson) async {
|
||||||
options:
|
options:
|
||||||
dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'}));
|
dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'}));
|
||||||
} else {
|
} else {
|
||||||
final mediaResponses = await photoUrls.map((photoUrl) async => await dio.post(
|
var mediaIds = [];
|
||||||
'$instanceUrl/api/v1/media',
|
|
||||||
data: dio_lib.FormData.fromMap({'file': File(photoUrl)}),
|
|
||||||
options:
|
|
||||||
dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'})));
|
|
||||||
|
|
||||||
final mediaIds = mediaResponses.map((mediaResponse) {
|
for (final photoUrl in photoUrls) {
|
||||||
final mediaId = mediaResponse.data['id'];
|
final resp = await dio.post('$instanceUrl/api/v1/media',
|
||||||
return mediaId;
|
data: dio_lib.FormData.fromMap({'file': File(photoUrl)}),
|
||||||
}).toList();
|
options:
|
||||||
|
dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'}));
|
||||||
|
mediaIds.add(resp.data['id']);
|
||||||
|
}
|
||||||
|
|
||||||
await dio.post('$instanceUrl/api/v1/statuses',
|
await dio.post('$instanceUrl/api/v1/statuses',
|
||||||
data: {'status': postText, 'media_ids': mediaIds},
|
data: {'status': postText, 'media_ids': mediaIds},
|
||||||
|
|
Loading…
Reference in a new issue