From 696981d5b0565110a1b47f373a6c5159c90a2b0f Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 23 Aug 2024 11:08:24 -0400 Subject: [PATCH] only:write_readme_html --- .../src/main/java/com/rusefi/FileLog.java | 12 ----------- .../rusefi/core/net/ConnectionAndMeta.java | 6 +++++- .../java/com/rusefi/core/rusEFIVersion.java | 2 +- .../src/main/resources/shared_io.properties | 1 + .../src/main/java/com/rusefi/ConsoleUI.java | 20 +++++++++++++++++++ 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/java_console/logging/src/main/java/com/rusefi/FileLog.java b/java_console/logging/src/main/java/com/rusefi/FileLog.java index e3797d69a0..cf6fa04c07 100644 --- a/java_console/logging/src/main/java/com/rusefi/FileLog.java +++ b/java_console/logging/src/main/java/com/rusefi/FileLog.java @@ -24,7 +24,6 @@ public enum FileLog { public static final String LOG_INFO_TEXT = "Writing logs to '" + FileLogger.DIR + "'"; public static final String OS_VERSION = "os.version"; - private static final String WIKI_URL = "https://github.com/rusefi/rusefi/wiki/rusEFI-logs-folder"; public static String currentLogName; @Nullable @@ -47,17 +46,6 @@ public enum FileLog { // Access is denied would be an example of a legit exception to happen here return; } - new Thread(FileLog::writeReadmeFile).start(); - } - - private static void writeReadmeFile() { - LazyFile file = new LazyFileImpl(FileLogger.DIR + "README.html"); - file.write("
" + "More info online
"); - try { - file.close(); - } catch (IOException e) { - // ignoring this one - } } public static boolean isLinux() { diff --git a/java_console/shared_io/src/main/java/com/rusefi/core/net/ConnectionAndMeta.java b/java_console/shared_io/src/main/java/com/rusefi/core/net/ConnectionAndMeta.java index a46fed416c..13e4cd7604 100644 --- a/java_console/shared_io/src/main/java/com/rusefi/core/net/ConnectionAndMeta.java +++ b/java_console/shared_io/src/main/java/com/rusefi/core/net/ConnectionAndMeta.java @@ -148,7 +148,11 @@ public class ConnectionAndMeta { } public static boolean saveSettingsToFile() { - return Boolean.TRUE.toString().equalsIgnoreCase(getStringProperty(getProperties(), "binary_config_image", "false")); + return getBoolean("binary_config_image"); + } + + public static boolean saveReadmeHtmlToFile() { + return Boolean.TRUE.toString().equalsIgnoreCase(getStringProperty(getProperties(), "write_readme_html", "false")); } public HttpURLConnection getHttpConnection() { diff --git a/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java b/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java index 9b0b5a96f0..8d2aa07b66 100644 --- a/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java +++ b/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java @@ -9,7 +9,7 @@ public interface rusEFIVersion { /** * @see com.rusefi.autoupdate.Autoupdate#VERSION */ - int CONSOLE_VERSION = 20240821; + int CONSOLE_VERSION = 20240823; AtomicReference firmwareVersion = new AtomicReference<>("N/A"); static long classBuildTimeMillis() { diff --git a/java_console/shared_io/src/main/resources/shared_io.properties b/java_console/shared_io/src/main/resources/shared_io.properties index 51d72ba111..f61adde1d6 100644 --- a/java_console/shared_io/src/main/resources/shared_io.properties +++ b/java_console/shared_io/src/main/resources/shared_io.properties @@ -2,3 +2,4 @@ auto_update_root_url=https://rusefi.com/build_server show_pcan=true show_simulator=true binary_config_image=true +write_readme_html=true diff --git a/java_console/ui/src/main/java/com/rusefi/ConsoleUI.java b/java_console/ui/src/main/java/com/rusefi/ConsoleUI.java index 6cc0a0b626..bf40a7db2a 100644 --- a/java_console/ui/src/main/java/com/rusefi/ConsoleUI.java +++ b/java_console/ui/src/main/java/com/rusefi/ConsoleUI.java @@ -1,9 +1,11 @@ package com.rusefi; +import com.devexperts.logging.FileLogger; import com.devexperts.logging.Logging; import com.rusefi.autodetect.PortDetector; import com.rusefi.binaryprotocol.BinaryProtocolLogger; import com.rusefi.core.MessagesCentral; +import com.rusefi.core.net.ConnectionAndMeta; import com.rusefi.io.CommandQueue; import com.rusefi.io.LinkManager; import com.rusefi.io.serial.BaudRateHolder; @@ -18,6 +20,8 @@ import com.rusefi.ui.lua.LuaScriptPanel; import com.rusefi.ui.util.DefaultExceptionHandler; import com.rusefi.ui.util.JustOneInstance; import com.rusefi.core.ui.AutoupdateUtil; +import com.rusefi.util.LazyFile; +import com.rusefi.util.LazyFileImpl; import javax.swing.*; @@ -25,6 +29,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.ActionListener; +import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; @@ -41,6 +46,7 @@ import static com.rusefi.ui.util.UiUtils.createOnTopParent; public class ConsoleUI { private static final Logging log = getLogging(ConsoleUI.class); private static final int DEFAULT_TAB_INDEX = 0; + private static final String WIKI_URL = "https://github.com/rusefi/rusefi/wiki/rusEFI-logs-folder"; public static final String TAB_INDEX = "main_tab"; protected static final String PORT_KEY = "port"; @@ -192,8 +198,22 @@ public class ConsoleUI { return port; } + private static void writeReadmeFile() { + LazyFile file = new LazyFileImpl(FileLogger.DIR + "README.html"); + file.write("
" + "More info online
"); + try { + file.close(); + } catch (IOException e) { + // ignoring this one + } + } + static void startUi(String[] args) throws InterruptedException, InvocationTargetException { FileLog.MAIN.start(); + if (ConnectionAndMeta.saveReadmeHtmlToFile()) { + new Thread(ConsoleUI::writeReadmeFile).start(); + } + log.info("OS name: " + FileLog.getOsName()); log.info("OS version: " + System.getProperty(FileLog.OS_VERSION));