blob: 21ef427335a1dec7c493d743ecef61101cbd03f6 [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ínez3c13a762024-11-09 23:03:32 +010027import FlattenThreadsSetUpReplyActionHandlerScript from '../../../features/flattenThreads/presentation/scripts/setUpReplyActionHandler.script';
28import FlattenThreadsReplyActionHandler from '../../../features/flattenThreads/core/replyActionHandler';
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020029
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020030const scriptRunner = createScriptRunner();
31scriptRunner.run();
32
33function createScriptRunner() {
34 const dependenciesProvider = DependenciesProviderSingleton.getInstance();
35 const autoRefresh = dependenciesProvider.getDependency(AutoRefreshDependency);
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +010036 const extraInfo = dependenciesProvider.getDependency(ExtraInfoDependency);
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +020037 const optionsProvider = dependenciesProvider.getDependency(
38 OptionsProviderDependency,
39 );
40 const startupDataStorage = dependenciesProvider.getDependency(
41 StartupDataStorageDependency,
42 );
Adrià Vilanova Martínez4e847f42024-11-09 23:03:32 +010043 const threadPageDesignWarning = dependenciesProvider.getDependency(
44 ThreadPageDesignWarningDependency,
45 );
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020046 const workflowsImport = dependenciesProvider.getDependency(
47 WorkflowsImportDependency,
48 );
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020049
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020050 return new ScriptRunner(
51 new SortedScriptsProviderAdapter(
52 [
53 // Individual feature scripts
54 new AutoRefreshSetUpScript(autoRefresh),
Adrià Vilanova Martínez6ecaa0d2024-10-26 17:04:32 +020055 new CCDarkThemeInjectAutoDarkTheme(),
56 new CCDarkThemeInjectForcedDarkTheme(),
Adrià Vilanova Martínezcb12c592024-11-09 20:46:03 +010057 new CCExtraInfoSetUpScript(extraInfo),
Adrià Vilanova Martínez3c13a762024-11-09 23:03:32 +010058 new FlattenThreadsSetUpReplyActionHandlerScript(
59 new FlattenThreadsReplyActionHandler(optionsProvider),
Adrià Vilanova Martínez4e847f42024-11-09 23:03:32 +010060 ),
Adrià Vilanova Martínez3c13a762024-11-09 23:03:32 +010061 new InteropThreadPageSetupScript(),
62 new ThreadPageDesignWarningSetUpScript(threadPageDesignWarning),
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +020063 new LoadDraftsSetupScript(optionsProvider, startupDataStorage),
Adrià Vilanova Martínezed1aba32024-10-26 21:23:12 +020064 new WorkflowsImportSetUpScript(workflowsImport),
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020065
Adrià Vilanova Martínez33a009c2024-11-09 22:41:56 +010066 // Standalone scripts
67 new ApplyStartupDataModificationsOnStartScript(startupDataStorage),
68 new MWI18nServerScript(),
69 new MWOptionsWatcherServerScript(),
70 new XHRInterceptorScript(),
Adrià Vilanova Martínezf92172f2024-10-19 15:55:15 +020071 ],
72 new ScriptSorterAdapter(),
73 ).getScripts(),
74 );
75}