diff --git a/CMakeLists.txt b/CMakeLists.txt index 08ecd0f..dfca9cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.10) project(eew CXX) - +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(webview REQUIRED) find_package(Threads REQUIRED) diff --git a/src/index.html b/src/index.html index 81b615e..8d04bbb 100644 --- a/src/index.html +++ b/src/index.html @@ -1,104 +1,159 @@ - + - Environment Variables Table + Environment Variables Viewer -

Environment Variables

- - - - - - - - - - -
KeyValue
+
+
+

Environment Variables Viewer

+

Real-time system environment configuration

+
+
- + + document.addEventListener('DOMContentLoaded', refreshEnvTable); + document.getElementById('refreshBtn').addEventListener('click', refreshEnvTable); + + // Mock data for demonstration + if (!window.getEnvString) { + window.getEnvString = async () => { + await new Promise(resolve => setTimeout(resolve, 1000)); + return { + NODE_ENV: 'development', + PORT: '3000', + DB_HOST: 'localhost', + DB_USER: 'root', + DB_PASSWORD: '********', + API_KEY: 'sk-********************************', + DEBUG_MODE: 'true', + LONG_TEXT_VARIABLE: 'This is a very long text value that exceeds the normal display area. It should be scrollable within the container so users can view the entire content without truncation. This provides a better user experience when dealing with large environment variable values.' + }; + }; + } + - \ No newline at end of file + + \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index d09a577..aab1e8e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include #include #include @@ -49,20 +51,41 @@ std::ostream&operator<<(std::ostream &os,const std::vector &v){ return os; } - +std::string envKvToJsonString(const vpss_t &v){ + std::stringstream ss; + const auto toJsonString = [](const std::string_view &str)->std::string{ + std::stringstream ss; + for(size_t i=0;i set={'\\','\"'}; + if(set.find(str[i])!=set.end()){ + ss<<"\\"; + } + ss<std::string { - std::stringstream oss; - oss<