fix for all calls

This commit is contained in:
Thomas 2023-07-30 11:13:14 +02:00
parent ac290dec2b
commit bbb47626ce
23 changed files with 44 additions and 45 deletions

View file

@ -69,7 +69,7 @@ public class Nitter implements Serializable {
.proxy(Helper.getProxy(context)) .proxy(Helper.getProxy(context))
.build(); .build();
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED)) .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null))
.addConverterFactory(SimpleXmlConverterFactory.create()) .addConverterFactory(SimpleXmlConverterFactory.create())
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -259,14 +259,14 @@ public class CrossActionHelper {
} }
private static MastodonSearchService init(Context context, @NonNull String instance) { private static MastodonSearchService init(Context context, String instance) {
final OkHttpClient okHttpClient = new OkHttpClient.Builder() final OkHttpClient okHttpClient = new OkHttpClient.Builder()
.readTimeout(60, TimeUnit.SECONDS) .readTimeout(60, TimeUnit.SECONDS)
.connectTimeout(60, TimeUnit.SECONDS) .connectTimeout(60, TimeUnit.SECONDS)
.proxy(Helper.getProxy(context)) .proxy(Helper.getProxy(context))
.build(); .build();
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v2/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v2/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();
@ -493,9 +493,7 @@ public class CrossActionHelper {
* Fetch and federate the remote status * Fetch and federate the remote status
*/ */
public static void fetchAccountInRemoteInstance(@NonNull Context context, String acct, String instance, Callback callback) { public static void fetchAccountInRemoteInstance(@NonNull Context context, String acct, String instance, Callback callback) {
if (instance == null) {
return;
}
MastodonSearchService mastodonSearchService = init(context, instance); MastodonSearchService mastodonSearchService = init(context, instance);
new Thread(() -> { new Thread(() -> {
Call<Results> resultsCall = mastodonSearchService.search(null, acct, null, "accounts", null, null, null, null, null, null, 1); Call<Results> resultsCall = mastodonSearchService.search(null, acct, null, "accounts", null, null, null, null, null, null, 1);

View file

@ -135,7 +135,7 @@ public class NotificationsHelper {
} }
private static MastodonNotificationsService init(Context context, @NonNull String instance) { private static MastodonNotificationsService init(Context context, String instance) {
final OkHttpClient okHttpClient = new OkHttpClient.Builder() final OkHttpClient okHttpClient = new OkHttpClient.Builder()
.readTimeout(60, TimeUnit.SECONDS) .readTimeout(60, TimeUnit.SECONDS)
@ -143,7 +143,7 @@ public class NotificationsHelper {
.proxy(Helper.getProxy(context)) .proxy(Helper.getProxy(context))
.build(); .build();
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -131,14 +131,14 @@ public class PushNotifications {
slug + "/unifiedpush.connector", null); slug + "/unifiedpush.connector", null);
} }
private static MastodonNotificationsService init(@NonNull Context context, @NonNull String instance) { private static MastodonNotificationsService init(@NonNull Context context, String instance) {
final OkHttpClient okHttpClient = new OkHttpClient.Builder() final OkHttpClient okHttpClient = new OkHttpClient.Builder()
.readTimeout(60, TimeUnit.SECONDS) .readTimeout(60, TimeUnit.SECONDS)
.connectTimeout(60, TimeUnit.SECONDS) .connectTimeout(60, TimeUnit.SECONDS)
.proxy(Helper.getProxy(context.getApplicationContext())) .proxy(Helper.getProxy(context.getApplicationContext()))
.build(); .build();
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -97,9 +97,9 @@ public class ComposeWorker extends Worker {
.build(); .build();
} }
private static MastodonStatusesService init(Context context, @NonNull String instance) { private static MastodonStatusesService init(Context context, String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(getOkHttpClient(context)) .client(getOkHttpClient(context))
.build(); .build();

View file

@ -252,7 +252,7 @@ public class FetchHomeWorker extends Worker {
private MastodonTimelinesService init(String instance) { private MastodonTimelinesService init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -109,9 +109,9 @@ public class ScheduleBoostWorker extends Worker {
.build(); .build();
} }
private MastodonStatusesService init(@NonNull String instance) { private MastodonStatusesService init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.client(getOkHttpClient()) .client(getOkHttpClient())
.build(); .build();

View file

@ -106,7 +106,7 @@ public class AccountsVM extends AndroidViewModel {
private MastodonAccountsService init(String instance) { private MastodonAccountsService init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();
@ -115,7 +115,7 @@ public class AccountsVM extends AndroidViewModel {
private MastodonAccountsService initv2(String instance) { private MastodonAccountsService initv2(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v2/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v2/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -63,18 +63,18 @@ public class AdminVM extends AndroidViewModel {
super(application); super(application);
} }
private MastodonAdminService init(@NonNull String instance) { private MastodonAdminService init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();
return retrofit.create(MastodonAdminService.class); return retrofit.create(MastodonAdminService.class);
} }
private MastodonAdminService initv2(@NonNull String instance) { private MastodonAdminService initv2(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v2/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v2/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -51,9 +51,9 @@ public class AnnouncementsVM extends AndroidViewModel {
super(application); super(application);
} }
private MastodonAnnouncementsService init(@NonNull String instance) { private MastodonAnnouncementsService init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -61,7 +61,7 @@ public class AppsVM extends AndroidViewModel {
private MastodonAppsService init(String instance) throws IllegalArgumentException { private MastodonAppsService init(String instance) throws IllegalArgumentException {
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create(); Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create();
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -58,7 +58,7 @@ public class FiltersVM extends AndroidViewModel {
private MastodonFiltersService initV2(String instance) { private MastodonFiltersService initV2(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v2/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v2/")
// .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) // .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient) .client(okHttpClient)

View file

@ -61,10 +61,10 @@ public class InstancesVM extends AndroidViewModel {
super(application); super(application);
} }
private MastodonInstanceService init(@NonNull String instance) { private MastodonInstanceService init(String instance) {
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create(); Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create();
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -53,7 +53,7 @@ public class NodeInfoVM extends AndroidViewModel {
private NodeInfoService init(String instance) { private NodeInfoService init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/")
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -93,9 +93,9 @@ public class NotificationsVM extends AndroidViewModel {
} }
} }
private MastodonNotificationsService init(@NonNull String instance) { private MastodonNotificationsService init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -59,10 +59,10 @@ public class OauthVM extends AndroidViewModel {
super(application); super(application);
} }
private MastodonAppsService init(@NonNull String instance) { private MastodonAppsService init(String instance) {
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create(); Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create();
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -41,9 +41,9 @@ public class OembedVM extends AndroidViewModel {
super(application); super(application);
} }
private MastodonOembedService init(@NonNull String instance) { private MastodonOembedService init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -57,10 +57,10 @@ public class SearchVM extends AndroidViewModel {
super(application); super(application);
} }
private MastodonSearchService init(@NonNull String instance) { private MastodonSearchService init(String instance) {
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create(); Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create();
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v2/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v2/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -91,9 +91,9 @@ public class StatusesVM extends AndroidViewModel {
.build(); .build();
} }
private MastodonStatusesService init(@NonNull String instance) { private MastodonStatusesService init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(getOkHttpClient()) .client(getOkHttpClient())
.build(); .build();

View file

@ -64,7 +64,7 @@ public class TagVM extends AndroidViewModel {
private MastodonTagService init(String instance) { private MastodonTagService init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -158,7 +158,7 @@ public class TimelinesVM extends AndroidViewModel {
private MastodonTimelinesService initInstanceOnly(String instance) { private MastodonTimelinesService initInstanceOnly(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED)) .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null))
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();
@ -167,7 +167,7 @@ public class TimelinesVM extends AndroidViewModel {
private MastodonTimelinesService initInstanceXMLOnly(String instance) { private MastodonTimelinesService initInstanceXMLOnly(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED)) .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null))
.addConverterFactory(SimpleXmlConverterFactory.create()) .addConverterFactory(SimpleXmlConverterFactory.create())
.client(okHttpClient) .client(okHttpClient)
.build(); .build();
@ -176,7 +176,7 @@ public class TimelinesVM extends AndroidViewModel {
private MastodonTimelinesService init(String instance) { private MastodonTimelinesService init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -47,9 +47,9 @@ public class ActionsVM extends AndroidViewModel {
super(application); super(application);
} }
private PleromaAPI init(@NonNull String instance) { private PleromaAPI init(String instance) {
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) + "/api/v1/") .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder())) .addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
.client(okHttpClient) .client(okHttpClient)
.build(); .build();

View file

@ -44,6 +44,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.IDN;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.util.ArrayList; import java.util.ArrayList;
@ -253,7 +254,7 @@ public class RetrofitPeertubeAPI {
.proxy(app.fedilab.android.mastodon.helper.Helper.getProxy(_context.getApplicationContext())) .proxy(app.fedilab.android.mastodon.helper.Helper.getProxy(_context.getApplicationContext()))
.build(); .build();
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://" + instance) .baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null))
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient) .client(okHttpClient)
.build(); .build();