react-native-consumet 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/android/build.gradle +1 -0
  2. package/android/generated/java/com/consumet/NativeConsumetSpec.java +8 -0
  3. package/android/generated/jni/RNConsumetSpec-generated.cpp +12 -0
  4. package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI-generated.cpp +14 -0
  5. package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI.h +18 -0
  6. package/android/src/main/java/com/consumet/ConsumetModule.kt +60 -35
  7. package/android/src/main/java/com/consumet/DdosGuardModule.kt +142 -0
  8. package/ios/generated/RNConsumetSpec/RNConsumetSpec-generated.mm +14 -0
  9. package/ios/generated/RNConsumetSpec/RNConsumetSpec.h +6 -0
  10. package/ios/generated/RNConsumetSpecJSI-generated.cpp +14 -0
  11. package/ios/generated/RNConsumetSpecJSI.h +18 -0
  12. package/lib/commonjs/NativeConsumet.ts +2 -0
  13. package/lib/commonjs/index.js +9 -4
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/models/types.js.map +1 -1
  16. package/lib/commonjs/providers/anime/animepahe.js +61 -9
  17. package/lib/commonjs/providers/anime/animepahe.js.map +1 -1
  18. package/lib/commonjs/providers/meta/anilist.js +24 -10
  19. package/lib/commonjs/providers/meta/anilist.js.map +1 -1
  20. package/lib/commonjs/providers/meta/tmdb.js +2 -1
  21. package/lib/commonjs/providers/meta/tmdb.js.map +1 -1
  22. package/lib/commonjs/providers/movies/multimovies.js +18 -6
  23. package/lib/commonjs/providers/movies/multimovies.js.map +1 -1
  24. package/lib/module/NativeConsumet.ts +2 -0
  25. package/lib/module/index.js +5 -3
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/module/models/types.js.map +1 -1
  28. package/lib/module/providers/anime/animepahe.js +62 -10
  29. package/lib/module/providers/anime/animepahe.js.map +1 -1
  30. package/lib/module/providers/meta/anilist.js +24 -10
  31. package/lib/module/providers/meta/anilist.js.map +1 -1
  32. package/lib/module/providers/meta/tmdb.js +2 -1
  33. package/lib/module/providers/meta/tmdb.js.map +1 -1
  34. package/lib/module/providers/movies/multimovies.js +18 -6
  35. package/lib/module/providers/movies/multimovies.js.map +1 -1
  36. package/lib/typescript/commonjs/src/NativeConsumet.d.ts +4 -0
  37. package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
  38. package/lib/typescript/commonjs/src/index.d.ts +3 -1
  39. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  40. package/lib/typescript/commonjs/src/models/types.d.ts +1 -0
  41. package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
  42. package/lib/typescript/commonjs/src/providers/anime/animepahe.d.ts +7 -3
  43. package/lib/typescript/commonjs/src/providers/anime/animepahe.d.ts.map +1 -1
  44. package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
  45. package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts.map +1 -1
  46. package/lib/typescript/commonjs/src/providers/movies/multimovies.d.ts.map +1 -1
  47. package/lib/typescript/module/src/NativeConsumet.d.ts +4 -0
  48. package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
  49. package/lib/typescript/module/src/index.d.ts +3 -1
  50. package/lib/typescript/module/src/index.d.ts.map +1 -1
  51. package/lib/typescript/module/src/models/types.d.ts +1 -0
  52. package/lib/typescript/module/src/models/types.d.ts.map +1 -1
  53. package/lib/typescript/module/src/providers/anime/animepahe.d.ts +7 -3
  54. package/lib/typescript/module/src/providers/anime/animepahe.d.ts.map +1 -1
  55. package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
  56. package/lib/typescript/module/src/providers/meta/tmdb.d.ts.map +1 -1
  57. package/lib/typescript/module/src/providers/movies/multimovies.d.ts.map +1 -1
  58. package/package.json +1 -1
  59. package/src/NativeConsumet.ts +2 -0
  60. package/src/index.tsx +2 -3
  61. package/src/models/types.ts +1 -0
  62. package/src/providers/anime/animepahe.ts +72 -10
  63. package/src/providers/meta/anilist.ts +33 -9
  64. package/src/providers/meta/tmdb.ts +2 -1
  65. package/src/providers/movies/multimovies.ts +15 -10
