only:write_readme_html

This commit is contained in:
Andrey 2024-08-23 11:08:24 -04:00
parent 7b69b851f3
commit 696981d5b0
5 changed files with 27 additions and 14 deletions

View File

@ -24,7 +24,6 @@ public enum FileLog {
public static final String LOG_INFO_TEXT = "Writing logs to '" + FileLogger.DIR + "'"; public static final String LOG_INFO_TEXT = "Writing logs to '" + FileLogger.DIR + "'";
public static final String OS_VERSION = "os.version"; 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; public static String currentLogName;
@Nullable @Nullable
@ -47,17 +46,6 @@ public enum FileLog {
// Access is denied would be an example of a legit exception to happen here // Access is denied would be an example of a legit exception to happen here
return; return;
} }
new Thread(FileLog::writeReadmeFile).start();
}
private static void writeReadmeFile() {
LazyFile file = new LazyFileImpl(FileLogger.DIR + "README.html");
file.write("<center>" + "<a href='" + WIKI_URL + "'>More info online<br/><img src=https://raw.githubusercontent.com/wiki/rusefi/rusefi/logo.gif></a>");
try {
file.close();
} catch (IOException e) {
// ignoring this one
}
} }
public static boolean isLinux() { public static boolean isLinux() {

View File

@ -148,7 +148,11 @@ public class ConnectionAndMeta {
} }
public static boolean saveSettingsToFile() { 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() { public HttpURLConnection getHttpConnection() {

View File

@ -9,7 +9,7 @@ public interface rusEFIVersion {
/** /**
* @see com.rusefi.autoupdate.Autoupdate#VERSION * @see com.rusefi.autoupdate.Autoupdate#VERSION
*/ */
int CONSOLE_VERSION = 20240821; int CONSOLE_VERSION = 20240823;
AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A"); AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
static long classBuildTimeMillis() { static long classBuildTimeMillis() {

View File

@ -2,3 +2,4 @@ auto_update_root_url=https://rusefi.com/build_server
show_pcan=true show_pcan=true
show_simulator=true show_simulator=true
binary_config_image=true binary_config_image=true
write_readme_html=true

View File

@ -1,9 +1,11 @@
package com.rusefi; package com.rusefi;
import com.devexperts.logging.FileLogger;
import com.devexperts.logging.Logging; import com.devexperts.logging.Logging;
import com.rusefi.autodetect.PortDetector; import com.rusefi.autodetect.PortDetector;
import com.rusefi.binaryprotocol.BinaryProtocolLogger; import com.rusefi.binaryprotocol.BinaryProtocolLogger;
import com.rusefi.core.MessagesCentral; import com.rusefi.core.MessagesCentral;
import com.rusefi.core.net.ConnectionAndMeta;
import com.rusefi.io.CommandQueue; import com.rusefi.io.CommandQueue;
import com.rusefi.io.LinkManager; import com.rusefi.io.LinkManager;
import com.rusefi.io.serial.BaudRateHolder; 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.DefaultExceptionHandler;
import com.rusefi.ui.util.JustOneInstance; import com.rusefi.ui.util.JustOneInstance;
import com.rusefi.core.ui.AutoupdateUtil; import com.rusefi.core.ui.AutoupdateUtil;
import com.rusefi.util.LazyFile;
import com.rusefi.util.LazyFileImpl;
import javax.swing.*; import javax.swing.*;
@ -25,6 +29,7 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -41,6 +46,7 @@ import static com.rusefi.ui.util.UiUtils.createOnTopParent;
public class ConsoleUI { public class ConsoleUI {
private static final Logging log = getLogging(ConsoleUI.class); private static final Logging log = getLogging(ConsoleUI.class);
private static final int DEFAULT_TAB_INDEX = 0; 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"; public static final String TAB_INDEX = "main_tab";
protected static final String PORT_KEY = "port"; protected static final String PORT_KEY = "port";
@ -192,8 +198,22 @@ public class ConsoleUI {
return port; return port;
} }
private static void writeReadmeFile() {
LazyFile file = new LazyFileImpl(FileLogger.DIR + "README.html");
file.write("<center>" + "<a href='" + WIKI_URL + "'>More info online<br/><img src=https://raw.githubusercontent.com/wiki/rusefi/rusefi/logo.gif></a>");
try {
file.close();
} catch (IOException e) {
// ignoring this one
}
}
static void startUi(String[] args) throws InterruptedException, InvocationTargetException { static void startUi(String[] args) throws InterruptedException, InvocationTargetException {
FileLog.MAIN.start(); FileLog.MAIN.start();
if (ConnectionAndMeta.saveReadmeHtmlToFile()) {
new Thread(ConsoleUI::writeReadmeFile).start();
}
log.info("OS name: " + FileLog.getOsName()); log.info("OS name: " + FileLog.getOsName());
log.info("OS version: " + System.getProperty(FileLog.OS_VERSION)); log.info("OS version: " + System.getProperty(FileLog.OS_VERSION));