Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add New Source: MangaIro #447

Merged
merged 84 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
75634c4
Add template for mangairo
getBoolean Sep 4, 2023
523157f
Create Cargo.lock
getBoolean Sep 4, 2023
7166d91
Update lib.rs
getBoolean Sep 4, 2023
95d438a
Update mangairo source info
getBoolean Sep 4, 2023
f754252
Update function argument names
getBoolean Sep 4, 2023
fbc9db4
Add boilerplate parser for mangaairo
getBoolean Sep 4, 2023
7937af8
Fix imports for mangairo
getBoolean Sep 4, 2023
71a1d06
Implement mangairo filters
getBoolean Sep 4, 2023
f4114d1
Update parser.rs
getBoolean Sep 4, 2023
cc105ed
Handle deep links
getBoolean Sep 4, 2023
fd2480a
Update build.sh
getBoolean Sep 4, 2023
f0ef730
Handle url without regex
getBoolean Sep 4, 2023
84ea32b
Return err instead of panic
getBoolean Sep 4, 2023
53cc3dd
mangairo url parser not dependent on base domain
getBoolean Sep 4, 2023
070eb1d
Implement mangairo parse_search
getBoolean Sep 4, 2023
d151420
Implement mangairo get_manga_list
getBoolean Sep 4, 2023
869b0bd
Implement mangairo get_manga_listing
getBoolean Sep 4, 2023
f070ab4
Use const page size variable
getBoolean Sep 4, 2023
c40348e
Update parser.rs
getBoolean Sep 4, 2023
49faea5
Fix warnings
getBoolean Sep 4, 2023
18943c9
Update Icon.png
getBoolean Sep 4, 2023
7c976aa
Scale logo to 128x128
getBoolean Sep 4, 2023
f56e9ba
Add background to logo
getBoolean Sep 4, 2023
911d7a4
Remove unused type
getBoolean Sep 4, 2023
4f0ffbe
Fix mangairo listings
getBoolean Sep 4, 2023
49e54ff
Fix lint
getBoolean Sep 4, 2023
fd45ec8
Fix lints
getBoolean Sep 4, 2023
5eb6aae
Fix unneeded return lint
getBoolean Sep 4, 2023
bb066e5
Fix All listing and search
getBoolean Sep 4, 2023
851276e
Update parser.rs
getBoolean Sep 4, 2023
b1d128c
Update lib.rs
getBoolean Sep 4, 2023
efe5773
Fix lint
getBoolean Sep 4, 2023
b056df1
Update parser.rs
getBoolean Sep 5, 2023
4f8be8a
Remove redundant "latest" listing
getBoolean Sep 5, 2023
4b4ebd9
Parse some manga details
getBoolean Sep 5, 2023
7c06b65
Fix manga description not always working
getBoolean Sep 5, 2023
36197f4
Implement mangairo get_chapter_list
getBoolean Sep 5, 2023
1c7b308
Implement get_page_list and fix ids
getBoolean Sep 5, 2023
b60f934
Remove logs
getBoolean Sep 5, 2023
3e5ad20
Finish parsing mangairo manga details
getBoolean Sep 5, 2023
906b3f8
Mark sm*t as suggestive
getBoolean Sep 5, 2023
c92cf47
Fix nsfw and viewer categories
getBoolean Sep 5, 2023
2703318
Fix home url for mangairo
getBoolean Sep 5, 2023
6d8b05a
Delete settings.json
getBoolean Sep 5, 2023
86cbcb2
Create settings.json
getBoolean Sep 5, 2023
b9bb0a5
Fix settings file format
getBoolean Sep 5, 2023
4e1942f
Fix mangairo settings (2)
getBoolean Sep 5, 2023
81afdda
Add category to nsfw
getBoolean Sep 5, 2023
f2fa915
Remove debug print
getBoolean Sep 5, 2023
cc01292
Fix mangairo pagination
getBoolean Sep 5, 2023
1960a25
Fix manga details manga url
getBoolean Sep 5, 2023
be2e1b1
Fix url encoding for mangairo
getBoolean Sep 6, 2023
e2a6c04
MangaIro manga details now includes author
getBoolean Sep 6, 2023
1d2bc7e
Use `alloc::ToString` for converting int to str
getBoolean Sep 8, 2023
67d0407
Use `BASE_URL` in `parser::get_filtered_url`
getBoolean Sep 8, 2023
b1e4264
Rename variable `img` to `cover`
getBoolean Sep 8, 2023
e3876d6
Use scaled down icon instead of stretched icon
getBoolean Sep 8, 2023
af4783f
Add newlines to end of json
getBoolean Sep 8, 2023
965ad19
Fix clippy lints
getBoolean Sep 8, 2023
2aa120f
Return URL from `parser::get_filtered_url`
getBoolean Sep 8, 2023
d8f93d2
Simplify has_more calculation
getBoolean Sep 8, 2023
5111bdd
Use tuple for `parser::get_manga_list`
getBoolean Sep 8, 2023
59a9dd8
Rename `result` to `manga` and fix lint
getBoolean Sep 8, 2023
dea8756
Return `has_more` instead of total result size
getBoolean Sep 8, 2023
4474d9a
Use `QueryParameters` for `page` URL parameter
getBoolean Sep 8, 2023
b6098f6
Refactor `parser::get_filtered_url` to use match
getBoolean Sep 8, 2023
71d1ad7
Rename `chap_num` to `chapter`
getBoolean Sep 8, 2023
da4db1f
Don't rename when unwrapping
getBoolean Sep 8, 2023
5756bfa
Extract lang to variable
getBoolean Sep 8, 2023
77fbf8a
Default chapter number to -1
getBoolean Sep 8, 2023
9a6a401
Run `cargo fmt`
getBoolean Sep 8, 2023
801a2fa
Add "Latest" Listing
getBoolean Sep 8, 2023
2f37a5d
Fix info source link for mangairo
getBoolean Sep 17, 2023
786e87d
Unwrap parsed_manga_id with if let
getBoolean Sep 17, 2023
05a6581
total_str no longer mut
getBoolean Sep 17, 2023
5a80bb5
Use suggested change for chapter number parsing
getBoolean Sep 17, 2023
1f93bb9
Calculate author and categories with map
getBoolean Sep 17, 2023
706a6cc
Resolve lint for calculating chapter
getBoolean Sep 17, 2023
2a68712
Use simpler replace_consecutive_underscores
getBoolean Sep 17, 2023
092b8e0
Delete settings.json
getBoolean Sep 24, 2023
03718ee
Use & instead of clone
getBoolean Sep 24, 2023
1df96e6
Add chap url variant for deeplinks
getBoolean Sep 24, 2023
94fbfc8
Assign URL var instead of using manga_id directly
getBoolean Sep 24, 2023
aded53e
Add comment to commented out code
getBoolean Sep 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/rust/en.mangairo/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
target = "wasm32-unknown-unknown"
100 changes: 100 additions & 0 deletions src/rust/en.mangairo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions src/rust/en.mangairo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "mangairo"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib"]

