Skip to content

Commit

Permalink
update.
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleStar-OuO committed May 26, 2024
0 parents commit f6d68c6
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# FeigeBlog Plugin

用于阅读[飞鸽博客](https://feigeblog.com/)漫画板块的 Rulia 插件.

## 说明

- 使用前需要在 Rulia 插件设置中手动添加一个HTTP标头,该标头的****`referer` ****`https://feigeblog.com/` .
![plugin.FeigeBlog](https://img2.imgtp.com/2024/05/27/yO49YjN5.png)
- 在使用过程中,在使用**搜索**时,筛选功能不生效.
Binary file added icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
216 changes: 216 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
let headers = {
appversion: '2.1.0'
}

async function setMangaListFilterOptions() {
try {
let result = [{
label: '分区',
name: 'filter_class_id',
options: [{
label: '同人',
value: 1
},
{
label: '原创',
value: 2
}
]
}]
window.Rulia.endWithResult(result);
} catch (error) {
window.Rulia.endWithResult([])
}
}

async function getMangaListByCategory(page, pageSize, filterOptions) {
const url = 'https://feigeblog.com/api/channel/searchUserChannel';
try {

const payload = {
filter_block: 2,
refresh_time: Date.now().toString(),
page: page.toString(),
filter_class_id: filterOptions.filter_class_id
}

const rawResponse = await window.Rulia.httpRequest({
url: url,
method: 'POST',
payload: JSON.stringify(payload),
contentType: 'application/json',
headers: headers
})

const response = JSON.parse(rawResponse);

var result = {
list: []
}
for (var manga of response.data.data) {
var comic = {
title: manga.name,
url: manga.id,
coverUrl: manga.cover
}
result.list.push(comic);
}
window.Rulia.endWithResult(result);
} catch (error) {
window.Rulia.endWithException(error.message);
}
}


async function getMangaListBySearching(page, pageSize, keyword) {
const url = 'https://feigeblog.com/api/channel/searchUserChannel';
try {

const payload = {
filter_block: 2,
keyword_type: 1,
keyword: keyword.toString(),
page: page.toString(),
refresh_time: Date.now().toString(),
}

const rawResponse = await window.Rulia.httpRequest({
url: url,
method: 'POST',
payload: JSON.stringify(payload),
contentType: 'application/json',
headers: headers
})

const response = JSON.parse(rawResponse);

var result = {
list: []
}
for (var manga of response.data.data) {
var comic = {
title: manga.name,
url: manga.id,
coverUrl: manga.cover
}
result.list.push(comic);
}
window.Rulia.endWithResult(result);
} catch (error) {
window.Rulia.endWithException(error.message);
}
}

async function getMangaList(page, pageSize, keyword, rawFilterOptions) {
if (keyword) {
return await getMangaListBySearching(page, pageSize, keyword);
} else {
return await getMangaListByCategory(page, pageSize, JSON.parse(rawFilterOptions));
}
}

async function getMangaData(dataPageUrl) {

const url = 'https://feigeblog.com/api/ajax/getAlbumDetailById';
const listUrl = 'https://feigeblog.com/api/ajax/getWorksListByAlbumId';

try {
const payload = {
id: dataPageUrl
}

const listPayload = {
id: dataPageUrl,
page: 1,
refreshTime: Date.now().toString(),
order_sort: 'asc'
}

const rawResponse = await window.Rulia.httpRequest({
url: url,
method: 'POST',
payload: JSON.stringify(payload),
contentType: 'application/json',
headers: headers
})

const listRawResponse = await window.Rulia.httpRequest({
url: listUrl,
method: 'POST',
payload: JSON.stringify(listPayload),
contentType: 'application/json',
headers: headers
})

const response = JSON.parse(rawResponse);

const listResponse = JSON.parse(listRawResponse);

let result = {
title: response.data.name,
description: response.data.desc,
coverUrl: response.data.cover,
chapterList: []
}

for (var manga of listResponse.data.data) {
let mangaTitle = manga.content;
let match = manga.content.match(/^(.*?)\n/);
if (match && match[1]) {
mangaTitle = match[1]
}
var comic = {
title: '[' + mangaTitle + '][' + manga.update_time + ']',
url: manga.id
}
result.chapterList.push(comic);
}

window.Rulia.endWithResult(result);
} catch (error) {
window.Rulia.endWithException(error.message);
}
}



async function getChapterImageList(chapterUrl) {
const url = 'https://feigeblog.com/api/ajax/worksDetail';

try {
const payload = {
id: chapterUrl
}

const rawResponse = await window.Rulia.httpRequest({
url: url,
method: 'POST',
payload: JSON.stringify(payload),
contentType: 'application/json',
headers: headers
})

const response = JSON.parse(rawResponse);

let result = [];
let list = response.data.image.split(',');

for (var i = 0; i < list.length; i++) {
result.push({
url: list[i],
index: i,
width: 1,
height: 1
});
}

window.Rulia.endWithResult(result);

} catch (error) {
window.Rulia.endWithException(error.message);
}
}

async function getImageUrl(path) {
window.Rulia.endWithResult(path);
}
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@rulia/FeigeBlog",
"title": "飞鸽博客",
"description": "您正在用RuliaReader阅读[飞鸽博客]的漫画板块捏.",
"version": "0.0.1",
"author": "LittleStar_OuO",
"tags": ["FeigeBlog", "manga", "comic"],
"homepage": "https://github.com/LittleStar-OuO/plugin.FeigeBlog"
}

0 comments on commit f6d68c6

Please sign in to comment.