Skip to content

Commit

Permalink
feat: add new source copymanga (#434)
Browse files Browse the repository at this point in the history
* init

* fix: update source name

* feat: add urls for deep link

* fix: update source icon

* feat: filter `題材`

* feat: filter `地區`

* feat: filter `狀態`

* feat: sort

* feat: generate url for filters

* feat: generate url for search

* feat: get `MangaPageResult` of filters page

* feat: get `MangaPageResult` of search json

* feat: complete `get_manga_details`

* feat: complete `get_chapter_list`

* feat: complete `get_page_list`

* feat: complete `handle_url`

* refactor: remove unused code

* refactor: reformat code

* feat: add urls for deep link

* refactor: remove unused feature

* refactor: rename variable `plaintext_vec` to `plaintext`

* fix: indent with tabs
  • Loading branch information
aphronyx authored Sep 6, 2023
1 parent d450c22 commit ecc36a2
Show file tree
Hide file tree
Showing 11 changed files with 1,141 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rust/zh.copymanga/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
target = "wasm32-unknown-unknown"
212 changes: 212 additions & 0 deletions src/rust/zh.copymanga/Cargo.lock

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

23 changes: 23 additions & 0 deletions src/rust/zh.copymanga/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "copymanga"
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]
aes = "0.8.3"
aidoku = { git = "https://github.com/Aidoku/aidoku-rs", features = ["helpers"] }
cbc = "0.1.2"
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
uuid = { version = "1.4.1", default-features = false }
6 changes: 6 additions & 0 deletions src/rust/zh.copymanga/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/zh.copymanga/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.
101 changes: 101 additions & 0 deletions src/rust/zh.copymanga/res/filters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
[
{
"type": "title"
},
{
"type": "select",
"name": "題材",
"options": [
"全部",
"愛情",
"歡樂向",
"冒險",
"奇幻",
"百合",
"校園",
"科幻",
"東方",
"耽美",
"生活",
"格鬥",
"輕小說",
"懸疑",
"其他",
"神鬼",
"職場",
"TL",
"萌系",
"治癒",
"長條",
"四格",
"節操",
"艦娘",
"競技",
"搞笑",
"偽娘",
"熱血",
"勵志",
"性轉換",
"彩色",
"後宮",
"美食",
"偵探",
"AA",
"音樂舞蹈",
"魔幻",
"戰爭",
"歷史",
"異世界",
"驚悚",
"機戰",
"都市",
"穿越",
"恐怖",
"C100",
"重生",
"C99",
"C101",
"C97",
"C96",
"生存",
"宅系",
"武俠",
"C98",
"C95",
"FATE",
"轉生",
"無修正",
"仙俠",
"LoveLive"
]
},
{
"type": "select",
"name": "地區",
"options": [
"全部",
"日漫",
"韓漫",
"美漫"
]
},
{
"type": "select",
"name": "狀態",
"options": [
"全部",
"連載中",
"已完結",
"短篇"
]
},
{
"type": "sort",
"name": "排序",
"canAscend": true,
"options": [
"更新時間",
"熱門"
]
}
]
18 changes: 18 additions & 0 deletions src/rust/zh.copymanga/res/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"info": {
"id": "zh.copymanga",
"lang": "zh",
"name": "拷貝漫畫",
"version": 1,
"url": "https://copymanga.site",
"urls": [
"https://copymanga.site",
"https://www.copymanga.site",
"https://copymanga.tv",
"https://www.copymanga.tv",
"https://mangacopy.com",
"https://www.mangacopy.com"
],
"nsfw": 1
}
}
27 changes: 27 additions & 0 deletions src/rust/zh.copymanga/src/decryptor.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use aes::{
cipher::{block_padding::Pkcs7, BlockDecryptMut, KeyIvInit},
Aes128,
};
use aidoku::std::String;

type Aes128CbcDec = cbc::Decryptor<Aes128>;

const KEY: &[u8] = b"xxxmanga.woo.key";

pub trait EncryptedString {
fn decrypt(self) -> String;
}

impl EncryptedString for String {
fn decrypt(self) -> String {
let encrypted_data = self.as_bytes();
let iv = &encrypted_data[..16];
let mut ciphertext =
hex::decode(&encrypted_data[16..]).expect("Failed to hex-decode ciphertext.");

let plaintext = Aes128CbcDec::new(KEY.into(), iv.into())
.decrypt_padded_mut::<Pkcs7>(&mut ciphertext)
.expect("Failed to decrypt chapter list");
String::from_utf8_lossy(plaintext).into()
}
}
Loading

0 comments on commit ecc36a2

Please sign in to comment.