diff options
| author | fox <fox@fakecake.org> | 2026-06-06 14:39:15 +0300 |
|---|---|---|
| committer | fox <fox@fakecake.org> | 2026-06-06 14:39:15 +0300 |
| commit | f8ee23be63b4babcd7d4cb81af8c38448299ebca (patch) | |
| tree | f99648471d193d5aac6ef71cc97c98a7c6ef2d1e | |
| parent | 6b78dec41da6f4b0526191ef52cef7c51cf29aeb (diff) | |
| parent | f9fb62d7282d7e1ec310a12b0fcb922267689d6d (diff) | |
| download | tt-rss-android-26.06-f8ee23be-signed.tar.gz tt-rss-android-26.06-f8ee23be-signed.tar.xz | |
Merge branch 'dev' into 'master' 26.06-f8ee23be-signed
Dev See merge request git/tt-rss/tt-rss-android!73
45 files changed, 2401 insertions, 474 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..0f68d559 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,6 @@ +# Project Notice & AI Disclosure + +This source tree is provided as-is because it might be useful. At the moment, I'm not actively looking for code contributions, bug reports, or any other feedback. + +**AI Disclosure:** This project uses Large Language Models (LLMs) to help write code, create unit tests, build scaffolding, and draft documentation. + diff --git a/org.fox.ttrss/build.gradle b/org.fox.ttrss/build.gradle index 9aefb525..de549142 100755 --- a/org.fox.ttrss/build.gradle +++ b/org.fox.ttrss/build.gradle @@ -138,6 +138,9 @@ def getVersion() { } dependencies { + testImplementation 'junit:junit:4.13.2' + testImplementation 'org.mockito:mockito-core:5.14.0' + implementation 'com.squareup.okhttp3:okhttp:3.12.5' implementation 'org.jsoup:jsoup:1.11.3' implementation 'com.bogdwellers:pinchtozoom:0.1' diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiCommon.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiCommon.java index 89152121..a653ac3a 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiCommon.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiCommon.java @@ -8,8 +8,6 @@ import android.content.pm.PackageManager; import android.content.res.AssetFileDescriptor; import android.net.ConnectivityManager; import android.net.NetworkInfo; -import android.security.KeyChain; -import android.security.KeyChainException; import android.util.Log; import androidx.annotation.NonNull; @@ -20,39 +18,18 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import org.fox.ttrss.util.KeyChainKeyManager; - -import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; -import java.security.KeyStore; -import java.security.PrivateKey; -import java.security.cert.X509Certificate; import java.util.HashMap; import java.util.Locale; import java.util.Map; -import java.util.concurrent.TimeUnit; - -import javax.net.ssl.KeyManager; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; import okhttp3.Credentials; import okhttp3.HttpUrl; -import okhttp3.Interceptor; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; -import okhttp3.ResponseBody; -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; public class ApiCommon { public static final String TAG = "ApiCommon"; @@ -75,9 +52,13 @@ public class ApiCommon { void setLastErrorMessage(String message); + void setLastException(Throwable e); + void notifyProgress(int progress); ApiError getLastError(); + + Throwable getLastException(); } public enum ApiError { @@ -271,8 +252,14 @@ public class ApiCommon { String fieldStr = bodyParams.get("field"); String modeStr = bodyParams.get("mode"); if (fieldStr != null && modeStr != null) { - int field = Integer.parseInt(fieldStr); - int mode = Integer.parseInt(modeStr); + int field, mode; + try { + field = Integer.parseInt(fieldStr); + mode = Integer.parseInt(modeStr); + } catch (NumberFormatException e) { + Log.d(TAG, "Invalid field/mode values: field=" + fieldStr + " mode=" + modeStr); + return null; + } switch (field) { case 0: // marked @@ -429,134 +416,97 @@ public class ApiCommon { Request request = requestBuilder.build(); - ResponseProgressListener listener = new ResponseProgressListener() { - @Override - public void update(HttpUrl url, long bytesRead, long contentLength) { - // Log.d(TAG, "[progress] " + url + " " + bytesRead + " of " + contentLength); + OkHttpFactory.ProgressListener listener = (url, bytesRead, contentLength) -> { + // Log.d(TAG, "[progress] " + url + " " + bytesRead + " of " + contentLength); - if (contentLength > 0) - caller.notifyProgress((int) (bytesRead * 100f / contentLength)); - } + if (contentLength > 0) + caller.notifyProgress((int) (bytesRead * 100f / contentLength)); }; - /* lets shamelessly hijack OkHttpProgressGlideModule */ - - OkHttpClient.Builder builder = new OkHttpClient.Builder() - .connectTimeout(10, TimeUnit.SECONDS) - .writeTimeout(10, TimeUnit.SECONDS) - .readTimeout(30, TimeUnit.SECONDS) - .addNetworkInterceptor(createInterceptor(listener)); - - String clientCertAlias = m_prefs.getString("mtls_certificate_alias", null); - - if (m_prefs.getBoolean("mtls_enabled", false) && clientCertAlias != null) { - try { - X509Certificate[] chain = KeyChain.getCertificateChain(context, clientCertAlias); - PrivateKey privateKey = KeyChain.getPrivateKey(context, clientCertAlias); - - KeyManager[] keyManagers = new KeyManager[]{new KeyChainKeyManager(clientCertAlias, chain, privateKey)}; - - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - - // we don't need custom CA - trustManagerFactory.init((KeyStore) null); - TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); - - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(keyManagers, trustManagers, null); - - // enable mtls in okhttp3 builder - builder.sslSocketFactory(sslContext.getSocketFactory()); - } catch (Exception e) { - e.printStackTrace(); - - caller.setLastErrorMessage(e.getMessage()); - caller.setLastError(ApiError.API_UNKNOWN); - } - } + OkHttpClient client = OkHttpFactory.createClient(context, listener, caller); + + try (Response response = client.newCall(request).execute()) { + if (response.isSuccessful()) { + String payloadReceived = response.body().string(); + + if (m_transportDebugging) Log.d(TAG, "<<< " + payloadReceived); + + JsonParser parser = new JsonParser(); + + JsonElement result = parser.parse(payloadReceived); + JsonObject resultObj = result.getAsJsonObject(); + + int statusCode = resultObj.get("status").getAsInt(); + + caller.setStatusCode(statusCode); + + switch (statusCode) { + case API_STATUS_OK: + caller.setLastError(ApiError.SUCCESS); + return result.getAsJsonObject().get("content"); + case API_STATUS_ERR: + JsonObject contentObj = resultObj.get("content").getAsJsonObject(); + String error = contentObj.get("error").getAsString(); + + switch (error) { + case "LOGIN_ERROR": + case "NOT_LOGGED_IN": + caller.setLastError(ApiError.LOGIN_FAILED); + break; + case "API_DISABLED": + caller.setLastError(ApiError.API_DISABLED); + break; + case "INCORRECT_USAGE": + caller.setLastError(ApiError.API_INCORRECT_USAGE); + break; + case "UNKNOWN_METHOD": + caller.setLastError(ApiError.API_UNKNOWN_METHOD); + break; + default: + Log.d(TAG, "Unknown API error: " + error); + caller.setLastErrorMessage(error); + caller.setLastError(ApiError.API_UNKNOWN); + break; + } + } - OkHttpClient client = builder.build(); - - Response response = client.newCall(request).execute(); - - if (response.isSuccessful()) { - String payloadReceived = response.body().string(); - - if (m_transportDebugging) Log.d(TAG, "<<< " + payloadReceived); - - JsonParser parser = new JsonParser(); - - JsonElement result = parser.parse(payloadReceived); - JsonObject resultObj = result.getAsJsonObject(); - - int statusCode = resultObj.get("status").getAsInt(); - - caller.setStatusCode(statusCode); - - switch (statusCode) { - case API_STATUS_OK: - caller.setLastError(ApiError.SUCCESS); - return result.getAsJsonObject().get("content"); - case API_STATUS_ERR: - JsonObject contentObj = resultObj.get("content").getAsJsonObject(); - String error = contentObj.get("error").getAsString(); - - switch (error) { - case "LOGIN_ERROR": - case "NOT_LOGGED_IN": - caller.setLastError(ApiError.LOGIN_FAILED); - break; - case "API_DISABLED": - caller.setLastError(ApiError.API_DISABLED); - break; - case "INCORRECT_USAGE": - caller.setLastError(ApiError.API_INCORRECT_USAGE); - break; - case "UNKNOWN_METHOD": - caller.setLastError(ApiError.API_UNKNOWN_METHOD); - break; - default: - Log.d(TAG, "Unknown API error: " + error); - caller.setLastErrorMessage(error); - caller.setLastError(ApiError.API_UNKNOWN); - break; - } + } else { + switch (response.code()) { + case 400: + caller.setLastError(ApiError.HTTP_BAD_REQUEST); + break; + case 401: + caller.setLastError(ApiError.HTTP_UNAUTHORIZED); + break; + case 403: + caller.setLastError(ApiError.HTTP_FORBIDDEN); + break; + case 404: + caller.setLastError(ApiError.HTTP_NOT_FOUND); + break; + case 500: + case 501: + caller.setLastError(ApiError.HTTP_SERVER_ERROR); + break; + default: + Log.d(TAG, "HTTP response code: " + response.code()); + caller.setLastErrorMessage("HTTP response code: " + response.code()); + caller.setLastError(ApiError.HTTP_OTHER_ERROR); + break; + } } - } else { - switch (response.code()) { - case 400: - caller.setLastError(ApiError.HTTP_BAD_REQUEST); - break; - case 401: - caller.setLastError(ApiError.HTTP_UNAUTHORIZED); - break; - case 403: - caller.setLastError(ApiError.HTTP_FORBIDDEN); - break; - case 404: - caller.setLastError(ApiError.HTTP_NOT_FOUND); - break; - case 500: - case 501: - caller.setLastError(ApiError.HTTP_SERVER_ERROR); - break; - default: - Log.d(TAG, "HTTP response code: " + response.code()); - caller.setLastErrorMessage("HTTP response code: " + response.code()); - caller.setLastError(ApiError.HTTP_OTHER_ERROR); - break; - } + return null; } - - return null; } catch (javax.net.ssl.SSLPeerUnverifiedException e) { caller.setLastError(ApiError.SSL_REJECTED); caller.setLastErrorMessage(e.getMessage()); - e.printStackTrace(); + caller.setLastException(e); + Log.e(TAG, "SSL certificate rejected", e); } catch (IOException e) { caller.setLastError(ApiError.IO_ERROR); caller.setLastErrorMessage(e.getMessage()); + caller.setLastException(e); if (e.getMessage() != null) { if (e.getMessage().matches("Hostname [^ ]+ was not verified")) { @@ -564,86 +514,22 @@ public class ApiCommon { } } - e.printStackTrace(); + Log.e(TAG, "IO error", e); } catch (com.google.gson.JsonSyntaxException e) { caller.setLastError(ApiError.PARSE_ERROR); caller.setLastErrorMessage(e.getMessage()); - e.printStackTrace(); + caller.setLastException(e); + Log.e(TAG, "JSON parse error", e); } catch (Exception e) { caller.setLastError(ApiError.OTHER_ERROR); caller.setLastErrorMessage(e.getMessage()); - e.printStackTrace(); + caller.setLastException(e); + Log.e(TAG, "API request failed", e); } return null; } - private interface ResponseProgressListener { - void update(HttpUrl url, long bytesRead, long contentLength); - } - - private static Interceptor createInterceptor(final ResponseProgressListener listener) { - return chain -> { - Request request = chain.request(); - Response response = chain.proceed(request); - return response.newBuilder() - .body(new ProgressResponseBody(request.url(), response.body(), listener)) - .build(); - }; - } - - private static class ProgressResponseBody extends ResponseBody { - private final HttpUrl url; - private final ResponseBody responseBody; - private final ResponseProgressListener progressListener; - private BufferedSource bufferedSource; - - public ProgressResponseBody(HttpUrl url, ResponseBody responseBody, - ResponseProgressListener progressListener) { - - this.url = url; - this.responseBody = responseBody; - this.progressListener = progressListener; - } - - @Override - public MediaType contentType() { - return responseBody.contentType(); - } - - @Override - public long contentLength() { - return responseBody.contentLength(); - } - - @Override - public BufferedSource source() { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; - } - - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; - - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - long fullLength = responseBody.contentLength(); - if (bytesRead == -1) { // this source is exhausted - totalBytesRead = fullLength; - } else { - totalBytesRead += bytesRead; - } - progressListener.update(url, totalBytesRead, fullLength); - return bytesRead; - } - }; - } - } - private static String getUserAgent(Context context) { try { PackageInfo packageInfo = context.getPackageManager(). @@ -656,7 +542,7 @@ public class ApiCommon { System.getProperty("http.agent")); } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); + Log.e(TAG, "getting package info", e); return String.format(Locale.ENGLISH, "Tiny Tiny RSS (Android) Unknown %1$s", diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiRequest.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiRequest.java index e2e67459..6c174adf 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiRequest.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiRequest.java @@ -11,16 +11,27 @@ import com.google.gson.JsonElement; import java.util.HashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicInteger; public class ApiRequest implements ApiCommon.ApiCaller { - private static final ExecutorService EXECUTOR = Executors.newSingleThreadExecutor(); + private static final ExecutorService EXECUTOR = Executors.newSingleThreadExecutor(new ThreadFactory() { + private final AtomicInteger m_count = new AtomicInteger(1); + @Override + public Thread newThread(Runnable r) { + Thread t = new Thread(r, "ApiRequest-" + m_count.getAndIncrement()); + t.setDaemon(true); + return t; + } + }); private final Handler m_mainHandler = new Handler(Looper.getMainLooper()); protected final Context m_context; protected int m_apiStatusCode = 0; protected String m_lastErrorMessage; protected ApiError m_lastError; + protected Throwable m_lastException; public ApiRequest(Context context) { m_context = context; @@ -83,6 +94,11 @@ public class ApiRequest implements ApiCommon.ApiCaller { } @Override + public void setLastException(Throwable e) { + m_lastException = e; + } + + @Override public void notifyProgress(int progress) { // Progress is no longer tracked via AsyncTask's publishProgress. // Subclasses can override if they need progress notifications. @@ -92,4 +108,16 @@ public class ApiRequest implements ApiCommon.ApiCaller { public ApiError getLastError() { return m_lastError; } + + @Override + public Throwable getLastException() { + return m_lastException; + } + + /** + * Shut down the shared executor. Call once when the application is terminating. + */ + public static void shutdownExecutor() { + EXECUTOR.shutdownNow(); + } } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiResponseParser.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiResponseParser.java new file mode 100644 index 00000000..18b2e4a7 --- /dev/null +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiResponseParser.java @@ -0,0 +1,130 @@ +package org.fox.ttrss; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import org.fox.ttrss.ApiCommon.ApiError; + +import java.util.Objects; + +/** + * Parses TT-RSS API v2 responses and maps error codes to ApiError enum. + * + * This is a pure-logic class with no Android dependencies, making it + * easy to unit test. ApiV2Client delegates to it after receiving HTTP responses. + */ +public final class ApiResponseParser { + + /** + * Result of parsing a v2 API response. + */ + public static final class ParsedResponse { + public final boolean success; + public final JsonElement data; + public final ApiError error; + public final String errorMessage; + + public ParsedResponse(boolean success, JsonElement data, ApiError error, String errorMessage) { + this.success = success; + this.data = data; + this.error = error; + this.errorMessage = errorMessage; + } + } + + private ApiResponseParser() { + // no instances + } + + /** + * Parse a v2 API response payload. + * + * Response format: {"success": true/false, "data": ..., "error": {"code": "..."}} + * + * @param payload raw JSON string from the HTTP response body + * @return parsed response with success flag, data, and error info + */ + public static ParsedResponse parse(String payload) { + try { + JsonElement result = JsonParser.parseString(payload); + JsonObject resultObj = result.getAsJsonObject(); + boolean success = resultObj.get("success").getAsBoolean(); + + if (success) { + JsonElement data = resultObj.get("data"); + return new ParsedResponse( + true, + data != null ? data : JsonParser.parseString("null"), + ApiError.SUCCESS, + null + ); + } else { + JsonObject errorObj = resultObj.getAsJsonObject("error"); + String errorCode = errorObj != null && errorObj.has("code") + ? errorObj.get("code").getAsString() + : "UNKNOWN"; + + return new ParsedResponse( + false, + null, + mapApiError(errorCode), + errorCode + ); + } + } catch (Exception e) { + return new ParsedResponse( + false, + null, + ApiError.PARSE_ERROR, + "Failed to parse v2 response: " + e.getMessage() + ); + } + } + + /** + * Map v2 API error codes to the common ApiError enum. + * + * @param errorCode error code from the v2 API response + * @return corresponding ApiError + */ + public static ApiError mapApiError(String errorCode) { + switch (Objects.requireNonNull(errorCode)) { + case "LOGIN_ERROR": + case "NOT_LOGGED_IN": + return ApiError.LOGIN_FAILED; + case "API_DISABLED": + return ApiError.API_DISABLED; + case "INCORRECT_USAGE": + return ApiError.API_INCORRECT_USAGE; + default: + return ApiError.API_UNKNOWN; + } + } + + /** + * Map HTTP status codes to the common ApiError enum. + * + * @param httpCode raw HTTP response status code + * @return corresponding ApiError + */ + public static ApiError mapHttpStatusError(int httpCode) { + switch (httpCode) { + case 400: + return ApiError.HTTP_BAD_REQUEST; + case 401: + return ApiError.HTTP_UNAUTHORIZED; + case 403: + return ApiError.HTTP_FORBIDDEN; + case 404: + return ApiError.HTTP_NOT_FOUND; + case 405: + return ApiError.API_UNKNOWN_METHOD; + case 500: + case 501: + return ApiError.HTTP_SERVER_ERROR; + default: + return ApiError.HTTP_OTHER_ERROR; + } + } +} diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiV2Client.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiV2Client.java index 12163413..340c1461 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiV2Client.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ApiV2Client.java @@ -10,39 +10,21 @@ import androidx.preference.PreferenceManager; import com.google.gson.Gson; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; import org.fox.ttrss.ApiCommon.ApiError; -import org.fox.ttrss.util.KeyChainKeyManager; import java.io.IOException; -import java.security.PrivateKey; -import java.security.cert.X509Certificate; import java.util.Locale; import java.util.Map; -import java.util.concurrent.TimeUnit; - -import javax.net.ssl.KeyManager; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; import okhttp3.Credentials; import okhttp3.FormBody; import okhttp3.HttpUrl; -import okhttp3.Interceptor; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; -import okhttp3.ResponseBody; -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; /** * RESTful APIv2 client for tt-rss. @@ -56,45 +38,7 @@ import okio.Source; public class ApiV2Client { public static final String TAG = "ApiV2Client"; - /** - * Build an OkHttpClient with the given progress listener (or null for no progress). - * Handles mutual TLS if configured. - */ - private static OkHttpClient buildClient(Context context, ProgressListener progressListener) { - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - OkHttpClient.Builder builder = new OkHttpClient.Builder() - .connectTimeout(10, TimeUnit.SECONDS) - .writeTimeout(10, TimeUnit.SECONDS) - .readTimeout(30, TimeUnit.SECONDS); - - if (progressListener != null) { - builder.addNetworkInterceptor(createProgressInterceptor(progressListener)); - } - - if (prefs.getBoolean("mtls_enabled", false)) { - String clientCertAlias = prefs.getString("mtls_certificate_alias", null); - if (clientCertAlias != null) { - try { - X509Certificate[] chain = android.security.KeyChain.getCertificateChain(context, clientCertAlias); - PrivateKey privateKey = android.security.KeyChain.getPrivateKey(context, clientCertAlias); - KeyManager[] keyManagers = new KeyManager[]{new KeyChainKeyManager(clientCertAlias, chain, privateKey)}; - - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - trustManagerFactory.init((java.security.KeyStore) null); - TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); - - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(keyManagers, trustManagers, null); - builder.sslSocketFactory(sslContext.getSocketFactory()); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - return builder.build(); - } /** * Build the base URL for APIv2 requests. @@ -237,7 +181,7 @@ public class ApiV2Client { } // Build client and execute - OkHttpClient client = buildClient(context, null); + OkHttpClient client = OkHttpFactory.createClient(context, null, null); Response response = client.newCall(requestBuilder.build()).execute(); if (response.isSuccessful()) { @@ -247,196 +191,46 @@ public class ApiV2Client { Log.d(TAG, "<<< " + payload); } - return parseV2Response(payload, caller); + ApiResponseParser.ParsedResponse parsed = ApiResponseParser.parse(payload); + caller.setLastError(parsed.error); + caller.setLastErrorMessage(parsed.errorMessage); + return parsed.data; } else { // Handle HTTP error codes response.body().close(); - mapHttpStatusError(response.code(), caller); + ApiError error = ApiResponseParser.mapHttpStatusError(response.code()); + caller.setLastError(error); + caller.setLastErrorMessage("HTTP " + response.code()); return null; } } catch (javax.net.ssl.SSLPeerUnverifiedException e) { caller.setLastError(ApiError.SSL_REJECTED); caller.setLastErrorMessage(e.getMessage()); - e.printStackTrace(); + caller.setLastException(e); + Log.e(TAG, "API response error", e); return null; } catch (IOException e) { caller.setLastError(ApiError.IO_ERROR); caller.setLastErrorMessage(e.getMessage()); + caller.setLastException(e); if (e.getMessage() != null && e.getMessage().matches("Hostname [^ ]+ was not verified")) { caller.setLastError(ApiError.SSL_HOSTNAME_REJECTED); } - e.printStackTrace(); + Log.e(TAG, "SSL peer unverified", e); return null; } catch (Exception e) { caller.setLastError(ApiError.OTHER_ERROR); caller.setLastErrorMessage(e.getMessage()); - e.printStackTrace(); - return null; - } - } - - /** - * Parse the v2 response wrapper: {"success": true/false, "data": ..., "error": {...}} - */ - private static JsonElement parseV2Response(String payload, ApiCommon.ApiCaller caller) { - JsonParser parser = new JsonParser(); - JsonElement result = parser.parse(payload); - - try { - JsonObject resultObj = result.getAsJsonObject(); - boolean success = resultObj.get("success").getAsBoolean(); - - if (success) { - caller.setLastError(ApiError.SUCCESS); - JsonElement data = resultObj.get("data"); - return data != null ? data : JsonParser.parseString("null"); - } else { - // Error response - JsonObject errorObj = resultObj.getAsJsonObject("error"); - String errorCode = errorObj != null && errorObj.has("code") - ? errorObj.get("code").getAsString() - : "UNKNOWN"; - - mapApiError(errorCode, caller); - return null; - } - } catch (Exception e) { - caller.setLastError(ApiError.PARSE_ERROR); - caller.setLastErrorMessage("Failed to parse v2 response: " + e.getMessage()); - e.printStackTrace(); + caller.setLastException(e); + Log.e(TAG, "IO error during request", e); return null; } } - /** - * Map v2 error codes to the common ApiError enum. - */ - private static void mapApiError(String errorCode, ApiCommon.ApiCaller caller) { - switch (errorCode) { - case "LOGIN_ERROR": - case "NOT_LOGGED_IN": - caller.setLastError(ApiError.LOGIN_FAILED); - break; - case "API_DISABLED": - caller.setLastError(ApiError.API_DISABLED); - break; - case "INCORRECT_USAGE": - caller.setLastError(ApiError.API_INCORRECT_USAGE); - break; - default: - Log.d(TAG, "Unknown APIv2 error: " + errorCode); - caller.setLastErrorMessage(errorCode); - caller.setLastError(ApiError.API_UNKNOWN); - break; - } - } - - /** - * Map HTTP status codes to the common ApiError enum. - */ - private static void mapHttpStatusError(int httpCode, ApiCommon.ApiCaller caller) { - switch (httpCode) { - case 400: - caller.setLastError(ApiError.HTTP_BAD_REQUEST); - break; - case 401: - caller.setLastError(ApiError.HTTP_UNAUTHORIZED); - break; - case 403: - caller.setLastError(ApiError.HTTP_FORBIDDEN); - break; - case 404: - caller.setLastError(ApiError.HTTP_NOT_FOUND); - break; - case 405: - // @todo what about METHOD_NOT_ALLOWED? do these two share status code? - caller.setLastError(ApiError.API_UNKNOWN_METHOD); - break; - case 500: - case 501: - caller.setLastError(ApiError.HTTP_SERVER_ERROR); - break; - default: - Log.d(TAG, "HTTP error code: " + httpCode); - caller.setLastErrorMessage("HTTP " + httpCode); - caller.setLastError(ApiError.HTTP_OTHER_ERROR); - break; - } - } - - // ─── Progress support ───────────────────────────────────────────────────── - - /** - * Internal progress callback interface. - * Mirrors ApiCommon.ResponseProgressListener (which is private there). - */ - private interface ProgressListener { - void update(HttpUrl url, long bytesRead, long contentLength); - } - private static Interceptor createProgressInterceptor(final ProgressListener listener) { - return chain -> { - Request request = chain.request(); - Response response = chain.proceed(request); - return response.newBuilder() - .body(new ProgressResponseBody(request.url(), response.body(), listener)) - .build(); - }; - } - - private static class ProgressResponseBody extends ResponseBody { - private final HttpUrl url; - private final ResponseBody responseBody; - private final ProgressListener progressListener; - private BufferedSource bufferedSource; - - public ProgressResponseBody(HttpUrl url, ResponseBody responseBody, - ProgressListener progressListener) { - this.url = url; - this.responseBody = responseBody; - this.progressListener = progressListener; - } - - @Override - public MediaType contentType() { - return responseBody.contentType(); - } - - @Override - public long contentLength() { - return responseBody.contentLength(); - } - - @Override - public BufferedSource source() { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; - } - - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; - - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - long fullLength = responseBody.contentLength(); - if (bytesRead == -1) { - totalBytesRead = fullLength; - } else { - totalBytesRead += bytesRead; - } - progressListener.update(url, totalBytesRead, fullLength); - return bytesRead; - } - }; - } - } // ─── Helpers ────────────────────────────────────────────────────────────── @@ -452,7 +246,7 @@ public class ApiV2Client { System.getProperty("http.agent")); } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); + Log.e(TAG, "unexpected error", e); return String.format(Locale.ENGLISH, "Tiny Tiny RSS (Android) Unknown %1$s", System.getProperty("http.agent")); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java index 8bed4c4a..73f2184b 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java @@ -133,7 +133,7 @@ public class ArticleFragment extends androidx.fragment.app.Fragment { try { m_activity.openUri(Uri.parse(m_article.link)); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "opening article link", e); m_activity.toast(R.string.error_other_error); } }); @@ -157,7 +157,7 @@ public class ArticleFragment extends androidx.fragment.app.Fragment { m_activity.openUri(Uri.parse(url)); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "opening comments/links", e); m_activity.toast(R.string.error_other_error); } }); @@ -255,7 +255,7 @@ public class ArticleFragment extends androidx.fragment.app.Fragment { return true; } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "opening URL from context menu", e); } return false; @@ -368,7 +368,7 @@ public class ArticleFragment extends androidx.fragment.app.Fragment { } catch (MalformedURLException e) { // } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "processing image URL", e); } } } @@ -398,7 +398,7 @@ public class ArticleFragment extends androidx.fragment.app.Fragment { } } catch (RuntimeException e) { - e.printStackTrace(); + Log.e(TAG, "rendering article content", e); } } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleModel.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleModel.java index 7e1189cd..f64155c5 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleModel.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleModel.java @@ -43,6 +43,7 @@ public class ArticleModel extends AndroidViewModel implements ApiCommon.ApiCalle private String m_lastErrorMessage; private ApiCommon.ApiError m_lastError; + private Throwable m_lastException; private Feed m_feed; private int m_firstId; private String m_searchQuery = ""; @@ -79,7 +80,7 @@ public class ArticleModel extends AndroidViewModel implements ApiCommon.ApiCalle m_clientCertChain.postValue(KeyChain.getCertificateChain(application, clientCertAlias)); m_clientCertKey.postValue(KeyChain.getPrivateKey(application, clientCertAlias)); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "loading client certificate", e); } }); } @@ -319,7 +320,13 @@ public class ArticleModel extends AndroidViewModel implements ApiCommon.ApiCalle m_lazyLoadEnabled = false; } - if (m_amountLoaded < Integer.parseInt(m_prefs.getString("headlines_request_size", "15"))) { + int requestSize; + try { + requestSize = Integer.parseInt(m_prefs.getString("headlines_request_size", "15")); + } catch (NumberFormatException e) { + requestSize = 15; + } + if (m_amountLoaded < requestSize) { Log.d(TAG, this + " amount loaded " + m_amountLoaded + " < request size, disabling lazy load"); m_lazyLoadEnabled = false; } @@ -332,7 +339,7 @@ public class ArticleModel extends AndroidViewModel implements ApiCommon.ApiCalle setLastError(ApiCommon.ApiError.OTHER_ERROR); setLastErrorMessage(e.getMessage()); - e.printStackTrace(); + Log.e(TAG, "fetching client certificate", e); } } @@ -365,6 +372,11 @@ public class ArticleModel extends AndroidViewModel implements ApiCommon.ApiCalle } @Override + public void setLastException(Throwable e) { + m_lastException = e; + } + + @Override public void notifyProgress(int progress) { m_loadingProgress.postValue(progress); } @@ -393,6 +405,11 @@ public class ArticleModel extends AndroidViewModel implements ApiCommon.ApiCalle return m_lastError; } + @Override + public Throwable getLastException() { + return m_lastException; + } + String getLastErrorMessage() { return m_lastErrorMessage; } @@ -442,4 +459,10 @@ public class ArticleModel extends AndroidViewModel implements ApiCommon.ApiCalle .orElse(null); } + @Override + public void onCleared() { + super.onCleared(); + m_executor.shutdownNow(); + } + } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java index c2eeba49..b8bafe8c 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java @@ -152,7 +152,7 @@ public class ArticlePager extends androidx.fragment.app.Fragment { Application.getArticlesModel().setActive(targetArticle); } catch (IndexOutOfBoundsException e) { - e.printStackTrace(); + Log.e(TAG, "setting active article", e); } } } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java index ef8660ad..d36a7d91 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java @@ -385,7 +385,7 @@ public class CommonActivity extends AppCompatActivity implements SharedPreferenc startActivity(Intent.createChooser(sendIntent, null)); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "sharing content", e); toast(e.getMessage()); } @@ -418,7 +418,7 @@ public class CommonActivity extends AppCompatActivity implements SharedPreferenc try { intent.launchUrl(this, uri); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "launching URL", e); toast(e.getMessage()); } } @@ -433,7 +433,7 @@ public class CommonActivity extends AppCompatActivity implements SharedPreferenc try { uri = Uri.parse("https:" + uri); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "fixing URI scheme", e); } } @@ -478,7 +478,7 @@ public class CommonActivity extends AppCompatActivity implements SharedPreferenc try { startActivity(intent); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "starting activity", e); toast(e.getMessage()); } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java index 77a70d02..cbddec2c 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java @@ -279,7 +279,7 @@ public class DetailActivity extends OnlineActivity implements HeadlinesEventList super.onBackPressed(); } catch (IllegalStateException e) { // java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState - e.printStackTrace(); + Log.e(TAG, "back pressed", e); } } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java index 6ec8ee01..c38ce800 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java @@ -111,7 +111,7 @@ public class FeedsFragment extends Fragment implements OnSharedPreferenceChangeL } } catch (IndexOutOfBoundsException e) { - e.printStackTrace(); + Log.e(TAG, "feed context menu", e); } Log.d(TAG, "onContextItemSelected, unhandled id=" + item.getItemId()); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsModel.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsModel.java index ff3510ad..aeefb08b 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsModel.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsModel.java @@ -49,6 +49,7 @@ public class FeedsModel extends AndroidViewModel implements ApiCommon.ApiCaller private int m_apiStatusCode = 0; private String m_lastErrorMessage; private ApiCommon.ApiError m_lastError; + private Throwable m_lastException; protected SharedPreferences m_prefs; @@ -75,6 +76,11 @@ public class FeedsModel extends AndroidViewModel implements ApiCommon.ApiCaller m_lastErrorMessage = message; } + @Override + public void setLastException(Throwable e) { + m_lastException = e; + } + public void startLoading(Feed feed) { Log.d(TAG, "startLoading feed id=" + feed.id + " cat=" + feed.is_cat); @@ -133,7 +139,7 @@ public class FeedsModel extends AndroidViewModel implements ApiCommon.ApiCaller setLastError(ApiCommon.ApiError.OTHER_ERROR); setLastErrorMessage(e.getMessage()); - e.printStackTrace(); + Log.e(TAG, "fetching feeds", e); } m_isLoading.postValue(false); @@ -164,6 +170,11 @@ public class FeedsModel extends AndroidViewModel implements ApiCommon.ApiCaller return m_lastError; } + @Override + public Throwable getLastException() { + return m_lastException; + } + String getLastErrorMessage() { return m_lastErrorMessage; } @@ -263,4 +274,10 @@ public class FeedsModel extends AndroidViewModel implements ApiCommon.ApiCaller } } + @Override + public void onCleared() { + super.onCleared(); + m_executor.shutdownNow(); + } + } \ No newline at end of file diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryActivity.java index 7b97a60b..317a9bb6 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryActivity.java @@ -205,7 +205,7 @@ public class GalleryActivity extends CommonActivity { popup.show(); } catch (IndexOutOfBoundsException e) { - e.printStackTrace(); + Log.e(TAG, "selecting gallery item", e); } }); } @@ -221,7 +221,7 @@ public class GalleryActivity extends CommonActivity { return true; } catch (IndexOutOfBoundsException e) { - e.printStackTrace(); + Log.e(TAG, "gallery menu item selected", e); } return super.onContextItemSelected(item); @@ -236,7 +236,7 @@ public class GalleryActivity extends CommonActivity { try { openUri(Uri.parse(url)); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "opening image URL", e); toast(R.string.error_other_error); } } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryModel.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryModel.java index 61fd139e..c648d9ef 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryModel.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/GalleryModel.java @@ -60,7 +60,7 @@ public class GalleryModel extends AndroidViewModel { return "data".equalsIgnoreCase(uri.getScheme()); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "checking gallery scheme", e); } return false; @@ -156,7 +156,7 @@ public class GalleryModel extends AndroidViewModel { m_items.postValue(checkList); } } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "checking image for gallery", e); } } } @@ -175,4 +175,10 @@ public class GalleryModel extends AndroidViewModel { m_isChecking.postValue(false); }); } + + @Override + public void onCleared() { + super.onCleared(); + m_executor.shutdownNow(); + } } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java index 11325713..51e9d775 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java @@ -186,7 +186,7 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { if (!onArticleMenuItemSelected(item, article, info.position)) return super.onContextItemSelected(item); } catch (IndexOutOfBoundsException e) { - e.printStackTrace(); + Log.e(TAG, "headlines context menu", e); } } @@ -352,7 +352,7 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { } } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "updating article", e); } } }); @@ -401,7 +401,7 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { m_readArticles.add(new Article(article)); } catch (IndexOutOfBoundsException e) { - e.printStackTrace(); + Log.e(TAG, "marking articles read", e); } } @@ -964,7 +964,7 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { } catch (NumberFormatException e) { m_activity.toast(R.string.score_invalid); - e.printStackTrace(); + Log.e(TAG, "setting article score", e); } }) .setNegativeButton(getString(R.string.cancel), @@ -1240,13 +1240,13 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { mp.setLooping(true); mp.start(); } catch (IllegalStateException e) { - e.printStackTrace(); + Log.e(TAG, "starting media playback", e); } }); m_mediaPlayer.prepareAsync(); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "preparing media player", e); } } @@ -1261,7 +1261,7 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { try { m_mediaPlayer.release(); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "releasing media player", e); } return false; } @@ -1372,7 +1372,7 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_LENGTH) + "…"; } } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "truncating excerpt", e); excerpt = ""; } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java index 505310b6..c1cea4cd 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java @@ -185,8 +185,13 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList // allow overriding feed to open on startup in non-shortcut mode, default to // open_on_startup prefs setting and not-category - int openFeedId = i.getIntExtra("feed_id", - Integer.parseInt(m_prefs.getString("open_on_startup", "0"))); + int openOnStartup; + try { + openOnStartup = Integer.parseInt(m_prefs.getString("open_on_startup", "0")); + } catch (NumberFormatException e) { + openOnStartup = 0; + } + int openFeedId = i.getIntExtra("feed_id", openOnStartup); boolean openFeedIsCat = i.getBooleanExtra("feed_is_cat", false); String openFeedTitle = i.getStringExtra("feed_title"); @@ -359,7 +364,7 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList setSortMode((String) sortNames[which]); } catch (IndexOutOfBoundsException e) { - e.printStackTrace(); + Log.e(TAG, "handling share intent", e); } dialog.cancel(); @@ -387,7 +392,7 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList super.onBackPressed(); } catch (IllegalStateException e) { // java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState - e.printStackTrace(); + Log.e(TAG, "startup activity selection", e); } } } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/OkHttpFactory.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/OkHttpFactory.java new file mode 100644 index 00000000..7922fbd1 --- /dev/null +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/OkHttpFactory.java @@ -0,0 +1,194 @@ +package org.fox.ttrss; + +import android.content.Context; +import android.content.SharedPreferences; +import android.security.KeyChain; +import android.security.KeyChainException; +import android.util.Log; + +import androidx.preference.PreferenceManager; + +import org.fox.ttrss.ApiCommon.ApiError; +import org.fox.ttrss.ApiCommon.ApiCaller; +import org.fox.ttrss.util.KeyChainKeyManager; + +import java.io.IOException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.cert.X509Certificate; +import java.util.concurrent.TimeUnit; + +import javax.net.ssl.KeyManager; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +/** + * Shared OkHttp client factory. + * + * Centralizes mTLS configuration, timeouts, and progress interceptors + * so that ApiCommon (v1) and ApiV2Client (v2) don't duplicate the setup. + */ +public final class OkHttpFactory { + private static final String TAG = "OkHttpFactory"; + + private static final long CONNECT_TIMEOUT = 10; + private static final long WRITE_TIMEOUT = 10; + private static final long READ_TIMEOUT = 30; + + /** + * Callback for download progress. Mirrors ApiCommon.ResponseProgressListener. + */ + public interface ProgressListener { + void update(okhttp3.HttpUrl url, long bytesRead, long contentLength); + } + + private OkHttpFactory() { + // no instances + } + + /** + * Build an OkHttpClient with mTLS support and optional progress tracking. + * + * @param context application context + * @param progressListener progress callback (or null for no progress) + * @param caller api caller for error reporting during mTLS setup + * @return configured OkHttpClient + */ + public static OkHttpClient createClient(Context context, ProgressListener progressListener, ApiCaller caller) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + OkHttpClient.Builder builder = new OkHttpClient.Builder() + .connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS) + .writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS) + .readTimeout(READ_TIMEOUT, TimeUnit.SECONDS); + + if (progressListener != null) { + builder.addNetworkInterceptor(createProgressInterceptor(progressListener)); + } + + configureMtls(context, builder, caller); + + return builder.build(); + } + + /** + * Configure mutual TLS on the OkHttpClient builder. + */ + private static void configureMtls(Context context, OkHttpClient.Builder builder, ApiCaller caller) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + if (!prefs.getBoolean("mtls_enabled", false)) { + return; + } + + String clientCertAlias = prefs.getString("mtls_certificate_alias", null); + if (clientCertAlias == null) { + return; + } + + try { + X509Certificate[] chain = KeyChain.getCertificateChain(context, clientCertAlias); + PrivateKey privateKey = KeyChain.getPrivateKey(context, clientCertAlias); + + KeyManager[] keyManagers = new KeyManager[]{new KeyChainKeyManager(clientCertAlias, chain, privateKey)}; + + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + trustManagerFactory.init((java.security.KeyStore) null); + TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, null); + builder.sslSocketFactory(sslContext.getSocketFactory()); + } catch (KeyChainException | InterruptedException e) { + Log.e(TAG, "mTLS setup failed", e); + if (caller != null) { + caller.setLastErrorMessage(e.getMessage()); + caller.setLastError(ApiError.API_UNKNOWN); + } + } catch (NoSuchAlgorithmException | java.security.KeyStoreException | + java.security.KeyManagementException e) { + Log.e(TAG, "mTLS SSL setup failed", e); + if (caller != null) { + caller.setLastErrorMessage(e.getMessage()); + caller.setLastError(ApiError.API_UNKNOWN); + } + } + } + + /** + * Create an OkHttp interceptor that reports download progress. + */ + private static Interceptor createProgressInterceptor(final ProgressListener listener) { + return chain -> { + Request request = chain.request(); + Response response = chain.proceed(request); + return response.newBuilder() + .body(new ProgressResponseBody(request.url(), response.body(), listener)) + .build(); + }; + } + + /** + * ResponseBody wrapper that reports byte-level progress. + */ + private static class ProgressResponseBody extends ResponseBody { + private final okhttp3.HttpUrl url; + private final ResponseBody responseBody; + private final ProgressListener progressListener; + private BufferedSource bufferedSource; + + ProgressResponseBody(okhttp3.HttpUrl url, ResponseBody responseBody, + ProgressListener progressListener) { + this.url = url; + this.responseBody = responseBody; + this.progressListener = progressListener; + } + + @Override + public okhttp3.MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + long fullLength = responseBody.contentLength(); + if (bytesRead == -1) { + totalBytesRead = fullLength; + } else { + totalBytesRead += bytesRead; + } + progressListener.update(url, totalBytesRead, fullLength); + return bytesRead; + } + }; + } + } +} diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java index 45875ec6..a65a3dc1 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java @@ -292,7 +292,7 @@ public class OnlineActivity extends CommonActivity { try { openUri(Uri.parse(getLastContentImageHitTestUrl())); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "opening content image", e); toast(R.string.error_other_error); } } @@ -846,7 +846,7 @@ public class OnlineActivity extends CommonActivity { } catch (NumberFormatException e) { toast(R.string.score_invalid); - e.printStackTrace(); + Log.e(TAG, "setting article score", e); } }) .setNegativeButton(getString(R.string.cancel), @@ -1247,7 +1247,7 @@ public class OnlineActivity extends CommonActivity { } } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "login request", e); } setSessionId(null); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesFragment.java index 6826c453..5f81afe7 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesFragment.java @@ -5,6 +5,7 @@ import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Bundle; +import android.util.Log; import androidx.annotation.Nullable; import androidx.preference.PreferenceFragmentCompat; @@ -16,6 +17,7 @@ import java.text.SimpleDateFormat; import java.util.Date; public class PreferencesFragment extends PreferenceFragmentCompat { + private static final String TAG = "PreferencesFragment"; @Override public void onCreate(Bundle savedInstanceState) { @@ -66,7 +68,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat { findPreference("build_timestamp").setSummary(getString(R.string.prefs_build_timestamp, buildTimestamp)); } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); + Log.e(TAG, "getting package info", e); } } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/RootCategoriesModel.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/RootCategoriesModel.java index 59790346..d1e3a04a 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/RootCategoriesModel.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/RootCategoriesModel.java @@ -73,7 +73,7 @@ public class RootCategoriesModel extends FeedsModel { setLastError(ApiCommon.ApiError.OTHER_ERROR); setLastErrorMessage(e.getMessage()); - e.printStackTrace(); + Log.e(TAG, "loading root categories", e); } } @@ -144,7 +144,7 @@ public class RootCategoriesModel extends FeedsModel { setLastError(ApiCommon.ApiError.OTHER_ERROR); setLastErrorMessage(e.getMessage()); - e.printStackTrace(); + Log.e(TAG, "loading nested categories", e); } m_isLoading.postValue(false); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/glide/OkHttpProgressGlideModule.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/glide/OkHttpProgressGlideModule.java index b50a4bee..e0ddd9c2 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/glide/OkHttpProgressGlideModule.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/glide/OkHttpProgressGlideModule.java @@ -6,6 +6,7 @@ import android.graphics.BitmapFactory; import android.os.Handler; import android.os.Looper; import android.security.KeyChain; +import android.util.Log; import android.util.Size; import androidx.preference.PreferenceManager; @@ -49,6 +50,8 @@ import okio.Source; @GlideModule public class OkHttpProgressGlideModule extends AppGlideModule { + private static final String TAG = "OkHttpProgressGlide"; + @Override public void registerComponents(Context context, Glide glide, Registry registry) { @@ -79,7 +82,7 @@ public class OkHttpProgressGlideModule extends AppGlideModule { // enable mtls in okhttp3 builder builder.sslSocketFactory(sslContext.getSocketFactory()); } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "configuring mTLS", e); } } diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Article.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Article.java index cdffffe2..376aa987 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Article.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Article.java @@ -1,5 +1,7 @@ package org.fox.ttrss.types; +import android.util.Log; + import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; @@ -14,6 +16,7 @@ import java.util.regex.Pattern; // TODO: serialize Labels public class Article { + private static final String TAG = "Article"; public static final int TYPE_AMR_FOOTER = -2; public static final int FLAVOR_KIND_ALBUM = 1; @@ -153,7 +156,7 @@ public class Article { flavorStreamUri = null; } } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "collecting media info", e); flavorImage = null; flavorImageUri = null; diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/SimpleLoginManager.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/SimpleLoginManager.java index 9693a9b6..11e0026d 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/SimpleLoginManager.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/SimpleLoginManager.java @@ -47,7 +47,7 @@ public abstract class SimpleLoginManager { } } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, "authentication request", e); } m_sessionId = null; diff --git a/org.fox.ttrss/src/test/java/org/fox/ttrss/ApiResponseParserTest.java b/org.fox.ttrss/src/test/java/org/fox/ttrss/ApiResponseParserTest.java new file mode 100644 index 00000000..d75c41b7 --- /dev/null +++ b/org.fox.ttrss/src/test/java/org/fox/ttrss/ApiResponseParserTest.java @@ -0,0 +1,239 @@ +package org.fox.ttrss; + +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; + +import org.junit.Test; + +import org.fox.ttrss.ApiCommon.ApiError; +import org.fox.ttrss.ApiResponseParser.ParsedResponse; + +import static org.junit.Assert.*; + +/** + * Tests for ApiResponseParser — pure logic, no Android dependencies. + */ +public class ApiResponseParserTest { + + // ── parse() — success responses ──────────────────────────────────────── + + @Test + public void parse_successResponse_returnsSuccessTrue() { + String json = "{\"success\":true,\"data\":{\"hello\":\"world\"},\"error\":null}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertTrue("Should be successful", result.success); + assertEquals("Error should be SUCCESS", ApiError.SUCCESS, result.error); + } + + @Test + public void parse_successResponse_returnsData() { + String json = "{\"success\":true,\"data\":{\"count\":42},\"error\":null}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertNotNull("Data should not be null", result.data); + assertEquals("Data should be correct", JsonParser.parseString("{\"count\":42}"), result.data); + } + + @Test + public void parse_successResponse_withNullData_returnsNullElement() { + String json = "{\"success\":true,\"data\":null,\"error\":null}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertTrue("Should be successful", result.success); + assertNotNull("Data element should exist (null JsonElement)", result.data); + assertTrue("Data should be null JSON", result.data.isJsonNull()); + } + + @Test + public void parse_successResponse_withEmptyDataObject() { + String json = "{\"success\":true,\"data\":{},\"error\":null}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertTrue("Should be successful", result.success); + assertNotNull("Data should not be null", result.data); + assertTrue("Data should be an empty object", result.data.isJsonObject()); + } + + // ── parse() — error responses ────────────────────────────────────────── + + @Test + public void parse_errorResponse_returnsSuccessFalse() { + String json = "{\"success\":false,\"data\":null,\"error\":{\"code\":\"LOGIN_ERROR\"}}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertFalse("Should not be successful", result.success); + assertNotNull("Error should be set", result.error); + } + + @Test + public void parse_errorResponse_loginError_mapsToLOGIN_FAILED() { + String json = "{\"success\":false,\"data\":null,\"error\":{\"code\":\"LOGIN_ERROR\"}}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertEquals("LOGIN_ERROR should map to LOGIN_FAILED", ApiError.LOGIN_FAILED, result.error); + } + + @Test + public void parse_errorResponse_notLoggedIn_mapsToLOGIN_FAILED() { + String json = "{\"success\":false,\"data\":null,\"error\":{\"code\":\"NOT_LOGGED_IN\"}}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertEquals("NOT_LOGGED_IN should map to LOGIN_FAILED", ApiError.LOGIN_FAILED, result.error); + } + + @Test + public void parse_errorResponse_apiDisabled_mapsToAPI_DISABLED() { + String json = "{\"success\":false,\"data\":null,\"error\":{\"code\":\"API_DISABLED\"}}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertEquals("API_DISABLED should map to API_DISABLED", ApiError.API_DISABLED, result.error); + } + + @Test + public void parse_errorResponse_incorrectUsage_mapsToAPI_INCORRECT_USAGE() { + String json = "{\"success\":false,\"data\":null,\"error\":{\"code\":\"INCORRECT_USAGE\"}}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertEquals("INCORRECT_USAGE should map to API_INCORRECT_USAGE", ApiError.API_INCORRECT_USAGE, result.error); + } + + @Test + public void parse_errorResponse_unknownCode_mapsToAPI_UNKNOWN() { + String json = "{\"success\":false,\"data\":null,\"error\":{\"code\":\"SOME_UNKNOWN_CODE\"}}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertEquals("Unknown error should map to API_UNKNOWN", ApiError.API_UNKNOWN, result.error); + } + + @Test + public void parse_errorResponse_missingCode_mapsToAPI_UNKNOWN() { + String json = "{\"success\":false,\"data\":null,\"error\":{}}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertEquals("Missing error code should map to API_UNKNOWN", ApiError.API_UNKNOWN, result.error); + } + + @Test + public void parse_errorResponse_missingErrorField_mapsToAPI_UNKNOWN() { + String json = "{\"success\":false,\"data\":null}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertEquals("Missing error object should map to API_UNKNOWN", ApiError.API_UNKNOWN, result.error); + } + + // ── parse() — malformed responses ────────────────────────────────────── + + @Test + public void parse_malformedJson_returnsParseError() { + String json = "not valid json at all"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertFalse("Should not be successful", result.success); + assertEquals("Should be PARSE_ERROR", ApiError.PARSE_ERROR, result.error); + assertNotNull("Error message should be set", result.errorMessage); + assertTrue("Error message should mention parse", result.errorMessage.contains("parse")); + } + + @Test + public void parse_missingSuccessField_returnsParseError() { + String json = "{\"data\":{\"hello\":\"world\"}}"; + ParsedResponse result = ApiResponseParser.parse(json); + + assertFalse("Should not be successful", result.success); + assertEquals("Missing success field should be PARSE_ERROR", ApiError.PARSE_ERROR, result.error); + } + + @Test + public void parse_emptyString_returnsParseError() { + ParsedResponse result = ApiResponseParser.parse(""); + + assertFalse("Should not be successful", result.success); + assertEquals("Empty string should be PARSE_ERROR", ApiError.PARSE_ERROR, result.error); + } + + // ── mapApiError() — direct tests ─────────────────────────────────────── + + @Test + public void mapApiError_loginError_returnsLOGIN_FAILED() { + assertEquals(ApiError.LOGIN_FAILED, ApiResponseParser.mapApiError("LOGIN_ERROR")); + } + + @Test + public void mapApiError_notLoggedIn_returnsLOGIN_FAILED() { + assertEquals(ApiError.LOGIN_FAILED, ApiResponseParser.mapApiError("NOT_LOGGED_IN")); + } + + @Test + public void mapApiError_apiDisabled_returnsAPI_DISABLED() { + assertEquals(ApiError.API_DISABLED, ApiResponseParser.mapApiError("API_DISABLED")); + } + + @Test + public void mapApiError_incorrectUsage_returnsAPI_INCORRECT_USAGE() { + assertEquals(ApiError.API_INCORRECT_USAGE, ApiResponseParser.mapApiError("INCORRECT_USAGE")); + } + + @Test + public void mapApiError_unknown_returnsAPI_UNKNOWN() { + assertEquals(ApiError.API_UNKNOWN, ApiResponseParser.mapApiError("SOME_RANDOM_ERROR")); + } + + // ── mapHttpStatusError() — direct tests ──────────────────────────────── + + @Test + public void mapHttpStatusError_400_returnsHTTP_BAD_REQUEST() { + assertEquals(ApiError.HTTP_BAD_REQUEST, ApiResponseParser.mapHttpStatusError(400)); + } + + @Test + public void mapHttpStatusError_401_returnsHTTP_UNAUTHORIZED() { + assertEquals(ApiError.HTTP_UNAUTHORIZED, ApiResponseParser.mapHttpStatusError(401)); + } + + @Test + public void mapHttpStatusError_403_returnsHTTP_FORBIDDEN() { + assertEquals(ApiError.HTTP_FORBIDDEN, ApiResponseParser.mapHttpStatusError(403)); + } + + @Test + public void mapHttpStatusError_404_returnsHTTP_NOT_FOUND() { + assertEquals(ApiError.HTTP_NOT_FOUND, ApiResponseParser.mapHttpStatusError(404)); + } + + @Test + public void mapHttpStatusError_405_returnsAPI_UNKNOWN_METHOD() { + assertEquals(ApiError.API_UNKNOWN_METHOD, ApiResponseParser.mapHttpStatusError(405)); + } + + @Test + public void mapHttpStatusError_500_returnsHTTP_SERVER_ERROR() { + assertEquals(ApiError.HTTP_SERVER_ERROR, ApiResponseParser.mapHttpStatusError(500)); + } + + @Test + public void mapHttpStatusError_501_returnsHTTP_SERVER_ERROR() { + assertEquals(ApiError.HTTP_SERVER_ERROR, ApiResponseParser.mapHttpStatusError(501)); + } + + @Test + public void mapHttpStatusError_502_returnsHTTP_OTHER_ERROR() { + assertEquals(ApiError.HTTP_OTHER_ERROR, ApiResponseParser.mapHttpStatusError(502)); + } + + @Test + public void mapHttpStatusError_503_returnsHTTP_OTHER_ERROR() { + assertEquals(ApiError.HTTP_OTHER_ERROR, ApiResponseParser.mapHttpStatusError(503)); + } + + @Test + public void mapHttpStatusError_200_returnsHTTP_OTHER_ERROR() { + // 200 is a success code, but this method is only called for error responses + assertEquals(ApiError.HTTP_OTHER_ERROR, ApiResponseParser.mapHttpStatusError(200)); + } + + @Test + public void mapHttpStatusError_999_returnsHTTP_OTHER_ERROR() { + assertEquals(ApiError.HTTP_OTHER_ERROR, ApiResponseParser.mapHttpStatusError(999)); + } +} diff --git a/org.fox.ttrss/src/test/java/org/fox/ttrss/ArticleDetailResponseTest.java b/org.fox.ttrss/src/test/java/org/fox/ttrss/ArticleDetailResponseTest.java new file mode 100644 index 00000000..49c7aa86 --- /dev/null +++ b/org.fox.ttrss/src/test/java/org/fox/ttrss/ArticleDetailResponseTest.java @@ -0,0 +1,225 @@ +package org.fox.ttrss; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import org.junit.Test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import static org.junit.Assert.*; + +/** + * Tests for parsing TT-RSS API v2 article detail responses. + * Uses fixture from src/test/resources/responses/article_detail.json + */ +public class ArticleDetailResponseTest { + + private String loadFixture(String path) throws IOException { + InputStream is = getClass().getClassLoader().getResourceAsStream(path); + if (is == null) { + throw new IOException("Fixture not found: " + path); + } + try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { + StringBuilder sb = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + sb.append(line); + } + return sb.toString(); + } + } + + // ── Response structure ────────────────────────────────────────────────── + + @Test + public void articleResponse_hasSuccessTrue() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/article_detail.json")).getAsJsonObject(); + assertTrue("Article response should have success=true", response.get("success").getAsBoolean()); + } + + @Test + public void articleResponse_hasDataArray() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/article_detail.json")).getAsJsonObject(); + assertTrue("Article data should be an array", response.get("data").isJsonArray()); + } + + // ── Core fields ───────────────────────────────────────────────────────── + + @Test + public void article_hasId() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have id", article.has("id")); + int id = article.get("id").getAsInt(); + assertTrue("Article id should be positive", id > 0); + } + + @Test + public void article_hasGuid() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have guid", article.has("guid")); + assertFalse("Article guid should not be empty", article.get("guid").getAsString().isEmpty()); + } + + @Test + public void article_hasTitle() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have title", article.has("title")); + assertFalse("Article title should not be empty", article.get("title").getAsString().isEmpty()); + } + + @Test + public void article_hasLink() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have link", article.has("link")); + assertFalse("Article link should not be empty", article.get("link").getAsString().isEmpty()); + } + + @Test + public void article_hasFeedId() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have feed_id", article.has("feed_id")); + assertTrue("Article feed_id should be positive", article.get("feed_id").getAsInt() > 0); + } + + @Test + public void article_hasUpdated() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have updated", article.has("updated")); + assertTrue("Article updated should be non-negative", article.get("updated").getAsInt() >= 0); + } + + // ── Boolean status fields ─────────────────────────────────────────────── + + @Test + public void article_hasUnreadBoolean() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("unread must be a primitive", article.get("unread").isJsonPrimitive()); + // Just verify it's a valid boolean value + article.get("unread").getAsBoolean(); + } + + @Test + public void article_hasMarkedBoolean() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("marked must be a primitive", article.get("marked").isJsonPrimitive()); + article.get("marked").getAsBoolean(); + } + + @Test + public void article_hasPublishedBoolean() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("published must be a primitive", article.get("published").isJsonPrimitive()); + article.get("published").getAsBoolean(); + } + + // ── Content and metadata ──────────────────────────────────────────────── + + @Test + public void article_hasContent() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have content", article.has("content")); + String content = article.get("content").getAsString(); + assertFalse("Article content should not be empty", content.isEmpty()); + } + + @Test + public void article_hasAuthor() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have author", article.has("author")); + // Author can be empty string but field must exist + } + + @Test + public void article_hasScore() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have score", article.has("score")); + // Score should be an integer + article.get("score").getAsInt(); + } + + @Test + public void article_hasFeedTitle() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have feed_title", article.has("feed_title")); + assertFalse("Article feed_title should not be empty", article.get("feed_title").getAsString().isEmpty()); + } + + // ── Optional fields ───────────────────────────────────────────────────── + + @Test + public void article_hasNote() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have note", article.has("note")); + // Note can be null (as in this fixture) + } + + @Test + public void article_hasLang() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have lang", article.has("lang")); + } + + @Test + public void article_hasComments() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have comments", article.has("comments")); + } + + @Test + public void article_hasCommentsField() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have comments", article.has("comments")); + } + + // ── Arrays ────────────────────────────────────────────────────────────── + + @Test + public void article_hasLabelsArray() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have labels", article.has("labels")); + assertTrue("labels should be an array", article.get("labels").isJsonArray()); + } + + @Test + public void article_hasAttachmentsArray() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have attachments", article.has("attachments")); + assertTrue("attachments should be an array", article.get("attachments").isJsonArray()); + } + + @Test + public void article_hasEnclosuresArray() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have enclosures", article.has("enclosures")); + assertTrue("enclosures should be an array", article.get("enclosures").isJsonArray()); + } + + // ── Flavor data ───────────────────────────────────────────────────────── + + @Test + public void article_hasFlavorImage() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have flavor_image", article.has("flavor_image")); + } + + @Test + public void article_hasFlavorStream() throws IOException { + JsonObject article = getFirstArticle(); + assertTrue("Article should have flavor_stream", article.has("flavor_stream")); + } + + // ── Helper ────────────────────────────────────────────────────────────── + + private JsonObject getFirstArticle() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/article_detail.json")).getAsJsonObject(); + JsonArray articles = response.getAsJsonArray("data"); + assertTrue("Article data should not be empty", articles.size() > 0); + return articles.get(0).getAsJsonObject(); + } +} diff --git a/org.fox.ttrss/src/test/java/org/fox/ttrss/CountersResponseTest.java b/org.fox.ttrss/src/test/java/org/fox/ttrss/CountersResponseTest.java new file mode 100644 index 00000000..302cde2d --- /dev/null +++ b/org.fox.ttrss/src/test/java/org/fox/ttrss/CountersResponseTest.java @@ -0,0 +1,195 @@ +package org.fox.ttrss; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import org.junit.Test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import static org.junit.Assert.*; + +/** + * Tests for parsing TT-RSS API v2 counters responses. + * Uses fixture from src/test/resources/responses/counters.json + */ +public class CountersResponseTest { + + private String loadFixture(String path) throws IOException { + InputStream is = getClass().getClassLoader().getResourceAsStream(path); + if (is == null) { + throw new IOException("Fixture not found: " + path); + } + try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { + StringBuilder sb = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + sb.append(line); + } + return sb.toString(); + } + } + + @Test + public void countersResponse_hasSuccessTrue() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/counters.json")).getAsJsonObject(); + assertTrue("Counters response should have success=true", response.get("success").getAsBoolean()); + } + + @Test + public void countersResponse_hasDataArray() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/counters.json")).getAsJsonObject(); + assertTrue("Counters data should be an array", response.get("data").isJsonArray()); + } + + @Test + public void countersResponse_hasGlobalUnread() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/counters.json")).getAsJsonObject(); + JsonArray counters = response.getAsJsonArray("data"); + + for (JsonElement entry : counters) { + JsonObject c = entry.getAsJsonObject(); + if ("global-unread".equals(c.get("id").getAsString())) { + assertTrue("global-unread should have a counter", c.has("counter")); + return; + } + } + fail("Counters should have a global-unread entry"); + } + + @Test + public void countersResponse_hasSubscribedFeeds() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/counters.json")).getAsJsonObject(); + JsonArray counters = response.getAsJsonArray("data"); + + for (JsonElement entry : counters) { + JsonObject c = entry.getAsJsonObject(); + if ("subscribed-feeds".equals(c.get("id").getAsString())) { + assertTrue("subscribed-feeds should have a counter", c.has("counter")); + int count = c.get("counter").getAsInt(); + assertTrue("subscribed-feeds count should be positive", count > 0); + return; + } + } + fail("Counters should have a subscribed-feeds entry"); + } + + @Test + public void countersResponse_hasStarredCounter() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/counters.json")).getAsJsonObject(); + JsonArray counters = response.getAsJsonArray("data"); + + for (JsonElement entry : counters) { + JsonObject c = entry.getAsJsonObject(); + if ("-1".equals(c.get("id").getAsString())) { + assertTrue("starred counter should have counter", c.has("counter")); + assertTrue("starred counter should have markedcounter", c.has("markedcounter")); + return; + } + } + fail("Counters should have a starred (-1) entry"); + } + + @Test + public void countersResponse_hasPublishedCounter() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/counters.json")).getAsJsonObject(); + JsonArray counters = response.getAsJsonArray("data"); + + for (JsonElement entry : counters) { + JsonObject c = entry.getAsJsonObject(); + if ("-2".equals(c.get("id").getAsString())) { + assertTrue("published counter should have counter", c.has("counter")); + assertTrue("published counter should have publishedcounter", c.has("publishedcounter")); + return; + } + } + fail("Counters should have a published (-2) entry"); + } + + @Test + public void countersResponse_hasAllArticlesCounter() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/counters.json")).getAsJsonObject(); + JsonArray counters = response.getAsJsonArray("data"); + + for (JsonElement entry : counters) { + JsonObject c = entry.getAsJsonObject(); + if ("-4".equals(c.get("id").getAsString())) { + assertTrue("all-articles counter should have counter", c.has("counter")); + assertTrue("all-articles counter should have auxcounter", c.has("auxcounter")); + return; + } + } + fail("Counters should have an all-articles (-4) entry"); + } + + @Test + public void countersResponse_hasCategoryEntries() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/counters.json")).getAsJsonObject(); + JsonArray counters = response.getAsJsonArray("data"); + + int categoryCount = 0; + for (JsonElement entry : counters) { + JsonObject c = entry.getAsJsonObject(); + // Categories have a description field and negative IDs (e.g. -1298) + if (c.has("description") && c.get("id").getAsInt() < 0) { + categoryCount++; + } + } + assertTrue("Counters should have category entries", categoryCount > 0); + } + + @Test + public void countersResponse_categoryHasCounter() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/counters.json")).getAsJsonObject(); + JsonArray counters = response.getAsJsonArray("data"); + + for (JsonElement entry : counters) { + JsonObject c = entry.getAsJsonObject(); + if (c.has("description")) { + assertTrue("Category counter should have counter", c.has("counter")); + assertTrue("Category counter should have auxcounter", c.has("auxcounter")); + // counter and auxcounter should be non-negative + assertTrue("counter should be non-negative", c.get("counter").getAsInt() >= 0); + assertTrue("auxcounter should be non-negative", c.get("auxcounter").getAsInt() >= 0); + } + } + } + + @Test + public void countersResponse_categoryHasDescription() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/counters.json")).getAsJsonObject(); + JsonArray counters = response.getAsJsonArray("data"); + + for (JsonElement entry : counters) { + JsonObject c = entry.getAsJsonObject(); + if (c.has("description")) { + assertFalse("Category description should not be empty", + c.get("description").getAsString().isEmpty()); + } + } + } + + @Test + public void countersResponse_specialFeedIdsAreNegative() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/counters.json")).getAsJsonObject(); + JsonArray counters = response.getAsJsonArray("data"); + + for (JsonElement entry : counters) { + JsonObject c = entry.getAsJsonObject(); + String id = c.get("id").getAsString(); + // Skip special string IDs + if ("global-unread".equals(id) || "subscribed-feeds".equals(id)) continue; + + int feedId = c.get("id").getAsInt(); + // Special feeds (-1 to -6) should be negative + if (feedId < 0) { + assertTrue("Special feed id should be negative", feedId < 0); + } + } + } +} diff --git a/org.fox.ttrss/src/test/java/org/fox/ttrss/FeedsResponseTest.java b/org.fox.ttrss/src/test/java/org/fox/ttrss/FeedsResponseTest.java new file mode 100644 index 00000000..abc85e55 --- /dev/null +++ b/org.fox.ttrss/src/test/java/org/fox/ttrss/FeedsResponseTest.java @@ -0,0 +1,117 @@ +package org.fox.ttrss; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import org.junit.Test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import static org.junit.Assert.*; + +/** + * Tests for parsing TT-RSS API v2 feeds responses. + * Uses fixture from src/test/resources/responses/feeds.json + */ +public class FeedsResponseTest { + + private String loadFixture(String path) throws IOException { + InputStream is = getClass().getClassLoader().getResourceAsStream(path); + if (is == null) { + throw new IOException("Fixture not found: " + path); + } + try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { + StringBuilder sb = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + sb.append(line); + } + return sb.toString(); + } + } + + @Test + public void feedsResponse_hasSuccessTrue() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/feeds.json")).getAsJsonObject(); + assertTrue("Feeds response should have success=true", response.get("success").getAsBoolean()); + } + + @Test + public void feedsResponse_hasDataArray() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/feeds.json")).getAsJsonObject(); + JsonElement data = response.get("data"); + assertNotNull("Feeds response should have data", data); + assertTrue("Feeds data should be an array", data.isJsonArray()); + } + + @Test + public void feedsResponse_hasMultipleFeeds() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/feeds.json")).getAsJsonObject(); + JsonArray feeds = response.getAsJsonArray("data"); + assertTrue("Feeds should have at least one entry", feeds.size() > 0); + } + + @Test + public void feed_entry_hasRequiredFields() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/feeds.json")).getAsJsonObject(); + JsonArray feeds = response.getAsJsonArray("data"); + JsonObject first = feeds.get(0).getAsJsonObject(); + + assertTrue("Feed should have feed_url", first.has("feed_url")); + assertTrue("Feed should have title", first.has("title")); + assertTrue("Feed should have id", first.has("id")); + assertTrue("Feed should have unread", first.has("unread")); + assertTrue("Feed should have cat_id", first.has("cat_id")); + assertTrue("Feed should have last_updated", first.has("last_updated")); + assertTrue("Feed should have order_id", first.has("order_id")); + assertTrue("Feed should have update_interval", first.has("update_interval")); + } + + @Test + public void feed_entry_hasOptionalFields() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/feeds.json")).getAsJsonObject(); + JsonArray feeds = response.getAsJsonArray("data"); + JsonObject first = feeds.get(0).getAsJsonObject(); + + assertTrue("Feed should have has_icon", first.has("has_icon")); + assertTrue("Feed should have last_error", first.has("last_error")); + } + + @Test + public void feed_entry_idsArePositive() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/feeds.json")).getAsJsonObject(); + JsonArray feeds = response.getAsJsonArray("data"); + + for (JsonElement feed : feeds) { + int id = feed.getAsJsonObject().get("id").getAsInt(); + assertTrue("Feed id should be positive, got: " + id, id > 0); + } + } + + @Test + public void feed_entry_unreadIsNonNegative() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/feeds.json")).getAsJsonObject(); + JsonArray feeds = response.getAsJsonArray("data"); + + for (JsonElement feed : feeds) { + int unread = feed.getAsJsonObject().get("unread").getAsInt(); + assertTrue("Feed unread should be non-negative, got: " + unread, unread >= 0); + } + } + + @Test + public void feed_entry_hasNonEmptyTitle() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/feeds.json")).getAsJsonObject(); + JsonArray feeds = response.getAsJsonArray("data"); + + for (JsonElement feed : feeds) { + String title = feed.getAsJsonObject().get("title").getAsString(); + assertFalse("Feed title should not be empty", title.isEmpty()); + } + } +} diff --git a/org.fox.ttrss/src/test/java/org/fox/ttrss/HeadlinesResponseTest.java b/org.fox.ttrss/src/test/java/org/fox/ttrss/HeadlinesResponseTest.java new file mode 100644 index 00000000..e00305fd --- /dev/null +++ b/org.fox.ttrss/src/test/java/org/fox/ttrss/HeadlinesResponseTest.java @@ -0,0 +1,167 @@ +package org.fox.ttrss; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import org.junit.Test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import static org.junit.Assert.*; + +/** + * Tests for parsing TT-RSS API v2 headlines (articles) responses. + * Uses fixture from src/test/resources/responses/headlines.json + */ +public class HeadlinesResponseTest { + + private String loadFixture(String path) throws IOException { + InputStream is = getClass().getClassLoader().getResourceAsStream(path); + if (is == null) { + throw new IOException("Fixture not found: " + path); + } + try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { + StringBuilder sb = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + sb.append(line); + } + return sb.toString(); + } + } + + @Test + public void headlinesResponse_hasSuccessTrue() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + assertTrue("Headlines response should have success=true", response.get("success").getAsBoolean()); + } + + @Test + public void headlinesResponse_hasDataArray() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + assertTrue("Headlines data should be an array", response.get("data").isJsonArray()); + } + + @Test + public void headlinesResponse_hasArticles() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + JsonArray articles = response.getAsJsonArray("data"); + assertTrue("Headlines should have at least one article", articles.size() > 0); + } + + @Test + public void article_entry_hasRequiredFields() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + JsonArray articles = response.getAsJsonArray("data"); + JsonObject first = articles.get(0).getAsJsonObject(); + + assertTrue("Article should have id", first.has("id")); + assertTrue("Article should have guid", first.has("guid")); + assertTrue("Article should have unread", first.has("unread")); + assertTrue("Article should have marked", first.has("marked")); + assertTrue("Article should have published", first.has("published")); + assertTrue("Article should have updated", first.has("updated")); + assertTrue("Article should have title", first.has("title")); + assertTrue("Article should have link", first.has("link")); + assertTrue("Article should have feed_id", first.has("feed_id")); + } + + @Test + public void article_entry_hasOptionalFields() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + JsonArray articles = response.getAsJsonArray("data"); + JsonObject first = articles.get(0).getAsJsonObject(); + + assertTrue("Article should have is_updated", first.has("is_updated")); + assertTrue("Article should have tags", first.has("tags")); + assertTrue("Article should have labels", first.has("labels")); + assertTrue("Article should have feed_title", first.has("feed_title")); + assertTrue("Article should have comments_count", first.has("comments_count")); + assertTrue("Article should have comments_link", first.has("comments_link")); + } + + @Test + public void article_entry_idsArePositive() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + JsonArray articles = response.getAsJsonArray("data"); + + for (JsonElement article : articles) { + int id = article.getAsJsonObject().get("id").getAsInt(); + assertTrue("Article id should be positive, got: " + id, id > 0); + } + } + + @Test + public void article_entry_updatedIsNonNegative() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + JsonArray articles = response.getAsJsonArray("data"); + + for (JsonElement article : articles) { + int updated = article.getAsJsonObject().get("updated").getAsInt(); + assertTrue("Article updated should be non-negative, got: " + updated, updated >= 0); + } + } + + @Test + public void article_entry_feedIdIsPositive() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + JsonArray articles = response.getAsJsonArray("data"); + + for (JsonElement article : articles) { + int feedId = article.getAsJsonObject().get("feed_id").getAsInt(); + assertTrue("Article feed_id should be positive, got: " + feedId, feedId > 0); + } + } + + @Test + public void article_entry_booleanFieldsAreValid() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + JsonArray articles = response.getAsJsonArray("data"); + + for (JsonElement article : articles) { + JsonObject a = article.getAsJsonObject(); + assertTrue("unread must be boolean", a.get("unread").isJsonPrimitive()); + assertTrue("marked must be boolean", a.get("marked").isJsonPrimitive()); + assertTrue("published must be boolean", a.get("published").isJsonPrimitive()); + assertTrue("is_updated must be boolean", a.get("is_updated").isJsonPrimitive()); + } + } + + @Test + public void article_entry_tagsIsArray() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + JsonArray articles = response.getAsJsonArray("data"); + + for (JsonElement article : articles) { + JsonObject a = article.getAsJsonObject(); + assertTrue("tags should be an array", a.get("tags").isJsonArray()); + } + } + + @Test + public void article_entry_guidIsPresent() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + JsonArray articles = response.getAsJsonArray("data"); + + for (JsonElement article : articles) { + JsonObject a = article.getAsJsonObject(); + assertTrue("guid should not be empty", !a.get("guid").getAsString().isEmpty()); + } + } + + @Test + public void article_entry_titleIsNonEmpty() throws IOException { + JsonObject response = JsonParser.parseString(loadFixture("responses/headlines.json")).getAsJsonObject(); + JsonArray articles = response.getAsJsonArray("data"); + + for (JsonElement article : articles) { + JsonObject a = article.getAsJsonObject(); + assertFalse("Article title should not be empty", a.get("title").getAsString().isEmpty()); + } + } +} diff --git a/org.fox.ttrss/src/test/java/org/fox/ttrss/LoginResponseTest.java b/org.fox.ttrss/src/test/java/org/fox/ttrss/LoginResponseTest.java new file mode 100644 index 00000000..b06d692d --- /dev/null +++ b/org.fox.ttrss/src/test/java/org/fox/ttrss/LoginResponseTest.java @@ -0,0 +1,130 @@ +package org.fox.ttrss; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import org.junit.Before; +import org.junit.Test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import static org.junit.Assert.*; + +/** + * Tests for parsing TT-RSS API v2 login responses. + * Uses fixture from src/test/resources/responses/login.json + */ +public class LoginResponseTest { + + private Gson gson; + + @Before + public void setUp() { + gson = new Gson(); + } + + private String loadFixture(String path) throws IOException { + InputStream is = getClass().getClassLoader().getResourceAsStream(path); + if (is == null) { + throw new IOException("Fixture not found: " + path); + } + try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { + StringBuilder sb = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + sb.append(line); + } + return sb.toString(); + } + } + + @Test + public void loginResponse_hasSuccessTrue() throws IOException { + String json = loadFixture("responses/login.json"); + JsonObject response = JsonParser.parseString(json).getAsJsonObject(); + + assertTrue("Login response should have success=true", + response.get("success").getAsBoolean()); + } + + @Test + public void loginResponse_hasDataObject() throws IOException { + String json = loadFixture("responses/login.json"); + JsonObject response = JsonParser.parseString(json).getAsJsonObject(); + + assertNotNull("Login response should have data", response.has("data")); + assertTrue("Login data should be an object", response.get("data").isJsonObject()); + } + + @Test + public void loginResponse_hasSessionId() throws IOException { + String json = loadFixture("responses/login.json"); + JsonObject response = JsonParser.parseString(json).getAsJsonObject(); + JsonObject data = response.getAsJsonObject("data"); + + assertTrue("Login data should have session_id", data.has("session_id")); + String sessionId = data.get("session_id").getAsString(); + assertFalse("Session ID should not be empty", sessionId.isEmpty()); + } + + @Test + public void loginResponse_hasApiLevel() throws IOException { + String json = loadFixture("responses/login.json"); + JsonObject response = JsonParser.parseString(json).getAsJsonObject(); + JsonObject data = response.getAsJsonObject("data"); + + assertTrue("Login data should have api_level", data.has("api_level")); + int apiLevel = data.get("api_level").getAsInt(); + assertTrue("API level should be positive", apiLevel > 0); + } + + @Test + public void loginResponse_hasConfig() throws IOException { + String json = loadFixture("responses/login.json"); + JsonObject response = JsonParser.parseString(json).getAsJsonObject(); + JsonObject data = response.getAsJsonObject("data"); + JsonObject config = data.getAsJsonObject("config"); + + assertNotNull("Login data should have config", config); + assertTrue("Config should have icons_url", config.has("icons_url")); + assertTrue("Config should have num_feeds", config.has("num_feeds")); + } + + @Test + public void loginResponse_errorIsNullOnSuccess() throws IOException { + String json = loadFixture("responses/login.json"); + JsonObject response = JsonParser.parseString(json).getAsJsonObject(); + + // error may be present but must be null on success + JsonElement error = response.get("error"); + if (error != null) { + assertTrue("Login response error should be null on success", + error.isJsonNull()); + } + } + + @Test + public void loginError_response_hasSuccessFalse() throws IOException { + String json = loadFixture("responses/login_error.json"); + JsonObject response = JsonParser.parseString(json).getAsJsonObject(); + + assertFalse("Failed login should have success=false", + response.get("success").getAsBoolean()); + } + + @Test + public void loginError_response_hasErrorObject() throws IOException { + String json = loadFixture("responses/login_error.json"); + JsonObject response = JsonParser.parseString(json).getAsJsonObject(); + + assertTrue("Failed login should have error", response.has("error")); + JsonObject error = response.getAsJsonObject("error"); + assertEquals("Error code should be LOGIN_ERROR", + "LOGIN_ERROR", error.get("code").getAsString()); + } +} diff --git a/org.fox.ttrss/src/test/java/org/fox/ttrss/types/ArticleTest.java b/org.fox.ttrss/src/test/java/org/fox/ttrss/types/ArticleTest.java new file mode 100644 index 00000000..9ea6a8fb --- /dev/null +++ b/org.fox.ttrss/src/test/java/org/fox/ttrss/types/ArticleTest.java @@ -0,0 +1,555 @@ +package org.fox.ttrss.types; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Tests for Article.java parsing logic. + * Tests the pure-Java methods: fixNullFields, cleanupExcerpt, collectMediaInfo, + * isHostDistinct, getLinkHost, equals, and toString. + */ +public class ArticleTest { + + // ── fixNullFields ──────────────────────────────────────────────────────── + + @Test + public void fixNullFields_setsNullNoteToEmptyString() { + Article article = new Article(); + article.note = null; + article.link = null; + article.tags = null; + article.excerpt = null; + article.content = null; + article.comments_link = null; + + article.fixNullFields(); + + assertEquals("", article.note); + assertEquals("", article.link); + assertNotNull(article.tags); + assertTrue(article.tags.isEmpty()); + assertEquals("", article.excerpt); + assertEquals("", article.content); + assertEquals("", article.comments_link); + } + + @Test + public void fixNullFields_preservesNonNullFields() { + Article article = new Article(); + article.note = "existing note"; + article.link = "https://example.com"; + article.tags = new java.util.ArrayList<>(); + article.tags.add("tag1"); + article.excerpt = "some excerpt"; + article.content = "<p>content</p>"; + article.comments_link = "https://example.com/comments"; + + article.fixNullFields(); + + assertEquals("existing note", article.note); + assertEquals("https://example.com", article.link); + assertEquals(1, article.tags.size()); + assertEquals("some excerpt", article.excerpt); + assertEquals("<p>content</p>", article.content); + assertEquals("https://example.com/comments", article.comments_link); + } + + // ── cleanupExcerpt ─────────────────────────────────────────────────────── + + @Test + public void cleanupExcerpt_replacesHellip() { + Article article = new Article(); + article.excerpt = "This is a long … text"; + article.cleanupExcerpt(); + assertEquals("This is a long … text", article.excerpt); + } + + @Test + public void cleanupExcerpt_stripsCdata() { + Article article = new Article(); + article.excerpt = "Some text <![CDATA[safe content]]]>"; + article.cleanupExcerpt(); + // ]]> is stripped first, then Jsoup parses remaining <![CDATA[safe content] + // leaving a trailing ] from the CDATA bracket + assertEquals("Some text safe content]", article.excerpt); + } + + @Test + public void cleanupExcerpt_stripsHtmlTags() { + Article article = new Article(); + article.excerpt = "<p>Hello <b>world</b></p>"; + article.cleanupExcerpt(); + assertEquals("Hello world", article.excerpt); + } + + @Test + public void cleanupExcerpt_hellipThenHtml() { + Article article = new Article(); + article.excerpt = "A long … <p>story</p>"; + article.cleanupExcerpt(); + assertEquals("A long … story", article.excerpt); + } + + @Test + public void cleanupExcerpt_nullExcerpt_doesNotThrow() { + Article article = new Article(); + article.excerpt = null; + article.cleanupExcerpt(); + assertNull(article.excerpt); + } + + @Test + public void cleanupExcerpt_emptyExcerpt_doesNotThrow() { + Article article = new Article(); + article.excerpt = ""; + article.cleanupExcerpt(); + assertEquals("", article.excerpt); + } + + // ── collectMediaInfo — direct flavor_image ─────────────────────────────── + + @Test + public void collectMediaInfo_usesDirectFlavorImage() { + Article article = new Article(); + article.flavor_image = "https://example.com/image.png"; + article.flavor_stream = "https://example.com/video.mp4"; + article.content = ""; + article.attachments = null; + + article.collectMediaInfo(); + + assertEquals("https://example.com/image.png", article.flavorImageUri); + assertEquals("https://example.com/video.mp4", article.flavorStreamUri); + assertNotNull(article.flavorImage); + assertEquals("img", article.flavorImage.tagName()); + } + + @Test + public void collectMediaInfo_directFlavorImage_ignoresContent() { + Article article = new Article(); + article.flavor_image = "https://example.com/direct.png"; + article.flavor_stream = ""; + article.content = "<img src='http://other.com/should-not-appear.jpg'>"; + article.attachments = null; + + article.collectMediaInfo(); + + assertEquals("https://example.com/direct.png", article.flavorImageUri); + assertNull(article.flavorStreamUri); + } + + @Test + public void collectMediaInfo_emptyFlavorImage_ignoresIt() { + Article article = new Article(); + article.flavor_image = ""; + article.flavor_stream = "https://example.com/stream.mp4"; + article.content = ""; + article.attachments = null; + + article.collectMediaInfo(); + + assertNull(article.flavorImageUri); + assertNull(article.flavorStreamUri); + assertNull(article.flavorImage); + } + + // ── collectMediaInfo — YouTube embed ───────────────────────────────────── + + @Test + public void collectMediaInfo_youtubeEmbed_extractsVideoId() { + Article article = new Article(); + article.flavor_image = null; + article.content = "<html><body><iframe src=\"https://www.youtube.com/embed/dQw4w9WgXcQ\"></iframe></body></html>"; + article.attachments = null; + + article.collectMediaInfo(); + + assertEquals("dQw4w9WgXcQ", article.youtubeVid); + assertEquals("https://img.youtube.com/vi/dQw4w9WgXcQ/hqdefault.jpg", article.flavorImageUri); + assertEquals("https://youtu.be/dQw4w9WgXcQ", article.flavorStreamUri); + assertNotNull(article.flavorImage); + assertEquals("iframe", article.flavorImage.tagName()); + } + + @Test + public void collectMediaInfo_youtubeEmbed_prefersIframeOverImg() { + Article article = new Article(); + article.flavor_image = null; + article.content = "<html><body><img src='https://example.com/thumb.jpg'>" + + "<iframe src=\"https://www.youtube.com/embed/abc123\"></iframe></body></html>"; + article.attachments = null; + + article.collectMediaInfo(); + + // iframe should be preferred over img + assertEquals("abc123", article.youtubeVid); + assertEquals("https://img.youtube.com/vi/abc123/hqdefault.jpg", article.flavorImageUri); + } + + @Test + public void collectMediaInfo_youtubeEmbed_handlesSubpath() { + Article article = new Article(); + article.flavor_image = null; + article.content = "<html><body><iframe src=\"https://www.youtube.com/embed/xyz789?start=10\"></iframe></body></html>"; + article.attachments = null; + + article.collectMediaInfo(); + + assertEquals("xyz789", article.youtubeVid); + } + + // ── collectMediaInfo — video element ───────────────────────────────────── + + @Test + public void collectMediaInfo_videoWithSource_extractsPosterAndStream() { + Article article = new Article(); + article.flavor_image = null; + article.content = "<html><body><video poster='https://example.com/poster.jpg'>" + + "<source src='https://example.com/video.mp4'></video></body></html>"; + article.attachments = null; + + article.collectMediaInfo(); + + assertEquals("https://example.com/poster.jpg", article.flavorImageUri); + assertEquals("https://example.com/video.mp4", article.flavorStreamUri); + assertNotNull(article.flavorImage); + assertEquals("video", article.flavorImage.tagName()); + } + + @Test + public void collectMediaInfo_videoWithoutSource_ignoresIt() { + Article article = new Article(); + article.flavor_image = null; + article.content = "<html><body><video></video></body></html>"; + article.attachments = null; + + article.collectMediaInfo(); + + // No source, so no media info extracted from video + assertNull(article.flavorImageUri); + assertNull(article.flavorStreamUri); + } + + // ── collectMediaInfo — regular image ───────────────────────────────────── + + @Test + public void collectMediaInfo_regularImage_setsUri() { + Article article = new Article(); + article.flavor_image = null; + article.content = "<html><body><img src='https://example.com/photo.jpg' alt='photo'></body></html>"; + article.attachments = null; + + article.collectMediaInfo(); + + assertEquals("https://example.com/photo.jpg", article.flavorImageUri); + assertNull(article.flavorStreamUri); + assertNotNull(article.flavorImage); + assertEquals("img", article.flavorImage.tagName()); + } + + @Test + public void collectMediaInfo_protocolRelativeImage_addsHttps() { + Article article = new Article(); + article.flavor_image = null; + article.content = "<html><body><img src='//cdn.example.com/image.png'></body></html>"; + article.attachments = null; + + article.collectMediaInfo(); + + assertEquals("https://cdn.example.com/image.png", article.flavorImageUri); + } + + // ── collectMediaInfo — fallback to attachments ─────────────────────────── + + @Test + public void collectMediaInfo_fallbackToImageAttachment() { + Article article = new Article(); + article.flavor_image = null; + article.content = ""; + article.attachments = new java.util.ArrayList<>(); + + Attachment imgAttachment = new Attachment(); + imgAttachment.content_url = "//cdn.example.com/attach.jpg"; + imgAttachment.content_type = "image/jpeg"; + article.attachments.add(imgAttachment); + + article.collectMediaInfo(); + + assertEquals("https://cdn.example.com/attach.jpg", article.flavorImageUri); + assertNotNull(article.flavorImage); + } + + @Test + public void collectMediaInfo_skipsNonImageAttachments() { + Article article = new Article(); + article.flavor_image = null; + article.content = ""; + article.attachments = new java.util.ArrayList<>(); + + Attachment pdf = new Attachment(); + pdf.content_url = "https://example.com/document.pdf"; + pdf.content_type = "application/pdf"; + article.attachments.add(pdf); + + article.collectMediaInfo(); + + assertNull(article.flavorImageUri); + } + + @Test + public void collectMediaInfo_emptyAttachments_doesNotThrow() { + Article article = new Article(); + article.flavor_image = null; + article.content = ""; + article.attachments = new java.util.ArrayList<>(); + + article.collectMediaInfo(); + + assertNull(article.flavorImageUri); + } + + // ── collectMediaInfo — no media at all ─────────────────────────────────── + + @Test + public void collectMediaInfo_noMedia_setsAllToNull() { + Article article = new Article(); + article.flavor_image = null; + article.content = "<html><body><p>just text</p></body></html>"; + article.attachments = null; + + article.collectMediaInfo(); + + assertNull(article.flavorImageUri); + assertNull(article.flavorStreamUri); + assertNull(article.flavorImage); + assertNull(article.youtubeVid); + } + + // ── isHostDistinct ─────────────────────────────────────────────────────── + + @Test + public void isHostDistinct_differentHosts_returnsTrue() { + Article article = new Article(); + article.site_url = "https://example.com"; + article.link = "https://other.com/article"; + + assertTrue(article.isHostDistinct()); + } + + @Test + public void isHostDistinct_sameHost_returnsFalse() { + Article article = new Article(); + article.site_url = "https://example.com"; + article.link = "https://example.com/article"; + + assertFalse(article.isHostDistinct()); + } + + @Test + public void isHostDistinct_wwwNormalized() { + Article article = new Article(); + article.site_url = "https://www.example.com"; + article.link = "https://example.com/article"; + + assertFalse(article.isHostDistinct()); + } + + @Test + public void isHostDistinct_malformedUrl_returnsFalse() { + Article article = new Article(); + article.site_url = "not a url"; + article.link = "https://example.com"; + + assertFalse(article.isHostDistinct()); + } + + @Test + public void isHostDistinct_nullFields_returnsFalse() { + Article article = new Article(); + + assertFalse(article.isHostDistinct()); + } + + // ── getLinkHost ────────────────────────────────────────────────────────── + + @Test + public void getLinkHost_validUrl_returnsHost() { + Article article = new Article(); + article.link = "https://example.com/path/to/article"; + + assertEquals("example.com", article.getLinkHost()); + } + + @Test + public void getLinkHost_subdomain_returnsSubdomain() { + Article article = new Article(); + article.link = "https://blog.example.com/article"; + + assertEquals("blog.example.com", article.getLinkHost()); + } + + @Test + public void getLinkHost_malformedUrl_returnsEmpty() { + Article article = new Article(); + article.link = "not a url"; + + assertEquals("", article.getLinkHost()); + } + + @Test + public void getLinkHost_nullLink_returnsEmpty() { + Article article = new Article(); + article.link = null; + + assertEquals("", article.getLinkHost()); + } + + // ── equals ─────────────────────────────────────────────────────────────── + + @Test + public void equals_sameId_returnsTrue() { + Article a1 = new Article(42); + Article a2 = new Article(42); + + assertTrue(a1.equals(a2)); + } + + @Test + public void equals_differentId_returnsFalse() { + Article a1 = new Article(42); + Article a2 = new Article(43); + + assertFalse(a1.equals(a2)); + } + + @Test + public void equals_null_returnsFalse() { + Article article = new Article(42); + + assertFalse(article.equals(null)); + } + + @Test + public void equals_sameObject_returnsTrue() { + Article article = new Article(42); + + assertTrue(article.equals(article)); + } + + @Test + public void equals_differentClass_returnsFalse() { + Article article = new Article(42); + + assertFalse(article.equals("not an article")); + } + + // ── toString ───────────────────────────────────────────────────────────── + + @Test + public void toString_containsId() { + Article article = new Article(123); + String str = article.toString(); + + assertTrue(str.contains("id:123")); + } + + @Test + public void toString_containsBooleanFields() { + Article article = new Article(1); + article.unread = true; + article.marked = false; + article.published = true; + article.score = 100; + article.selected = true; + + String str = article.toString(); + + assertTrue(str.contains("unread:true")); + assertTrue(str.contains("marked:false")); + assertTrue(str.contains("published:true")); + assertTrue(str.contains("score:100")); + assertTrue(str.contains("selected:true")); + } + + // ── clone ──────────────────────────────────────────────────────────────── + + @Test + public void clone_copiesAllFields() { + Article original = new Article(99); + original.unread = true; + original.marked = false; + original.published = true; + original.score = 42; + original.updated = 1234567890; + original.is_updated = true; + original.title = "Test Title"; + original.link = "https://example.com"; + original.feed_id = 7; + original.tags = new java.util.ArrayList<>(); + original.tags.add("tag1"); + original.attachments = new java.util.ArrayList<>(); + original.content = "<p>content</p>"; + original.excerpt = "excerpt"; + original.labels = new java.util.ArrayList<>(); + original.feed_title = "Test Feed"; + original.comments_count = 5; + original.comments_link = "https://example.com/comments"; + original.always_display_attachments = true; + original.author = "Author Name"; + original.note = "A note"; + original.selected = true; + original.active = true; + original.flavor_image = "https://example.com/thumb.jpg"; + original.flavor_stream = "https://example.com/stream.mp4"; + original.flavor_kind = 2; + original.site_url = "https://example.com"; + + Article clone = new Article(original); + + assertEquals(original.id, clone.id); + assertEquals(original.unread, clone.unread); + assertEquals(original.marked, clone.marked); + assertEquals(original.published, clone.published); + assertEquals(original.score, clone.score); + assertEquals(original.updated, clone.updated); + assertEquals(original.is_updated, clone.is_updated); + assertEquals(original.title, clone.title); + assertEquals(original.link, clone.link); + assertEquals(original.feed_id, clone.feed_id); + assertEquals(original.tags, clone.tags); + assertEquals(original.attachments, clone.attachments); + assertEquals(original.content, clone.content); + assertEquals(original.excerpt, clone.excerpt); + assertEquals(original.labels, clone.labels); + assertEquals(original.feed_title, clone.feed_title); + assertEquals(original.comments_count, clone.comments_count); + assertEquals(original.comments_link, clone.comments_link); + assertEquals(original.always_display_attachments, clone.always_display_attachments); + assertEquals(original.author, clone.author); + assertEquals(original.note, clone.note); + assertEquals(original.selected, clone.selected); + assertEquals(original.active, clone.active); + assertEquals(original.flavor_image, clone.flavor_image); + assertEquals(original.flavor_stream, clone.flavor_stream); + assertEquals(original.flavor_kind, clone.flavor_kind); + assertEquals(original.site_url, clone.site_url); + } + + @Test + public void clone_copiesTransientFields() { + Article original = new Article(1); + original.flavorImageUri = "https://example.com/uri"; + original.flavorStreamUri = "https://example.com/stream"; + original.youtubeVid = "abc123"; + + Article clone = new Article(original); + + assertEquals(original.flavorImageUri, clone.flavorImageUri); + assertEquals(original.flavorStreamUri, clone.flavorStreamUri); + assertEquals(original.youtubeVid, clone.youtubeVid); + } +} diff --git a/org.fox.ttrss/src/test/resources/responses/article_detail.json b/org.fox.ttrss/src/test/resources/responses/article_detail.json new file mode 100644 index 00000000..15a31fb9 --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/article_detail.json @@ -0,0 +1 @@ +{"success":true,"data":[{"id":18623503,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:4c2e274af9b395d1a3e2f1e5dcc0ca53ae940e63\"}","title":"Got myself a birthday present.","link":"https:\/\/old.reddit.com\/r\/vintagecomputing\/comments\/1ty2vrk\/got_myself_a_birthday_present\/","labels":[],"unread":false,"marked":false,"published":false,"comments":"","author":"\/u\/voltron_87","updated":1780707180,"feed_id":10878,"attachments":[],"score":0,"feed_title":"reddit","note":null,"lang":"","flavor_image":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=cached_redirect&url=https%3A%2F%2Fpreview.redd.it%2Fmgz3u7xn8k5h1.png%3Fwidth%3D140%26height%3D105%26auto%3Dwebp%26s%3D919c1e04a4124a24e8a5f9ac35a20fa54d7c1904&d=images","flavor_stream":"","enclosures":[],"content":"<?xml encoding=\"UTF-8\"><html><body><div><div> <a href=\"https:\/\/old.reddit.com\/r\/vintagecomputing\/comments\/1ty2vrk\/got_myself_a_birthday_present\/\" rel=\"noopener noreferrer\" target=\"_blank\"> <img src=\"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=cached_redirect&url=https%3A%2F%2Fpreview.redd.it%2Fmgz3u7xn8k5h1.png%3Fwidth%3D140%26height%3D105%26auto%3Dwebp%26s%3D919c1e04a4124a24e8a5f9ac35a20fa54d7c1904&d=images\" alt=\"Got myself a birthday present.\" title=\"Got myself a birthday present.\" referrerpolicy=\"no-referrer\" loading=\"lazy\"> <\/a> <\/div><div> <!-- SC_OFF --><div><p>got the sidewinder 3d pro ready for some action!<\/p> <\/div><!-- SC_ON --> submitted by <a href=\"https:\/\/old.reddit.com\/user\/voltron_87\" rel=\"noopener noreferrer\" target=\"_blank\"> \/u\/voltron_87 <\/a> to <a href=\"https:\/\/old.reddit.com\/r\/vintagecomputing\/\" rel=\"noopener noreferrer\" target=\"_blank\"> r\/vintagecomputing <\/a> <br> <span><a href=\"https:\/\/www.reddit.com\/gallery\/1ty2vrk\" rel=\"noopener noreferrer\" target=\"_blank\">[link]<\/a><\/span> <span><a href=\"https:\/\/old.reddit.com\/r\/vintagecomputing\/comments\/1ty2vrk\/got_myself_a_birthday_present\/\" rel=\"noopener noreferrer\" target=\"_blank\">[comments]<\/a><\/span> <\/div><\/div><\/body><\/html>\n"}],"error":null} diff --git a/org.fox.ttrss/src/test/resources/responses/categories.json b/org.fox.ttrss/src/test/resources/responses/categories.json new file mode 100644 index 00000000..c1a23b71 --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/categories.json @@ -0,0 +1 @@ +{"success":true,"data":[{"id":2,"title":"Blogs","unread":0,"order_id":1},{"id":74,"title":"Comics","unread":0,"order_id":2},{"id":60,"title":"Games","unread":0,"order_id":3},{"id":1022,"title":"Security","unread":0,"order_id":4},{"id":914,"title":"Software","unread":0,"order_id":5},{"id":989,"title":"Gitlab","unread":0,"order_id":1},{"id":12,"title":"Technology","unread":0,"order_id":6},{"id":947,"title":"Trashcan","unread":0,"order_id":7},{"id":-2,"title":"Labels","unread":0},{"id":-1,"title":"Special","unread":0},{"id":0,"title":"Uncategorized","unread":0}],"error":null} diff --git a/org.fox.ttrss/src/test/resources/responses/config.json b/org.fox.ttrss/src/test/resources/responses/config.json new file mode 100644 index 00000000..1e4f26b3 --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/config.json @@ -0,0 +1 @@ +{"success":true,"data":{"custom_sort_types":[],"daemon_is_running":false,"icons_url":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php","num_feeds":99},"error":null} diff --git a/org.fox.ttrss/src/test/resources/responses/counters.json b/org.fox.ttrss/src/test/resources/responses/counters.json new file mode 100644 index 00000000..c654aec8 --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/counters.json @@ -0,0 +1 @@ +{"success":true,"data":[{"id":"global-unread","counter":0},{"id":"subscribed-feeds","counter":99},{"id":0,"counter":0,"auxcounter":3},{"id":-1,"counter":0,"auxcounter":11,"markedcounter":11},{"id":-2,"counter":0,"auxcounter":0,"publishedcounter":0},{"id":-3,"counter":0,"auxcounter":0},{"id":-4,"counter":0,"auxcounter":0},{"id":-1298,"counter":0,"auxcounter":65,"markedcounter":1,"publishedcounter":0,"description":"Debian"},{"id":-1292,"counter":0,"auxcounter":675,"markedcounter":1,"publishedcounter":0,"description":"Technology"},{"id":-1313,"counter":0,"auxcounter":1039,"markedcounter":2,"publishedcounter":0,"description":"Security"},{"id":-1297,"counter":0,"auxcounter":23,"markedcounter":0,"publishedcounter":0,"description":"GNOME"},{"id":-1296,"counter":0,"auxcounter":28,"markedcounter":0,"publishedcounter":0,"description":"KDE"},{"id":-1315,"counter":0,"auxcounter":200,"markedcounter":0,"publishedcounter":0,"description":"Exploit"},{"id":-1314,"counter":0,"auxcounter":376,"markedcounter":0,"publishedcounter":0,"description":"Vulnerability"},{"id":-1293,"counter":0,"auxcounter":351,"markedcounter":1,"publishedcounter":0,"description":"Games"},{"id":-1291,"counter":0,"auxcounter":526,"markedcounter":1,"publishedcounter":0,"description":"Linux"},{"id":-1316,"counter":0,"auxcounter":39,"markedcounter":0,"publishedcounter":0,"description":"Wayland"},{"id":-1299,"counter":0,"auxcounter":424,"markedcounter":1,"publishedcounter":0,"description":"Windows"},{"id":-1295,"counter":0,"auxcounter":144,"markedcounter":0,"publishedcounter":0,"description":"Git"},{"id":-1294,"counter":0,"auxcounter":17,"markedcounter":0,"publishedcounter":0,"description":"FreeBSD"},{"id":-1033,"counter":0,"auxcounter":0,"markedcounter":0,"publishedcounter":0,"description":"Tiny Tiny RSS"},{"id":11042,"title":"The Hacker News","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":2352,"title":"Buni","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10988,"title":"Release notes from minio","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":9594,"title":"\u0413\u043e\u0440\u044f\u0447\u0438\u0435 \u041d\u043e\u0432\u0438\u043d\u043a\u0438","error":"","updated":"4:15","counter":0,"markedcounter":1,"publishedcounter":0,"ts":1780735998},{"id":10804,"title":"Release notes from minio","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10702,"title":"Release notes from redis","error":"","updated":"4:31","counter":0,"markedcounter":2,"publishedcounter":0,"ts":1780735998},{"id":10844,"title":"Vaxry's Blog","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10039,"title":"GitLab","error":"","updated":"4:30","counter":0,"markedcounter":2,"publishedcounter":0,"ts":1780735998},{"id":10298,"title":"GitLab Security Releases","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11029,"title":"Calvin and Hobbes - GoComics","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11031,"title":"FoxTrot Classics - GoComics","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10206,"title":"GitLab FOSS tags","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":8815,"title":"The CRPG Addict","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10085,"title":"Release notes from tengine","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10294,"title":"Release notes from transgui","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10805,"title":"Release notes from mc","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":9607,"title":"StoneToss","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10664,"title":"Release notes from faugus-laun…","error":"","updated":"Never","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10667,"title":"BattlePenguin","error":"cURL error 28: Connection timed out after 15001 milliseconds (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/battlepenguin.com\/feed.xml","updated":"Apr 09, 23:46","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10842,"title":"Jeff Geerling's Blog","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":9456,"title":"Mac's Motor City Garage","error":"cURL error 28: Connection timed out after 15002 milliseconds (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/macsmotorcitygarage.com\/feed\/","updated":"Apr 10, 0:00","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":7860,"title":"rpgcodex.net","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11026,"title":"The Far Side - Daily Dose - Go…","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10293,"title":"Release notes from umu-proton","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10280,"title":"Nerdly Pleasures","error":"","updated":"4:02","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10666,"title":"Release notes from redis-stack","error":"","updated":"Never","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10332,"title":"Creatures of Thought","error":"","updated":"4:15","counter":0,"markedcounter":1,"publishedcounter":0,"ts":1780735998},{"id":10075,"title":"Extra Ordinary","error":"","updated":"4:02","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11033,"title":"Pearls Before Swine - GoComics","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11036,"title":"Shoe - Comics Kingdom","error":"","updated":"Never","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10770,"title":"Release notes from GeoLite.mmd…","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10196,"title":"Release notes from immich","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11037,"title":"Memes [Copy] on PieFed","error":"","updated":"3:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10243,"title":"Almost a Famine","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10843,"title":"Release notes from code-market…","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10878,"title":"reddit","error":"","updated":"4:33","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10986,"title":"Release notes from paperless-n…","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":9988,"title":"Alpine Linux News","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10769,"title":"Hackaday","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10086,"title":"Explosm.net","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10204,"title":"Release notes from roundcubema…","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10668,"title":"Release notes from watchstate","error":"","updated":"4:30","counter":0,"markedcounter":1,"publishedcounter":0,"ts":1780735998},{"id":10038,"title":"GitLab Major Releases","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10161,"title":"Release notes from Ventoy","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11044,"title":"Recent Commits to tengine:mast…","error":"","updated":"4:15","counter":0,"markedcounter":1,"publishedcounter":0,"ts":1780735998},{"id":9638,"title":"Phoronix","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":9596,"title":"Tags from OpenTTD-patches","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10807,"title":"Release notes from k3s","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11041,"title":"Release notes from nginx","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10803,"title":"Release notes from grafana","error":"","updated":"4:02","counter":0,"markedcounter":1,"publishedcounter":0,"ts":1780735998},{"id":10629,"title":"Tags from Xray-core","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10090,"title":"Malwarebytes Labs","error":"","updated":"4:33","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10665,"title":"Release notes from proxmox-bac…","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11040,"title":"Safely Endangered - Comics","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10806,"title":"Release notes from headlamp","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":9615,"title":"Byte Cellar","error":"","updated":"4:02","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":8289,"title":"BleepingComputer","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":9677,"title":"TorrentFreak","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10205,"title":"Release notes from nexus-publi…","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10036,"title":"Release notes from nextcloud","error":"","updated":"Never","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10882,"title":"Release notes from lego","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10292,"title":"Release notes from vscodium","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11032,"title":"Herman - GoComics","error":"","updated":"4:02","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":9821,"title":"Almost Secure","error":"cURL error 28: Operation timed out after 15002 milliseconds with 15754 out of 571298 bytes received (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/palant.info\/rss.xml","updated":"Apr 10, 23:47","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10151,"title":"Vincent Bernat","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11039,"title":"The Comics Curmudgeon","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10669,"title":"Release notes from vaultwarden","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10881,"title":"Release notes from meme-search","error":"","updated":"Never","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11035,"title":"Poorly Drawn Lines - GoComics","error":"","updated":"4:02","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10197,"title":"Release notes from navidrome","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10203,"title":"Release notes from argo-cd","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10845,"title":"Release notes from consul","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10333,"title":"Ken Shirriff's blog","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10242,"title":"The Digital Antiquarian","error":"","updated":"4:33","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11024,"title":"Release notes from mc","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10736,"title":"Pi My Life Up","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":9664,"title":"DoublePulsar - Medium","error":"cURL error 28: Operation timed out after 15000 milliseconds with 21882 out of 107419 bytes received (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/doublepulsar.com\/feed","updated":"Apr 09, 23:45","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":9684,"title":"Let's Play Archive Updates","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10101,"title":"Data Driven Gamer","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10627,"title":"Grafana Labs blog on Grafana L…","error":"","updated":"Never","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11028,"title":"Bob the Angry Flower - GoComic…","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11030,"title":"FoxTrot - GoComics","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10989,"title":"Release notes from tempus","error":"","updated":"Never","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10147,"title":"The Register","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11043,"title":"nginx:debian\/latest commits","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10841,"title":"Release notes from frigate","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10244,"title":"Release notes from authentik","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10955,"title":"Release notes from element-web","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10954,"title":"Release notes from synapse","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10990,"title":"all subreddits","error":"","updated":"4:02","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11034,"title":"Perry Bible Fellowship - GoCom…","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10880,"title":"Reading.sh Newsroom","error":"cURL error 56: CONNECT tunnel failed, response 500 (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/news.reading.sh\/feed\/","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10207,"title":"Release notes from SwarmUI","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11025,"title":"Peanuts - GoComics","error":"","updated":"4:15","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":11038,"title":"popular links","error":"","updated":"4:31","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":9624,"title":"Krebs on Security","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10282,"title":"\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0411\u043b\u043e\u043a\u044a","error":"","updated":"4:30","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":10879,"title":"The Adventurers' Guild","error":"","updated":"4:02","counter":0,"markedcounter":0,"publishedcounter":0,"ts":1780735998},{"id":-2,"kind":"cat","counter":0},{"id":0,"kind":"cat","markedcounter":0,"publishedcounter":0,"counter":0},{"id":2,"kind":"cat","markedcounter":0,"publishedcounter":0,"counter":0},{"id":12,"kind":"cat","markedcounter":3,"publishedcounter":0,"counter":0},{"id":60,"kind":"cat","markedcounter":1,"publishedcounter":0,"counter":0},{"id":74,"kind":"cat","markedcounter":0,"publishedcounter":0,"counter":0},{"id":914,"kind":"cat","markedcounter":5,"publishedcounter":0,"counter":0},{"id":947,"kind":"cat","markedcounter":0,"publishedcounter":0,"counter":0},{"id":989,"kind":"cat","markedcounter":2,"publishedcounter":0,"counter":0},{"id":1022,"kind":"cat","markedcounter":0,"publishedcounter":0,"counter":0}],"error":null} diff --git a/org.fox.ttrss/src/test/resources/responses/feed_tree.json b/org.fox.ttrss/src/test/resources/responses/feed_tree.json new file mode 100644 index 00000000..463d1bd7 --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/feed_tree.json @@ -0,0 +1 @@ +{"success":true,"data":{"categories":{"identifier":"id","label":"name","items":[{"id":"CAT:-1","items":[{"id":"FEED:-4","name":"All articles","unread":0,"type":"feed","error":"","updated":"","icon":"inbox","bare_id":-4,"auxcounter":0},{"id":"FEED:-3","name":"Fresh articles","unread":0,"type":"feed","error":"","updated":"","icon":"whatshot","bare_id":-3,"auxcounter":0},{"id":"FEED:-1","name":"Starred articles","unread":0,"type":"feed","error":"","updated":"","icon":"star","bare_id":-1,"auxcounter":0},{"id":"FEED:-2","name":"Published articles","unread":0,"type":"feed","error":"","updated":"","icon":"rss_feed","bare_id":-2,"auxcounter":0},{"id":"FEED:0","name":"Archived articles","unread":0,"type":"feed","error":"","updated":"","icon":"archive","bare_id":0,"auxcounter":0},{"id":"FEED:-6","name":"Recently read","unread":0,"type":"feed","error":"","updated":"","icon":"restore","bare_id":-6,"auxcounter":0}],"name":"Special","type":"category","unread":-1,"bare_id":-1},{"id":"CAT:-2","items":[{"id":"FEED:-1298","name":"Debian","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1298,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#dc143c"},{"id":"FEED:-1315","name":"Exploit","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1315,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#dc143c"},{"id":"FEED:-1294","name":"FreeBSD","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1294,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#ff4500"},{"id":"FEED:-1293","name":"Games","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1293,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#8a2be2"},{"id":"FEED:-1295","name":"Git","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1295,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#8fbc8f"},{"id":"FEED:-1297","name":"GNOME","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1297,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#d2691e"},{"id":"FEED:-1296","name":"KDE","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1296,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#4169e1"},{"id":"FEED:-1291","name":"Linux","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1291,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#008b8b"},{"id":"FEED:-1313","name":"Security","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1313,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#ff8c00"},{"id":"FEED:-1292","name":"Technology","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1292,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#2f4f4f"},{"id":"FEED:-1033","name":"Tiny Tiny RSS","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1033,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#6495ed"},{"id":"FEED:-1314","name":"Vulnerability","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1314,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#ff7f50"},{"id":"FEED:-1316","name":"Wayland","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1316,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#008000"},{"id":"FEED:-1299","name":"Windows","unread":0,"type":"feed","error":"","updated":"","icon":"label","bare_id":-1299,"auxcounter":0,"fg_color":"#ffffff","bg_color":"#808080"}],"name":"Labels","type":"category","unread":-1,"bare_id":-2},{"id":"CAT:2","bare_id":2,"auxcounter":-1,"name":"Blogs","items":[{"id":"FEED:9456","bare_id":9456,"auxcounter":-1,"name":"Mac's Motor City Garage","checkbox":false,"unread":-1,"error":"cURL error 28: Connection timed out after 15002 milliseconds (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/macsmotorcitygarage.com\/feed\/","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9456","param":"(33 articles \/ Apr 10, 0:00)","updates_disabled":1},{"id":"FEED:10280","bare_id":10280,"auxcounter":-1,"name":"Nerdly Pleasures","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10280","param":"(26 articles \/ 4:02)","updates_disabled":1},{"id":"FEED:10242","bare_id":10242,"auxcounter":-1,"name":"The Digital Antiquarian","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10242","param":"(13 articles \/ 4:33)","updates_disabled":1},{"id":"FEED:10151","bare_id":10151,"auxcounter":-1,"name":"Vincent Bernat","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10151","param":"(7 articles \/ 4:31)","updates_disabled":1}],"checkbox":false,"type":"category","unread":-1,"child_unread":-1,"param":"(4 feeds)"},{"id":"CAT:74","bare_id":74,"auxcounter":-1,"name":"Comics","items":[{"id":"FEED:11028","bare_id":11028,"auxcounter":-1,"name":"Bob the Angry Flower - GoComics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11028","param":"(12 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:2352","bare_id":2352,"auxcounter":-1,"name":"Buni","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=2352","param":"(18 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:11029","bare_id":11029,"auxcounter":-1,"name":"Calvin and Hobbes - GoComics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11029","param":"(67 articles \/ 4:31)","updates_disabled":0},{"id":"FEED:10086","bare_id":10086,"auxcounter":-1,"name":"Explosm.net","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10086","param":"(22 articles \/ 4:31)","updates_disabled":0},{"id":"FEED:10075","bare_id":10075,"auxcounter":-1,"name":"Extra Ordinary","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10075","param":"(16 articles \/ 4:02)","updates_disabled":1},{"id":"FEED:11031","bare_id":11031,"auxcounter":-1,"name":"FoxTrot Classics - GoComics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11031","param":"(58 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:11030","bare_id":11030,"auxcounter":-1,"name":"FoxTrot - GoComics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11030","param":"(32 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:11032","bare_id":11032,"auxcounter":-1,"name":"Herman - GoComics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11032","param":"(120 articles \/ 4:02)","updates_disabled":0},{"id":"FEED:11025","bare_id":11025,"auxcounter":-1,"name":"Peanuts - GoComics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11025","param":"(120 articles \/ 4:15)","updates_disabled":0},{"id":"FEED:11033","bare_id":11033,"auxcounter":-1,"name":"Pearls Before Swine - GoComics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11033","param":"(67 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:11034","bare_id":11034,"auxcounter":-1,"name":"Perry Bible Fellowship - GoComics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11034","param":"(5 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:11035","bare_id":11035,"auxcounter":-1,"name":"Poorly Drawn Lines - GoComics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11035","param":"(21 articles \/ 4:02)","updates_disabled":1},{"id":"FEED:11040","bare_id":11040,"auxcounter":-1,"name":"Safely Endangered - Comics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11040","param":"(35 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:11036","bare_id":11036,"auxcounter":-1,"name":"Shoe - Comics Kingdom","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11036","param":"(95 articles \/ Never)","updates_disabled":1},{"id":"FEED:9607","bare_id":9607,"auxcounter":-1,"name":"StoneToss","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9607","param":"(19 articles \/ 4:30)","updates_disabled":0},{"id":"FEED:11039","bare_id":11039,"auxcounter":-1,"name":"The Comics Curmudgeon","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11039","param":"(39 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:11026","bare_id":11026,"auxcounter":-1,"name":"The Far Side - Daily Dose - GoComics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11026","param":"(141 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:11027","bare_id":11027,"auxcounter":-1,"name":"The Far Side - New Stuff - GoComics","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11027","param":"(0 articles \/ 4:02)","updates_disabled":1}],"checkbox":false,"type":"category","unread":-1,"child_unread":-1,"param":"(18 feeds)"},{"id":"CAT:60","bare_id":60,"auxcounter":-1,"name":"Games","items":[{"id":"FEED:10243","bare_id":10243,"auxcounter":-1,"name":"Almost a Famine","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10243","param":"(29 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10101","bare_id":10101,"auxcounter":-1,"name":"Data Driven Gamer","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10101","param":"(29 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:9684","bare_id":9684,"auxcounter":-1,"name":"Let's Play Archive Updates","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9684","param":"(10 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:7860","bare_id":7860,"auxcounter":-1,"name":"rpgcodex.net","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=7860","param":"(36 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:9596","bare_id":9596,"auxcounter":-1,"name":"Tags from OpenTTD-patches","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9596","param":"(11 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:10879","bare_id":10879,"auxcounter":-1,"name":"The Adventurers' Guild","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10879","param":"(30 articles \/ 4:02)","updates_disabled":1},{"id":"FEED:8815","bare_id":8815,"auxcounter":-1,"name":"The CRPG Addict","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=8815","param":"(13 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:9594","bare_id":9594,"auxcounter":-1,"name":"\u0413\u043e\u0440\u044f\u0447\u0438\u0435 \u041d\u043e\u0432\u0438\u043d\u043a\u0438","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9594","param":"(232 articles \/ 4:15)","updates_disabled":1}],"checkbox":false,"type":"category","unread":-1,"child_unread":-1,"param":"(8 feeds)"},{"id":"CAT:1022","bare_id":1022,"auxcounter":-1,"name":"Security","items":[{"id":"FEED:9821","bare_id":9821,"auxcounter":-1,"name":"Almost Secure","checkbox":false,"unread":-1,"error":"cURL error 28: Operation timed out after 15002 milliseconds with 15754 out of 571298 bytes received (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/palant.info\/rss.xml","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9821","param":"(10 articles \/ Apr 10, 23:47)","updates_disabled":1},{"id":"FEED:8289","bare_id":8289,"auxcounter":-1,"name":"BleepingComputer","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=8289","param":"(229 articles \/ 4:15)","updates_disabled":0},{"id":"FEED:9624","bare_id":9624,"auxcounter":-1,"name":"Krebs on Security","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9624","param":"(17 articles \/ 4:30)","updates_disabled":0},{"id":"FEED:10090","bare_id":10090,"auxcounter":-1,"name":"Malwarebytes Labs","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10090","param":"(72 articles \/ 4:33)","updates_disabled":1}],"checkbox":false,"type":"category","unread":-1,"child_unread":-1,"param":"(4 feeds)"},{"id":"CAT:914","bare_id":914,"auxcounter":-1,"name":"Software","items":[{"id":"FEED:10206","bare_id":10206,"auxcounter":-1,"name":"GitLab FOSS tags","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10206","param":"(36 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10298","bare_id":10298,"auxcounter":-1,"name":"GitLab Security Releases","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10298","param":"(92 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10627","bare_id":10627,"auxcounter":-1,"name":"Grafana Labs blog on Grafana Labs","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10627","param":"(20 articles \/ Never)","updates_disabled":1},{"id":"FEED:11043","bare_id":11043,"auxcounter":-1,"name":"nginx:debian\/latest commits","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11043","param":"(57 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:11044","bare_id":11044,"auxcounter":-1,"name":"Recent Commits to tengine:master","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11044","param":"(29 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:10203","bare_id":10203,"auxcounter":-1,"name":"Release notes from argo-cd","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10203","param":"(15 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:10244","bare_id":10244,"auxcounter":-1,"name":"Release notes from authentik","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10244","param":"(18 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10843","bare_id":10843,"auxcounter":-1,"name":"Release notes from code-marketplace","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10843","param":"(10 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10845","bare_id":10845,"auxcounter":-1,"name":"Release notes from consul","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10845","param":"(20 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10955","bare_id":10955,"auxcounter":-1,"name":"Release notes from element-web","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10955","param":"(17 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10664","bare_id":10664,"auxcounter":-1,"name":"Release notes from faugus-launcher","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10664","param":"(23 articles \/ Never)","updates_disabled":1},{"id":"FEED:10841","bare_id":10841,"auxcounter":-1,"name":"Release notes from frigate","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10841","param":"(10 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10770","bare_id":10770,"auxcounter":-1,"name":"Release notes from GeoLite.mmdb","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10770","param":"(12 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:10803","bare_id":10803,"auxcounter":-1,"name":"Release notes from grafana","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10803","param":"(20 articles \/ 4:02)","updates_disabled":0},{"id":"FEED:10806","bare_id":10806,"auxcounter":-1,"name":"Release notes from headlamp","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10806","param":"(13 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10196","bare_id":10196,"auxcounter":-1,"name":"Release notes from immich","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10196","param":"(10 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:10807","bare_id":10807,"auxcounter":-1,"name":"Release notes from k3s","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10807","param":"(18 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10882","bare_id":10882,"auxcounter":-1,"name":"Release notes from lego","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10882","param":"(19 articles \/ 4:15)","updates_disabled":0},{"id":"FEED:11024","bare_id":11024,"auxcounter":-1,"name":"Release notes from mc","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11024","param":"(3 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10805","bare_id":10805,"auxcounter":-1,"name":"Release notes from mc","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10805","param":"(10 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10881","bare_id":10881,"auxcounter":-1,"name":"Release notes from meme-search","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10881","param":"(12 articles \/ Never)","updates_disabled":1},{"id":"FEED:10804","bare_id":10804,"auxcounter":-1,"name":"Release notes from minio","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10804","param":"(10 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10988","bare_id":10988,"auxcounter":-1,"name":"Release notes from minio","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10988","param":"(10 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:10197","bare_id":10197,"auxcounter":-1,"name":"Release notes from navidrome","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10197","param":"(10 articles \/ 4:15)","updates_disabled":0},{"id":"FEED:10036","bare_id":10036,"auxcounter":-1,"name":"Release notes from nextcloud","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10036","param":"(18 articles \/ Never)","updates_disabled":1},{"id":"FEED:10205","bare_id":10205,"auxcounter":-1,"name":"Release notes from nexus-public","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10205","param":"(14 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:11041","bare_id":11041,"auxcounter":-1,"name":"Release notes from nginx","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11041","param":"(14 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:10986","bare_id":10986,"auxcounter":-1,"name":"Release notes from paperless-ngx","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10986","param":"(10 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:10665","bare_id":10665,"auxcounter":-1,"name":"Release notes from proxmox-backup-arm64","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10665","param":"(11 articles \/ 4:30)","updates_disabled":0},{"id":"FEED:10702","bare_id":10702,"auxcounter":-1,"name":"Release notes from redis","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10702","param":"(15 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10666","bare_id":10666,"auxcounter":-1,"name":"Release notes from redis-stack","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10666","param":"(12 articles \/ Never)","updates_disabled":1},{"id":"FEED:10204","bare_id":10204,"auxcounter":-1,"name":"Release notes from roundcubemail","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10204","param":"(13 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10207","bare_id":10207,"auxcounter":-1,"name":"Release notes from SwarmUI","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10207","param":"(10 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10954","bare_id":10954,"auxcounter":-1,"name":"Release notes from synapse","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10954","param":"(17 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10989","bare_id":10989,"auxcounter":-1,"name":"Release notes from tempus","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10989","param":"(19 articles \/ Never)","updates_disabled":1},{"id":"FEED:10085","bare_id":10085,"auxcounter":-1,"name":"Release notes from tengine","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10085","param":"(10 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10294","bare_id":10294,"auxcounter":-1,"name":"Release notes from transgui","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10294","param":"(9 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10293","bare_id":10293,"auxcounter":-1,"name":"Release notes from umu-proton","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10293","param":"(10 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10669","bare_id":10669,"auxcounter":-1,"name":"Release notes from vaultwarden","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10669","param":"(10 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:10161","bare_id":10161,"auxcounter":-1,"name":"Release notes from Ventoy","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10161","param":"(10 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10292","bare_id":10292,"auxcounter":-1,"name":"Release notes from vscodium","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10292","param":"(11 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10668","bare_id":10668,"auxcounter":-1,"name":"Release notes from watchstate","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10668","param":"(17 articles \/ 4:30)","updates_disabled":0},{"id":"FEED:10629","bare_id":10629,"auxcounter":-1,"name":"Tags from Xray-core","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10629","param":"(12 articles \/ 4:31)","updates_disabled":1}],"checkbox":false,"type":"category","unread":-1,"child_unread":-1,"param":"(43 feeds)"},{"id":"CAT:12","bare_id":12,"auxcounter":-1,"name":"Technology","items":[{"id":"CAT:989","bare_id":989,"name":"Gitlab","items":[{"id":"FEED:10039","bare_id":10039,"auxcounter":-1,"name":"GitLab","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10039","param":"(40 articles \/ 4:30)","updates_disabled":0},{"id":"FEED:10038","bare_id":10038,"auxcounter":-1,"name":"GitLab Major Releases","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10038","param":"(37 articles \/ 4:30)","updates_disabled":0}],"checkbox":false,"type":"category","unread":-1,"child_unread":-1,"auxcounter":-1,"parent_id":12,"param":"(2 feeds)"},{"id":"FEED:9988","bare_id":9988,"auxcounter":-1,"name":"Alpine Linux News","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9988","param":"(10 articles \/ 4:15)","updates_disabled":0},{"id":"FEED:10667","bare_id":10667,"auxcounter":-1,"name":"BattlePenguin","checkbox":false,"unread":-1,"error":"cURL error 28: Connection timed out after 15001 milliseconds (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/battlepenguin.com\/feed.xml","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10667","param":"(10 articles \/ Apr 09, 23:46)","updates_disabled":1},{"id":"FEED:9615","bare_id":9615,"auxcounter":-1,"name":"Byte Cellar","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9615","param":"(11 articles \/ 4:02)","updates_disabled":1},{"id":"FEED:10332","bare_id":10332,"auxcounter":-1,"name":"Creatures of Thought","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10332","param":"(21 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:9664","bare_id":9664,"auxcounter":-1,"name":"DoublePulsar - Medium","checkbox":false,"unread":-1,"error":"cURL error 28: Operation timed out after 15000 milliseconds with 21882 out of 107419 bytes received (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/doublepulsar.com\/feed","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9664","param":"(10 articles \/ Apr 09, 23:45)","updates_disabled":1},{"id":"FEED:10769","bare_id":10769,"auxcounter":-1,"name":"Hackaday","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10769","param":"(279 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10842","bare_id":10842,"auxcounter":-1,"name":"Jeff Geerling's Blog","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10842","param":"(28 articles \/ 4:15)","updates_disabled":0},{"id":"FEED:10333","bare_id":10333,"auxcounter":-1,"name":"Ken Shirriff's blog","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10333","param":"(27 articles \/ 4:30)","updates_disabled":0},{"id":"FEED:9638","bare_id":9638,"auxcounter":-1,"name":"Phoronix","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9638","param":"(323 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10736","bare_id":10736,"auxcounter":-1,"name":"Pi My Life Up","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10736","param":"(11 articles \/ 4:31)","updates_disabled":0},{"id":"FEED:10880","bare_id":10880,"auxcounter":-1,"name":"Reading.sh Newsroom","checkbox":false,"unread":-1,"error":"cURL error 56: CONNECT tunnel failed, response 500 (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/news.reading.sh\/feed\/","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10880","param":"(10 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:11042","bare_id":11042,"auxcounter":-1,"name":"The Hacker News","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11042","param":"(221 articles \/ 4:15)","updates_disabled":1},{"id":"FEED:10147","bare_id":10147,"auxcounter":-1,"name":"The Register","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10147","param":"(550 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:9677","bare_id":9677,"auxcounter":-1,"name":"TorrentFreak","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=9677","param":"(41 articles \/ 4:30)","updates_disabled":1},{"id":"FEED:10844","bare_id":10844,"auxcounter":-1,"name":"Vaxry's Blog","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10844","param":"(16 articles \/ 4:31)","updates_disabled":1},{"id":"FEED:10282","bare_id":10282,"auxcounter":-1,"name":"\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0411\u043b\u043e\u043a\u044a","checkbox":false,"unread":-1,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10282","param":"(33 articles \/ 4:30)","updates_disabled":0}],"checkbox":false,"type":"category","unread":-1,"child_unread":-1,"param":"(18 feeds)"},{"id":"CAT:0","bare_id":0,"auxcounter":-1,"name":"Uncategorized","items":[{"id":"FEED:10990","bare_id":10990,"auxcounter":-1,"name":"all subreddits","checkbox":false,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10990","param":"(5332 articles \/ 4:02)","unread":-1,"type":"feed","updates_disabled":1},{"id":"FEED:11037","bare_id":11037,"auxcounter":-1,"name":"Memes [Copy] on PieFed","checkbox":false,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11037","param":"(1802 articles \/ 3:30)","unread":-1,"type":"feed","updates_disabled":1},{"id":"FEED:11038","bare_id":11038,"auxcounter":-1,"name":"popular links","checkbox":false,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=11038","param":"(3430 articles \/ 4:31)","unread":-1,"type":"feed","updates_disabled":1},{"id":"FEED:10878","bare_id":10878,"auxcounter":-1,"name":"reddit","checkbox":false,"error":"","icon":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php?op=feed_icon&id=10878","param":"(6662 articles \/ 4:33)","unread":-1,"type":"feed","updates_disabled":1}],"type":"category","checkbox":false,"unread":-1,"child_unread":-1,"param":"(4 feeds)"}]}},"error":null} diff --git a/org.fox.ttrss/src/test/resources/responses/feeds.json b/org.fox.ttrss/src/test/resources/responses/feeds.json new file mode 100644 index 00000000..55672dca --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/feeds.json @@ -0,0 +1 @@ +{"success":true,"data":[{"feed_url":"https:\/\/old.reddit.com\/r\/all\/.rss?limit=100","title":"all subreddits","id":10990,"unread":0,"has_icon":true,"cat_id":0,"last_updated":1780718558,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/almostafamine.blogspot.com\/feeds\/posts\/default","title":"Almost a Famine","id":10243,"unread":0,"has_icon":false,"cat_id":60,"last_updated":1780720220,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/palant.info\/rss.xml","title":"Almost Secure","id":9821,"unread":0,"has_icon":true,"cat_id":1022,"last_updated":1775864821,"order_id":0,"last_error":"cURL error 28: Operation timed out after 15002 milliseconds with 15754 out of 571298 bytes received (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/palant.info\/rss.xml","update_interval":-1},{"feed_url":"https:\/\/www.alpinelinux.org\/atom.xml","title":"Alpine Linux News","id":9988,"unread":0,"has_icon":false,"cat_id":12,"last_updated":1780719313,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/battlepenguin.com\/feed.xml","title":"BattlePenguin","id":10667,"unread":0,"has_icon":false,"cat_id":12,"last_updated":1775778367,"order_id":0,"last_error":"cURL error 28: Connection timed out after 15001 milliseconds (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/battlepenguin.com\/feed.xml","update_interval":-1},{"feed_url":"https:\/\/www.bleepingcomputer.com\/feed\/","title":"BleepingComputer","id":8289,"unread":0,"has_icon":false,"cat_id":1022,"last_updated":1780719329,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/comiccaster.xyz\/rss\/bob-the-angry-flower","title":"Bob the Angry Flower - GoComics","id":11028,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780720285,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"http:\/\/www.bunicomic.com\/feed\/","title":"Buni","id":2352,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780720283,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/bytecellar.com\/feed\/","title":"Byte Cellar","id":9615,"unread":0,"has_icon":true,"cat_id":12,"last_updated":1780718566,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/comiccaster.xyz\/rss\/calvinandhobbes","title":"Calvin and Hobbes - GoComics","id":11029,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780720277,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/technicshistory.com\/feed\/","title":"Creatures of Thought","id":10332,"unread":0,"has_icon":false,"cat_id":12,"last_updated":1780719332,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/datadrivengamer.blogspot.com\/feeds\/posts\/default","title":"Data Driven Gamer","id":10101,"unread":0,"has_icon":false,"cat_id":60,"last_updated":1780719314,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/doublepulsar.com\/feed","title":"DoublePulsar - Medium","id":9664,"unread":0,"has_icon":false,"cat_id":12,"last_updated":1775778350,"order_id":0,"last_error":"cURL error 28: Operation timed out after 15000 milliseconds with 21882 out of 107419 bytes received (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/doublepulsar.com\/feed","update_interval":-1},{"feed_url":"https:\/\/explosm.net\/rss.xml","title":"Explosm.net","id":10086,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780720291,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/www.exocomics.com\/feed","title":"Extra Ordinary","id":10075,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780718563,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/comiccaster.xyz\/rss\/foxtrotclassics","title":"FoxTrot Classics - GoComics","id":11031,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780719316,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/comiccaster.xyz\/rss\/foxtrot","title":"FoxTrot - GoComics","id":11030,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780720288,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/about.gitlab.com\/atom.xml","title":"GitLab","id":10039,"unread":0,"has_icon":true,"cat_id":989,"last_updated":1780720223,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/gitlab.com\/gitlab-org\/gitlab-foss\/-\/tags?format=atom","title":"GitLab FOSS tags","id":10206,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720238,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/about.gitlab.com\/releases.xml","title":"GitLab Major Releases","id":10038,"unread":0,"has_icon":false,"cat_id":989,"last_updated":1780720233,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/about.gitlab.com\/security-releases.xml","title":"GitLab Security Releases","id":10298,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720297,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/grafana.com\/blog\/news.xml","title":"Grafana Labs blog on Grafana Labs","id":10627,"unread":0,"has_icon":false,"cat_id":914,"last_updated":0,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/hackaday.com\/feed\/","title":"Hackaday","id":10769,"unread":0,"has_icon":true,"cat_id":12,"last_updated":1780720291,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/comiccaster.xyz\/rss\/herman","title":"Herman - GoComics","id":11032,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780718569,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/www.jeffgeerling.com\/blog.xml","title":"Jeff Geerling's Blog","id":10842,"unread":0,"has_icon":false,"cat_id":12,"last_updated":1780719325,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/www.blogger.com\/feeds\/6264947694886887540\/posts\/default","title":"Ken Shirriff's blog","id":10333,"unread":0,"has_icon":false,"cat_id":12,"last_updated":1780720225,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/krebsonsecurity.com\/feed\/","title":"Krebs on Security","id":9624,"unread":0,"has_icon":false,"cat_id":1022,"last_updated":1780720221,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/lparchive.org\/rss","title":"Let's Play Archive Updates","id":9684,"unread":0,"has_icon":false,"cat_id":60,"last_updated":1780720284,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/macsmotorcitygarage.com\/feed\/","title":"Mac's Motor City Garage","id":9456,"unread":0,"has_icon":false,"cat_id":2,"last_updated":1775779223,"order_id":0,"last_error":"cURL error 28: Connection timed out after 15002 milliseconds (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/macsmotorcitygarage.com\/feed\/","update_interval":-1},{"feed_url":"https:\/\/www.malwarebytes.com\/blog\/feed\/index.xml","title":"Malwarebytes Labs","id":10090,"unread":0,"has_icon":false,"cat_id":1022,"last_updated":1780720420,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/piefed.social\/f\/memecommunities_copy.rss","title":"Memes [Copy] on PieFed","id":11037,"unread":0,"has_icon":false,"cat_id":0,"last_updated":1780716640,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/nerdlypleasures.blogspot.com\/feeds\/posts\/default","title":"Nerdly Pleasures","id":10280,"unread":0,"has_icon":true,"cat_id":2,"last_updated":1780718571,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/salsa.debian.org\/nginx-team\/nginx\/-\/commits\/debian\/latest?ref_type=HEADS&format=atom","title":"nginx:debian\/latest commits","id":11043,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720281,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/comiccaster.xyz\/rss\/peanuts","title":"Peanuts - GoComics","id":11025,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780719321,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/comiccaster.xyz\/rss\/pearlsbeforeswine","title":"Pearls Before Swine - GoComics","id":11033,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780720301,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/comiccaster.xyz\/rss\/perry-bible-fellowship","title":"Perry Bible Fellowship - GoComics","id":11034,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780720299,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/www.phoronix.com\/rss.php","title":"Phoronix","id":9638,"unread":0,"has_icon":false,"cat_id":12,"last_updated":1780720289,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/pimylifeup.com\/feed\/","title":"Pi My Life Up","id":10736,"unread":0,"has_icon":false,"cat_id":12,"last_updated":1780720282,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/comiccaster.xyz\/rss\/poorly-drawn-lines","title":"Poorly Drawn Lines - GoComics","id":11035,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780718564,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/old.reddit.com\/r\/popular\/.rss?limit=100","title":"popular links","id":11038,"unread":0,"has_icon":true,"cat_id":0,"last_updated":1780720271,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/news.reading.sh\/feed\/","title":"Reading.sh Newsroom","id":10880,"unread":0,"has_icon":true,"cat_id":12,"last_updated":1780719322,"order_id":0,"last_error":"cURL error 56: CONNECT tunnel failed, response 500 (see https:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html) for https:\/\/news.reading.sh\/feed\/","update_interval":-1},{"feed_url":"https:\/\/github.com\/alibaba\/tengine\/commits\/master.atom","title":"Recent Commits to tengine:master","id":11044,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780719313,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/old.reddit.com\/.rss?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49&limit=100","title":"reddit","id":10878,"unread":0,"has_icon":true,"cat_id":0,"last_updated":1780720419,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/argoproj\/argo-cd\/releases.atom","title":"Release notes from argo-cd","id":10203,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780719325,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/goauthentik\/authentik\/releases.atom","title":"Release notes from authentik","id":10244,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720210,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/coder\/code-marketplace\/releases.atom","title":"Release notes from code-marketplace","id":10843,"unread":0,"has_icon":true,"cat_id":914,"last_updated":1780720228,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/hashicorp\/consul\/releases.atom","title":"Release notes from consul","id":10845,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720298,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/element-hq\/element-web\/releases.atom","title":"Release notes from element-web","id":10955,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720236,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/Faugus\/faugus-launcher\/releases.atom","title":"Release notes from faugus-launcher","id":10664,"unread":0,"has_icon":false,"cat_id":914,"last_updated":0,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/blakeblackshear\/frigate\/releases.atom","title":"Release notes from frigate","id":10841,"unread":0,"has_icon":true,"cat_id":914,"last_updated":1780720234,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/P3TERX\/GeoLite.mmdb\/releases.atom","title":"Release notes from GeoLite.mmdb","id":10770,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780719327,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/grafana\/grafana\/releases.atom","title":"Release notes from grafana","id":10803,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780718562,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/github.com\/kubernetes-sigs\/headlamp\/releases.atom","title":"Release notes from headlamp","id":10806,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720227,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/immich-app\/immich\/releases.atom","title":"Release notes from immich","id":10196,"unread":0,"has_icon":true,"cat_id":914,"last_updated":1780719323,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/k3s-io\/k3s\/releases.atom","title":"Release notes from k3s","id":10807,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720217,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/go-acme\/lego\/releases.atom","title":"Release notes from lego","id":10882,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780719309,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/github.com\/minio\/mc\/releases.atom","title":"Release notes from mc","id":10805,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720292,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/pgsty\/mc\/releases.atom","title":"Release notes from mc","id":11024,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720304,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/neonwatty\/meme-search\/releases.atom","title":"Release notes from meme-search","id":10881,"unread":0,"has_icon":false,"cat_id":914,"last_updated":0,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/pgsty\/minio\/releases.atom","title":"Release notes from minio","id":10988,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780719319,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/minio\/minio\/releases.atom","title":"Release notes from minio","id":10804,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720287,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/navidrome\/navidrome\/releases.atom","title":"Release notes from navidrome","id":10197,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780719331,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/github.com\/nextcloud\/server\/releases.atom","title":"Release notes from nextcloud","id":10036,"unread":0,"has_icon":false,"cat_id":914,"last_updated":0,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/sonatype\/nexus-public\/releases.atom","title":"Release notes from nexus-public","id":10205,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780719328,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/nginx\/nginx\/releases.atom","title":"Release notes from nginx","id":11041,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780719327,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/paperless-ngx\/paperless-ngx\/releases.atom","title":"Release notes from paperless-ngx","id":10986,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780719325,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/wofferl\/proxmox-backup-arm64\/releases.atom","title":"Release notes from proxmox-backup-arm64","id":10665,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720213,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/github.com\/redis\/redis\/releases.atom","title":"Release notes from redis","id":10702,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720273,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/redis-stack\/redis-stack\/releases.atom","title":"Release notes from redis-stack","id":10666,"unread":0,"has_icon":false,"cat_id":914,"last_updated":0,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/roundcube\/roundcubemail\/releases.atom","title":"Release notes from roundcubemail","id":10204,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720294,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/mcmonkeyprojects\/SwarmUI\/releases.atom","title":"Release notes from SwarmUI","id":10207,"unread":0,"has_icon":true,"cat_id":914,"last_updated":1780720214,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/element-hq\/synapse\/releases.atom","title":"Release notes from synapse","id":10954,"unread":0,"has_icon":true,"cat_id":914,"last_updated":1780720278,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/eddyizm\/tempus\/releases.atom","title":"Release notes from tempus","id":10989,"unread":0,"has_icon":false,"cat_id":914,"last_updated":0,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/alibaba\/tengine\/releases.atom","title":"Release notes from tengine","id":10085,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720222,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/lighterowl\/transgui\/releases.atom","title":"Release notes from transgui","id":10294,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720230,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/Open-Wine-Components\/umu-proton\/releases.atom","title":"Release notes from umu-proton","id":10293,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720275,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/dani-garcia\/vaultwarden\/releases.atom","title":"Release notes from vaultwarden","id":10669,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780719318,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/ventoy\/Ventoy\/releases.atom","title":"Release notes from Ventoy","id":10161,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720226,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/VSCodium\/vscodium\/releases.atom","title":"Release notes from vscodium","id":10292,"unread":0,"has_icon":true,"cat_id":914,"last_updated":1780720222,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/arabcoders\/watchstate\/releases.atom","title":"Release notes from watchstate","id":10668,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720220,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/rpgcodex.net\/rss.xml","title":"rpgcodex.net","id":7860,"unread":0,"has_icon":true,"cat_id":60,"last_updated":1780719317,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/safelyendangered.com\/blogs\/comics.atom","title":"Safely Endangered - Comics","id":11040,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780719321,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/comiccaster.xyz\/feeds\/shoe.xml","title":"Shoe - Comics Kingdom","id":11036,"unread":0,"has_icon":false,"cat_id":74,"last_updated":0,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/stonetoss.com\/comic\/feed\/","title":"StoneToss","id":9607,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780720216,"order_id":0,"last_error":"","update_interval":0},{"feed_url":"https:\/\/github.com\/JGRennison\/OpenTTD-patches\/tags.atom","title":"Tags from OpenTTD-patches","id":9596,"unread":0,"has_icon":false,"cat_id":60,"last_updated":1780719322,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/github.com\/XTLS\/Xray-core\/tags.atom","title":"Tags from Xray-core","id":10629,"unread":0,"has_icon":false,"cat_id":914,"last_updated":1780720272,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/advgamer.blogspot.com\/rss.xml","title":"The Adventurers' Guild","id":10879,"unread":0,"has_icon":false,"cat_id":60,"last_updated":1780718561,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/joshreads.com\/feed\/","title":"The Comics Curmudgeon","id":11039,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780719312,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/feeds.feedburner.com\/TheCrpgAddict","title":"The CRPG Addict","id":8815,"unread":0,"has_icon":false,"cat_id":60,"last_updated":1780720212,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/www.filfre.net\/feed\/","title":"The Digital Antiquarian","id":10242,"unread":0,"has_icon":false,"cat_id":2,"last_updated":1780720421,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/comiccaster.xyz\/rss\/farside-daily","title":"The Far Side - Daily Dose - GoComics","id":11026,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780720208,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/comiccaster.xyz\/rss\/farside-new","title":"The Far Side - New Stuff - GoComics","id":11027,"unread":0,"has_icon":false,"cat_id":74,"last_updated":1780718563,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/thehackernews.com\/feeds\/posts\/default","title":"The Hacker News","id":11042,"unread":0,"has_icon":true,"cat_id":12,"last_updated":1780719323,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/www.theregister.com\/headlines.atom","title":"The Register","id":10147,"unread":0,"has_icon":true,"cat_id":12,"last_updated":1780720218,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/torrentfreak.com\/feed\/","title":"TorrentFreak","id":9677,"unread":0,"has_icon":true,"cat_id":12,"last_updated":1780720219,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/blog.vaxry.net\/feed","title":"Vaxry's Blog","id":10844,"unread":0,"has_icon":true,"cat_id":12,"last_updated":1780720303,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/vincent.bernat.ch\/en\/blog\/atom.xml","title":"Vincent Bernat","id":10151,"unread":0,"has_icon":true,"cat_id":2,"last_updated":1780720297,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/feed.rutracker.cc\/atom\/f\/635.atom","title":"\u0413\u043e\u0440\u044f\u0447\u0438\u0435 \u041d\u043e\u0432\u0438\u043d\u043a\u0438","id":9594,"unread":0,"has_icon":true,"cat_id":60,"last_updated":1780719319,"order_id":0,"last_error":"","update_interval":-1},{"feed_url":"https:\/\/sysblok.ru\/feed\/","title":"\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0411\u043b\u043e\u043a\u044a","id":10282,"unread":0,"has_icon":false,"cat_id":12,"last_updated":1780720235,"order_id":0,"last_error":"","update_interval":0}],"error":null} diff --git a/org.fox.ttrss/src/test/resources/responses/headlines.json b/org.fox.ttrss/src/test/resources/responses/headlines.json new file mode 100644 index 00000000..5e0e9ade --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/headlines.json @@ -0,0 +1 @@ +{"success":true,"data":[{"id":18623503,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:4c2e274af9b395d1a3e2f1e5dcc0ca53ae940e63\"}","unread":false,"marked":false,"published":false,"updated":1780707207,"is_updated":false,"title":"Got myself a birthday present.","link":"https:\/\/old.reddit.com\/r\/vintagecomputing\/comments\/1ty2vrk\/got_myself_a_birthday_present\/","feed_id":10878,"tags":["birthday present","hardware","lang:english","pc","sidewinder 3d pro","vintage computing","vintagecomputing"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/voltron_87","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623480,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:c1afbfcc378869494ae0370ed57aad6f883c9d20\"}","unread":false,"marked":false,"published":false,"updated":1780713080,"is_updated":false,"title":"Marilyn Monroe Nudi (not what you think, sorry)","link":"https:\/\/old.reddit.com\/r\/TheDepthsBelow\/comments\/1ty4y0r\/marilyn_monroe_nudi_not_what_you_think_sorry\/","feed_id":10878,"tags":["atlantis dive resorts","goniobranchus kuniei","lang:english","marilyn monroe nudi","sea slug","thedepthsbelow","underwater photography"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/BeginningConstant567","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623484,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:a6d7baab9cabe67f905a621da65cf4408f9fda66\"}","unread":false,"marked":false,"published":false,"updated":1780712968,"is_updated":false,"title":"What is this plastic book related item?","link":"https:\/\/old.reddit.com\/r\/whatisthisthing\/comments\/1ty4woh\/what_is_this_plastic_book_related_item\/","feed_id":10878,"tags":["acrylic","identification","lang:english","plastic bookmark","school item","what is this","whatisthisthing"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/BanditoStrikesAgain","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623453,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:c958c64e69696f9d5b202a12c50057ef99aecb58\"}","unread":false,"marked":false,"published":false,"updated":1780712481,"is_updated":false,"title":"How do you view Markdown inside Pi Coding Agent?","link":"https:\/\/old.reddit.com\/r\/PiCodingAgent\/comments\/1ty4qop\/how_do_you_view_markdown_inside_pi_coding_agent\/","feed_id":10878,"tags":["cli","lang:english","markdown","picodingagent","terminal","usability","workflow"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/Low-Law-3508","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623437,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:62fe5366d1f009e8ba1ba876f3c3b7532826f89d\"}","unread":false,"marked":false,"published":false,"updated":1780711997,"is_updated":false,"title":"ComfyUI support or ByteDance Lance-3B (unified image\/video generation, editing, and understanding), with dynamic VRAM for low-VRAM GPUs","link":"https:\/\/old.reddit.com\/r\/StableDiffusion\/comments\/1ty4kg1\/comfyui_support_or_bytedance_lance3b_unified\/","feed_id":10878,"tags":["ai model","bytedance","comfyui","lance-3b","lang:english","stablediffusion","vram"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/HuskyTheSniffer","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623433,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:0dfd5e0735d16e9facbd8b22cfdae8941ef37f56\"}","unread":false,"marked":false,"published":false,"updated":1780708278,"is_updated":false,"title":"Bitch, I\u2019m The \u2018Murrica Train","link":"https:\/\/old.reddit.com\/r\/BitchImATrain\/comments\/1ty39jz\/bitch_im_the_murrica_train\/","feed_id":10878,"tags":["bitchimatrain","bnsf","lang:english","liberty","patriotic","railroad","train"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/TaperClapper","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623431,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:ffba76d6e36e05a28849ce81b9e87d8fe6c381b0\"}","unread":false,"marked":false,"published":false,"updated":1780707970,"is_updated":false,"title":"The Wolf Among Us Remastered on Epic Games Store and Steam","link":"https:\/\/old.reddit.com\/r\/pcgaming\/comments\/1ty35o0\/the_wolf_among_us_remastered_on_epic_games_store\/","feed_id":10878,"tags":["epic games store","lang:english","pcgaming","remastered","steam","the wolf among us","video games"],"labels":[[-1293,"Games","#ffffff","#8a2be2"]],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/MythicStream","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623435,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:0660ff0d412c776b200167b4292bd7d8512ae76b\"}","unread":false,"marked":false,"published":false,"updated":1780704720,"is_updated":false,"title":"The Avatar: The Last Airbender AAA RPG, Which Was Supposed to Be 'The Biggest Video Game in Franchise History,' Is Dead","link":"https:\/\/old.reddit.com\/r\/pcgaming\/comments\/1ty1zdf\/the_avatar_the_last_airbender_aaa_rpg_which_was\/","feed_id":10878,"tags":["aaa rpg","avatar","cancellation","lang:english","pcgaming","the last airbender","video game"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/Gorotheninja","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623434,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:67a8a204f311b5b5ab5b0c0c6c12ffb0f6f1e854\"}","unread":false,"marked":false,"published":false,"updated":1780697567,"is_updated":false,"title":"Rocking Mandrake Linux like it's 2001!","link":"https:\/\/old.reddit.com\/r\/vintagecomputing\/comments\/1txz61l\/rocking_mandrake_linux_like_its_2001\/","feed_id":10878,"tags":["86box","kde","lang:english","linux","mandrake","vintage computing","vintagecomputing"],"labels":[[-1293,"Games","#ffffff","#8a2be2"],[-1296,"KDE","#ffffff","#4169e1"],[-1291,"Linux","#ffffff","#008b8b"]],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/c64z86","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623413,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:cf0127ccfaf2ae7001c9714c4db11d18fc2aa315\"}","unread":false,"marked":false,"published":false,"updated":1780708052,"is_updated":false,"title":"Cursed_meme","link":"https:\/\/old.reddit.com\/r\/cursedimages\/comments\/1ty36pa\/cursed_meme\/","feed_id":10878,"tags":["blink","cursed","cursedimages","eyelash","humor","lang:english","meme"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/PhatPanda69699","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623414,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:564df8d89bdfdf63332c76dd4e254436624fbf99\"}","unread":false,"marked":false,"published":false,"updated":1780701586,"is_updated":false,"title":"The Senat 900 is a luxury executive sedan manufactured in Russia that functions as a rebadged variant of the Chinese Hongqi H9 luxury car. Senat is a sub brand of Russian luxury car maker, Aurus","link":"https:\/\/old.reddit.com\/r\/WeirdWheels\/comments\/1ty0s0v\/the_senat_900_is_a_luxury_executive_sedan\/","feed_id":10878,"tags":["aurus","hongqi h9","lang:english","luxury sedan","russian automotive","senat 900","weirdwheels"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/Venkie2Maybach","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623415,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:8feefdc65e60e5014951b98f8baf6a8eed48a352\"}","unread":false,"marked":false,"published":false,"updated":1780690893,"is_updated":false,"title":"dots.tts 2B\ud83c\udf99\ufe0f SOTA TTS from RedNote","link":"https:\/\/old.reddit.com\/r\/LocalLLaMA\/comments\/1txwbge\/dotstts_2b_sota_tts_from_rednote\/","feed_id":10878,"tags":["ai","lang:english","localllama","machine learning","open source","tts","xiaohongshu"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/KokaOP","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623406,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:db122822d60e2c4575a71fe4078e6b428022cc21\"}","unread":false,"marked":false,"published":false,"updated":1780707120,"is_updated":false,"title":"Linux DRM Ioctl Developed By AMD Being Disabled Following Ongoing Security Issue","link":"https:\/\/www.phoronix.com\/news\/Linux-7.1-DRM-Change-Handle","feed_id":9638,"tags":[""],"labels":[[-1291,"Linux","#ffffff","#008b8b"],[-1313,"Security","#ffffff","#ff8c00"]],"feed_title":"Phoronix","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"Michael Larabel","score":0,"note":null,"lang":"en","site_url":"https:\/\/www.phoronix.com\/"},{"id":18623405,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:d6aba1585127f9a17242b2577d4c0bc8a1e40c80\"}","unread":false,"marked":false,"published":false,"updated":1780698916,"is_updated":false,"title":"Start spreading the news: Datacenters may face one-year ban in NY","link":"https:\/\/www.theregister.com\/a\/5251911","feed_id":10147,"tags":["legal"],"labels":[[-1292,"Technology","#ffffff","#2f4f4f"]],"feed_title":"The Register","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"","score":0,"note":null,"lang":"","site_url":"https:\/\/www.theregister.com\/"},{"id":18623366,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:1f3f0d713b8f99e73fd35d406ed6fb9c82883c96\"}","unread":false,"marked":false,"published":false,"updated":1780701794,"is_updated":false,"title":"hmmm","link":"https:\/\/old.reddit.com\/r\/hmmm\/comments\/1ty0v4z\/hmmm\/","feed_id":10878,"tags":["banana","food","hmmm","jelly","lang:english","peanut butter","sandwich"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/sonnyhayes22","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623308,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:0ea552a8f4e6645e09a216a2196d70b90a737aca\"}","unread":false,"marked":false,"published":false,"updated":1780700806,"is_updated":false,"title":"FINAL FANTASY VII REVELATION - Reveal Trailer","link":"https:\/\/old.reddit.com\/r\/pcgaming\/comments\/1ty0gxv\/final_fantasy_vii_revelation_reveal_trailer\/","feed_id":10878,"tags":["final fantasy","lang:english","pcgaming","reveal trailer","revelation","square enix","video game"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/Turbostrider27","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623302,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:2b8e11a32e662b4cf530107f7d1392be84f8a5db\"}","unread":false,"marked":false,"published":false,"updated":1780701807,"is_updated":false,"title":"I have trained diffusion and flow matching models from scratch. Same architecture, same dataset, huge difference.","link":"https:\/\/old.reddit.com\/r\/StableDiffusion\/comments\/1ty0vbi\/i_have_trained_diffusion_and_flow_matching_models\/","feed_id":10878,"tags":["diffusion models","flow matching","generative ai","lang:english","machine learning","stablediffusion","training comparison"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/TensorForger","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623286,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:6f3f5d5cf03a45508b201aca6c69b1ca697ee9a0\"}","unread":false,"marked":false,"published":false,"updated":1780700481,"is_updated":false,"title":"Alien: Isolation 2 on Steam","link":"https:\/\/old.reddit.com\/r\/pcgaming\/comments\/1ty0c54\/alien_isolation_2_on_steam\/","feed_id":10878,"tags":["alien isolation 2","horror","lang:english","pc gaming","pcgaming","steam","video games"],"labels":[[-1293,"Games","#ffffff","#8a2be2"]],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/lurkingdanger22","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623287,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:940516514b7d936a29d7edf6d6ec75875d2d6fc8\"}","unread":false,"marked":false,"published":false,"updated":1780700148,"is_updated":false,"title":"Aol ilwpz thjopul pz zapss kvvapun ha h yhwpk yhal","link":"https:\/\/old.reddit.com\/r\/Ooer\/comments\/1ty078j\/aol_ilwpz_thjopul_pz_zapss_kvvapun_ha_h_yhwpk_yhal\/","feed_id":10878,"tags":["art","bird","cage","face","lang:english","ooer","surreal"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/Round_Ad_1920","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"},{"id":18623283,"guid":"{\"ver\":2,\"uid\":2,\"hash\":\"SHA1:08edd261483116439d50f2fc6ca573366df678c7\"}","unread":false,"marked":false,"published":false,"updated":1780697937,"is_updated":false,"title":"Royal Flycatcher(Onychorhynchus coronatus)","link":"https:\/\/old.reddit.com\/r\/AIDKE\/comments\/1txzbcn\/royal_flycatcheronychorhynchus_coronatus\/","feed_id":10878,"tags":["aidke","bird","lang:english","nature","onychorhynchus coronatus","royal flycatcher","wildlife"],"labels":[],"feed_title":"reddit","comments_count":0,"comments_link":"","always_display_attachments":false,"author":"\/u\/Comprehensive-Way482","score":0,"note":null,"lang":"","site_url":"https:\/\/old.reddit.com\/?feed=891da5ece7313512415784b790ecb2a5b85fddde&user=Important-Shallot-49"}],"error":null} diff --git a/org.fox.ttrss/src/test/resources/responses/labels.json b/org.fox.ttrss/src/test/resources/responses/labels.json new file mode 100644 index 00000000..beef765d --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/labels.json @@ -0,0 +1 @@ +{"success":true,"data":[{"id":-1298,"caption":"Debian","fg_color":"#ffffff","bg_color":"#dc143c","checked":false},{"id":-1315,"caption":"Exploit","fg_color":"#ffffff","bg_color":"#dc143c","checked":false},{"id":-1294,"caption":"FreeBSD","fg_color":"#ffffff","bg_color":"#ff4500","checked":false},{"id":-1293,"caption":"Games","fg_color":"#ffffff","bg_color":"#8a2be2","checked":false},{"id":-1295,"caption":"Git","fg_color":"#ffffff","bg_color":"#8fbc8f","checked":false},{"id":-1297,"caption":"GNOME","fg_color":"#ffffff","bg_color":"#d2691e","checked":false},{"id":-1296,"caption":"KDE","fg_color":"#ffffff","bg_color":"#4169e1","checked":false},{"id":-1291,"caption":"Linux","fg_color":"#ffffff","bg_color":"#008b8b","checked":false},{"id":-1313,"caption":"Security","fg_color":"#ffffff","bg_color":"#ff8c00","checked":false},{"id":-1292,"caption":"Technology","fg_color":"#ffffff","bg_color":"#2f4f4f","checked":false},{"id":-1033,"caption":"Tiny Tiny RSS","fg_color":"#ffffff","bg_color":"#6495ed","checked":false},{"id":-1314,"caption":"Vulnerability","fg_color":"#ffffff","bg_color":"#ff7f50","checked":false},{"id":-1316,"caption":"Wayland","fg_color":"#ffffff","bg_color":"#008000","checked":false},{"id":-1299,"caption":"Windows","fg_color":"#ffffff","bg_color":"#808080","checked":false}],"error":null} diff --git a/org.fox.ttrss/src/test/resources/responses/login.json b/org.fox.ttrss/src/test/resources/responses/login.json new file mode 100644 index 00000000..df2cc37c --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/login.json @@ -0,0 +1 @@ +{"success":true,"data":{"session_id":"SESSION_ID_PLACEHOLDER","config":{"custom_sort_types":[],"daemon_is_running":false,"icons_url":"https:\/\/dev-debian.fakecake.org\/tt-rss\/public.php","num_feeds":99},"api_level":23},"error":null} diff --git a/org.fox.ttrss/src/test/resources/responses/login_error.json b/org.fox.ttrss/src/test/resources/responses/login_error.json new file mode 100644 index 00000000..67481f5e --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/login_error.json @@ -0,0 +1 @@ +{"success":false,"data":null,"error":{"code":"LOGIN_ERROR","message":""}} diff --git a/org.fox.ttrss/src/test/resources/responses/not_logged_in.json b/org.fox.ttrss/src/test/resources/responses/not_logged_in.json new file mode 100644 index 00000000..42ced18b --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/not_logged_in.json @@ -0,0 +1 @@ +{"success":false,"data":null,"error":{"code":"NOT_LOGGED_IN","message":""}} diff --git a/org.fox.ttrss/src/test/resources/responses/unread.json b/org.fox.ttrss/src/test/resources/responses/unread.json new file mode 100644 index 00000000..d22c7129 --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/unread.json @@ -0,0 +1 @@ +{"success":true,"data":{"unread":0},"error":null} diff --git a/org.fox.ttrss/src/test/resources/responses/version.json b/org.fox.ttrss/src/test/resources/responses/version.json new file mode 100644 index 00000000..85097a4f --- /dev/null +++ b/org.fox.ttrss/src/test/resources/responses/version.json @@ -0,0 +1 @@ +{"success":true,"data":{"version":"26.06-c8e5408ea"},"error":null} diff --git a/scripts/record-api-responses.sh b/scripts/record-api-responses.sh new file mode 100755 index 00000000..c6e7a8b0 --- /dev/null +++ b/scripts/record-api-responses.sh @@ -0,0 +1,186 @@ +#!/usr/bin/env bash +# +# record-api-responses.sh +# Records TT-RSS API v2 responses as JSON fixtures for unit tests. +# +# Usage: +# ./scripts/record-api-responses.sh -u <username> -p '<password>' -h https://example.com/tt-rss +# # or via environment: +# export TTRSS_URL_ENV=https://example.com/tt-rss +# export TTRSS_USER_ENV=<username> +# export TTRSS_PASS_ENV='<password>' +# ./scripts/record-api-responses.sh +# +# Individual endpoints can be recorded by passing endpoint names: +# ./scripts/record-api-responses.sh -u <user> -p '<pass>' -h https://example.com/tt-rss -- feeds headlines +# +# Available endpoints: feeds headlines article_detail categories feed_tree unread counters config version labels login login_error not_logged_in + +set -euo pipefail + +# ── Defaults ────────────────────────────────────────────────────────────── +OUTPUT_DIR="" +ARTICLE_ID="" +ALL_ENDPOINTS="feeds headlines article_detail categories feed_tree unread counters config version labels login login_error not_logged_in" +ENDPOINTS_TO_RECORD=() + +# ── Parse arguments ─────────────────────────────────────────────────────── +while [[ $# -gt 0 ]]; do + case "$1" in + -u|--user) TTRSS_USER="$2"; shift 2 ;; + -p|--pass) TTRSS_PASS="$2"; shift 2 ;; + -h|--host) TTRSS_URL="$2"; shift 2 ;; + -o|--output) OUTPUT_DIR="$2"; shift 2 ;; + --) ENDPOINTS_TO_RECORD=("${@:2}"); break ;; + *) ENDPOINTS_TO_RECORD+=("$1"); shift ;; + esac +done + +# Fall back to environment variables (only if not set via args) +if [[ -z "${TTRSS_URL:-}" ]]; then TTRSS_URL="$TTRSS_URL_ENV"; fi +if [[ -z "${TTRSS_USER:-}" ]]; then TTRSS_USER="$TTRSS_USER_ENV"; fi +if [[ -z "${TTRSS_PASS:-}" ]]; then TTRSS_PASS="$TTRSS_PASS_ENV"; fi + +# Resolve output directory (default: src/test/resources/responses/) +if [[ -z "$OUTPUT_DIR" ]]; then + SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" + OUTPUT_DIR="$PROJECT_DIR/org.fox.ttrss/src/test/resources/responses" +fi + +# ── Validation ──────────────────────────────────────────────────────────── +if [[ -z "$TTRSS_URL" || -z "$TTRSS_USER" || -z "$TTRSS_PASS" ]]; then + echo "Error: TTRSS_URL, TTRSS_USER, and TTRSS_PASS must be set (via args or env)." + echo " Example: ./scripts/record-api-responses.sh -u <user> -p '<pass>' -h https://example.com/tt-rss" + exit 1 +fi + +mkdir -p "$OUTPUT_DIR" + +# Strip trailing slash +TTRSS_URL="${TTRSS_URL%/}" +BASE_URL="$TTRSS_URL/api/v2" + +# ── Determine which endpoints to record ─────────────────────────────────── +if [[ ${#ENDPOINTS_TO_RECORD[@]} -eq 0 ]]; then + ENDPOINTS_TO_RECORD=($ALL_ENDPOINTS) +fi + +# Validate endpoint names +for ep in "${ENDPOINTS_TO_RECORD[@]}"; do + if [[ ! " $ALL_ENDPOINTS " =~ " $ep " ]]; then + echo "Warning: Unknown endpoint '$ep', skipping." + continue + fi +done + +# ── Login ───────────────────────────────────────────────────────────────── +echo "Logging in to $TTRSS_URL ..." +LOGIN_RESPONSE=$(curl -s -X POST "$BASE_URL/auth/login" \ + -H "Content-Type: text/json" \ + -d "{\"user\":\"$TTRSS_USER\", \"password\": \"$TTRSS_PASS\"}") + +SESSION_ID=$(echo "$LOGIN_RESPONSE" | grep -o '"session_id":"[^"]*"' | cut -d'"' -f4) +if [[ -z "$SESSION_ID" ]]; then + echo "Error: Login failed. Response: $LOGIN_RESPONSE" + exit 1 +fi +echo " Session ID: $SESSION_ID" + +# Save login response (replace real session_id with placeholder) +echo "$LOGIN_RESPONSE" | sed "s/$SESSION_ID/SESSION_ID_PLACEHOLDER/g" > "$OUTPUT_DIR/login.json" +echo " Saved: login.json" + +# ── Record endpoints ───────────────────────────────────────────────────── +record_endpoint() { + local name="$1" + local method="${2:-GET}" + local path="$3" + local body="${4:-}" + local headers="${5:-}" + + local outfile="$OUTPUT_DIR/${name}.json" + + if [[ "$method" == "GET" ]]; then + local response + response=$(curl -s "$BASE_URL/$path" \ + -H "X-Session-ID: $SESSION_ID" \ + $headers) + elif [[ "$method" == "POST" ]]; then + local response + response=$(curl -s -X POST "$BASE_URL/$path" \ + -H "Content-Type: text/json" \ + -H "X-Session-ID: $SESSION_ID" \ + $headers \ + -d "$body") + fi + + echo "$response" > "$outfile" + local size + size=$(wc -c < "$outfile") + echo " Saved: ${name}.json ($size bytes)" +} + +# Record each requested endpoint +for ep in "${ENDPOINTS_TO_RECORD[@]}"; do + case "$ep" in + feeds) + record_endpoint "feeds" "GET" "feeds" + ;; + headlines) + record_endpoint "headlines" "GET" "articles?unread=true&limit=20&sort=updated&order=descending" + ;; + article_detail) + # Need an article ID from headlines first + if [[ -z "$ARTICLE_ID" && -f "$OUTPUT_DIR/headlines.json" ]]; then + ARTICLE_ID=$(grep -o '"id":[0-9]*' "$OUTPUT_DIR/headlines.json" | head -1 | cut -d: -f2) + fi + if [[ -z "$ARTICLE_ID" ]]; then + echo " Skipping: article_detail (no article_id available, record headlines first)" + continue + fi + record_endpoint "article_detail" "GET" "articles/$ARTICLE_ID" + ;; + categories) + record_endpoint "categories" "GET" "categories" + ;; + feed_tree) + record_endpoint "feed_tree" "GET" "feed-tree" + ;; + unread) + record_endpoint "unread" "GET" "unread" + ;; + counters) + record_endpoint "counters" "GET" "counters" + ;; + config) + record_endpoint "config" "GET" "config" + ;; + version) + record_endpoint "version" "GET" "version" + ;; + labels) + if [[ -z "$ARTICLE_ID" && -f "$OUTPUT_DIR/headlines.json" ]]; then + ARTICLE_ID=$(grep -o '"id":[0-9]*' "$OUTPUT_DIR/headlines.json" | head -1 | cut -d: -f2) + fi + if [[ -z "$ARTICLE_ID" ]]; then + echo " Skipping: labels (no article_id available, record headlines first)" + continue + fi + record_endpoint "labels" "GET" "labels?article_id=$ARTICLE_ID" + ;; + login_error) + record_endpoint "login_error" "POST" "auth/login" '{"user":"unknown","password":"wrong"}' + ;; + not_logged_in) + outfile="$OUTPUT_DIR/not_logged_in.json" + response=$(curl -s "$BASE_URL/feeds" -H "X-Session-ID: invalid-session") + echo "$response" > "$outfile" + size=$(wc -c < "$outfile") + echo " Saved: not_logged_in.json ($size bytes)" + ;; + esac +done + +echo "" +echo "Done. All fixtures saved to: $OUTPUT_DIR" |
