Skip to content

Commit

Permalink
- Obscured links
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanYuuki committed Oct 8, 2024
1 parent dc302e0 commit e34a44b
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 43 deletions.
39 changes: 19 additions & 20 deletions lib/database/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

import 'dart:convert';
import 'dart:developer';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:hive/hive.dart';
import 'package:http/http.dart' as http;

const String proxy_url = "https://goodproxy.goodproxy.workers.dev/fetch?url=";
// const String proxy_url = "https://anymey-proxy.vercel.app/cors?url=";
const String consumet_api_url =
"https://consumet-api-two-nu.vercel.app/meta/anilist/";
const String aniwatch_api_url = "https://aniwatch-ryan.vercel.app/anime/";
String proxyUrl = "https://goodproxy.goodproxy.workers.dev/fetch?url=";
String consumetUrl = "${dotenv.get('CONSUMET_URL')}meta/anilist/";
String aniwatchUrl = "${dotenv.get('ANIME_URL')}anime/";
bool isRomaji = Hive.box('app-data').get('isRomaji', defaultValue: false);
void toggleRomaji(String source, bool state) {}

Future<dynamic>? fetchHomePageAniwatch() async {
final response =
await http.get(Uri.parse('$proxy_url${aniwatch_api_url}home'));
await http.get(Uri.parse('$proxyUrl${aniwatchUrl}home'));
if (response.statusCode == 200) {
return jsonDecode(response.body);
} else {
Expand All @@ -29,21 +28,21 @@ Future<dynamic>? fetchHomePageConsumet() async {

try {
final spotlightAnimesResponse = await http.get(Uri.parse(
'${proxy_url}https://consumet-api-two-nu.vercel.app/meta/anilist/trending'));
'$proxyUrl${dotenv.get('CONSUMET_URL')}meta/anilist/trending'));
final trendingAnimesResponse = await http.get(Uri.parse(
'${proxy_url}https://consumet-api-two-nu.vercel.app/meta/anilist/trending?page=2'));
'$proxyUrl${dotenv.get('CONSUMET_URL')}meta/anilist/trending?page=2'));
final latestEpisodesResponse = await http.get(Uri.parse(
'${proxy_url}https://consumet-api-two-nu.vercel.app/meta/anilist/advanced-search?sort=["EPISODES"]'));
'$proxyUrl${dotenv.get('CONSUMET_URL')}meta/anilist/advanced-search?sort=["EPISODES"]'));
final topUpcomingAnimesResponse = await http.get(Uri.parse(
'${proxy_url}https://consumet-api-two-nu.vercel.app/meta/anilist/advanced-search?status=NOT_YET_RELEASED'));
'$proxyUrl${dotenv.get('CONSUMET_URL')}meta/anilist/advanced-search?status=NOT_YET_RELEASED'));
final topAiringAnimesResponse = await http.get(Uri.parse(
'${proxy_url}https://consumet-api-two-nu.vercel.app/meta/anilist/trending?page=3'));
'$proxyUrl${dotenv.get('CONSUMET_URL')}meta/anilist/trending?page=3'));
final mostPopularAnimesResponse = await http.get(Uri.parse(
'${proxy_url}https://consumet-api-two-nu.vercel.app/meta/anilist/popular'));
'$proxyUrl${dotenv.get('CONSUMET_URL')}meta/anilist/popular'));
final mostFavouriteAnimesResponse = await http.get(Uri.parse(
'${proxy_url}https://consumet-api-two-nu.vercel.app/meta/anilist/popular?page=2'));
'$proxyUrl${dotenv.get('CONSUMET_URL')}meta/anilist/popular?page=2'));
final latestCompletedAnimesResponse = await http.get(Uri.parse(
'${proxy_url}https://consumet-api-two-nu.vercel.app/meta/anilist/advanced-search?year=2024&status=FINISHED'));
'$proxyUrl${dotenv.get('CONSUMET_URL')}meta/anilist/advanced-search?year=2024&status=FINISHED'));

