mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-01-11 20:10:25 +00:00
chore: update dependencies and clean up PluginManager by removing unused properties and methods
This commit is contained in:
parent
3b7c5b85b9
commit
3e5a547bd8
3 changed files with 16 additions and 46 deletions
13
package-lock.json
generated
13
package-lock.json
generated
|
|
@ -8,6 +8,7 @@
|
|||
"name": "nuvio",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@babel/standalone": "^7.28.0",
|
||||
"@expo/metro-runtime": "~4.0.1",
|
||||
"@expo/vector-icons": "^14.1.0",
|
||||
"@gorhom/bottom-sheet": "^5.1.2",
|
||||
|
|
@ -71,7 +72,8 @@
|
|||
"react-native-web": "~0.19.13",
|
||||
"react-native-wheel-color-picker": "^1.3.1",
|
||||
"react-navigation-shared-element": "^3.1.3",
|
||||
"subsrt": "^1.1.1"
|
||||
"subsrt": "^1.1.1",
|
||||
"sucrase": "^3.35.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
|
|
@ -2206,6 +2208,15 @@
|
|||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/standalone": {
|
||||
"version": "7.28.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/standalone/-/standalone-7.28.0.tgz",
|
||||
"integrity": "sha512-KwedtFtU9oE/1zih0Cxb7Orudibv40KfklaQvUexeQ/2b6dktEHwa/Uqpdqr0AM1vD1+QZSQOXHwRQpt/JO0hQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/template": {
|
||||
"version": "7.27.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz",
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
"web": "expo start --web"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/standalone": "^7.28.0",
|
||||
"@expo/metro-runtime": "~4.0.1",
|
||||
"@expo/vector-icons": "^14.1.0",
|
||||
"@gorhom/bottom-sheet": "^5.1.2",
|
||||
|
|
@ -72,7 +73,8 @@
|
|||
"react-native-web": "~0.19.13",
|
||||
"react-native-wheel-color-picker": "^1.3.1",
|
||||
"react-navigation-shared-element": "^3.1.3",
|
||||
"subsrt": "^1.1.1"
|
||||
"subsrt": "^1.1.1",
|
||||
"sucrase": "^3.35.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ interface Plugin {
|
|||
author: string;
|
||||
description: string;
|
||||
type: 'scraper' | 'other';
|
||||
isBuiltIn?: boolean;
|
||||
isEnabled?: boolean;
|
||||
getStreams: (options: GetStreamsOptions) => Promise<Stream[]>;
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +101,6 @@ class CookieJar {
|
|||
class PluginManager {
|
||||
private plugins: Plugin[] = [];
|
||||
private static instance: PluginManager;
|
||||
private disabledPlugins: Set<string> = new Set();
|
||||
|
||||
private constructor() {
|
||||
this.loadBuiltInPlugins();
|
||||
|
|
@ -139,8 +136,6 @@ class PluginManager {
|
|||
// Provide registerPlugin globally for built-in modules
|
||||
(global as any).registerPlugin = (plugin: Plugin) => {
|
||||
if (plugin && typeof plugin.getStreams === 'function') {
|
||||
plugin.isBuiltIn = true;
|
||||
plugin.isEnabled = !this.disabledPlugins.has(plugin.name);
|
||||
this.plugins.push(plugin);
|
||||
logger.log(`[PluginManager] Successfully registered plugin: ${plugin.name} v${plugin.version}`);
|
||||
} else {
|
||||
|
|
@ -169,8 +164,6 @@ class PluginManager {
|
|||
// This is simpler and more reliable than using `with` or the Function constructor's scope.
|
||||
(global as any).registerPlugin = (plugin: Plugin) => {
|
||||
if (plugin && typeof plugin.getStreams === 'function') {
|
||||
plugin.isBuiltIn = false;
|
||||
plugin.isEnabled = !this.disabledPlugins.has(plugin.name);
|
||||
this.plugins.push(plugin);
|
||||
logger.log(`[PluginManager] Successfully registered plugin: ${plugin.name} v${plugin.version}`);
|
||||
} else {
|
||||
|
|
@ -205,44 +198,8 @@ class PluginManager {
|
|||
return this.plugins.filter(p => p.type === 'scraper');
|
||||
}
|
||||
|
||||
public getAllPlugins(): Plugin[] {
|
||||
return this.plugins;
|
||||
}
|
||||
|
||||
public togglePlugin(pluginName: string): boolean {
|
||||
const plugin = this.plugins.find(p => p.name === pluginName);
|
||||
if (!plugin) return false;
|
||||
|
||||
if (plugin.isEnabled) {
|
||||
this.disabledPlugins.add(pluginName);
|
||||
plugin.isEnabled = false;
|
||||
} else {
|
||||
this.disabledPlugins.delete(pluginName);
|
||||
plugin.isEnabled = true;
|
||||
}
|
||||
|
||||
logger.log(`[PluginManager] Plugin ${pluginName} ${plugin.isEnabled ? 'enabled' : 'disabled'}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
public removePlugin(pluginName: string): boolean {
|
||||
const pluginIndex = this.plugins.findIndex(p => p.name === pluginName);
|
||||
if (pluginIndex === -1) return false;
|
||||
|
||||
const plugin = this.plugins[pluginIndex];
|
||||
if (plugin.isBuiltIn) {
|
||||
logger.warn(`[PluginManager] Cannot remove built-in plugin: ${pluginName}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.plugins.splice(pluginIndex, 1);
|
||||
this.disabledPlugins.delete(pluginName);
|
||||
logger.log(`[PluginManager] Plugin ${pluginName} removed`);
|
||||
return true;
|
||||
}
|
||||
|
||||
public async getAllStreams(options: Omit<GetStreamsOptions, 'logger' | 'cache' | 'fetch' | 'fetchWithCookies' | 'setCookie' | 'parseHTML' | 'URL' | 'URLSearchParams' | 'FormData'>): Promise<Stream[]> {
|
||||
const scrapers = this.getScraperPlugins().filter(p => p.isEnabled);
|
||||
const scrapers = this.getScraperPlugins();
|
||||
if (scrapers.length === 0) {
|
||||
logger.log('[PluginManager] No scraper plugins loaded.');
|
||||
return [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue