From 92e1d37ad2b3c9219c70397df1be129e02779d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Fri, 17 Mar 2023 19:59:09 +0100 Subject: [PATCH] fix neko images browser policy match . #89 --- client/src/components/RoomsCreate.vue | 10 ++++++++-- client/src/store/state.ts | 24 +++++++++++++----------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/client/src/components/RoomsCreate.vue b/client/src/components/RoomsCreate.vue index 7703027..06c2804 100644 --- a/client/src/components/RoomsCreate.vue +++ b/client/src/components/RoomsCreate.vue @@ -571,8 +571,14 @@ export default class RoomsCreate extends Vue { get browserPolicyConfig() { const nekoImage = this.data.neko_image if (!nekoImage) return undefined - - return this.$store.state.browserPolicyConfig.find(({ images }: { images: string[] }): boolean => images.includes(nekoImage)) + + return this.$store.state.browserPolicyConfig.find( + // find browser policy config for this image + ({ images }: { images: string[] }): boolean => images.some( + // if nekoImage includes the image name + (image: string): boolean => nekoImage.includes(image) + ) + ) } get browserPolicyExtensions() { diff --git a/client/src/store/state.ts b/client/src/store/state.ts index 1945cab..1ba4398 100644 --- a/client/src/store/state.ts +++ b/client/src/store/state.ts @@ -135,41 +135,43 @@ export const state = { // browserPolicyConfig: [ - { - type: BrowserPolicyTypeEnum.firefox, - path: '/usr/lib/firefox/distribution/policies.json', - profile: '/home/neko/.mozilla/firefox/profile.default', - images: [ 'm1k1o/neko:latest', 'm1k1o/neko:firefox' ], - }, + // firefox esr { type: BrowserPolicyTypeEnum.firefox, path: '/usr/lib/firefox-esr/distribution/policies.json', profile: '/home/neko/.mozilla/firefox/profile.default', - images: [ 'm1k1o/neko:arm-firefox' ], + images: [ 'arm-firefox' ], + }, + // firefox (needs to be after firefox-esr, because it matches all remaining firefox images) + { + type: BrowserPolicyTypeEnum.firefox, + path: '/usr/lib/firefox/distribution/policies.json', + profile: '/home/neko/.mozilla/firefox/profile.default', + images: [ 'm1k1o/neko:latest', 'firefox' ], }, { type: BrowserPolicyTypeEnum.chromium, path: '/etc/chromium/policies/managed/policies.json', profile: '/home/neko/.config/chromium', - images: [ 'm1k1o/neko:chromium', 'm1k1o/neko:arm-chromium', 'm1k1o/neko:ungoogled-chromium' ], + images: [ 'chromium', 'ungoogled-chromium' ], }, { type: BrowserPolicyTypeEnum.chromium, path: '/etc/opt/chrome/policies/managed/policies.json', profile: '/home/neko/.config/google-chrome', - images: [ 'm1k1o/neko:google-chrome' ], + images: [ 'google-chrome' ], }, { type: BrowserPolicyTypeEnum.chromium, path: '/etc/brave/policies/managed/policies.json', profile: '/home/neko/.config/brave', - images: [ 'm1k1o/neko:brave' ], + images: [ 'brave' ], }, { type: BrowserPolicyTypeEnum.chromium, path: '/etc/opt/edge/policies/managed/policies.json', profile: '/home/neko/.config/microsoft-edge', - images: [ 'm1k1o/neko:microsoft-edge' ], + images: [ 'microsoft-edge' ], }, ] as BrowserPolicyConfig[], browserPolicyExtensions: [