]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
prestium: read i2p port from env
authortobtoht <tob@featherwallet.org>
Fri, 3 Mar 2023 23:33:08 +0000 (00:33 +0100)
committertobtoht <tob@featherwallet.org>
Fri, 3 Mar 2023 23:33:08 +0000 (00:33 +0100)
src/main.cpp
src/utils/os/Prestium.cpp
src/utils/os/Prestium.h

index cf78968ac9f58da8cca77e2e1e29f4d07e2f2ea9..b40ce828b9330025ab51f0442a4d791268fccd06 100644 (file)
@@ -189,7 +189,7 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) {
     // Prestium initial config
     if (config()->get(Config::firstRun).toBool() && Prestium::detect()) {
         config()->set(Config::proxy, Config::Proxy::i2p);
-        config()->set(Config::socks5Port, 4448);
+        config()->set(Config::socks5Port, Prestium::i2pPort());
     }
 
     if (parser.isSet("use-local-tor"))
index 80a5829119958ea64dccb71c2941919e8cd7bab3..4cfe081a6923c46e27a7166532aa5b9f3e624037 100644 (file)
@@ -8,7 +8,24 @@
 
 #include "utils/Utils.h"
 
+#define PRESTIUM_DEFAULT_PORT 4448
+
 bool Prestium::detect()
 {
     return QSysInfo::prettyProductName().contains("Prestium");
+}
+
+int Prestium::i2pPort()
+{
+    QString portStr = qgetenv("PRESTIUM_FEATHER_I2P_PORT");
+    if (portStr.isEmpty()) {
+        return PRESTIUM_DEFAULT_PORT;
+    }
+
+    int port = portStr.toInt();
+    if (port < 1 || port > 65535) {
+        return PRESTIUM_DEFAULT_PORT;
+    }
+
+    return port;
 }
\ No newline at end of file
index 879c9a3d0281e7cfaf23310b64dbbbf5da20a001..66bf1b988c11d737f582a9dc661a57e8c8590e93 100644 (file)
@@ -8,6 +8,7 @@
 class Prestium {
 public:
     static bool detect();
+    static int i2pPort();
 };
 
 #endif //FEATHER_PRESTIUM_H