Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
495cd20
novel-updates: automatic list update
Batorian Jul 15, 2024
bf3bce2
novel-updates: only mark read when chapter available
Batorian Jul 15, 2024
3edf70d
progress-tracking: initial commit
Batorian Jul 19, 2024
9932c12
progress-tracking: introduce trackProgress
Batorian Jul 19, 2024
54f3427
progress-tracking: fix?
Batorian Jul 19, 2024
507eb4b
progress-tracking: test
Batorian Jul 19, 2024
90965ef
progress-tracking: test
Batorian Jul 19, 2024
3046407
progress-tracking: test
Batorian Jul 19, 2024
3a7e1c6
progress-tracking: scribble hub update
Batorian Jul 19, 2024
9b7aee8
progress-tracking: fix regex
Batorian Jul 19, 2024
0cefbf1
progress-tracking: revert version
Batorian Jul 19, 2024
da79bf0
Merge branch 'LNReader:master' into progress-tracking
Batorian Jul 19, 2024
2c4ae70
Merge branch 'refs/heads/master' into progress-tracking
Batorian Jul 21, 2024
350509e
progress-tracking: remove lint
Batorian Jul 21, 2024
ca6c8e4
Merge branch 'LNReader:master' into progress-tracking
Batorian Jul 22, 2024
d19910c
Merge branch 'LNReader:master' into progress-tracking
Batorian Jul 24, 2024
d52eadc
Merge branch 'LNReader:master' into progress-tracking
Batorian Jul 25, 2024
a3cd14c
Merge branch 'refs/heads/master' into progress-tracking
Batorian Jul 28, 2024
eeaa427
Merge branch 'refs/heads/master' into progress-tracking
Batorian Aug 6, 2024
b33d214
Merge branch 'LNReader:master' into progress-tracking
Batorian Aug 7, 2024
0cba766
Merge branch 'LNReader:master' into progress-tracking
Batorian Aug 12, 2024
5a5d905
Merge branch 'LNReader:master' into progress-tracking
Batorian Aug 14, 2024
50f820c
Merge branch 'LNReader:master' into progress-tracking
Batorian Aug 14, 2024
b7b430d
Merge branch 'LNReader:master' into progress-tracking
Batorian Aug 17, 2024
eac74b7
Merge branch 'LNReader:master' into progress-tracking
Batorian Aug 23, 2024
3e4b3a1
Merge branch 'refs/heads/master' into progress-tracking
Batorian Aug 27, 2024
9f5a7f5
Merge branch 'LNReader:master' into progress-tracking
Batorian Aug 29, 2024
01d6124
Merge branch 'master' into progress-tracking
Batorian Sep 12, 2024
ba0640f
Merge branch 'master' into progress-tracking
Batorian Nov 28, 2024
e230595
Merge branch 'LNReader:master' into progress-tracking
Batorian Nov 29, 2024
bdd5066
Merge branch 'LNReader:master' into progress-tracking
Batorian Dec 1, 2024
2498a67
Merge branch 'master' into progress-tracking
Batorian Mar 7, 2025
c0c682b
progress-tracking: update
Batorian Mar 7, 2025
288acd8
progress-tracking: update
Batorian Mar 7, 2025
9582006
Merge branch 'LNReader:master' into progress-tracking
Batorian Mar 12, 2025
392aede
Merge branch 'master' into progress-tracking
Batorian Mar 17, 2025
50a08f7
chapter-sync: update
Batorian Mar 17, 2025
f982769
chapter-sync: update test version
Batorian Mar 17, 2025
1c12a1b
chapter-sync: update
Batorian Mar 17, 2025
1c67c88
chapter-sync: update
Batorian Mar 19, 2025
a219c74
Merge branch 'master' into chapter-sync
Batorian Mar 19, 2025
65ce8d7
Merge branch 'master' into chapter-sync
Batorian Mar 24, 2025
5a5000c
chapter-sync: update
Batorian Mar 24, 2025
b08ff6a
chapter-sync: update
Batorian Mar 24, 2025
c803979
chapter-sync: update
Batorian Mar 25, 2025
3eb9548
Merge branch 'LNReader:master' into chapter-sync
Batorian Mar 25, 2025
69ee5cb
Merge branch 'LNReader:master' into chapter-sync
Batorian May 19, 2025
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
41 changes: 40 additions & 1 deletion src/plugins/english/novelupdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ import { CheerioAPI, load as parseHTML } from 'cheerio';
import { fetchApi } from '@libs/fetch';
import { Filters, FilterTypes } from '@libs/filterInputs';
import { Plugin } from '@typings/plugin';
import { storage } from '@libs/storage';

