diff --git a/server/2015Remote/2015Remote.rc b/server/2015Remote/2015Remote.rc index c5e2598..c11e014 100644 Binary files a/server/2015Remote/2015Remote.rc and b/server/2015Remote/2015Remote.rc differ diff --git a/server/2015Remote/WebPage.h b/server/2015Remote/WebPage.h index dcc41b9..33841ce 100644 --- a/server/2015Remote/WebPage.h +++ b/server/2015Remote/WebPage.h @@ -1,3551 +1,20 @@ #pragma once +#include #include +#include "resource.h" -// Embedded HTML page for web remote control -// Split into parts to avoid MSVC string literal limit (16KB) - +// Embedded HTML page for web remote control. +// Source of truth: server/web/index.html (shared with future Go server). +// Compiled into the binary as RC BINARY resource IDR_WEB_INDEX_HTML. inline std::string GetWebPageHTML() { - std::string html; - - // Part 1: Head and base styles - html += R"HTML( - - - - - SimpleRemoter - - - - - - - - - - - - - -)HTML"; - - // Part 6: HTML body - html += R"HTML( -
- -
-
- -
-
Total: 0
-
Showing: 0
-
-
- -
-
-
- -
-
-
-
-
- Connecting... - - - - -
-
-
- -
-
- - - - -
-
- - - - - - - - - -
-
-
- -
- - - - -
-
100%
- -
- - -
-
- -
-
Terminal
-
Connecting...
-
-
-
- -
- - - - - -
-
- - - - - - -)HTML"; - - // 加载 xterm.js + FitAddon(终端)。放在 app script 前,保证 Terminal/FitAddon 全局可用。 - html += R"HTML( - - -)HTML"; - - // Part 7: JavaScript - State and WebSocket - html += R"HTML( - - -)HTML"; - - return html; + HRSRC hRes = FindResourceA(NULL, MAKEINTRESOURCEA(IDR_WEB_INDEX_HTML), "BINARY"); + if (!hRes) return {}; + DWORD size = SizeofResource(NULL, hRes); + if (!size) return {}; + HGLOBAL hData = LoadResource(NULL, hRes); + if (!hData) return {}; + LPVOID p = LockResource(hData); + if (!p) return {}; + return std::string(static_cast(p), size); } diff --git a/server/2015Remote/WebService.cpp b/server/2015Remote/WebService.cpp index 1c3acaf..b38e38e 100644 --- a/server/2015Remote/WebService.cpp +++ b/server/2015Remote/WebService.cpp @@ -255,6 +255,9 @@ void CWebService::ServerThread(int port) { // Serve static HTML page and file downloads static std::string cachedHtml = GetWebPageHTML(); + // Log loaded size; zero bytes means the RC BINARY resource is missing or + // server/web/index.html was not embedded — check 2015Remote.rc and rebuild. + Mprintf("[WebService] index.html loaded: %zu bytes\n", cachedHtml.size()); std::string payloadsDir = m_PayloadsDir; // Capture for lambda // 静态资源缓存:xterm.js / xterm.css / fit-addon。RC binary 资源加载一次缓存到内存, diff --git a/server/2015Remote/resource.h b/server/2015Remote/resource.h index 5c8d9b8..821ec30 100644 --- a/server/2015Remote/resource.h +++ b/server/2015Remote/resource.h @@ -262,6 +262,7 @@ #define IDR_WEB_XTERM_JS 382 #define IDR_WEB_XTERM_CSS 383 #define IDR_WEB_XTERM_FIT_JS 384 +#define IDR_WEB_INDEX_HTML 385 #define IDC_MESSAGE 1000 #define IDC_ONLINE 1001 #define IDC_STATIC_TIPS 1002 @@ -988,7 +989,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 385 +#define _APS_NEXT_RESOURCE_VALUE 386 #define _APS_NEXT_COMMAND_VALUE 33051 #define _APS_NEXT_CONTROL_VALUE 2542 #define _APS_NEXT_SYMED_VALUE 105 diff --git a/server/web/index.html b/server/web/index.html new file mode 100644 index 0000000..fbd6d96 --- /dev/null +++ b/server/web/index.html @@ -0,0 +1,3474 @@ + + + + + + SimpleRemoter + + + + + + + + + + + + + + +
+ +
+
+ +
+
Total: 0
+
Showing: 0
+
+
+ +
+
+
+ +
+
+
+
+
+ Connecting... + + + + +
+
+
+ +
+
+ + + + +
+
+ + + + + + + + + +
+
+
+ +
+ + + + +
+
100%
+ +
+ + +
+
+ +
+
Terminal
+
Connecting...
+
+
+
+ +
+ + + + + +
+
+ + + + + + + + + + + + + \ No newline at end of file