diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d517940..18c3502 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,10 +45,7 @@ jobs: artifacts: "dist/*-win-installer.exe,dist/*-win-portable.exe" build_mac: - strategy: - matrix: - os: [ macos-15, macos-15-intel ] - runs-on: ${{ matrix.os }} + runs-on: macos-13 permissions: contents: write steps: @@ -83,7 +80,7 @@ jobs: replacesArtifacts: true omitDraftDuringUpdate: true omitNameDuringUpdate: true - artifacts: "dist/*-mac-*.dmg" + artifacts: "dist/*-mac.dmg" build_linux: runs-on: ubuntu-latest diff --git a/electron/main.js b/electron/main.js index bdaa0cc..1c70182 100644 --- a/electron/main.js +++ b/electron/main.js @@ -22,27 +22,6 @@ ipcMain.handle('alert', async(event, message) => { }); }); -// add support for showing a confirm window via ipc -ipcMain.handle('confirm', async(event, message) => { - - // show confirm dialog - const result = await dialog.showMessageBox(mainWindow, { - type: "question", - title: "Confirm", - message: message, - cancelId: 0, // esc key should press cancel button - defaultId: 1, // enter key should press ok button - buttons: [ - "Cancel", // 0 - "OK", // 1 - ], - }); - - // check if user clicked OK - return result.response === 1; - -}); - // add support for showing a prompt window via ipc ipcMain.handle('prompt', async(event, message) => { return await electronPrompt({ diff --git a/electron/preload.js b/electron/preload.js index 5465420..8abc460 100644 --- a/electron/preload.js +++ b/electron/preload.js @@ -15,11 +15,6 @@ contextBridge.exposeInMainWorld('electron', { return await ipcRenderer.invoke('alert', message); }, - // show a confirm dialog in electron browser window, this fixes a bug where confirm breaks input fields on windows - confirm: async function(message) { - return await ipcRenderer.invoke('confirm', message); - }, - // add support for using "prompt" in electron browser window prompt: async function(message) { return await ipcRenderer.invoke('prompt', message); diff --git a/meshchat.py b/meshchat.py index 448c7a3..a6d92db 100644 --- a/meshchat.py +++ b/meshchat.py @@ -4,7 +4,6 @@ import argparse import io import json import os -import platform import sys import threading import time @@ -945,7 +944,6 @@ class ReticulumMeshChat: "version": self.get_app_version(), "lxmf_version": LXMF.__version__, "rns_version": RNS.__version__, - "python_version": platform.python_version(), "storage_path": self.storage_path, "database_path": self.database_path, "database_file_size": os.path.getsize(self.database_path), @@ -980,10 +978,6 @@ class ReticulumMeshChat: @routes.post("/api/v1/reticulum/enable-transport") async def index(request): - # ensure reticulum section exists - if "reticulum" not in self.reticulum.config: - self.reticulum.config["reticulum"] = {} - # enable transport mode self.reticulum.config["reticulum"]["enable_transport"] = True self.reticulum.config.write() @@ -996,10 +990,6 @@ class ReticulumMeshChat: @routes.post("/api/v1/reticulum/disable-transport") async def index(request): - # ensure reticulum section exists - if "reticulum" not in self.reticulum.config: - self.reticulum.config["reticulum"] = {} - # disable transport mode self.reticulum.config["reticulum"]["enable_transport"] = False self.reticulum.config.write() @@ -1733,10 +1723,6 @@ class ReticulumMeshChat: if "transport_id" in interface_stats: interface_stats["transport_id"] = interface_stats["transport_id"].hex() - # ensure network_id is hex as json_response can't serialize bytes - if "network_id" in interface_stats and interface_stats["network_id"] is not None: - interface_stats["network_id"] = interface_stats["network_id"].hex() - # ensure probe_responder is hex as json_response can't serialize bytes if "probe_responder" in interface_stats and interface_stats["probe_responder"] is not None: interface_stats["probe_responder"] = interface_stats["probe_responder"].hex() @@ -2052,9 +2038,6 @@ class ReticulumMeshChat: # called when web app has started async def on_startup(app): - # remember main event loop - AsyncUtils.set_main_loop(asyncio.get_event_loop()) - # auto launch web browser if launch_browser: try: @@ -3039,11 +3022,10 @@ class ReticulumMeshChat: has_delivered = lxmf_message.state == LXMF.LXMessage.DELIVERED has_propagated = lxmf_message.state == LXMF.LXMessage.SENT and lxmf_message.method == LXMF.LXMessage.PROPAGATED has_failed = lxmf_message.state == LXMF.LXMessage.FAILED - has_rejected = lxmf_message.state == LXMF.LXMessage.REJECTED is_cancelled = lxmf_message.state == LXMF.LXMessage.CANCELLED # check if we should stop updating - if has_delivered or has_propagated or has_failed or has_rejected or is_cancelled: + if has_delivered or has_propagated or has_failed or is_cancelled: should_update_message = False # handle an announce received from reticulum, for an audio call address @@ -3570,31 +3552,12 @@ class NomadnetFileDownloader(NomadnetDownloader): self.on_file_download_success(file_name, file_data) return - # check for list response with bytes in position 0, and metadata dict in position 1 - # e.g: [file_bytes, {name: "filename.ext"}] - if isinstance(response, list) and isinstance(response[1], dict): - - file_data: bytes = response[0] - metadata: dict = response[1] - - # get file name from metadata - file_name = "downloaded_file" - if metadata is not None and "name" in metadata: - file_path = metadata["name"].decode("utf-8") - file_name = os.path.basename(file_path) - - self.on_file_download_success(file_name, file_data) - return - - # try using original response format + # original response format # unsure if this is actually used anymore now that a buffered reader is provided # have left here just in case... - try: - file_name: str = response[0] - file_data: bytes = response[1] - self.on_file_download_success(file_name, file_data) - except: - self.on_download_failure("unsupported_response") + file_name: str = response[0] + file_data: bytes = response[1] + self.on_file_download_success(file_name, file_data) # page download failed, send error to provided callback def on_download_failure(self, failure_reason): diff --git a/package-lock.json b/package-lock.json index f0dcc41..c31e9de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "reticulum-meshchat", - "version": "2.4.0", + "version": "2.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "reticulum-meshchat", - "version": "2.4.0", + "version": "2.2.0", "license": "MIT", "dependencies": { "@mdi/js": "^7.4.47", @@ -17,7 +17,7 @@ "click-outside-vue3": "^4.0.1", "compressorjs": "^1.2.1", "electron-prompt": "^1.7.0", - "micron-parser": "^1.1.0", + "micron-parser": "^1.0.2", "mitt": "^3.0.1", "moment": "^2.30.1", "postcss": "^8.4.49", @@ -4184,10 +4184,9 @@ } }, "node_modules/micron-parser": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/micron-parser/-/micron-parser-1.1.0.tgz", - "integrity": "sha512-v1CXQkmuxRDz6N0EWcUhPq+FzZ4RBXPO7zEuhrRIBsnOZBjXSZosSRYQyU53DNAPL5SR+xRRFDCGhvR0cexf8A==", - "license": "MIT", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/micron-parser/-/micron-parser-1.0.2.tgz", + "integrity": "sha512-lYrEolylOUXeSISYrPRW/ZZAH1dpZRyTJ0VzQIA4cWJy0yNCXUUs+ujuAwV2OYlAPH8tCE1Z22+zg04Ilp/JWg==", "dependencies": { "dompurify": "*" } diff --git a/package.json b/package.json index f102884..9f66a11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reticulum-meshchat", - "version": "2.4.0", + "version": "2.2.0", "description": "", "main": "electron/main.js", "scripts": { @@ -33,7 +33,7 @@ "mac": { "target": "dmg", "identity": null, - "artifactName": "ReticulumMeshChat-v${version}-${os}-${arch}.${ext}", + "artifactName": "ReticulumMeshChat-v${version}-${os}.${ext}", "extendInfo": { "NSMicrophoneUsageDescription": "Microphone access is only needed for Audio Calls", "com.apple.security.device.audio-input": true @@ -102,7 +102,7 @@ "click-outside-vue3": "^4.0.1", "compressorjs": "^1.2.1", "electron-prompt": "^1.7.0", - "micron-parser": "^1.1.0", + "micron-parser": "^1.0.2", "mitt": "^3.0.1", "moment": "^2.30.1", "postcss": "^8.4.49", diff --git a/requirements.txt b/requirements.txt index a72e138..7b3f950 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -aiohttp>=3.13.3 +aiohttp>=3.9.5 cx_freeze>=7.0.0 -lxmf>=1.0.1 -peewee>=3.18.1,<4.0.0 -rns>=1.3.7 -websockets>=16.0 +lxmf>=0.8.0 +peewee>=3.17.3 +rns>=1.0.0 +websockets>=14.2 diff --git a/src/backend/async_utils.py b/src/backend/async_utils.py index b8feaca..d20d507 100644 --- a/src/backend/async_utils.py +++ b/src/backend/async_utils.py @@ -1,25 +1,25 @@ import asyncio -from typing import Coroutine class AsyncUtils: - # remember main loop - main_loop: asyncio.AbstractEventLoop | None = None - - @staticmethod - def set_main_loop(loop: asyncio.AbstractEventLoop): - AsyncUtils.main_loop = loop - # this method allows running the provided async coroutine from within a sync function - # it will run the async function on the main event loop if possible, otherwise it logs a warning + # it will run the async function on the existing event loop if available, otherwise it will start a new event loop @staticmethod - def run_async(coroutine: Coroutine): + def run_async(coroutine): - # run provided coroutine on main event loop, ensuring thread safety - if AsyncUtils.main_loop and AsyncUtils.main_loop.is_running(): - asyncio.run_coroutine_threadsafe(coroutine, AsyncUtils.main_loop) + # attempt to get existing event loop + existing_event_loop = None + try: + existing_event_loop = asyncio.get_running_loop() + except RuntimeError: + # 'RuntimeError: no running event loop' + pass + + # if there is an existing event loop running, submit the coroutine to that loop + if existing_event_loop and existing_event_loop.is_running(): + existing_event_loop.create_task(coroutine) return - # main event loop not running... - print("WARNING: Main event loop not available. Could not schedule task.") + # otherwise start a new event loop to run the coroutine + asyncio.run(coroutine) diff --git a/src/frontend/components/App.vue b/src/frontend/components/App.vue index 3e69308..ff92964 100644 --- a/src/frontend/components/App.vue +++ b/src/frontend/components/App.vue @@ -448,7 +448,7 @@ export default { // ask to stop syncing if already syncing if(this.isSyncingPropagationNode){ - if(await DialogUtils.confirm("Are you sure you want to stop syncing?")){ + if(confirm("Are you sure you want to stop syncing?")){ await this.stopSyncingPropagationNode(); } return; @@ -529,7 +529,7 @@ export default { async hangupAllCalls() { // confirm user wants to hang up calls - if(!await DialogUtils.confirm("Are you sure you want to hang up all incoming and outgoing calls?")){ + if(!confirm("Are you sure you want to hang up all incoming and outgoing calls?")){ return; } diff --git a/src/frontend/components/about/AboutPage.vue b/src/frontend/components/about/AboutPage.vue index 1a5bc36..d12c96d 100644 --- a/src/frontend/components/about/AboutPage.vue +++ b/src/frontend/components/about/AboutPage.vue @@ -12,7 +12,7 @@