fix(media hosting): restore android imgur support

This commit is contained in:
Tommaso Casaburi
2026-05-01 22:52:56 +07:00
parent db61ca09d4
commit 9f388693eb
9 changed files with 57 additions and 28 deletions
@@ -40,7 +40,7 @@ public class ImgurLiveUploadTest {
}
@Test
@Ignore("Imgur upload is no longer supported on Android WebView; keep for manual diagnostics.")
@Ignore("Live provider diagnostic; may fail when Imgur is unavailable from the current network.")
public void imgur_liveUpload_fromGeneratedPng_succeeds() throws Exception {
Intent launchIntent = new Intent(appContext, MainActivity.class);
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -18,10 +18,10 @@ import org.junit.runner.RunWith;
* Instrumentation tests for MediaUploadAutomationRunner against controlled HTML fixtures.
* Uses DataTransfer injection (no chooser). Simulates: delayed DOM, missing selectors,
* success URL extraction, blocked. Validates timeout/error classification (input_not_found,
* blocked/captcha, upload_timed_out). Kept for opt-in diagnostics because Android app uploads no
* longer use this WebView path.
* blocked/captcha, upload_timed_out). Kept opt-in because these instrumentation tests exercise
* WebView timing behavior rather than ordinary unit logic.
*/
@Ignore("Imgur WebView upload is no longer supported on Android; keep for manual diagnostics.")
@Ignore("WebView automation fixture diagnostics; run manually with connected Android tests.")
@RunWith(AndroidJUnit4.class)
public class MediaUploadAutomationRunnerTest {
@@ -5,9 +5,9 @@ package fivechan.android;
* Reconciled with electron/media-upload-recipes.js for imgbb and imgur.
*
* Android vs Electron (prevent drift):
* - Android app uploads use native catbox and WebView automation for imgbb. The imgur runner
* is retained for diagnostics/tests only. Real Uri attempts use the WebView file chooser
* callback; fixtures/fallback use DataTransfer JS injection.
* - Android app uploads use native catbox and WebView automation for imgur/imgbb. Real Uri
* attempts use the WebView file chooser callback when possible; fixtures/fallback use
* DataTransfer JS injection.
* - Electron: catbox/imgur/imgbb. CDP DOM.setFileInputFiles + submit click.
* - Selectors: file input, submit, success extractor, blocked indicators kept in sync for imgbb
* and imgur.
@@ -36,7 +36,7 @@ public final class MediaUploadRecipes {
}
public static boolean isAndroidUploadProvider(String provider) {
return PROVIDER_IMGBB.equals(provider);
return PROVIDER_IMGUR.equals(provider) || PROVIDER_IMGBB.equals(provider);
}
public static String getUploadUrl(String provider) {