From 2a14f26bed529b0c1137c681b1a924cdfb3af4d5 Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 12 Jan 2026 14:02:30 +0100 Subject: [PATCH 1/3] fix: added listen and intrude protocols --- .../controllers/PhoneIslandController.ts | 8 +++++ src/main/main.ts | 36 +++++++++++++++---- src/renderer/src/pages/PhoneIslandPage.tsx | 12 +++++++ src/shared/constants.ts | 2 ++ 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src/main/classes/controllers/PhoneIslandController.ts b/src/main/classes/controllers/PhoneIslandController.ts index 1a731a9d..9d2ef403 100644 --- a/src/main/classes/controllers/PhoneIslandController.ts +++ b/src/main/classes/controllers/PhoneIslandController.ts @@ -124,6 +124,14 @@ export class PhoneIslandController { this.window.emit(IPC_EVENTS.TRANSFER_CALL, to) } + intrudeCall(to: string) { + this.window.emit(IPC_EVENTS.INTRUDE_CALL, to) + } + + listenCall(to: string) { + this.window.emit(IPC_EVENTS.LISTEN_CALL, to) + } + updateDefaultDevice(ext: Extension, force: boolean) { try { diff --git a/src/main/main.ts b/src/main/main.ts index 3ff5df93..385d858a 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -543,16 +543,40 @@ async function attachProtocolListeners() { function handleNethLinkProtocol(url: string): Promise { //we have to define the purpose of the nethlink custom protocol Log.info('HandleProtocol Nethlink:', url) - const data = new URL("nethlink://" + url) - - const action = data.host + + const cleanUrl = url.replace(/^nethlink:\/?\/?/, '') + const [actionPart, queryString] = cleanUrl.split('?') + const action = actionPart.toLowerCase().trim() + const params = new URLSearchParams(queryString || '') + const to = params.get('to') + + Log.info(`[NethLink Protocol] Action: '${action}', To: '${to}'`) + try { switch (action) { - case 'transfer': - const to = data.searchParams.get('to') - if (to) + case 'transfer': { + if (to) { + Log.info('Transfer call to:', to) + PhoneIslandController.instance.callTransfer(to) + } + break; + } + case 'listen': { + if (to) { + Log.info('Listen call to:', to) PhoneIslandController.instance.callTransfer(to) + } break; + } + case 'intrude': { + if (to) { + Log.info('Intrude call to:', to) + PhoneIslandController.instance.callTransfer(to) + } + break; + } + default: + Log.warning('Unknown nethlink action:', action) } NethLinkController.instance.show() } catch (e) { diff --git a/src/renderer/src/pages/PhoneIslandPage.tsx b/src/renderer/src/pages/PhoneIslandPage.tsx index fe0012d3..13873e46 100644 --- a/src/renderer/src/pages/PhoneIslandPage.tsx +++ b/src/renderer/src/pages/PhoneIslandPage.tsx @@ -188,6 +188,18 @@ export function PhoneIslandPage() { }) }) + window.electron.receive(IPC_EVENTS.INTRUDE_CALL, (to: string) => { + eventDispatch(PHONE_ISLAND_EVENTS['phone-island-call-intrude'], { + to + }) + }) + + window.electron.receive(IPC_EVENTS.LISTEN_CALL, (to: string) => { + eventDispatch(PHONE_ISLAND_EVENTS['phone-island-call-listen'], { + to + }) + }) + window.electron.receive(IPC_EVENTS.RECONNECT_PHONE_ISLAND, () => { logout() }) diff --git a/src/shared/constants.ts b/src/shared/constants.ts index 5af4baf4..78c0e621 100644 --- a/src/shared/constants.ts +++ b/src/shared/constants.ts @@ -105,6 +105,8 @@ export enum IPC_EVENTS { SHOW_COMMAND_BAR = "SHOW_COMMAND_BAR", HIDE_COMMAND_BAR = "HIDE_COMMAND_BAR", CHANGE_COMMAND_BAR_SHORTCUT = "CHANGE_COMMAND_BAR_SHORTCUT", + INTRUDE_CALL = "INTRUDE_CALL", + LISTEN_CALL = "LISTEN_CALL", } //PHONE ISLAND EVENTS From 58e21b2f70ef73c313f57f8c5efe87fbe1b6ba9c Mon Sep 17 00:00:00 2001 From: Edoardo Spadoni Date: Mon, 12 Jan 2026 14:16:31 +0100 Subject: [PATCH 2/3] fix: call function with correct names --- src/main/classes/controllers/PhoneIslandController.ts | 3 +++ src/main/main.ts | 10 +++++----- src/renderer/src/pages/PhoneIslandPage.tsx | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/classes/controllers/PhoneIslandController.ts b/src/main/classes/controllers/PhoneIslandController.ts index 9d2ef403..a1ca938f 100644 --- a/src/main/classes/controllers/PhoneIslandController.ts +++ b/src/main/classes/controllers/PhoneIslandController.ts @@ -121,14 +121,17 @@ export class PhoneIslandController { } callTransfer(to: string) { + Log.info("Tranfer to", to) this.window.emit(IPC_EVENTS.TRANSFER_CALL, to) } intrudeCall(to: string) { + Log.info("Intrude to", to) this.window.emit(IPC_EVENTS.INTRUDE_CALL, to) } listenCall(to: string) { + Log.info("Listen to", to) this.window.emit(IPC_EVENTS.LISTEN_CALL, to) } diff --git a/src/main/main.ts b/src/main/main.ts index 385d858a..d265b527 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -543,15 +543,15 @@ async function attachProtocolListeners() { function handleNethLinkProtocol(url: string): Promise { //we have to define the purpose of the nethlink custom protocol Log.info('HandleProtocol Nethlink:', url) - + const cleanUrl = url.replace(/^nethlink:\/?\/?/, '') const [actionPart, queryString] = cleanUrl.split('?') const action = actionPart.toLowerCase().trim() const params = new URLSearchParams(queryString || '') const to = params.get('to') - + Log.info(`[NethLink Protocol] Action: '${action}', To: '${to}'`) - + try { switch (action) { case 'transfer': { @@ -564,14 +564,14 @@ async function attachProtocolListeners() { case 'listen': { if (to) { Log.info('Listen call to:', to) - PhoneIslandController.instance.callTransfer(to) + PhoneIslandController.instance.listenCall(to) } break; } case 'intrude': { if (to) { Log.info('Intrude call to:', to) - PhoneIslandController.instance.callTransfer(to) + PhoneIslandController.instance.intrudeCall(to) } break; } diff --git a/src/renderer/src/pages/PhoneIslandPage.tsx b/src/renderer/src/pages/PhoneIslandPage.tsx index 13873e46..510c9248 100644 --- a/src/renderer/src/pages/PhoneIslandPage.tsx +++ b/src/renderer/src/pages/PhoneIslandPage.tsx @@ -183,18 +183,21 @@ export function PhoneIslandPage() { }) window.electron.receive(IPC_EVENTS.TRANSFER_CALL, (to: string) => { + Log.info("Receive event and send Transfer to", to) eventDispatch(PHONE_ISLAND_EVENTS['phone-island-call-transfer'], { to }) }) window.electron.receive(IPC_EVENTS.INTRUDE_CALL, (to: string) => { + Log.info("Receive event and send Intrude to", to) eventDispatch(PHONE_ISLAND_EVENTS['phone-island-call-intrude'], { to }) }) window.electron.receive(IPC_EVENTS.LISTEN_CALL, (to: string) => { + Log.info("Receive event and send Listen to", to) eventDispatch(PHONE_ISLAND_EVENTS['phone-island-call-listen'], { to }) From a483c0038d08f4a1e11b090db73dbf8ba0d843c3 Mon Sep 17 00:00:00 2001 From: Antonio Date: Tue, 13 Jan 2026 10:51:43 +0100 Subject: [PATCH 3/3] chore(dep): update phone-island --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5320e924..3e1c6bf8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "@nethesis/nethesis-brands-svg-icons": "github:nethesis/Font-Awesome#ns-brands", "@nethesis/nethesis-light-svg-icons": "github:nethesis/Font-Awesome#ns-light", "@nethesis/nethesis-solid-svg-icons": "github:nethesis/Font-Awesome#ns-solid", - "@nethesis/phone-island": "^0.18.1", + "@nethesis/phone-island": "^0.18.2", "@tailwindcss/forms": "^0.5.7", "@types/lodash": "^4.14.202", "@types/node": "^18.19.9", @@ -5641,9 +5641,9 @@ } }, "node_modules/@nethesis/phone-island": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@nethesis/phone-island/-/phone-island-0.18.1.tgz", - "integrity": "sha512-kqV7BnPvireD0078MDqqqWwUAc0Qqci7YfW78wu4Am9uDoSabM+mc+TGiIBlS+9dAj5Md53aBH99SUsPTpWAuA==", + "version": "0.18.2", + "resolved": "https://registry.npmjs.org/@nethesis/phone-island/-/phone-island-0.18.2.tgz", + "integrity": "sha512-tvRQfc3LE48lVJu2McTw8ifDH6unTHc3/GqUjlgwGX05gAEPjCFicKoLh3b5YnfjOUxcKmltIE1yLqZCAmTUOw==", "dev": true, "license": "GPL-3.0-or-later", "dependencies": { diff --git a/package.json b/package.json index 85ec9265..f590770a 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@nethesis/nethesis-brands-svg-icons": "github:nethesis/Font-Awesome#ns-brands", "@nethesis/nethesis-light-svg-icons": "github:nethesis/Font-Awesome#ns-light", "@nethesis/nethesis-solid-svg-icons": "github:nethesis/Font-Awesome#ns-solid", - "@nethesis/phone-island": "^0.18.1", + "@nethesis/phone-island": "^0.18.2", "@tailwindcss/forms": "^0.5.7", "@types/lodash": "^4.14.202", "@types/node": "^18.19.9",