Compare commits

..

3 Commits

Author SHA1 Message Date
df85e7fa7e Add maintainer information to package.json 2025-10-01 15:54:06 -05:00
f60daddaea temp 2025-10-01 15:47:43 -05:00
fbdcaef6e8 Add debian packaging support. 2025-10-01 15:47:06 -05:00
14 changed files with 819 additions and 1968 deletions

View File

@@ -1,55 +0,0 @@
# Documentation
README.md
LICENSE
donate.md
screenshots/
# Development files
.github/
electron/
# Build artifacts and cache
public/
node_modules/
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
env/
venv/
ENV/
env.bak/
venv.bak/
# IDE and editor files
.vscode/
.idea/
*.swp
*.swo
*~
# OS files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Git
.git/
.gitignore
# Docker files
Dockerfile*
docker-compose*.yml
.dockerignore
# Logs
*.log
# Temporary files
*.tmp
*.temp

View File

@@ -1,20 +0,0 @@
name: Bearer PR Check
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
security-events: write
jobs:
rule_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Bearer
uses: bearer/bearer-action@828eeb928ce2f4a7ca5ed57fb8b59508cb8c79bc # v2
with:
diff: true

View File

@@ -1,29 +0,0 @@
name: Bearer Master
on:
push:
branches:
- master
permissions:
security-events: write
jobs:
rule_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Bearer
uses: bearer/bearer-action@828eeb928ce2f4a7ca5ed57fb8b59508cb8c79bc # v2
with:
format: sarif
output: results.sarif
- name: Upload SARIF file
if: always()
uses: github/codeql-action/upload-sarif@2827891b2e5e0510dceab8c3619f4fe255451277 # v4
with:
sarif_file: results.sarif
category: bearer-security-scan

View File

@@ -12,53 +12,15 @@ jobs:
contents: write
steps:
- name: Clone Repo
uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
uses: actions/checkout@v1
- name: Install NodeJS
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e # v1
with:
node-version: 22
- name: Install Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.13"
- name: Install Python Deps
run: pip install -r requirements.txt
- name: Install NodeJS Deps
run: npm install
- name: Build Electron App
run: npm run dist
- name: Create Release
id: create_release
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1
with:
draft: true
allowUpdates: true
replacesArtifacts: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
artifacts: "dist/*-win-installer.exe,dist/*-win-portable.exe"
build_mac:
runs-on: macos-13
permissions:
contents: write
steps:
- name: Clone Repo
uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
- name: Install NodeJS
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e # v1
uses: actions/setup-node@v1
with:
node-version: 18
- name: Install Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
uses: actions/setup-python@v5
with:
python-version: "3.11"
@@ -73,7 +35,45 @@ jobs:
- name: Create Release
id: create_release
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1
uses: ncipollo/release-action@v1
with:
draft: true
allowUpdates: true
replacesArtifacts: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
artifacts: "dist/*-win-installer.exe,dist/*-win-portable.exe"
build_mac:
runs-on: macos-13
permissions:
contents: write
steps:
- name: Clone Repo
uses: actions/checkout@v1
- name: Install NodeJS
uses: actions/setup-node@v1
with:
node-version: 18
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Python Deps
run: pip install -r requirements.txt
- name: Install NodeJS Deps
run: npm install
- name: Build Electron App
run: npm run dist
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
draft: true
allowUpdates: true
@@ -88,17 +88,17 @@ jobs:
contents: write
steps:
- name: Clone Repo
uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
uses: actions/checkout@v1
- name: Install NodeJS
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e # v1
uses: actions/setup-node@v1
with:
node-version: 22
node-version: 18
- name: Install Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
uses: actions/setup-python@v5
with:
python-version: "3.13"
python-version: "3.11"
- name: Install Python Deps
run: pip install -r requirements.txt
@@ -111,7 +111,7 @@ jobs:
- name: Create Release
id: create_release
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1
uses: ncipollo/release-action@v1
with:
draft: true
allowUpdates: true
@@ -127,34 +127,31 @@ jobs:
contents: read
steps:
- name: Clone Repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Set lowercase repository owner
run: echo "REPO_OWNER_LC=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
uses: docker/setup-buildx-action@v3
- name: Log in to the GitHub Container registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: >-
ghcr.io/${{ env.REPO_OWNER_LC }}/reticulum-meshchat:latest,
ghcr.io/${{ env.REPO_OWNER_LC }}/reticulum-meshchat:${{ github.ref_name }}
labels: >-
org.opencontainers.image.title=Reticulum MeshChat,
org.opencontainers.image.description=Docker image for Reticulum MeshChat,
tags: |
ghcr.io/${{ github.repository }}/reticulum-meshchat:latest
ghcr.io/${{ github.repository }}/reticulum-meshchat:${{ github.ref_name }}
labels: |
org.opencontainers.image.title=Reticulum MeshChat
org.opencontainers.image.description=Docker image for Reticulum MeshChat
org.opencontainers.image.url=https://github.com/${{ github.repository }}/pkgs/container/reticulum-meshchat/

