From 65820ae8cdc3174a8e957e7eb02d1998f64cdb89 Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Tue, 30 Jan 2024 00:41:03 -0300 Subject: [PATCH 1/2] core: frontend: add support for 'avoid_iframes' field in register_service --- core/frontend/src/App.vue | 8 ++++++-- core/frontend/src/types/helper.ts | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/frontend/src/App.vue b/core/frontend/src/App.vue index fa836fb309..e7d506b4ba 100644 --- a/core/frontend/src/App.vue +++ b/core/frontend/src/App.vue @@ -187,7 +187,7 @@ @@ -461,7 +461,7 @@ export default Vue.extend({ ? `${address}${service.metadata.icon}` : service.metadata?.icon ?? 'mdi-puzzle', route: this.addExtraQuery(service.metadata?.route ?? address, service.metadata?.extra_query), - new_page: service.metadata?.new_page ?? undefined, + new_page: service.metadata?.avoid_iframes ?? service.metadata?.new_page, advanced: false, text: service.metadata?.description ?? 'Service text', extension: true, @@ -673,6 +673,10 @@ export default Vue.extend({ } }, createExtensionAddress(service: Service): string { + if (service.metadata?.avoid_iframes) { + const base_url = window.location.origin.split(":").slice(0, 2).join(":") + return `${base_url}:${service.port}` + } let address = `/extension/${service?.metadata?.sanitized_name}` if (service?.metadata?.new_page) { address += '?full_page=true' diff --git a/core/frontend/src/types/helper.ts b/core/frontend/src/types/helper.ts index ab3df3bedf..022cdcd30d 100644 --- a/core/frontend/src/types/helper.ts +++ b/core/frontend/src/types/helper.ts @@ -10,6 +10,7 @@ export interface ServiceMetadata { new_page?: boolean sanitized_name?: string extra_query?: string + avoid_iframes?: boolean } export interface Service { From b6b17efb7691b1f14520a9cedb436cedaea0647c Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Tue, 30 Jan 2024 00:41:20 -0300 Subject: [PATCH 2/2] core: helper: add support for 'avoid_iframes' field in register_service --- core/frontend/src/App.vue | 2 +- core/services/helper/main.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/frontend/src/App.vue b/core/frontend/src/App.vue index e7d506b4ba..b4c6108c61 100644 --- a/core/frontend/src/App.vue +++ b/core/frontend/src/App.vue @@ -674,7 +674,7 @@ export default Vue.extend({ }, createExtensionAddress(service: Service): string { if (service.metadata?.avoid_iframes) { - const base_url = window.location.origin.split(":").slice(0, 2).join(":") + const base_url = window.location.origin.split(':').slice(0, 2).join(':') return `${base_url}:${service.port}` } let address = `/extension/${service?.metadata?.sanitized_name}` diff --git a/core/services/helper/main.py b/core/services/helper/main.py index 609b2d081b..6ba665635c 100755 --- a/core/services/helper/main.py +++ b/core/services/helper/main.py @@ -99,6 +99,7 @@ class ServiceMetadata(BaseModel): route: Optional[str] new_page: Optional[bool] extra_query: Optional[str] + avoid_iframes: Optional[bool] api: str sanitized_name: Optional[str]