Start adding documation and add host.ps1 for windows users (#725)
* Add docs v0.0.1 * Add icon size warning * Fix sourcenover caution * Fix semver descriptions * Filters fix * Quickfix quickstart * Add icon warning v2 * Fix typos * Add NovelItem * Update plugins host * Update plugins host * Remove unnecesarry .js and .dist * Update plugins host * Add host.ps1 * Fix readme.txt * Fix READNE.txt, again * Remove .js and .dist * readme update with ost * Add linux/windows hosting functions * Fix workflows
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
import { fetchFile } from "@libs/fetch";
|
||||
import { Plugin } from "@typings/plugin";
|
||||
import { Filters } from "@libs/filterInputs";
|
||||
import { load as loadCheerio } from "cheerio";
|
||||
import { defaultCover } from "@libs/defaultCover";
|
||||
import { NovelStatus } from "@libs/novelStatus";
|
||||
// import { isUrlAbsolute } from "@libs/isAbsoluteUrl";
|
||||
// import { parseMadaraDate } from "@libs/parseMadaraDate";
|
||||
|
||||
class TemplatePlugin implements Plugin.PluginBase {
|
||||
id = "";
|
||||
name = "";
|
||||
icon = "";
|
||||
site = "";
|
||||
version = "1.0.0";
|
||||
filters: Filters | undefined = undefined;
|
||||
|
||||
async popularNovels(
|
||||
pageNo: number,
|
||||
{
|
||||
showLatestNovels,
|
||||
filters,
|
||||
}: Plugin.PopularNovelsOptions<typeof this.filters>
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
|
||||
/** Add your fetching code here */
|
||||
novels.push({
|
||||
name: "Novel1",
|
||||
url: "example.com/novel1",
|
||||
cover: defaultCover,
|
||||
});
|
||||
return novels;
|
||||
}
|
||||
async parseNovelAndChapters(novelUrl: string): Promise<Plugin.SourceNovel> {
|
||||
const novel: Plugin.SourceNovel = {
|
||||
url: novelUrl,
|
||||
};
|
||||
|
||||
// TODO: get here data from the site and
|
||||
// un-comment and fill-in the relevant fields
|
||||
|
||||
// novel.name = "";
|
||||
// novel.artist = "";
|
||||
// novel.author = "";
|
||||
novel.cover = defaultCover;
|
||||
// novel.genres = "";
|
||||
// novel.status = NovelStatus.Completed;
|
||||
// novel.summary = "";
|
||||
|
||||
let chapters: Plugin.ChapterItem[] = [];
|
||||
|
||||
// TODO: here parse the chapter list
|
||||
|
||||
// TODO: add each chapter to the list using
|
||||
const chapter: Plugin.ChapterItem = {
|
||||
name: "",
|
||||
url: "",
|
||||
releaseTime: "",
|
||||
chapterNumber: 0,
|
||||
};
|
||||
chapters.push(chapter);
|
||||
|
||||
novel.chapters = chapters;
|
||||
return novel;
|
||||
}
|
||||
async parseChapter(chapterUrl: string): Promise<string> {
|
||||
// parse chapter text here
|
||||
const chapterText = "";
|
||||
return chapterText;
|
||||
}
|
||||
async searchNovels(
|
||||
searchTerm: string,
|
||||
pageNo: number
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
let novels: Plugin.NovelItem[] = [];
|
||||
|
||||
// get novels using the search term
|
||||
|
||||
return novels;
|
||||
}
|
||||
async fetchImage(url: string): Promise<string | undefined> {
|
||||
// if your plugin has images and they won't load
|
||||
// this is the function to fiddle with
|
||||
return fetchFile(url);
|
||||
}
|
||||
}
|
||||
|
||||
export default new TemplatePlugin();
|
||||
Reference in New Issue
Block a user