View File

@@ -11,35 +11,32 @@ jobs:
contents: read
steps:
- name: Clone Repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Set lowercase repository owner
run: echo "REPO_OWNER_LC=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
uses: docker/setup-buildx-action@v3
- name: Log in to the GitHub Container registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: >-
ghcr.io/${{ env.REPO_OWNER_LC }}/reticulum-meshchat:latest,
ghcr.io/${{ env.REPO_OWNER_LC }}/reticulum-meshchat:${{ github.ref_name }}
labels: >-
org.opencontainers.image.title=Reticulum MeshChat,
org.opencontainers.image.description=Docker image for Reticulum MeshChat,
org.opencontainers.image.url=https://github.com/${{ github.repository }}/pkgs/container/reticulum-meshchat/
tags: |
ghcr.io/liamcottle/reticulum-meshchat:latest
ghcr.io/liamcottle/reticulum-meshchat:${{ github.ref_name }}
labels: |
org.opencontainers.image.title=Reticulum MeshChat
org.opencontainers.image.description=Docker image for Reticulum MeshChat
org.opencontainers.image.url=https://github.com/liamcottle/reticulum-meshchat/pkgs/container/reticulum-meshchat/

2
.gitignore vendored
View File

@@ -9,5 +9,3 @@ node_modules
# local storage
storage/
*.pyc

View File

@@ -1,11 +1,5 @@
# Build arguments
ARG NODE_VERSION=20
ARG NODE_ALPINE_SHA256=sha256:6a91081a440be0b57336fbc4ee87f3dab1a2fd6f80cdb355dcf960e13bda3b59
ARG PYTHON_VERSION=3.11
ARG PYTHON_ALPINE_SHA256=sha256:822ceb965f026bc47ee667e50a44309d2d81087780bbbf64f2005521781a3621
# Build the frontend
FROM node:${NODE_VERSION}-alpine@${NODE_ALPINE_SHA256} AS build-frontend
FROM node:20-bookworm-slim AS build-frontend
WORKDIR /src
@@ -19,19 +13,13 @@ RUN npm install --omit=dev && \
npm run build-frontend
# Main app build
FROM python:${PYTHON_VERSION}-alpine@${PYTHON_ALPINE_SHA256}
FROM python:3.11-bookworm
WORKDIR /app
# Install Python deps
COPY ./requirements.txt .
RUN apk add --no-cache --virtual .build-deps \
gcc \
musl-dev \
linux-headers \
python3-dev && \
pip install -r requirements.txt && \
apk del .build-deps
RUN pip install -r requirements.txt
# Copy prebuilt frontend
COPY --from=build-frontend /src/public public

View File