[profile.dev]
panic = "abort"

[profile.release]
panic = "abort"
opt-level = "s"
strip = true
lto = true

[dependencies]
aidoku = { git = "https://github.com/Aidoku/aidoku-rs", features = ["helpers"] }
27 changes: 27 additions & 0 deletions src/rust/en.mangairo/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function Package-Source {
param (
[Parameter(Mandatory = $true, Position = 0)]
[String[]]$Name,

[switch]$Build
)
$Name | ForEach-Object {
$source = $_
if ($Build) {
Write-Output "building $source"
cargo +nightly build --release
}

Write-Output "packaging $source"
New-Item -ItemType Directory -Path target/wasm32-unknown-unknown/release/Payload -Force | Out-Null
Copy-Item res/* target/wasm32-unknown-unknown/release/Payload -ErrorAction SilentlyContinue
Copy-Item sources/$source/res/* target/wasm32-unknown-unknown/release/Payload -ErrorAction SilentlyContinue
Set-Location target/wasm32-unknown-unknown/release
Copy-Item "$source.wasm" Payload/main.wasm
Compress-Archive -Force -DestinationPath "../../../$source.aix" -Path Payload
Remove-Item -Recurse -Force Payload/
Set-Location ../../..
}
}

Package-Source mangairo -Build
6 changes: 6 additions & 0 deletions src/rust/en.mangairo/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cargo +nightly build --release
mkdir -p target/wasm32-unknown-unknown/release/Payload
cp res/* target/wasm32-unknown-unknown/release/Payload
cp target/wasm32-unknown-unknown/release/*.wasm target/wasm32-unknown-unknown/release/Payload/main.wasm
cd target/wasm32-unknown-unknown/release ; zip -r package.aix Payload
mv package.aix ../../../package.aix
Binary file added src/rust/en.mangairo/res/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions src/rust/en.mangairo/res/filters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
[
{
"type": "title"
},
{
"type": "author"
},
{
"type": "select",
"name": "Sort",
"options": [
"Latest",
"Newest",
"Hot"
]
},
{
"type": "select",
"name": "Status",
"options": [
"All",
"Ongoing",
"Completed"
]
},
{
"type": "select",
"name": "Genre",
"options": [
"All",
"Action",
"Adult",
"Adventure",
"Comedy",
"Cooking",
"Doujinshi",
"Drama",
"Ecchi",
"Erotica",
"Fantasy",
"Gender bender",
"Harem",
"Historical",
"Horror",
"Isekai",
"Josei",
"Manhua",
"Manhwa",
"Martial arts",
"Mature",
"Mecha",
"Medical",
"Mystery",
"One shot",
"Pornographic",
"Phychological",
"Romance",
"School life",
"Sci fi",
"Seinen",
"Shoujo",
"Shoujo ai",
"Shounen",
"Shounen ai",
"Slice of Life",
"Smut",
"Sports",
"Supernatural",
"Tragedy",
"Webtoons",
"Yaoi",
"Yuri"
]
}
]
28 changes: 28 additions & 0 deletions src/rust/en.mangairo/res/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"info": {
"id": "en.mangairo",
"lang": "en",
"name": "MangaIro",
"version": 1,
"urls": [
"https://w.mangairo.com",
"https://chap.mangairo.com"
],
"nsfw": 1
},
"languages": [],
"listings": [
{
"name": "Latest"
},
{
"name": "New Releases"
},
{
"name": "Hot"
},
{
"name": "Completed"
}
]
}
93 changes: 93 additions & 0 deletions src/rust/en.mangairo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#![no_std]
use aidoku::{
error::Result,
prelude::*,
std::{
net::{HttpMethod, Request},
String, Vec,
},
Chapter, DeepLink, Filter, Listing, Manga, MangaPageResult, Page,
};

mod parser;
use parser::{BASE_URL, USER_AGENT};

#[get_manga_list]
fn get_manga_list(filters: Vec<Filter>, page: i32) -> Result<MangaPageResult> {
let url = parser::get_filtered_url(filters, page);
// aidoku::prelude::println!("get_manga_list: {}", url);
let html = Request::new(url.as_str(), HttpMethod::Get).html()?;

let (manga, has_more) = parser::parse_manga_list(html, page);
Ok(MangaPageResult { manga, has_more })
}

#[get_manga_details]
fn get_manga_details(manga_id: String) -> Result<Manga> {
let url = format!("{}", &manga_id);
let html = Request::new(url, HttpMethod::Get).html()?;
parser::parse_manga_details(html, manga_id)
}

#[get_manga_listing]
fn get_manga_listing(listing: Listing, page: i32) -> Result<MangaPageResult> {
let url = match listing.name.as_str() {
"Latest" => format!("{BASE_URL}/manga-list/type-latest/ctg-all/state-all/page-{page}"),
"New Releases" => format!("{BASE_URL}/manga-list/type-newest/ctg-7/state-all/page-{page}"),
"Hot" => format!("{BASE_URL}/manga-list/type-topview/ctg-all/state-all/page-{page}"),
"Completed" => {
format!("{BASE_URL}/manga-list/type-latest/ctg-all/state-completed/page-{page}")
}
_ => format!("{BASE_URL}/manga-list/type-latest/ctg-all/state-all/page-{page}"),
};
// aidoku::prelude::println!("get_manga_listing: {}", url);
let html = Request::new(url.as_str(), HttpMethod::Get).html()?;
let (manga, has_more) = parser::parse_manga_list(html, page);

Ok(MangaPageResult { manga, has_more })
}

#[get_chapter_list]
fn get_chapter_list(manga_id: String) -> Result<Vec<Chapter>> {
let url = format!("{}", &manga_id);
// aidoku::prelude::println!("get_chapter_list: {}", url);
let html = Request::new(url, HttpMethod::Get).html()?;
parser::get_chapter_list(html)
}

#[get_page_list]
fn get_page_list(manga_id: String, chapter_id: String) -> Result<Vec<Page>> {
let url = format!("{}/{}", &manga_id, &chapter_id);
// aidoku::prelude::println!("get_page_list: {}", url);
let html = Request::new(url.as_str(), HttpMethod::Get).html()?;
parser::get_page_list(html)
}

#[modify_image_request]
fn modify_image_request(request: Request) {
request
.header("Referer", BASE_URL)
.header("User-Agent", USER_AGENT);
}

#[handle_url]
fn handle_url(url: String) -> Result<DeepLink> {
let parsed_manga_id = parser::parse_incoming_url_manga_id(&url);
let parsed_chapter_id = parser::parse_incoming_url_chapter_id(&url);
// aidoku::prelude::println!("handle_url manga id: {:?}", parsed_manga_id);
// aidoku::prelude::println!("handle_url chapter id: {:?}", parsed_chapter_id);

if let Some(parsed_manga_id) = parsed_manga_id {
Ok(DeepLink {
manga: Some(get_manga_details(parsed_manga_id)?),
chapter: parsed_chapter_id.map(|chapter_id_value| Chapter {
id: chapter_id_value,
..Default::default()
}),
})
} else {
Err(aidoku::error::AidokuError {
reason: aidoku::error::AidokuErrorKind::Unimplemented,
})
}
}
Loading
Loading