You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.ts 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import './templates.js'
  2. import './legacy/filelistSearch.js'
  3. import './actions/deleteAction'
  4. import './actions/downloadAction'
  5. import './actions/editLocallyAction'
  6. import './actions/favoriteAction'
  7. import './actions/openFolderAction'
  8. import './actions/openInFilesAction.js'
  9. import './actions/renameAction'
  10. import './actions/sidebarAction'
  11. import './actions/viewInFolderAction'
  12. import Vue from 'vue'
  13. import { createPinia, PiniaVuePlugin } from 'pinia'
  14. import FilesListView from './views/FilesList.vue'
  15. import NavigationService from './services/Navigation'
  16. import NavigationView from './views/Navigation.vue'
  17. import processLegacyFilesViews from './legacy/navigationMapper.js'
  18. import registerFavoritesView from './views/favorites'
  19. import registerRecentView from './views/recent'
  20. import registerFilesView from './views/files'
  21. import registerPreviewServiceWorker from './services/ServiceWorker.js'
  22. import router from './router/router.js'
  23. import RouterService from './services/RouterService'
  24. import SettingsModel from './models/Setting.js'
  25. import SettingsService from './services/Settings.js'
  26. declare global {
  27. interface Window {
  28. OC: any;
  29. OCA: any;
  30. OCP: any;
  31. }
  32. }
  33. // Init private and public Files namespace
  34. window.OCA.Files = window.OCA.Files ?? {}
  35. window.OCP.Files = window.OCP.Files ?? {}
  36. // Expose router
  37. const Router = new RouterService(router)
  38. Object.assign(window.OCP.Files, { Router })
  39. // Init Pinia store
  40. Vue.use(PiniaVuePlugin)
  41. const pinia = createPinia()
  42. // Init Navigation Service
  43. const Navigation = new NavigationService()
  44. Object.assign(window.OCP.Files, { Navigation })
  45. Vue.prototype.$navigation = Navigation
  46. // Init Files App Settings Service
  47. const Settings = new SettingsService()
  48. Object.assign(window.OCA.Files, { Settings })
  49. Object.assign(window.OCA.Files.Settings, { Setting: SettingsModel })
  50. // Init Navigation View
  51. const View = Vue.extend(NavigationView)
  52. const FilesNavigationRoot = new View({
  53. name: 'FilesNavigationRoot',
  54. propsData: {
  55. Navigation,
  56. },
  57. router,
  58. pinia,
  59. })
  60. FilesNavigationRoot.$mount('#app-navigation-files')
  61. // Init content list view
  62. const ListView = Vue.extend(FilesListView)
  63. const FilesList = new ListView({
  64. name: 'FilesListRoot',
  65. router,
  66. pinia,
  67. })
  68. FilesList.$mount('#app-content-vue')
  69. // Init legacy and new files views
  70. processLegacyFilesViews()
  71. registerFavoritesView()
  72. registerFilesView()
  73. registerRecentView()
  74. // Register preview service worker
  75. registerPreviewServiceWorker()