class NovelUpdates implements Plugin.PluginBase {
id = 'novelupdates';
name = 'Novel Updates';
version = '0.9.0';
version = '0.10.0';
icon = 'src/en/novelupdates/icon.png';
customCSS = 'src/en/novelupdates/customCSS.css';
site = 'https://www.novelupdates.com/';

syncChapter = storage.get('syncChapter');

parseNovels(loadedCheerio: CheerioAPI) {
const novels: Plugin.NovelItem[] = [];
loadedCheerio('div.search_main_box_nu').each((_, el) => {
Expand Down Expand Up @@ -899,6 +902,34 @@ class NovelUpdates implements Plugin.PluginBase {
return chapterCheerio.html()!;
}

async handleChapterEvent(
novelPath: string,
chapter: Plugin.ChapterItem,
): Promise<boolean> {
try {
// Get HTML content
const result = await fetchApi(this.site + novelPath);
const body = await result.text();
const loadedCheerio = parseHTML(body);

// Extract IDs
const shortlink = loadedCheerio('link[rel="shortlink"]').attr('href');
const novelId = shortlink?.match(/\?p=(\d+)/)?.[1];
const chapterId = chapter.path.match(/\/(\d+)\//)?.[1];

// Validation
if (!novelId || !chapterId) return false;

// Chapter sync
const syncUrl = `${this.site}readinglist_update.php?rid=${chapterId}&sid=${novelId}&checked=yes`;
await fetchApi(syncUrl);

return true;
} catch (error) {
return false;
}
}

async searchNovels(
searchTerm: string,
page: number,
Expand Down Expand Up @@ -1054,6 +1085,14 @@ class NovelUpdates implements Plugin.PluginBase {
type: FilterTypes.CheckboxGroup,
},
} satisfies Filters;

pluginSettings = {
syncChapter: {
value: '',
label: 'Sync chapter progress with plugin site',
type: 'Switch',
},
};
}

export default new NovelUpdates();
43 changes: 42 additions & 1 deletion src/plugins/english/scribblehub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ import { fetchApi } from '@libs/fetch';
import { FilterTypes, Filters } from '@libs/filterInputs';
import { Plugin } from '@typings/plugin';
import dayjs from 'dayjs';
import { storage } from '@libs/storage';

class ScribbleHubPlugin implements Plugin.PluginBase {
id = 'scribblehub';
name = 'Scribble Hub';
icon = 'src/en/scribblehub/icon.png';
site = 'https://www.scribblehub.com/';
version = '1.0.2';
version = '1.1.0';

syncChapter = storage.get('syncChapter');

parseNovels(loadedCheerio: CheerioAPI) {
const novels: Plugin.NovelItem[] = [];
Expand Down Expand Up @@ -176,6 +179,36 @@ class ScribbleHubPlugin implements Plugin.PluginBase {
return chapterText;
}

async handleChapterEvent(
novelPath: string,
chapter: Plugin.ChapterItem,
): Promise<boolean> {
try {
// Extract IDs from paths
const novelId = novelPath.match(/series\/(\d+)\//)?.[1];
const chapterId = chapter.path.match(/chapter\/(\d+)\//)?.[1];

// Validation
if (!novelId || !chapterId) return false;

const formData = new FormData();
formData.append('action', 'wi_addchangerl');
formData.append('strCID', chapterId);
formData.append('strSID', novelId);

// Chapter sync
const syncUrl = `${this.site}wp-admin/admin-ajax.php`;
await fetchApi(syncUrl, {
method: 'POST',
body: formData,
});

return true;
} catch (error) {
return false;
}
}

async searchNovels(searchTerm: string): Promise<Plugin.NovelItem[]> {
const url = `${this.site}?s=${encodeURIComponent(searchTerm)}&post_type=fictionposts`;
const result = await fetchApi(url);
Expand Down Expand Up @@ -298,6 +331,14 @@ class ScribbleHubPlugin implements Plugin.PluginBase {
type: FilterTypes.ExcludableCheckboxGroup,
},
} satisfies Filters;

pluginSettings = {
syncChapter: {
value: '',
label: 'Sync chapter progress with plugin site',
type: 'Switch',
},
};
}

export default new ScribbleHubPlugin();
8 changes: 7 additions & 1 deletion src/types/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ export namespace Plugin {
imageRequestInit?: ImageRequestInit;
filters?: Filters;
version: string;
//flag indicates whether access to LocalStorage, SesesionStorage is required.
// Flag indicates whether access to LocalStorage, SesesionStorage is required.
webStorageUtilized?: boolean;
// Flag indicates whether chapter status is synced.
syncChapter?: boolean;
popularNovels(
pageNo: number,
options: PopularNovelsOptions<Filters>,
Expand All @@ -87,6 +89,10 @@ export namespace Plugin {
*/
parseNovel(novelPath: string): Promise<SourceNovel>;
parseChapter(chapterPath: string): Promise<string>;
handleChapterEvent?(
novelPath: string,
chapter: ChapterItem,
): Promise<boolean>;
searchNovels(searchTerm: string, pageNo: number): Promise<NovelItem[]>;
resolveUrl?(path: string, isNovel?: boolean): string;
};
Expand Down