@@ -93,6 +93,7 @@ dependencies {
93
93
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
94
94
  implementation "androidx.annotation:annotation:1.5.0"
95
95
  implementation "androidx.webkit:webkit:1.8.0"
96
+ implementation 'com.squareup.okhttp3:okhttp:4.9.2'
96
97
  }
97
98
 
98
99
  react {
@@ -35,4 +35,12 @@ public abstract class NativeConsumetSpec extends ReactContextBaseJavaModule impl
35
35
  @ReactMethod
36
36
  @DoNotStrip
37
37
  public abstract void getSources(String xrax, Promise promise);
38
+
39
+ @ReactMethod
40
+ @DoNotStrip
41
+ public abstract void bypassDdosGuard(String url, Promise promise);
42
+
43
+ @ReactMethod
44
+ @DoNotStrip
45
+ public abstract void getDdosGuardCookiesWithWebView(String url, Promise promise);
38
46
  }
@@ -17,9 +17,21 @@ static facebook::jsi::Value __hostFunction_NativeConsumetSpecJSI_getSources(face
17
17
  return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "getSources", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
18
18
  }
19
19
 
20
+ static facebook::jsi::Value __hostFunction_NativeConsumetSpecJSI_bypassDdosGuard(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
+ static jmethodID cachedMethodId = nullptr;
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "bypassDdosGuard", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
23
+ }
24
+
25
+ static facebook::jsi::Value __hostFunction_NativeConsumetSpecJSI_getDdosGuardCookiesWithWebView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
26
+ static jmethodID cachedMethodId = nullptr;
27
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "getDdosGuardCookiesWithWebView", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
28
+ }
29
+
20
30
  NativeConsumetSpecJSI::NativeConsumetSpecJSI(const JavaTurboModule::InitParams &params)
21
31
  : JavaTurboModule(params) {
22
32
  methodMap_["getSources"] = MethodMetadata {1, __hostFunction_NativeConsumetSpecJSI_getSources};
33
+ methodMap_["bypassDdosGuard"] = MethodMetadata {1, __hostFunction_NativeConsumetSpecJSI_bypassDdosGuard};
34
+ methodMap_["getDdosGuardCookiesWithWebView"] = MethodMetadata {1, __hostFunction_NativeConsumetSpecJSI_getDdosGuardCookiesWithWebView};
23
35
  }
24
36
 
25
37
  std::shared_ptr<TurboModule> RNConsumetSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
@@ -17,10 +17,24 @@ static jsi::Value __hostFunction_NativeConsumetCxxSpecJSI_getSources(jsi::Runtim
17
17
  count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
18
18
  );
19
19
  }
20
+ static jsi::Value __hostFunction_NativeConsumetCxxSpecJSI_bypassDdosGuard(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
21
+ return static_cast<NativeConsumetCxxSpecJSI *>(&turboModule)->bypassDdosGuard(
22
+ rt,
23
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
24
+ );
25
+ }
26
+ static jsi::Value __hostFunction_NativeConsumetCxxSpecJSI_getDdosGuardCookiesWithWebView(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
27
+ return static_cast<NativeConsumetCxxSpecJSI *>(&turboModule)->getDdosGuardCookiesWithWebView(
28
+ rt,
29
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
30
+ );
31
+ }
20
32
 
21
33
  NativeConsumetCxxSpecJSI::NativeConsumetCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
22
34
  : TurboModule("Consumet", jsInvoker) {
23
35
  methodMap_["getSources"] = MethodMetadata {1, __hostFunction_NativeConsumetCxxSpecJSI_getSources};
36
+ methodMap_["bypassDdosGuard"] = MethodMetadata {1, __hostFunction_NativeConsumetCxxSpecJSI_bypassDdosGuard};
37
+ methodMap_["getDdosGuardCookiesWithWebView"] = MethodMetadata {1, __hostFunction_NativeConsumetCxxSpecJSI_getDdosGuardCookiesWithWebView};
24
38
  }
