[ehentai] add onLoadFailed;

update template
This commit is contained in:
2024-11-11 17:40:52 +08:00
parent 3c76970317
commit 6000e00228
4 changed files with 47 additions and 66 deletions

View File

@@ -560,74 +560,20 @@ class NewComicSource extends ComicSource {
* @param url
* @param comicId
* @param epId
* @returns {{} | Promise<{}>}
* @returns {ImageLoadingConfig | Promise<ImageLoadingConfig>}
*/
onImageLoad: (url, comicId, epId) => {
/*
```
return {
url: `${url}?id=comicId`,
// http method
method: 'GET',
// any
data: null,
headers: {
'user-agent': 'pica_comic/v3.1.0',
},
// * modify response data
// * @param data {ArrayBuffer}
// * @returns {ArrayBuffer}
onResponse: (data) => {
return data
},
// {string | null} a js script. The script will be executed in a new Isolate.
// The script should contain a function named `modifyImage`, which receives an [Image] as the only argument, and returns an [Image].
// Only [Image] api is available in the script.
// Do not use this field if it is not necessary.
modifyImage: `
function modifyImage(buffer) {
}
`,
}
```
*/
return {}
},
/**
* [Optional] provide configs for a thumbnail loading
* @param url {string}
* @returns {{}}
* @returns {ImageLoadingConfig | Promise<ImageLoadingConfig>}
*
* `ImageLoadingConfig.modifyImage` and `ImageLoadingConfig.onLoadFailed` will be ignored.
* They are not supported for thumbnails.
*/
onThumbnailLoad: (url) => {
/*
```
return {
url: `${url}?id=comicId`,
// http method
method: 'GET',
// {any}
data: null,
headers: {
'user-agent': 'pica_comic/v3.1.0',
},
// modify response data
onResponse: (data) => {
return data
},
// {string | null} a js script. The script will be executed in a new Isolate.
// The script should contain a function named `modifyImage`, which receives an [Image] as the only argument, and returns an [Image].
// Only [Image] api is available in the script.
// Do not use this field if it is not necessary.
modifyImage: `
function modifyImage(image) {
}
`,
}
```
*/
return {}
},
/**