diff --git a/bin/server.dart b/bin/server.dart index 481eecc..a14d39e 100644 --- a/bin/server.dart +++ b/bin/server.dart @@ -102,6 +102,9 @@ Future _postOnMastodon(reqJson) async { photoUrls = photoUrls.sublist(0, 4); } + print('photoUrls: $photoUrls'); + print('otherPhotos: $otherPhotos'); + // Post the post on Mastodon. // First we upload all photos with dio. // Then we post the post with the uploaded photos and the text. @@ -132,10 +135,10 @@ Future _postOnMastodon(reqJson) async { mediaIds.add(resp.data['id']); } - var postResponse = await dio.post('$instanceUrl/api/v1/statuses', - data: {'status': postText, 'media_ids': mediaIds}, - options: - dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'})); + // var postResponse = await dio.post('$instanceUrl/api/v1/statuses', + // data: {'status': postText, 'media_ids': mediaIds}, + // options: + // dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'})); await Future.wait(photoUrls.map((photoUrl) => File(photoUrl).delete())); @@ -150,6 +153,9 @@ Future _postOnMastodon(reqJson) async { otherPhotos = []; } + print('photoUrls: $photoUrls'); + print('otherPhotos: $otherPhotos'); + for (final photoUrl in photoUrls) { final resp = await dio.post('$instanceUrl/api/v1/media', data: dio_lib.FormData.fromMap( @@ -159,13 +165,13 @@ Future _postOnMastodon(reqJson) async { mediaIds.add(resp.data['id']); } - postResponse = await dio.post('$instanceUrl/api/v1/statuses', - data: { - 'in_reply_to_id': postResponse.data['id'], - 'media_ids': mediaIds - }, - options: - dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'})); + // postResponse = await dio.post('$instanceUrl/api/v1/statuses', + // data: { + // 'in_reply_to_id': postResponse.data['id'], + // 'media_ids': mediaIds + // }, + // options: + // dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'})); await Future.wait(photoUrls.map((photoUrl) => File(photoUrl).delete())); }