25
39
 
26
40
 
@@ -21,6 +21,8 @@ protected:
21
21
 
22
22
  public:
23
23
  virtual jsi::Value getSources(jsi::Runtime &rt, jsi::String xrax) = 0;
24
+ virtual jsi::Value bypassDdosGuard(jsi::Runtime &rt, jsi::String url) = 0;
25
+ virtual jsi::Value getDdosGuardCookiesWithWebView(jsi::Runtime &rt, jsi::String url) = 0;
24
26
 
25
27
  };
26
28
 
@@ -59,6 +61,22 @@ private:
59
61
  return bridging::callFromJs<jsi::Value>(
60
62
  rt, &T::getSources, jsInvoker_, instance_, std::move(xrax));
61
63
  }
64
+ jsi::Value bypassDdosGuard(jsi::Runtime &rt, jsi::String url) override {
65
+ static_assert(
66
+ bridging::getParameterCount(&T::bypassDdosGuard) == 2,
67
+ "Expected bypassDdosGuard(...) to have 2 parameters");
68
+
69
+ return bridging::callFromJs<jsi::Value>(
70
+ rt, &T::bypassDdosGuard, jsInvoker_, instance_, std::move(url));
71
+ }
72
+ jsi::Value getDdosGuardCookiesWithWebView(jsi::Runtime &rt, jsi::String url) override {
73
+ static_assert(
74
+ bridging::getParameterCount(&T::getDdosGuardCookiesWithWebView) == 2,
75
+ "Expected getDdosGuardCookiesWithWebView(...) to have 2 parameters");
76
+
77
+ return bridging::callFromJs<jsi::Value>(
78
+ rt, &T::getDdosGuardCookiesWithWebView, jsInvoker_, instance_, std::move(url));
79
+ }
62
80
 
63
81
  private:
64
82
  friend class NativeConsumetCxxSpec;
@@ -7,19 +7,22 @@ import android.util.Log
7
7
  import android.webkit.*
8
8
  import com.facebook.react.bridge.Promise
9
9
  import com.facebook.react.bridge.ReactApplicationContext
10
+ import com.facebook.react.bridge.ReactMethod
10
11
  import com.facebook.react.module.annotations.ReactModule
11
12
  import com.facebook.react.turbomodule.core.interfaces.TurboModule
12
13
  import java.util.concurrent.CountDownLatch
13
14
  import java.util.concurrent.TimeUnit
14
15
 
15
16
  @ReactModule(name = ConsumetModule.NAME)
