-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move app vuex store to pinia
Removes the vuex app store module in favour of a pinia store instead. Also cleans up the app types a bit, although this is still a bit messy due to some weird naming choices in the past. That's something for a follow-up though. Also removes the `announceExtensions` method inside the app's `ready` hook, which could be used to register file editors. Apparently it was not used by any app because there is already another way to register file editors, which is via the `extensions` property inside the `appInfo` object.
- Loading branch information
1 parent
015dd7b
commit 3d1cdeb
Showing
35 changed files
with
315 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Change: Registering app file editors | ||
|
||
BREAKING CHANGE for developers: The `announceExtensions` method inside the app's `ready` hook, which could be used to register file editors, has been removed. Developers should use the `extensions` property inside the `appInfo` object instead. | ||
|
||
https://github.com/owncloud/web/pull/10330 | ||
https://github.com/owncloud/web/issues/10210 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,48 @@ | ||
import { defineWebApplication, useAppsStore } from '@ownclouders/web-pkg' | ||
import translations from '../l10n/translations.json' | ||
import * as app from './App.vue' | ||
const { default: App, mimeTypes, appId } = app as any | ||
import { useGettext } from 'vue3-gettext' | ||
import { getMimeTypes } from './mimeTypes' | ||
|
||
// just a dummy function to trick gettext tools | ||
function $gettext(msg) { | ||
return msg | ||
} | ||
const { default: App, appId } = app as any | ||
|
||
const routes = [ | ||
{ | ||
path: '/:driveAliasAndItem(.*)?', | ||
component: App, | ||
name: 'media', | ||
meta: { | ||
authContext: 'hybrid', | ||
title: $gettext('Preview'), | ||
patchCleanPath: true | ||
} | ||
} | ||
] | ||
export default defineWebApplication({ | ||
setup() { | ||
const { $gettext } = useGettext() | ||
const appsStore = useAppsStore() | ||
|
||
const routes = [ | ||
{ | ||
path: '/:driveAliasAndItem(.*)?', | ||
component: App, | ||
name: 'media', | ||
meta: { | ||
authContext: 'hybrid', | ||
title: $gettext('Preview'), | ||
patchCleanPath: true | ||
} | ||
} | ||
] | ||
|
||
const routeName = 'preview-media' | ||
const routeName = 'preview-media' | ||
|
||
const appInfo = { | ||
name: $gettext('Preview'), | ||
id: appId, | ||
icon: 'eye', | ||
extensions: mimeTypes().map((mimeType) => ({ | ||
mimeType, | ||
routeName, | ||
label: $gettext('Preview') | ||
})) | ||
} | ||
const appInfo = { | ||
name: $gettext('Preview'), | ||
id: appId, | ||
icon: 'eye', | ||
extensions: getMimeTypes(appsStore.getExternalAppConfigByAppId(appId)?.mimeTypes).map( | ||
(mimeType) => ({ | ||
mimeType, | ||
routeName, | ||
label: $gettext('Preview') | ||
}) | ||
) | ||
} | ||
|
||
export default { | ||
appInfo, | ||
routes, | ||
translations, | ||
mimeTypes | ||
} | ||
return { | ||
appInfo, | ||
routes, | ||
translations | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export const getMimeTypes = (extensionMimeTypes: string[] = []) => { | ||
return [ | ||
'audio/flac', | ||
'audio/mpeg', | ||
'audio/ogg', | ||
'audio/wav', | ||
'audio/x-flac', | ||
'audio/x-wav', | ||
'image/gif', | ||
'image/jpeg', | ||
'image/png', | ||
'video/mp4', | ||
'video/webm', | ||
...extensionMimeTypes | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.