diff --git a/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeAPI.java b/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeAPI.java index 173316a..2692d0d 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeAPI.java +++ b/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeAPI.java @@ -1253,7 +1253,7 @@ public class PeertubeAPI { */ public APIResponse getSubscriptionsTL(String max_id) { try { - return getTL("/users/me/subscriptions/videos", "-publishedAt", null, max_id, null, null); + return getTL(true, "/users/me/subscriptions/videos", "-publishedAt", null, max_id, null, null); } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); return apiResponse; @@ -1322,7 +1322,7 @@ public class PeertubeAPI { */ public APIResponse getOverviewTL(String max_id) { try { - return getTL("/overviews/videos", null, null, max_id, null, null); + return getTL(false, "/overviews/videos", null, null, max_id, null, null); } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); return apiResponse; @@ -1337,7 +1337,7 @@ public class PeertubeAPI { */ public APIResponse getLikedTL(String max_id) { try { - return getTL("/videos/", "-likes", null, max_id, null, null); + return getTL(false, "/videos/", "-likes", null, max_id, null, null); } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); return apiResponse; @@ -1352,7 +1352,7 @@ public class PeertubeAPI { */ public APIResponse getTrendingTL(String max_id) { try { - return getTL("/videos/", "-trending", null, max_id, null, null); + return getTL(false, "/videos/", "-trending", null, max_id, null, null); } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); return apiResponse; @@ -1367,7 +1367,7 @@ public class PeertubeAPI { */ public APIResponse getRecentlyAddedTL(String max_id) { try { - return getTL("/videos/", "-publishedAt", null, max_id, null, null); + return getTL(false, "/videos/", "-publishedAt", null, max_id, null, null); } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); return apiResponse; @@ -1382,7 +1382,7 @@ public class PeertubeAPI { */ public APIResponse getLocalTL(String max_id) { try { - return getTL("/videos/", "-publishedAt", "local", max_id, null, null); + return getTL(true, "/videos/", "-publishedAt", "local", max_id, null, null); } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); return apiResponse; @@ -1397,7 +1397,7 @@ public class PeertubeAPI { */ public APIResponse getPublicTL(String max_id) { try { - return getTL("/videos/", "-publishedAt", null, max_id, null, null); + return getTL(false, "/videos/", "-publishedAt", null, max_id, null, null); } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); return apiResponse; @@ -1412,7 +1412,7 @@ public class PeertubeAPI { * @return APIResponse */ @SuppressWarnings("SameParameterValue") - private APIResponse getTL(String action, String sort, String filter, String max_id, String since_id, String min_id) throws HttpsConnection.HttpsConnectionException { + private APIResponse getTL(boolean needToken, String action, String sort, String filter, String max_id, String since_id, String min_id) throws HttpsConnection.HttpsConnectionException { HashMap params = new HashMap<>(); if (max_id != null) @@ -1434,7 +1434,7 @@ public class PeertubeAPI { List peertubes = new ArrayList<>(); try { HttpsConnection httpsConnection = new HttpsConnection(context); - String response = httpsConnection.get(getAbsoluteUrl(action), 60, params, prefKeyOauthTokenT); + String response = httpsConnection.get(getAbsoluteUrl(action), 60, params, needToken ? prefKeyOauthTokenT : null); if (!action.equals("/overviews/videos")) { JSONArray values = new JSONObject(response).getJSONArray("data"); peertubes = parsePeertube(values);