pluginManager.ts (42a9f3e6edf48cfb1acc40cd35cb6621e7f940e9) pluginManager.ts (33d529550b6205d83b1bee02bb839fb71b46cd36)
1import RNFS, {
2 copyFile,
3 exists,
4 readDir,
5 readFile,
6 stat,
7 unlink,
8 writeFile,

--- 22 unchanged lines hidden (view full) ---

31 CacheControl,
32 emptyFunction,
33 internalSerializeKey,
34 localPluginHash,
35 localPluginPlatform,
36} from '@/constants/commonConst';
37import delay from '@/utils/delay';
38import * as cheerio from 'cheerio';
1import RNFS, {
2 copyFile,
3 exists,
4 readDir,
5 readFile,
6 stat,
7 unlink,
8 writeFile,

--- 22 unchanged lines hidden (view full) ---

31 CacheControl,
32 emptyFunction,
33 internalSerializeKey,
34 localPluginHash,
35 localPluginPlatform,
36} from '@/constants/commonConst';
37import delay from '@/utils/delay';
38import * as cheerio from 'cheerio';
39import CookieManager from '@react-native-cookies/cookies';
40import he from 'he';
41import Network from './network';
42import LocalMusicSheet from './localMusicSheet';
43import Mp3Util from '@/native/mp3Util';
44import {PluginMeta} from './pluginMeta';
45import {useEffect, useState} from 'react';
46import {addFileScheme, getFileName} from '@/utils/fileUtils';
47import {URL} from 'react-native-url-polyfill';
48import Base64 from '@/utils/base64';
49import MediaCache from './mediaCache';
50import {produce} from 'immer';
51import objectPath from 'object-path';
39import he from 'he';
40import Network from './network';
41import LocalMusicSheet from './localMusicSheet';
42import Mp3Util from '@/native/mp3Util';
43import {PluginMeta} from './pluginMeta';
44import {useEffect, useState} from 'react';
45import {addFileScheme, getFileName} from '@/utils/fileUtils';
46import {URL} from 'react-native-url-polyfill';
47import Base64 from '@/utils/base64';
48import MediaCache from './mediaCache';
49import {produce} from 'immer';
50import objectPath from 'object-path';
51import notImplementedFunction from '@/utils/notImplementedFunction.ts';
52
53axios.defaults.timeout = 2000;
54
55const sha256 = CryptoJs.SHA256;
56
57export enum PluginStateCode {
58 /** 版本不匹配 */
59 VersionNotMatch = 'VERSION NOT MATCH',
60 /** 无法解析 */
61 CannotParse = 'CANNOT PARSE',
62}
63
52
53axios.defaults.timeout = 2000;
54
55const sha256 = CryptoJs.SHA256;
56
57export enum PluginStateCode {
58 /** 版本不匹配 */
59 VersionNotMatch = 'VERSION NOT MATCH',
60 /** 无法解析 */
61 CannotParse = 'CANNOT PARSE',
62}
63
64const deprecatedCookieManager = {
65 get: notImplementedFunction,
66 set: notImplementedFunction,
67 flush: notImplementedFunction,
68};
69
64const packages: Record<string, any> = {
65 cheerio,
66 'crypto-js': CryptoJs,
67 axios,
68 dayjs,
69 'big-integer': bigInt,
70 qs,
71 he,
70const packages: Record<string, any> = {
71 cheerio,
72 'crypto-js': CryptoJs,
73 axios,
74 dayjs,
75 'big-integer': bigInt,
76 qs,
77 he,
72 '@react-native-cookies/cookies': CookieManager,
78 '@react-native-cookies/cookies': deprecatedCookieManager,
73 webdav,
74};
75
76const _require = (packageName: string) => {
77 let pkg = packages[packageName];
78 pkg.default = pkg;
79 return pkg;
80};

--- 881 unchanged lines hidden (view full) ---

962 };
963 } catch {
964 return {
965 isOk: false,
966 };
967 }
968 }
969}
79 webdav,
80};
81
82const _require = (packageName: string) => {
83 let pkg = packages[packageName];
84 pkg.default = pkg;
85 return pkg;
86};

--- 881 unchanged lines hidden (view full) ---

968 };
969 } catch {
970 return {
971 isOk: false,
972 };
973 }
974 }
975}
976
970//#endregion
971
972let plugins: Array<Plugin> = [];
973const pluginStateMapper = new StateMapper(() => plugins);
974
975//#region 本地音乐插件
976/** 本地插件 */
977const localFilePlugin = new Plugin(function () {

--- 487 unchanged lines hidden ---
977//#endregion
978
979let plugins: Array<Plugin> = [];
980const pluginStateMapper = new StateMapper(() => plugins);
981
982//#region 本地音乐插件
983/** 本地插件 */
984const localFilePlugin = new Plugin(function () {

--- 487 unchanged lines hidden ---