Skip to content

Commit

Permalink
refactor: make use of applicationConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Jan 15, 2024
1 parent c8eb0f3 commit 57fadbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 3 additions & 4 deletions packages/web-app-preview/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineWebApplication, useAppsStore } from '@ownclouders/web-pkg'
import { defineWebApplication } from '@ownclouders/web-pkg'
import translations from '../l10n/translations.json'
import * as app from './App.vue'
import { useGettext } from 'vue3-gettext'
Expand All @@ -7,9 +7,8 @@ import { getMimeTypes } from './mimeTypes'
const { default: App, appId } = app as any

export default defineWebApplication({
setup() {
setup({ applicationConfig }) {
const { $gettext } = useGettext()
const appsStore = useAppsStore()

const routes = [
{
Expand All @@ -30,7 +29,7 @@ export default defineWebApplication({
name: $gettext('Preview'),
id: appId,
icon: 'eye',
extensions: getMimeTypes(appsStore.externalAppConfig[appId]?.mimeTypes).map((mimeType) => ({
extensions: getMimeTypes(applicationConfig?.mimeTypes).map((mimeType) => ({
mimeType,
routeName,
label: $gettext('Preview')
Expand Down
6 changes: 2 additions & 4 deletions packages/web-app-text-editor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ import {
AppWrapperRoute,
ApplicationFileExtension,
defineWebApplication,
useAppsStore,
useUserStore
} from '@ownclouders/web-pkg'

export default defineWebApplication({
setup() {
setup({ applicationConfig }) {
const { $gettext } = useGettext()
const userStore = useUserStore()
const appsStore = useAppsStore()

const appId = 'text-editor'

Expand Down Expand Up @@ -53,7 +51,7 @@ export default defineWebApplication({
}
]

const config = appsStore.externalAppConfig[appId] || {}
const config = applicationConfig || {}
extensions.push(...(config.extraExtensions || []).map((ext: string) => ({ extension: ext })))

let primaryExtensions: string[] = config.primaryExtensions || ['txt', 'md']
Expand Down

0 comments on commit 57fadbc

Please sign in to comment.