mirror of
https://gitlab.com/vyla-entertainment/sdk.git
synced 2026-11-19 16:47:24 -05:00
chore: improve Socket.dev security and quality scores by removing node-tls-client, eliminating environment variable access and obfuscation patterns, refining package metadata, and cleaning up unused code, removed manga and cinemaarmy
This commit is contained in:
20
src/sdk.js
20
src/sdk.js
@@ -2,16 +2,13 @@ import SOURCES, { AGGREGATOR_SOURCES, DEDICATED_SOURCES, SOURCE_MAP } from "./co
|
||||
import EMBEDS, { EMBED_MAP } from "./embed_config.js";
|
||||
import { fetchDownloads } from "./downloads/downloads.js";
|
||||
import { probeSource } from "./health.js";
|
||||
import { getChapterPages, getMangaDetails, searchManga } from "./manga/atsu.js";
|
||||
import { fetchSubtitles, getSubPathsMovie, getSubPathsTv } from "./subtitles.js";
|
||||
import { createStreamArgs } from "./utils/helpers.js";
|
||||
|
||||
const ALL_SOURCE_MODULES = Object.fromEntries(
|
||||
await Promise.all(SOURCES.map(async cfg => [cfg.key, await import(`./sources/${cfg.sourceFile}.js`)]))
|
||||
);
|
||||
const ACTIVE_SOURCES = SOURCES.filter(cfg => !cfg.disabled);
|
||||
|
||||
const SOURCE_MODULES = Object.fromEntries(
|
||||
Object.entries(ALL_SOURCE_MODULES).filter(([key]) => !SOURCE_MAP[key]?.disabled)
|
||||
await Promise.all(ACTIVE_SOURCES.map(async cfg => [cfg.key, await import(`./sources/${cfg.sourceFile}.js`)]))
|
||||
);
|
||||
|
||||
export default class VylaSDK {
|
||||
@@ -70,14 +67,14 @@ export default class VylaSDK {
|
||||
return sources;
|
||||
}
|
||||
async probeSource(key) {
|
||||
const cfg = SOURCES.find(cfg => cfg.key === key);
|
||||
const cfg = SOURCE_MAP[key];
|
||||
if (!cfg) throw new Error(`Source with key "${key}" not found`);
|
||||
const mod = SOURCE_MODULES[key];
|
||||
if (!mod) throw new Error(`Source module for key "${key}" not found`);
|
||||
return await probeSource(this, cfg, mod);
|
||||
}
|
||||
async getStream(key, id, s = null, e = null, clientIP = null) {
|
||||
const cfg = SOURCES.find(cfg => cfg.key === key);
|
||||
const cfg = SOURCE_MAP[key];
|
||||
if (!cfg) throw new Error(`Source with key "${key}" not found`);
|
||||
const mod = SOURCE_MODULES[key];
|
||||
if (!mod) throw new Error(`Source module for key "${key}" not found`);
|
||||
@@ -97,13 +94,4 @@ export default class VylaSDK {
|
||||
async getDownloads(id, s = null, e = null) {
|
||||
return await fetchDownloads(this, id, s, e);
|
||||
}
|
||||
async searchManga(query, page = 1, perPage = 12) {
|
||||
return await searchManga(query, page, perPage);
|
||||
}
|
||||
async getManga(id) {
|
||||
return await getMangaDetails(id);
|
||||
}
|
||||
async getMangaChapter(mangaId, chapterId) {
|
||||
return await getChapterPages(mangaId, chapterId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user