Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danemadsen/cloudflare_challenge_handler
https://github.com/danemadsen/cloudflare_challenge_handler
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/danemadsen/cloudflare_challenge_handler
- Owner: danemadsen
- License: mit
- Created: 2024-12-12T05:57:06.000Z (11 days ago)
- Default Branch: main
- Last Pushed: 2024-12-12T05:58:16.000Z (11 days ago)
- Last Synced: 2024-12-12T06:29:59.265Z (11 days ago)
- Language: Dart
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
A flutter package to handle cloudflare challenges using webview and dio
## Features
The handler widget will automatically open a webview for cloudflare when a challenge is detected.
## Getting started
To use the package, add `cloudflare_interceptor` to your `pubspec.yaml` file.
```yaml
dependencies:
cloudflare_interceptor: ^1.0.0
```Then import the package to your dart file.
```dart
import 'package:cloudflare_interceptor/cloudflare_interceptor.dart';
```## Usage
The package provides a `CloudflareChallengeHandler` widget that will handle the cloudflare challenge.
The widget should be added as a parent of any area of ui code where you intend on using a cloudflare protected api / website.
Ensure you use the same dio and cookie jar instance for the handler and the api / website.```dart
CloudflareChallengeHandler(
dio: dio,
cookieJar: cookieJar,
child: Scaffold(
appBar: AppBar(
title: Text('Cloudflare Challenge Handler Example'),
),
body: Center(
child: ElevatedButton(
onPressed: () async {
final response = await dio.get('https://example.com');
print(response.data);
},
child: Text('Get Data'),
),
),
),
)
```