blob: 72302ff5e8d93f5e9a8bc372186d8459a55fd31b [file] [log] [blame]
Adrià Vilanova Martínez2d035552024-10-26 20:23:34 +02001// Run legacy Javascript entry point
2import '../../../contentScripts/communityConsole/start';
3
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +02004import DependenciesProviderSingleton, {
5 AutoRefreshDependency,
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +01006 ExtraInfoDependency,
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +02007 OptionsProviderDependency,
8 StartupDataStorageDependency,
Adrià Vilanova Martínez4e847f42024-11-09 23:03:32 +01009 ThreadPageDesignWarningDependency,
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020010 WorkflowsImportDependency,
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020011} from '../../../common/architecture/dependenciesProvider/DependenciesProvider';
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020012import AutoRefreshSetUpScript from '../../../features/autoRefresh/presentation/scripts/setUp.script';
Adrià Vilanova Martínezfe694782024-11-09 20:40:43 +010013import CCDarkThemeInjectAutoDarkTheme from '../../../features/ccDarkTheme/presentation/scripts/injectAutoDarkTheme.script';
14import CCDarkThemeInjectForcedDarkTheme from '../../../features/ccDarkTheme/presentation/scripts/injectForcedDarkTheme.script';
Adrià Vilanova Martínez2d035552024-10-26 20:23:34 +020015import InteropThreadPageSetupScript from '../../../features/interopThreadPage/presentation/scripts/setup.script';
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020016import ScriptRunner from '../../../infrastructure/presentation/scripts/ScriptRunner';
17import ScriptSorterAdapter from '../../../infrastructure/presentation/scripts/ScriptSorter.adapter';
18import { SortedScriptsProviderAdapter } from '../../../infrastructure/presentation/scripts/SortedScriptsProvider.adapter';
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +020019import LoadDraftsSetupScript from '../../../features/loadDrafts/presentation/scripts/setup.script';
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020020import WorkflowsImportSetUpScript from '../../../features/workflows/presentation/scripts/importSetUp.script';
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +010021import CCExtraInfoSetUpScript from '../../../features/extraInfo/presentation/scripts/ccExtraInfoSetUp.script';
Adrià Vilanova Martínez33a009c2024-11-09 22:41:56 +010022import MWI18nServerScript from '../../../presentation/standaloneScripts/mainWorldServers/MWI18nServerScript.script';
23import MWOptionsWatcherServerScript from '../../../presentation/standaloneScripts/mainWorldServers/MWOptionsWatcherServerScript.script';
24import ApplyStartupDataModificationsOnStartScript from '../../../presentation/standaloneScripts/startupDataStorage/applyStartupDataModificationsOnStart.script';
25import XHRInterceptorScript from '../../../presentation/standaloneScripts/xhrInterceptor/xhrInterceptor.script';
Adrià Vilanova Martínez4e847f42024-11-09 23:03:32 +010026import ThreadPageDesignWarningSetUpScript from '../../../features/threadPageDesignWarning/presentation/scripts/setUp.script';
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020027
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020028const scriptRunner = createScriptRunner();
29scriptRunner.run();
30
31function createScriptRunner() {
32 const dependenciesProvider = DependenciesProviderSingleton.getInstance();
33 const autoRefresh = dependenciesProvider.getDependency(AutoRefreshDependency);
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +010034 const extraInfo = dependenciesProvider.getDependency(ExtraInfoDependency);
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +020035 const optionsProvider = dependenciesProvider.getDependency(
36 OptionsProviderDependency,
37 );
38 const startupDataStorage = dependenciesProvider.getDependency(
39 StartupDataStorageDependency,
40 );
Adrià Vilanova Martínez4e847f42024-11-09 23:03:32 +010041 const threadPageDesignWarning = dependenciesProvider.getDependency(
42 ThreadPageDesignWarningDependency,
43 );
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020044 const workflowsImport = dependenciesProvider.getDependency(
45 WorkflowsImportDependency,
46 );
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020047
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020048 return new ScriptRunner(
49 new SortedScriptsProviderAdapter(
50 [
51 // Individual feature scripts
52 new AutoRefreshSetUpScript(autoRefresh),
Adrià Vilanova Martínez6ecaa0d2024-10-26 17:04:32 +020053 new CCDarkThemeInjectAutoDarkTheme(),
54 new CCDarkThemeInjectForcedDarkTheme(),
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +010055 new CCExtraInfoSetUpScript(extraInfo),
Adrià Vilanova Martínez2d035552024-10-26 20:23:34 +020056 new InteropThreadPageSetupScript(),
Adrià Vilanova Martínez4e847f42024-11-09 23:03:32 +010057 new ThreadPageDesignWarningSetUpScript(
58 threadPageDesignWarning,
59 ),
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +020060 new LoadDraftsSetupScript(optionsProvider, startupDataStorage),
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020061 new WorkflowsImportSetUpScript(workflowsImport),
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020062
Adrià Vilanova Martínez33a009c2024-11-09 22:41:56 +010063 // Standalone scripts
64 new ApplyStartupDataModificationsOnStartScript(startupDataStorage),
65 new MWI18nServerScript(),
66 new MWOptionsWatcherServerScript(),
67 new XHRInterceptorScript(),
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020068 ],
69 new ScriptSorterAdapter(),
70 ).getScripts(),
71 );
72}