@@ -22,7 +22,6 @@ import webbrowser
from peewee import SqliteDatabase
from serial.tools import list_ports
import psutil
import database
from src.backend.announce_handler import AnnounceHandler
@@ -148,12 +147,6 @@ class ReticulumMeshChat:
# remember websocket clients
self.websocket_clients: List[web.WebSocketResponse] = []
# track announce timestamps for rate calculation
self.announce_timestamps = []
# track download speeds for nomadnetwork files (list of tuples: (file_size_bytes, duration_seconds))
self.download_speeds = []
# register audio call identity
self.audio_call_manager = AudioCallManager(identity=self.identity)
self.audio_call_manager.register_incoming_call_callback(self.on_incoming_audio_call)
@@ -381,13 +374,6 @@ class ReticulumMeshChat:
if "interface_enabled" in interface:
interface["interface_enabled"] = "true"
keys_to_remove = []
for key, value in interface.items():
if value is None:
keys_to_remove.append(key)
for key in keys_to_remove:
del interface[key]
# save config
self.reticulum.config.write()
@@ -411,13 +397,6 @@ class ReticulumMeshChat:
if "interface_enabled" in interface:
interface["interface_enabled"] = "false"
keys_to_remove = []
for key, value in interface.items():
if value is None:
keys_to_remove.append(key)
for key in keys_to_remove:
del interface[key]
# save config
self.reticulum.config.write()
@@ -529,7 +508,7 @@ class ReticulumMeshChat:
# handle I2P interface
if interface_type == "I2PInterface":
interface_details['connectable'] = "True"
InterfaceEditor.update_value(interface_details, data, "peers")
interface_details["peers"] = data.get('peers')
# handle tcp server interface
if interface_type == "TCPServerInterface":
@@ -961,34 +940,6 @@ class ReticulumMeshChat:
# get app info
@routes.get("/api/v1/app/info")
async def index(request):
# Get memory usage for current process
process = psutil.Process()
memory_info = process.memory_info()
# Get network I/O statistics
net_io = psutil.net_io_counters()
# Get total paths
path_table = self.reticulum.get_path_table()
total_paths = len(path_table)
# Calculate announce rates
current_time = time.time()
announces_per_second = len([t for t in self.announce_timestamps if current_time - t <= 1.0])
announces_per_minute = len([t for t in self.announce_timestamps if current_time - t <= 60.0])
announces_per_hour = len([t for t in self.announce_timestamps if current_time - t <= 3600.0])
# Clean up old announce timestamps (older than 1 hour)
self.announce_timestamps = [t for t in self.announce_timestamps if current_time - t <= 3600.0]
# Calculate average download speed
avg_download_speed_bps = None
if self.download_speeds:
total_bytes = sum(size for size, _ in self.download_speeds)
total_duration = sum(duration for _, duration in self.download_speeds)
if total_duration > 0:
avg_download_speed_bps = total_bytes / total_duration
return web.json_response({
"app_info": {
"version": self.get_app_version(),
@@ -1001,25 +952,6 @@ class ReticulumMeshChat:
"reticulum_config_path": self.reticulum.configpath,
"is_connected_to_shared_instance": self.reticulum.is_connected_to_shared_instance,
"is_transport_enabled": self.reticulum.transport_enabled(),
"memory_usage": {
"rss": memory_info.rss, # Resident Set Size (bytes)
"vms": memory_info.vms, # Virtual Memory Size (bytes)
},
"network_stats": {
"bytes_sent": net_io.bytes_sent,
"bytes_recv": net_io.bytes_recv,
"packets_sent": net_io.packets_sent,
"packets_recv": net_io.packets_recv,
},
"reticulum_stats": {
"total_paths": total_paths,
"announces_per_second": announces_per_second,
"announces_per_minute": announces_per_minute,
"announces_per_hour": announces_per_hour,
},
"download_stats": {
"avg_download_speed_bps": avg_download_speed_bps,
},
},
})
@@ -2299,16 +2231,6 @@ class ReticulumMeshChat:
# handle successful file download
def on_file_download_success(file_name, file_bytes):
# Track download speed
download_size = len(file_bytes)
if hasattr(downloader, 'start_time') and downloader.start_time:
download_duration = time.time() - downloader.start_time
if download_duration > 0:
self.download_speeds.append((download_size, download_duration))
# Keep only last 100 downloads for average calculation
if len(self.download_speeds) > 100:
self.download_speeds.pop(0)
AsyncUtils.run_async(client.send_str(json.dumps({
"type": "nomadnet.file.download",
"nomadnet_file_download": {
@@ -2346,7 +2268,6 @@ class ReticulumMeshChat:
# download the file
downloader = NomadnetFileDownloader(destination_hash, file_path, on_file_download_success, on_file_download_failure, on_file_download_progress)
downloader.start_time = time.time()
AsyncUtils.run_async(downloader.download())
# handle downloading a page from a nomadnet node
@@ -3119,9 +3040,6 @@ class ReticulumMeshChat:
# log received announce
print("Received an announce from " + RNS.prettyhexrep(destination_hash) + " for [call.audio]")
# track announce timestamp
self.announce_timestamps.append(time.time())
# upsert announce to database
self.db_upsert_announce(announced_identity, destination_hash, aspect, app_data, announce_packet_hash)
@@ -3143,9 +3061,6 @@ class ReticulumMeshChat:
# log received announce
print("Received an announce from " + RNS.prettyhexrep(destination_hash) + " for [lxmf.delivery]")
# track announce timestamp
self.announce_timestamps.append(time.time())
# upsert announce to database
self.db_upsert_announce(announced_identity, destination_hash, aspect, app_data, announce_packet_hash)
@@ -3171,9 +3086,6 @@ class ReticulumMeshChat:
# log received announce
print("Received an announce from " + RNS.prettyhexrep(destination_hash) + " for [lxmf.propagation]")
# track announce timestamp
self.announce_timestamps.append(time.time())
# upsert announce to database
self.db_upsert_announce(announced_identity, destination_hash, aspect, app_data, announce_packet_hash)
@@ -3258,9 +3170,6 @@ class ReticulumMeshChat:
# log received announce
print("Received an announce from " + RNS.prettyhexrep(destination_hash) + " for [nomadnetwork.node]")
# track announce timestamp
self.announce_timestamps.append(time.time())
# upsert announce to database
self.db_upsert_announce(announced_identity, destination_hash, aspect, app_data, announce_packet_hash)

2172
package-lock.json generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "reticulum-meshchat",
"version": "2.32.0",
"version": "2.2.1",
"description": "",
"main": "electron/main.js",
"scripts": {
@@ -17,7 +17,7 @@
"node": ">=18"
},
"devDependencies": {
"electron": "^35.7.5",
"electron": "^30.0.8",
"electron-builder": "^24.6.3"
},
"build": {
@@ -102,7 +102,7 @@
"@tailwindcss/forms": "^0.5.9",
"@vitejs/plugin-vue": "^5.2.1",
"autoprefixer": "^10.4.20",
"axios": "^1.12.0",
"axios": "^1.10.0",
"click-outside-vue3": "^4.0.1",
"compressorjs": "^1.2.1",
"electron-prompt": "^1.7.0",
@@ -114,7 +114,7 @@
"tailwindcss": "^3.4.17",
"vis-data": "^7.1.9",
"vis-network": "^9.1.9",
"vite": "^6.4.1",
"vite": "^6.0.5",
"vite-plugin-vuetify": "^2.0.4",
"vue-router": "^4.5.0",
"vuetify": "^3.7.6"

View File

@@ -1,7 +1,6 @@
aiohttp>=3.12.14
cx_freeze>=7.0.0
lxmf>=0.9.2
lxmf>=0.8.0
peewee>=3.18.1
psutil>=7.1.3
rns>=1.0.2
rns>=1.0.0
websockets>=14.2

View File

@@ -64,141 +64,6 @@
</div>
</div>
<!-- system resources -->
<div v-if="appInfo && appInfo.memory_usage" class="bg-white dark:bg-zinc-900 rounded shadow">
<div class="flex border-b border-gray-300 dark:border-zinc-700 text-gray-700 dark:text-zinc-200 p-2 font-semibold">
System Resources
<span class="ml-auto text-xs text-green-600 dark:text-green-400 flex items-center">
<span class="w-2 h-2 bg-green-500 rounded-full mr-1 animate-pulse"></span>
Live
</span>
</div>
<div class="divide-y divide-gray-200 dark:divide-zinc-800 text-gray-900 dark:text-zinc-200">
<!-- memory usage -->
<div class="flex p-1">
<div class="mr-auto">
<div>Memory Usage (RSS)</div>
<div class="text-sm text-gray-700 dark:text-zinc-400">{{ formatBytes(appInfo.memory_usage.rss) }}</div>
</div>
</div>
<!-- virtual memory -->
<div class="flex p-1">
<div class="mr-auto">
<div>Virtual Memory Size</div>
<div class="text-sm text-gray-700 dark:text-zinc-400">{{ formatBytes(appInfo.memory_usage.vms) }}</div>
</div>
</div>
</div>
</div>
<!-- network statistics -->
<div v-if="appInfo && appInfo.network_stats" class="bg-white dark:bg-zinc-900 rounded shadow">
<div class="flex border-b border-gray-300 dark:border-zinc-700 text-gray-700 dark:text-zinc-200 p-2 font-semibold">
Network Statistics
<span class="ml-auto text-xs text-green-600 dark:text-green-400 flex items-center">
<span class="w-2 h-2 bg-green-500 rounded-full mr-1 animate-pulse"></span>
Live
</span>
</div>
<div class="divide-y divide-gray-200 dark:divide-zinc-800 text-gray-900 dark:text-zinc-200">
<!-- bytes sent -->
<div class="flex p-1">
<div class="mr-auto">
<div>Data Sent</div>
<div class="text-sm text-gray-700 dark:text-zinc-400">{{ formatBytes(appInfo.network_stats.bytes_sent) }}</div>
</div>
</div>
<!-- bytes received -->
<div class="flex p-1">
<div class="mr-auto">
<div>Data Received</div>
<div class="text-sm text-gray-700 dark:text-zinc-400">{{ formatBytes(appInfo.network_stats.bytes_recv) }}</div>
</div>
</div>
<!-- packets sent -->
<div class="p-1">
<div>Packets Sent</div>
<div class="text-sm text-gray-700 dark:text-zinc-400">{{ formatNumber(appInfo.network_stats.packets_sent) }}</div>
</div>
<!-- packets received -->
<div class="p-1">
<div>Packets Received</div>
<div class="text-sm text-gray-700 dark:text-zinc-400">{{ formatNumber(appInfo.network_stats.packets_recv) }}</div>
</div>
</div>
</div>
<!-- reticulum statistics -->
<div v-if="appInfo && appInfo.reticulum_stats" class="bg-white dark:bg-zinc-900 rounded shadow">
<div class="flex border-b border-gray-300 dark:border-zinc-700 text-gray-700 dark:text-zinc-200 p-2 font-semibold">
Reticulum Statistics
<span class="ml-auto text-xs text-green-600 dark:text-green-400 flex items-center">
<span class="w-2 h-2 bg-green-500 rounded-full mr-1 animate-pulse"></span>
Live
</span>
</div>
<div class="divide-y divide-gray-200 dark:divide-zinc-800 text-gray-900 dark:text-zinc-200">
<!-- total paths -->
<div class="p-1">
<div>Total Paths</div>
<div class="text-sm text-gray-700 dark:text-zinc-400">{{ formatNumber(appInfo.reticulum_stats.total_paths) }}</div>
</div>
<!-- announces per second -->
<div class="p-1">
<div>Announces per Second</div>
<div class="text-sm text-gray-700 dark:text-zinc-400">{{ formatNumber(appInfo.reticulum_stats.announces_per_second) }}</div>
</div>
<!-- announces per minute -->
<div class="p-1">
<div>Announces per Minute</div>
<div class="text-sm text-gray-700 dark:text-zinc-400">{{ formatNumber(appInfo.reticulum_stats.announces_per_minute) }}</div>
</div>
<!-- announces per hour -->
<div class="p-1">
<div>Announces per Hour</div>
<div class="text-sm text-gray-700 dark:text-zinc-400">{{ formatNumber(appInfo.reticulum_stats.announces_per_hour) }}</div>
</div>
</div>
</div>
<!-- download statistics -->
<div v-if="appInfo && appInfo.download_stats" class="bg-white dark:bg-zinc-900 rounded shadow">
<div class="flex border-b border-gray-300 dark:border-zinc-700 text-gray-700 dark:text-zinc-200 p-2 font-semibold">
Download Statistics
<span class="ml-auto text-xs text-green-600 dark:text-green-400 flex items-center">
<span class="w-2 h-2 bg-green-500 rounded-full mr-1 animate-pulse"></span>
Live
</span>
</div>
<div class="divide-y divide-gray-200 dark:divide-zinc-800 text-gray-900 dark:text-zinc-200">
<!-- average download speed -->
<div class="p-1">
<div>Average Download Speed</div>
<div class="text-sm text-gray-700 dark:text-zinc-400">
<span v-if="appInfo.download_stats.avg_download_speed_bps !== null">
{{ formatBytesPerSecond(appInfo.download_stats.avg_download_speed_bps) }}
</span>
<span v-else>No downloads yet</span>
</div>
</div>
</div>
</div>
<!-- reticulum status -->
<div v-if="appInfo" class="bg-white dark:bg-zinc-900 rounded shadow">
<div class="flex border-b border-gray-300 dark:border-zinc-700 text-gray-700 dark:text-zinc-200 p-2 font-semibold">Reticulum Status</div>
@@ -261,21 +126,11 @@ export default {
return {
appInfo: null,
config: null,
updateInterval: null,
};
},
mounted() {
this.getAppInfo();
this.getConfig();
// Update stats every 5 seconds
this.updateInterval = setInterval(() => {
this.getAppInfo();
}, 5000);
},
beforeUnmount() {
if (this.updateInterval) {
clearInterval(this.updateInterval);
}
},
methods: {
async getAppInfo() {
@@ -311,12 +166,6 @@ export default {
formatBytes: function(bytes) {
return Utils.formatBytes(bytes);
},
formatNumber: function(num) {
return Utils.formatNumber(num);
},
formatBytesPerSecond: function(bytesPerSecond) {
return Utils.formatBytesPerSecond(bytesPerSecond);
},
},
computed: {
isElectron() {

View File

@@ -124,12 +124,7 @@
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
</div>
<div class="my-auto">
Downloading: {{ nodeFilePath }} ({{ nodeFileProgress }}%)
<span v-if="nodeFileDownloadSpeed !== null" class="ml-2 text-sm">
- {{ formatBytesPerSecond(nodeFileDownloadSpeed) }}
</span>
</div>
<div class="my-auto">Downloading: {{ nodeFilePath }} ({{ nodeFileProgress }}%)</div>
</div>
</div>
@@ -184,7 +179,6 @@ import DialogUtils from "../../js/DialogUtils";
import WebSocketConnection from "../../js/WebSocketConnection";
import NomadNetworkSidebar from "./NomadNetworkSidebar.vue";
import GlobalEmitter from "../../js/GlobalEmitter";
import Utils from "../../js/Utils";
export default {
name: 'NomadNetworkPage',
@@ -219,10 +213,6 @@ export default {
isDownloadingNodeFile: false,
nodeFilePath: null,
nodeFileProgress: 0,
nodeFileDownloadStartTime: null,
nodeFileLastProgressTime: null,
nodeFileLastProgressValue: 0,
nodeFileDownloadSpeed: null,
nomadnetPageDownloadCallbacks: {},
nomadnetFileDownloadCallbacks: {},
@@ -766,72 +756,26 @@ export default {
this.isDownloadingNodeFile = true;
this.nodeFilePath = parsedUrl.path.split("/").pop();
this.nodeFileProgress = 0;
this.nodeFileDownloadStartTime = Date.now();
this.nodeFileLastProgressTime = Date.now();
this.nodeFileLastProgressValue = 0;
this.nodeFileDownloadSpeed = null;
// start file download
this.downloadNomadNetFile(destinationHash, parsedUrl.path, (fileName, fileBytesBase64) => {
// Calculate final download speed based on actual file size
if (this.nodeFileDownloadStartTime) {
const totalTime = (Date.now() - this.nodeFileDownloadStartTime) / 1000; // seconds
const fileSizeBytes = atob(fileBytesBase64).length;
if (totalTime > 0) {
this.nodeFileDownloadSpeed = fileSizeBytes / totalTime;
}
}
// no longer downloading
this.isDownloadingNodeFile = false;
// download file to browser
this.downloadFileFromBase64(fileName, fileBytesBase64);
// Clear speed after a moment
setTimeout(() => {
this.nodeFileDownloadSpeed = null;
}, 2000);
}, (failureReason) => {
// no longer downloading
this.isDownloadingNodeFile = false;
this.nodeFileDownloadSpeed = null;
// show error message
DialogUtils.alert(`Failed to download file: ${failureReason}`);
}, (progress) => {
const currentTime = Date.now();
const progressValue = progress;
this.nodeFileProgress = Math.round(progressValue * 100);
// Calculate estimated download speed based on progress rate
if (this.nodeFileDownloadStartTime && progressValue > 0) {
const elapsedTime = (currentTime - this.nodeFileDownloadStartTime) / 1000; // seconds
if (elapsedTime > 0.5) { // Only calculate after at least 0.5 seconds
// Estimate total file size based on progress rate
// If we've downloaded progressValue in elapsedTime, estimate total time
const estimatedTotalTime = elapsedTime / progressValue;
// Estimate file size based on average download speed assumption
// We'll refine this when download completes with actual size
// For now, estimate based on typical mesh network file sizes (100KB-10MB range)
// Use a conservative estimate that will be updated when download completes
const estimatedFileSize = 500 * 1024; // Start with 500KB estimate
const estimatedBytesDownloaded = estimatedFileSize * progressValue;
const estimatedSpeed = estimatedBytesDownloaded / elapsedTime;
// Only update if we have a reasonable estimate
if (estimatedSpeed > 0 && estimatedSpeed < 100 * 1024 * 1024) { // Cap at 100MB/s
this.nodeFileDownloadSpeed = estimatedSpeed;
}
}
}
this.nodeFileLastProgressTime = currentTime;
this.nodeFileLastProgressValue = progressValue;
this.nodeFileProgress = Math.round(progress * 100);
});
return;
@@ -885,9 +829,6 @@ export default {
setTimeout(() => URL.revokeObjectURL(objectUrl), 10000);
},
formatBytesPerSecond: function(bytesPerSecond) {
return Utils.formatBytesPerSecond(bytesPerSecond);
},
onNodeClick: function(node) {
// update selected node

View File

@@ -25,13 +25,6 @@ class Utils {
}
static formatNumber(num) {
if(num === 0){
return '0';
}
return num.toLocaleString();
}
static parseSeconds(secondsToFormat) {
secondsToFormat = Number(secondsToFormat);
var days = Math.floor(secondsToFormat / (3600 * 24));
@@ -134,22 +127,6 @@ class Utils {
}
static formatBytesPerSecond(bytesPerSecond) {
if(bytesPerSecond === 0 || bytesPerSecond == null){
return '0 B/s';
}
const k = 1024;
const decimals = 1;
const sizes = ['B/s', 'KB/s', 'MB/s', 'GB/s', 'TB/s', 'PB/s', 'EB/s', 'ZB/s', 'YB/s'];
const i = Math.floor(Math.log(bytesPerSecond) / Math.log(k));
return parseFloat((bytesPerSecond / Math.pow(k, i)).toFixed(decimals)) + ' ' + sizes[i];
}
static formatFrequency(hz) {
if(hz === 0 || hz == null){