16
- class ConsumetModule(private val reactContext: ReactApplicationContext) : NativeConsumetSpec(reactContext), TurboModule {
17
+ class ConsumetModule(private val reactContext: ReactApplicationContext) :
18
+ NativeConsumetSpec(reactContext), TurboModule {
17
19
  private val handler by lazy { Handler(Looper.getMainLooper()) }
18
20
  private val tag by lazy { javaClass.simpleName }
21
+ private val ddosGuardHelper by lazy { DdosGuardHelper(reactContext) }
19
22
 
20
23
  class JsInterface(
21
- private val latch: CountDownLatch,
22
- private val context: ReactApplicationContext
24
+ private val latch: CountDownLatch,
25
+ private val context: ReactApplicationContext
23
26
  ) {
24
27
  var result: String? = null
25
28
 
@@ -62,11 +65,13 @@ class ConsumetModule(private val reactContext: ReactApplicationContext) : Native
62
65
 
63
66
  webview.addJavascriptInterface(jsi, "jsinterface")
64
67
 
65
- webview.webViewClient = object : WebViewClient() {
66
- override fun onPageFinished(view: WebView?, url: String?) {
67
- super.onPageFinished(view, url)
68
+ webview.webViewClient =
69
+ object : WebViewClient() {
70
+ override fun onPageFinished(view: WebView?, url: String?) {
71
+ super.onPageFinished(view, url)
68
72
 
69
- val cdnScript = """
73
+ val cdnScript =
74
+ """
70
75
  (async function() {
71
76
  async function loadScriptWithFallback(url, localFilename) {
72
77
  try {
@@ -101,21 +106,30 @@ class ConsumetModule(private val reactContext: ReactApplicationContext) : Native
101
106
  })();
102
107
  """.trimIndent()
103
108
 
104
- view?.evaluateJavascript(cdnScript, null)
105
- }
106
-
107
- override fun onReceivedError(view: WebView?, errorCode: Int, description: String?, failingUrl: String?) {
108
- Log.e(tag, "WebView error: $errorCode - $description @ $failingUrl")
109
- super.onReceivedError(view, errorCode, description, failingUrl)
110
- }
111
- }
112
-
113
- webview.webChromeClient = object : WebChromeClient() {
114
- override fun onConsoleMessage(consoleMessage: ConsoleMessage?): Boolean {
115
- Log.d(tag, "Console: [${consoleMessage?.messageLevel()}] ${consoleMessage?.message()}")
116
- return super.onConsoleMessage(consoleMessage)
117
- }
118
- }
109
+ view?.evaluateJavascript(cdnScript, null)
110
+ }
111
+
112
+ override fun onReceivedError(
113
+ view: WebView?,
114
+ errorCode: Int,
115
+ description: String?,
116
+ failingUrl: String?
117
+ ) {
118
+ Log.e(tag, "WebView error: $errorCode - $description @ $failingUrl")
119
+ super.onReceivedError(view, errorCode, description, failingUrl)
120
+ }
121
+ }
122
+
123
+ webview.webChromeClient =
124
+ object : WebChromeClient() {
125
+ override fun onConsoleMessage(consoleMessage: ConsoleMessage?): Boolean {
126
+ Log.d(
127
+ tag,
128
+ "Console: [${consoleMessage?.messageLevel()}] ${consoleMessage?.message()}"
129
+ )
130
+ return super.onConsoleMessage(consoleMessage)
131
+ }
132
+ }
119
133
 
120
134
  val headers = mapOf("X-Requested-With" to "org.lineageos.jelly")
121
135
  webview.loadUrl("https://megacloud.tv/about", headers)
@@ -123,24 +137,35 @@ class ConsumetModule(private val reactContext: ReactApplicationContext) : Native
123
137
 
124
138
  // Await result or timeout
125
139
  Thread {
126
- val success = latch.await(TIMEOUT_SEC, TimeUnit.SECONDS)
127
-
128
- handler.post {
129
- webView?.stopLoading()
130
- webView?.destroy()
131
- webView = null
132
-
133
- if (success && jsi.result != null) {
134
- promise.resolve(jsi.result)
135
- } else {
136
- promise.reject("ERROR", "Failed to get sources or timeout2")
140
+ val success = latch.await(TIMEOUT_SEC, TimeUnit.SECONDS)
141
+
142
+ handler.post {
143
+ webView?.stopLoading()
144
+ webView?.destroy()
145
+ webView = null
146
+
147
+ if (success && jsi.result != null) {
148
+ promise.resolve(jsi.result)
149
+ } else {
150
+ promise.reject("ERROR", "Failed to get sources or timeout2")
151
+ }
152
+ }
137
153
  }
138
- }
139
- }.start()
154
+ .start()
140
155
  }
141
156
 
142
157
  companion object {
143
158
  const val NAME = "Consumet"
144
159
  private const val TIMEOUT_SEC: Long = 90
145
160
  }
161
+
162
+ @ReactMethod
163
+ override fun bypassDdosGuard(url: String, promise: Promise) {
164
+ ddosGuardHelper.bypassDdosGuard(url, promise)
165
+ }
166
+
167
+ @ReactMethod
168
+ override fun getDdosGuardCookiesWithWebView(url: String, promise: Promise) {
169
+ ddosGuardHelper.getDdosGuardCookiesWithWebView(url, promise)
170
+ }
146
171
  }
@@ -0,0 +1,142 @@
1
+ package com.consumet
2
+
3
+ import android.webkit.CookieManager
4
+ import com.facebook.react.bridge.Promise
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.bridge.WritableNativeMap
7
+ import okhttp3.Cookie
8
+ import okhttp3.HttpUrl.Companion.toHttpUrlOrNull // Updated import
9
+ import okhttp3.OkHttpClient
10
+ import okhttp3.Request
11
+ import java.util.regex.Pattern
12
+ import android.webkit.WebView
13
+ import android.webkit.WebViewClient
14
+ import android.os.Handler
15
+ import android.os.Looper
16
+
17
+ class DdosGuardHelper(private val reactContext: ReactApplicationContext) {
18
+ private val client = OkHttpClient.Builder().build()
19
+ private val cookieManager = CookieManager.getInstance()
20
+
21
+ fun bypassDdosGuard(url: String, promise: Promise) {
22
+ try {
23
+ val httpUrl = url.toHttpUrlOrNull() ?: run {
24
+ promise.reject("ERROR", "Invalid URL")
25
+ return
26
+ }
27
+
28
+ val cookies = cookieManager.getCookie(url)
29
+ val oldCookies = mutableListOf<Cookie>()
30
+ var ddg2Cookie: Cookie? = null
31
+
32
+ if (!cookies.isNullOrEmpty()) {
33
+ cookies.split(";").forEach { cookieStr ->
34
+ Cookie.parse(httpUrl, cookieStr.trim())?.let { cookie ->
35
+ oldCookies.add(cookie)
36
+ if (cookie.name == "__ddg2") {
37
+ ddg2Cookie = cookie
38
+ }
39
+ }
40
+ }
41
+ }
42
+
43
+ if (ddg2Cookie != null && !ddg2Cookie!!.value.isEmpty()) {
44
+ val result = WritableNativeMap()
45
+ result.putString("cookie", cookiesToHeaderString(oldCookies))
46
+ promise.resolve(result)
47
+ return
48
+ }
49
+
50
+ // Get new cookie
51
+ val newCookie = getNewCookie(httpUrl) ?: run {
52
+ promise.reject("ERROR", "Failed to get DDos-Guard cookie")
53
+ return
54
+ }
55
+
56
+ oldCookies.add(newCookie)
57
+ val newCookieHeader = cookiesToHeaderString(oldCookies)
58
+
59
+ val result = WritableNativeMap()
60
+ result.putString("cookie", newCookieHeader)
61
+ promise.resolve(result)
62
+ } catch (e: Exception) {
63
+ promise.reject("ERROR", e.message, e)
64
+ }
65
+ }
66
+
67
+ private fun getNewCookie(url: okhttp3.HttpUrl): Cookie? {
68
+ val cookies = cookieManager.getCookie(url.toString())
69
+ val oldCookies = mutableListOf<Cookie>()
70
+ var ddg2Cookie: Cookie? = null
71
+
72
+ if (!cookies.isNullOrEmpty()) {
73
+ cookies.split(";").forEach { cookieStr ->
74
+ Cookie.parse(url, cookieStr.trim())?.let { cookie ->
75
+ oldCookies.add(cookie)
76
+ if (cookie.name == "__ddg2") {
77
+ ddg2Cookie = cookie
78
+ }
79
+ }
80
+ }
81
+ }
82
+
83
+ if (ddg2Cookie != null && !ddg2Cookie!!.value.isEmpty()) {
84
+ return ddg2Cookie
85
+ }
86
+
87
+ val checkJsRequest = Request.Builder()
88
+ .url("https://check.ddos-guard.net/check.js")
89
+ .get()
90
+ .build()
91
+
92
+ val checkJsResponse = client.newCall(checkJsRequest).execute()
93
+ val checkJsBody = checkJsResponse.body?.string() ?: ""
94
+ checkJsResponse.close()
95
+
96
+ // Extract well-known path from check.js
97
+ val pattern = Pattern.compile("'([^']*)'")
98
+ val matcher = pattern.matcher(checkJsBody)
99
+ if (!matcher.find()) {
100
+ return null
101
+ }
102
+ val wellKnown = matcher.group(1)
103
+
104
+ val checkUrl = "${url.scheme}://${url.host}$wellKnown"
105
+ val checkRequest = Request.Builder()
106
+ .url(checkUrl)
107
+ .get()
108
+ .build()
109
+
110
+ val checkResponse = client.newCall(checkRequest).execute()
111
+ val setCookieHeader = checkResponse.header("set-cookie")
112
+ checkResponse.close()
113
+
114
+ return setCookieHeader?.let { Cookie.parse(url, it) }
115
+ }
116
+
117
+ private fun cookiesToHeaderString(cookies: List<Cookie>): String {
118
+ return cookies.joinToString("; ") { "${it.name}=${it.value}" }
119
+ }
120
+
121
+ fun getDdosGuardCookiesWithWebView(url: String, promise: Promise) {
122
+ Handler(Looper.getMainLooper()).post {
123
+ val webView = WebView(reactContext)
124
+ webView.settings.javaScriptEnabled = true
125
+ webView.settings.domStorageEnabled = true
126
+
127
+ webView.webViewClient = object : WebViewClient() {
128
+ override fun onPageFinished(view: WebView, url: String) {
129
+ val cookieManager = android.webkit.CookieManager.getInstance()
130
+ val cookie = cookieManager.getCookie(url)
131
+ if (!cookie.isNullOrEmpty() && cookie.contains("__ddg2")) {
132
+ promise.resolve(cookie)
133
+ } else {
134
+ promise.reject("COOKIE_ERROR", "No __ddg2 cookie received")
135
+ }
136
+ }
137
+ }
138
+
139
+ webView.loadUrl(url)
140
+ }
141
+ }
142
+ }
@@ -30,10 +30,24 @@ namespace facebook::react {
30
30
  return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "getSources", @selector(getSources:resolve:reject:), args, count);
31
31
  }
32
32
 
33
+ static facebook::jsi::Value __hostFunction_NativeConsumetSpecJSI_bypassDdosGuard(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
34
+ return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "bypassDdosGuard", @selector(bypassDdosGuard:resolve:reject:), args, count);
35
+ }
36
+
37
+ static facebook::jsi::Value __hostFunction_NativeConsumetSpecJSI_getDdosGuardCookiesWithWebView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
38
+ return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "getDdosGuardCookiesWithWebView", @selector(getDdosGuardCookiesWithWebView:resolve:reject:), args, count);
39
+ }
40
+
33
41
  NativeConsumetSpecJSI::NativeConsumetSpecJSI(const ObjCTurboModule::InitParams &params)
34
42
  : ObjCTurboModule(params) {
35
43
 
36
44
  methodMap_["getSources"] = MethodMetadata {1, __hostFunction_NativeConsumetSpecJSI_getSources};
37
45
 
46
+
47
+ methodMap_["bypassDdosGuard"] = MethodMetadata {1, __hostFunction_NativeConsumetSpecJSI_bypassDdosGuard};
48
+
49
+
50
+ methodMap_["getDdosGuardCookiesWithWebView"] = MethodMetadata {1, __hostFunction_NativeConsumetSpecJSI_getDdosGuardCookiesWithWebView};
51
+
38
52
  }
39
53
  } // namespace facebook::react
@@ -38,6 +38,12 @@ NS_ASSUME_NONNULL_BEGIN
38
38
  - (void)getSources:(NSString *)xrax
39
39
  resolve:(RCTPromiseResolveBlock)resolve
40
40
  reject:(RCTPromiseRejectBlock)reject;
41
+ - (void)bypassDdosGuard:(NSString *)url
42
+ resolve:(RCTPromiseResolveBlock)resolve
43
+ reject:(RCTPromiseRejectBlock)reject;
44
+ - (void)getDdosGuardCookiesWithWebView:(NSString *)url
45
+ resolve:(RCTPromiseResolveBlock)resolve
46
+ reject:(RCTPromiseRejectBlock)reject;
41
47
 
42
48
  @end
43
49
 
@@ -17,10 +17,24 @@ static jsi::Value __hostFunction_NativeConsumetCxxSpecJSI_getSources(jsi::Runtim
17
17
  count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
18
18
  );
19
19
  }
20
+ static jsi::Value __hostFunction_NativeConsumetCxxSpecJSI_bypassDdosGuard(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
21
+ return static_cast<NativeConsumetCxxSpecJSI *>(&turboModule)->bypassDdosGuard(
22
+ rt,
23
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
24
+ );
25
+ }
26
+ static jsi::Value __hostFunction_NativeConsumetCxxSpecJSI_getDdosGuardCookiesWithWebView(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
27
+ return static_cast<NativeConsumetCxxSpecJSI *>(&turboModule)->getDdosGuardCookiesWithWebView(
28
+ rt,
29
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
30
+ );
31
+ }
20
32
 
21
33
  NativeConsumetCxxSpecJSI::NativeConsumetCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
22
34
  : TurboModule("Consumet", jsInvoker) {
23
35
  methodMap_["getSources"] = MethodMetadata {1, __hostFunction_NativeConsumetCxxSpecJSI_getSources};
36
+ methodMap_["bypassDdosGuard"] = MethodMetadata {1, __hostFunction_NativeConsumetCxxSpecJSI_bypassDdosGuard};
37
+ methodMap_["getDdosGuardCookiesWithWebView"] = MethodMetadata {1, __hostFunction_NativeConsumetCxxSpecJSI_getDdosGuardCookiesWithWebView};
24
38
  }
25
39
 
26
40
 
@@ -21,6 +21,8 @@ protected:
21
21
 
22
22
  public:
23
23
  virtual jsi::Value getSources(jsi::Runtime &rt, jsi::String xrax) = 0;
24
+ virtual jsi::Value bypassDdosGuard(jsi::Runtime &rt, jsi::String url) = 0;
25
+ virtual jsi::Value getDdosGuardCookiesWithWebView(jsi::Runtime &rt, jsi::String url) = 0;
24
26
 
25
27
  };
26
28
 
@@ -59,6 +61,22 @@ private:
59
61
  return bridging::callFromJs<jsi::Value>(
60
62
  rt, &T::getSources, jsInvoker_, instance_, std::move(xrax));
61
63
  }
64
+ jsi::Value bypassDdosGuard(jsi::Runtime &rt, jsi::String url) override {
65
+ static_assert(
66
+ bridging::getParameterCount(&T::bypassDdosGuard) == 2,
67
+ "Expected bypassDdosGuard(...) to have 2 parameters");
68
+
69
+ return bridging::callFromJs<jsi::Value>(
70
+ rt, &T::bypassDdosGuard, jsInvoker_, instance_, std::move(url));
71
+ }
72
+ jsi::Value getDdosGuardCookiesWithWebView(jsi::Runtime &rt, jsi::String url) override {
73
+ static_assert(
74
+ bridging::getParameterCount(&T::getDdosGuardCookiesWithWebView) == 2,
75
+ "Expected getDdosGuardCookiesWithWebView(...) to have 2 parameters");
76
+
77
+ return bridging::callFromJs<jsi::Value>(
78
+ rt, &T::getDdosGuardCookiesWithWebView, jsInvoker_, instance_, std::move(url));
79
+ }
62
80
 
63
81
  private:
64
82
  friend class NativeConsumetCxxSpec;
@@ -3,6 +3,8 @@ import { TurboModuleRegistry } from 'react-native';
3
3
 
4
4
  export interface Spec extends TurboModule {
5
5
  getSources(xrax: string): Promise<string>;
6
+ bypassDdosGuard(url: string): Promise<{ cookie: string }>;
7
+ getDdosGuardCookiesWithWebView(url: string): Promise<string>;
6
8
  }
7
9
 
8
10
  export default TurboModuleRegistry.getEnforcing<Spec>('Consumet');
@@ -225,7 +225,7 @@ Object.defineProperty(exports, "Voe", {
225
225
  return _index2.Voe;
226
226
  }
227
227
  });
228
- exports.getSources = getSources;
228
+ exports.getSources = exports.getDdosGuardCookiesWithWebView = exports.bypassDdosGuard = void 0;
229
229
  require("react-native-url-polyfill/auto");
230
230
  var _NativeConsumet = _interopRequireDefault(require("./NativeConsumet"));
231
231
  var _index = require("./providers/index.js");
@@ -233,7 +233,12 @@ var _providersList = require("./utils/providers-list.js");
233
233
  var _index2 = require("./extractors/index.js");
234
234
  var _index3 = require("./models/index.js");
235
235
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
236
- function getSources(s) {
237
- return _NativeConsumet.default.getSources(s);
238
- }
236
+ const {
237
+ getSources,
238
+ bypassDdosGuard,
239
+ getDdosGuardCookiesWithWebView
240
+ } = _NativeConsumet.default;
241
+ exports.getDdosGuardCookiesWithWebView = getDdosGuardCookiesWithWebView;
242
+ exports.bypassDdosGuard = bypassDdosGuard;
243
+ exports.getSources = getSources;
239
244
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["require","_NativeConsumet","_interopRequireDefault","_index","_providersList","_index2","_index3","e","__esModule","default","getSources","s","Consumet"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAwBA,IAAAM,OAAA,GAAAN,OAAA;AAuCkB,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AApEX,SAASG,UAAUA,CAACC,CAAS,EAAmB;EACrD,OAAOC,uBAAQ,CAACF,UAAU,CAACC,CAAC,CAAC;AAC/B","ignoreList":[]}
1
+ {"version":3,"names":["require","_NativeConsumet","_interopRequireDefault","_index","_providersList","_index2","_index3","e","__esModule","default","getSources","bypassDdosGuard","getDdosGuardCookiesWithWebView","Consumet","exports"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAIA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAwBA,IAAAM,OAAA,GAAAN,OAAA;AAuCkB,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAnEX,MAAM;EAAEG,UAAU;EAAEC,eAAe;EAAEC;AAA+B,CAAC,GAAGC,uBAAQ;AAACC,OAAA,CAAAF,8BAAA,GAAAA,8BAAA;AAAAE,OAAA,CAAAH,eAAA,GAAAA,eAAA;AAAAG,OAAA,CAAAJ,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["MediaFormat","exports","StreamingServers","MediaStatus","WatchListType","SubOrSub","TvType","Genres","Topics"],"sourceRoot":"..\\..\\..\\src","sources":["models/types.ts"],"mappings":";;;;;;IA4DYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAAA,IAoIXE,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAU1B;EAVUA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAAA,IAwBhBC,WAAW,GAAAF,OAAA,CAAAE,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAAA,IASXC,aAAa,GAAAH,OAAA,CAAAG,aAAA,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAAA,IASbC,QAAQ,GAAAJ,OAAA,CAAAI,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AA6HpB;AACA;AACA;AAgBA;AACA;AACA;AAFA,IAGYC,MAAM,GAAAL,OAAA,CAAAK,MAAA,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AAAA,IAyGNC,MAAM,GAAAN,OAAA,CAAAM,MAAA,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AAAA,IAqBNC,MAAM,GAAAP,OAAA,CAAAO,MAAA,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["MediaFormat","exports","StreamingServers","MediaStatus","WatchListType","SubOrSub","TvType","Genres","Topics"],"sourceRoot":"..\\..\\..\\src","sources":["models/types.ts"],"mappings":";;;;;;IA4DYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAAA,IAoIXE,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAU1B;EAVUA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAAA,IAwBhBC,WAAW,GAAAF,OAAA,CAAAE,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAAA,IASXC,aAAa,GAAAH,OAAA,CAAAG,aAAA,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAAA,IASbC,QAAQ,GAAAJ,OAAA,CAAAI,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AA6HpB;AACA;AACA;AAgBA;AACA;AACA;AAFA,IAGYC,MAAM,GAAAL,OAAA,CAAAK,MAAA,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AAAA,IA0GNC,MAAM,GAAAN,OAAA,CAAAM,MAAA,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AAAA,IAqBNC,MAAM,GAAAP,OAAA,CAAAO,MAAA,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA","ignoreList":[]}