diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e092ca43f6bf407a44eda7316b426e95b71ceaa2..25a2cd761b2c38a48147a54f79640b34ad0fa7ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: # runs-on: ubuntu-latest # steps: - # - uses: actions/checkout@v2 + # - uses: actions/checkout@v3 # - uses: actions/setup-node@v1 # with: # node-version: '16.x' @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js 16.x for lint uses: actions/setup-node@v1 with: @@ -41,7 +41,7 @@ jobs: NODE_ENV: test steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js 16.x uses: actions/setup-node@v1 with: @@ -63,7 +63,7 @@ jobs: NODE_ENV: test steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js 16.x uses: actions/setup-node@v1 with: diff --git a/.github/workflows/docker_img.yml b/.github/workflows/docker_img.yml index 5dd8db7891e24bf018b1f8e90164c038bf4b7b93..eb5368f03107d568f2157cbee31359bae1f03f6b 100644 --- a/.github/workflows/docker_img.yml +++ b/.github/workflows/docker_img.yml @@ -30,7 +30,7 @@ jobs: build: [ 'local', 'prod' ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: 'Set matomo env var' # if matrix.build is local, only run if master or dev if: ${{ !(matrix.build == 'local' && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/dev') }} @@ -120,7 +120,7 @@ jobs: needs: build-docker-img steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set env var run: | echo "Using github.ref: $GITHUB_REF" diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 9203ddec11d5972bd515d88cabe518281765a226..ec46c942aebec12804baf7c73da2bd092023d55c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -59,7 +59,7 @@ jobs: failure-state: ${{ steps.failure-state-step.outputs.failure-state }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.ref }} diff --git a/.github/workflows/manual_e2e.yml b/.github/workflows/manual_e2e.yml index 9829d7053bd047b73209192c0effbb5c87715599..a55bd1e16b0aee7d9dc6c91af8aba780b2bc40ec 100644 --- a/.github/workflows/manual_e2e.yml +++ b/.github/workflows/manual_e2e.yml @@ -9,7 +9,7 @@ jobs: hide_previous_if_exists: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: 'master' - uses: actions/github-script@v5 @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: 'Add checklist comment' uses: actions/github-script@v5 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 42fc00b29beb30be08b73526c02e9325fb3955ad..211fd6d9ed6b726d95894c16366837d1c743392a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: if: success() runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Create Release id: create_release uses: actions/create-release@v1 diff --git a/.github/workflows/repo_sync_ebrains.yml b/.github/workflows/repo_sync_ebrains.yml index 548b768b0cd23b694a323919a7e64c71ee512d92..e29122fa0ac82239f8772e61b0d0b8581135fbd1 100644 --- a/.github/workflows/repo_sync_ebrains.yml +++ b/.github/workflows/repo_sync_ebrains.yml @@ -9,7 +9,7 @@ jobs: sync: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: wei/git-sync@v3 with: source_repo: ${GITHUB_REPOSITORY} diff --git a/docs/releases/v2.11.2.md b/docs/releases/v2.11.2.md index 33f38116daac237e5a68b131eeaa4d7dbf5b7d09..7ad012150e7c5d0a544364947db83a2a73af5d91 100644 --- a/docs/releases/v2.11.2.md +++ b/docs/releases/v2.11.2.md @@ -13,3 +13,4 @@ - Pass messages to plugin API when not handled - Fix lint +- Update CI \ No newline at end of file diff --git a/src/messaging/service.ts b/src/messaging/service.ts index 3e9ecc6183f6bd5cde06737929f39c423f4d6809..48dc941bbe62838c278e5ed55ec28fd0131c5835 100644 --- a/src/messaging/service.ts +++ b/src/messaging/service.ts @@ -9,10 +9,15 @@ import { TYPE as NMV_TYPE, processJsonLd as nmvProcess } from './nmvSwc/index' import { TYPE as NATIVE_TYPE, processJsonLd as nativeProcess } from './native' import { BoothVisitor, JRPCRequest, ListenerChannel } from "src/api/jsonrpc" import { ApiService } from "src/api"; -import { ApiBoothEvents } from "src/api/service"; +import { ApiBoothEvents, namespace as apiNameSpace } from "src/api/service"; export const IAV_POSTMESSAGE_NAMESPACE = `ebrains:iav:` +const RECOGNISED_NAMESPACES = [ + IAV_POSTMESSAGE_NAMESPACE, + apiNameSpace +] + export const MANAGED_METHODS = [ 'openminds:nmv:loadSwc', 'openminds:nmv:unloadSwc' @@ -69,7 +74,11 @@ export class MessagingService { window.addEventListener('message', async ({ data, origin, source }) => { if (/^webpack/.test(data.type)) return - if (data === '') return + if (!data) return + const { method } = data + if (RECOGNISED_NAMESPACES.every(namespace => method.indexOf(namespace) !== 0)) { + return + } const src = source as Window const { id } = data try { diff --git a/src/widget/service.ts b/src/widget/service.ts index 9430269418731ceb3b57810b54b26ef155ef7ef0..67856fb1f1c79ed1de0145394e3148f99c7bb633 100644 --- a/src/widget/service.ts +++ b/src/widget/service.ts @@ -1,5 +1,5 @@ import { ComponentPortal } from "@angular/cdk/portal"; -import { ComponentFactory, ComponentFactoryResolver, ComponentRef, Injectable, Injector, ViewContainerRef } from "@angular/core"; +import { ComponentRef, Injectable, Injector, ViewContainerRef } from "@angular/core"; import { RM_WIDGET } from "./constants"; import { WidgetPortal } from "./widgetPortal/widgetPortal.component"; @@ -12,11 +12,6 @@ export class WidgetService { public vcr: ViewContainerRef private viewRefMap = new Map<WidgetPortal<unknown>, ComponentRef<WidgetPortal<unknown>>>() - private cf: ComponentFactory<WidgetPortal<unknown>> - - constructor(cfr: ComponentFactoryResolver){ - this.cf = cfr.resolveComponentFactory(WidgetPortal) - } public addNewWidget<T>(Component: new (...arg: any) => T, injector: Injector): WidgetPortal<T> { const inj = Injector.create({ @@ -26,7 +21,8 @@ export class WidgetService { }], parent: injector }) - const widgetPortal = this.vcr.createComponent(this.cf, 0, inj) as ComponentRef<WidgetPortal<T>> + + const widgetPortal = this.vcr.createComponent(WidgetPortal, {index: 0, injector: inj}) as ComponentRef<WidgetPortal<T>> const cmpPortal = new ComponentPortal<T>(Component, this.vcr, inj) this.viewRefMap.set(widgetPortal.instance, widgetPortal)