if (spotlightAnimesResponse.statusCode == 200) {
data['spotlightAnimes'] =
Expand Down Expand Up @@ -99,7 +98,7 @@ Future<dynamic>? fetchHomePageConsumet() async {
Future<dynamic>? fetchAnimeDetailsConsumet(String id) async {
try {
final resp =
await http.get(Uri.parse('$proxy_url${consumet_api_url}info/$id'));
await http.get(Uri.parse('$proxyUrl${consumetUrl}info/$id'));

if (resp.statusCode == 200) {
final data = jsonDecode(resp.body);
Expand All @@ -116,7 +115,7 @@ Future<dynamic>? fetchAnimeDetailsConsumet(String id) async {
Future<dynamic> fetchAnimeDetailsAniwatch(String id) async {
try {
final resp =
await http.get(Uri.parse('$proxy_url${aniwatch_api_url}info?id=$id'));
await http.get(Uri.parse('$proxyUrl${aniwatchUrl}info?id=$id'));

if (resp.statusCode == 200) {
final data = jsonDecode(resp.body);
Expand All @@ -135,7 +134,7 @@ Future<dynamic>? fetchSearchesAniwatch(String id) async {}
Future<dynamic>? fetchSearchesConsumet(String id) async {}
Future<dynamic>? fetchStreamingDataConsumet(String id) async {
final resp =
await http.get(Uri.parse('$proxy_url${consumet_api_url}episodes/$id'));
await http.get(Uri.parse('$proxyUrl${consumetUrl}episodes/$id'));
if (resp.statusCode == 200) {
final tempData = jsonDecode(resp.body);
return tempData;
Expand All @@ -144,7 +143,7 @@ Future<dynamic>? fetchStreamingDataConsumet(String id) async {

Future<dynamic>? fetchStreamingDataAniwatch(String id) async {
final resp =
await http.get(Uri.parse('$proxy_url${aniwatch_api_url}episodes/$id'));
await http.get(Uri.parse('$proxyUrl${aniwatchUrl}episodes/$id'));
if (resp.statusCode == 200) {
final tempData = jsonDecode(resp.body);
return tempData;
Expand All @@ -155,7 +154,7 @@ Future<dynamic> fetchStreamingLinksAniwatch(
String id, String server, String category) async {
try {
final url =
'${aniwatch_api_url}episode-srcs?id=$id?server=$server&category=$category';
'${aniwatchUrl}episode-srcs?id=$id?server=$server&category=$category';
final resp = await http.get(Uri.parse(url));
if (resp.statusCode == 200) {
final tempData = jsonDecode(resp.body);
Expand All @@ -170,7 +169,7 @@ Future<dynamic> fetchStreamingLinksAniwatch(

Future<dynamic>? fetchStreamingLinksConsumet(String id) async {
final resp =
await http.get(Uri.parse('$proxy_url${consumet_api_url}watch/$id'));
await http.get(Uri.parse('$proxyUrl${consumetUrl}watch/$id'));
if (resp.statusCode == 200) {
final tempData = jsonDecode(resp.body);
return tempData;
Expand Down
27 changes: 25 additions & 2 deletions lib/pages/Anime/details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import 'package:aurora/database/scraper/scraper_details.dart';
import 'package:aurora/theme/theme_provider.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
<<<<<<< Updated upstream
=======
import 'package:flutter_dotenv/flutter_dotenv.dart';
>>>>>>> Stashed changes
import 'package:hive_flutter/hive_flutter.dart';
import 'package:iconly/iconly.dart';
import 'package:http/http.dart' as http;
Expand Down Expand Up @@ -83,7 +87,7 @@ class _DetailsPageState extends State<DetailsPage>
late Animation<double> _animation;

final String baseUrl =
'https://goodproxy.goodproxy.workers.dev/fetch?url=https://aniwatch-ryan.vercel.app/anime/info?id=';
'https://goodproxy.goodproxy.workers.dev/fetch?url=${dotenv.get('ANIME_URL')}anime/info?id=';

@override
void initState() {
Expand Down Expand Up @@ -179,6 +183,23 @@ class _DetailsPageState extends State<DetailsPage>
charactersdata = characterTemp['characters'] ?? [];
altdata = characterTemp;
});
<<<<<<< Updated upstream
=======

final newResponse = await http.get(Uri.parse(
'https://goodproxy.goodproxy.workers.dev/fetch?url=${dotenv.get('CONSUMET_URL')}meta/anilist/info/${data?['anilistId']}'));

if (newResponse.statusCode == 200) {
final characterTemp = jsonDecode(newResponse.body);
setState(() {
description = characterTemp?['description'] ?? data?['description'];
charactersdata = characterTemp['characters'] ?? [];
altdata = characterTemp;
});
} else {
log('Failed to fetch character data? from Consumet: ${newResponse.statusCode}');
}
>>>>>>> Stashed changes
} else {
log('Failed to fetch character data? from Consumet: ${newResponse.statusCode}');
}
Expand Down Expand Up @@ -483,7 +504,9 @@ class _DetailsPageState extends State<DetailsPage>
),
const SizedBox(height: 10),
Text(
altdata?['status'] ?? data?['status'] ?? 'RELEASING',
altdata?['status'] ??
data?['status'] ??
'RELEASING',
style: TextStyle(
fontFamily: 'Poppins-Bold',
color: Theme.of(context).colorScheme.primary,
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/Anime/search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:ui';
import 'package:aurora/components/IconWithLabel.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:http/http.dart' as http;
import 'package:iconly/iconly.dart';
import 'package:iconsax/iconsax.dart';
Expand Down Expand Up @@ -33,7 +34,7 @@ class _SearchPageState extends State<SearchPage> {
Future<void> fetchSearchedTerm() async {
_searchData = null;
final String url =
'https://aniwatch-ryan.vercel.app/anime/search?q=${controller.text}';
'${dotenv.get('ANIME_URL')}anime/search?q=${controller.text}';
final resp = await http.get(Uri.parse(url));
if (resp.statusCode == 200) {
final tempData = jsonDecode(resp.body);
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/Manga/details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:aurora/components/MangaExclusive/chapters.dart';
import 'package:aurora/database/database.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:iconly/iconly.dart';
import 'package:http/http.dart' as http;
import 'package:iconsax/iconsax.dart';
Expand Down Expand Up @@ -33,7 +34,7 @@ class _MangaDetailsPageState extends State<MangaDetailsPage> {
String? description;

final String baseUrl =
'https://anymey-proxy.vercel.app/cors?url=https://manga-ryan.vercel.app/api/manga/';
'${dotenv.get('PROXY_URL')}${dotenv.get('MANGA_URL')}api/manga/';

@override
void initState() {
Expand Down
8 changes: 6 additions & 2 deletions lib/pages/Manga/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import 'package:aurora/fallbackData/manga_data.dart';
import 'package:aurora/pages/onboarding_screens/avatar_page.dart';
import 'package:aurora/theme/theme_provider.dart';
import 'package:flutter/material.dart';
<<<<<<< Updated upstream
=======
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:hive_flutter/hive_flutter.dart';
>>>>>>> Stashed changes
import 'package:iconly/iconly.dart';
import 'package:iconsax/iconsax.dart';
import 'dart:convert';
Expand Down Expand Up @@ -45,8 +50,7 @@ class _MangaHomePageState extends State<MangaHomePage> {
}

Future<void> fetchData() async {
const String apiUrl =
'https://anymey-proxy.vercel.app/cors?url=https://manga-ryan.vercel.app/api/mangalist';
String apiUrl = '${dotenv.get('PROXY_URL')}${dotenv.get('MANGA_URL')}api/mangaList';

try {
final response1 = await http.get(Uri.parse(apiUrl));
Expand Down
7 changes: 3 additions & 4 deletions lib/pages/Manga/read_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:aurora/components/MangaExclusive/toggle_bars.dart';
import 'package:aurora/database/database.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:http/http.dart' as http;
import 'package:provider/provider.dart';

Expand Down Expand Up @@ -42,9 +43,9 @@ class _ReadingPageState extends State<ReadingPage> {
fetchChapterData();
}

String url = '${dotenv.get('PROXY_URL')}${dotenv.get('MANGA_URL')}api/manga/';

Future<void> fetchChapterData() async {
const String url =
'https://anymey-proxy.vercel.app/cors?url=https://manga-ryan.vercel.app/api/manga/';
try {
final resp = await http.get(Uri.parse(url + widget.id));
final provider = Provider.of<AppData>(context, listen: false);
Expand Down Expand Up @@ -83,8 +84,6 @@ class _ReadingPageState extends State<ReadingPage> {
setState(() {
isLoading = true;
});
const String url =
'https://anymey-proxy.vercel.app/cors?url=https://manga-ryan.vercel.app/api/manga/';
try {
final provider = Provider.of<AppData>(context, listen: false);
final resp = await http.get(
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/Manga/search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:ui';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:http/http.dart' as http;
import 'package:iconly/iconly.dart';
import 'package:iconsax/iconsax.dart';
Expand Down Expand Up @@ -32,7 +33,7 @@ class _MangaSearchPageState extends State<MangaSearchPage> {
Future<void> fetchSearchedTerm() async {
_searchData = null;
final String url =
'https://anymey-proxy.vercel.app/cors?url=https://manga-ryan.vercel.app/api/search/${controller.text}';
'https://anymey-proxy.vercel.app/cors?url=${dotenv.get('MANGA_URL')}api/search/${controller.text}';
final resp = await http.get(Uri.parse(url));
if (resp.statusCode == 200) {
final tempData = jsonDecode(resp.body);
Expand Down
24 changes: 12 additions & 12 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -796,18 +796,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.5"
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
Expand Down Expand Up @@ -844,18 +844,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.11.1"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.15.0"
version: "1.12.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -1217,10 +1217,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
version: "0.7.0"
text_scroll:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1377,10 +1377,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "14.2.5"
version: "14.2.1"
wakelock_plus:
dependency: "direct main"
description:
Expand Down

0 comments on commit e34a44b

Please sign in to comment.