Electron app Failed to get ipaddress when exported as Flatpak

89 views Asked by At

I am trying to make a Flatpak for my little application “OpenSpeedTest-Server

This is a simple network performance estimation tool. It is working fine on Windows, Mac and Linux (DEB).

1) When i Export the same in Flatpak, Application unable to get the client device ip address.

2) Also i am not able to put a custom icon for my Flatpak.

I used electronforge. enter image description here

Here is my package.json

{
  "name": "OpenSpeedTest-Server",
  "productName": "OpenSpeedTest-Server",
  "version": "2.1.0",
  "description": "Network Speed Test Server - by OpenSpeedTest",
  "main": "src/index.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "lint": "echo \"No linting configured\""
  },
  "keywords": [],
  "author": {
    "name": "OpenSpeedTest",
    "email": "[email protected]"
  },
  "license": "MIT",
  "config": {
    "forge": {
      "packagerConfig": {
        "icon": "src/icon.png"
      },
      "makers": [
        {
      "name": "@electron-forge/maker-flatpak",
      "config": {
        "name": "OpenSpeedTest_Server",
        "options": {
          "categories": [
            "Utility"
          ],
          "icon": "src/icon.png"
        }
      }
    },
        {
          "name": "@electron-forge/maker-zip",
          "platforms": [
            "darwin"
          ]
        },
        {
          "name": "@electron-forge/maker-deb",
          "config": {}
        },
        {
          "name": "@electron-forge/maker-rpm",
          "config": {}
        }
      ]
    }
  },
  "dependencies": {
    "cors": "^2.8.5",
    "electron-squirrel-startup": "^1.0.0",
    "express": "^4.17.1",
    "internal-ip": "^6.2.0",
    "tcp-port-used": "^1.0.2"
  },
  "devDependencies": {
    "@davidwinter/electron-forge-maker-snap": "^2.0.4",
    "@electron-forge/cli": "^6.0.0-beta.57",
    "@electron-forge/maker-deb": "^6.0.0-beta.57",
    "@electron-forge/maker-flatpak": "^6.0.0-beta.57",
    "@electron-forge/maker-rpm": "^6.0.0-beta.57",
    "@electron-forge/maker-squirrel": "^6.0.0-beta.57",
    "@electron-forge/maker-zip": "^6.0.0-beta.57",
    "electron": "13.1.2"
  }
}

How can i solve this issue?

1

There are 1 answers

0
Vishnu On BEST ANSWER

Solved the issue by adding iproute2 to source and specifying icon dimension. Max supported was 512x512 and i was using 1024x1024

 {
          "name": "@electron-forge/maker-flatpak",
          "config": {
            "name": "OpenSpeedTest_Server",
            "options": {
              "categories": [
                "Utility"
              ],
              "icon": {
                "512x512": "src/android-chrome-512x512.png"
              }
            },
            "modules": [
              {
                "name": "zypak",
                "sources": [
                  {
                    "type": "git",
                    "url": "https://github.com/refi64/zypak",
                    "tag": "v2021.02"
                  }
                ]
              },
              {
                "name": "iproute2",
                "make-install-args": [
                  "PREFIX=/app",
                  "CONFDIR=/app/share/iproute2",
                  "SBINDIR=/app/bin"
                ],
                "sources": [
                  {
                    "type": "archive",
                    "url": "https://www.kernel.org/pub/linux/utils/net/iproute2/iproute2-5.7.0.tar.xz",
                    "sha256": "725dc7ba94aae54c6f8d4223ca055d9fb4fe89d6994b1c03bfb4411c4dd10f21"
                  }
                ],
                "cleanup": [
                  "/include",
                  "/share/bash-completion",
                  "/share/man"
                ]
              }
            ]
          }
        },