diff postdog/main.c @ 172:0face9898d04

[PostDog] Small changes.
author MrJuneJune <me@mrjunejune.com>
date Mon, 19 Jan 2026 18:56:54 -0800
parents 058de208e640
children
line wrap: on
line diff
--- a/postdog/main.c	Mon Jan 19 17:33:18 2026 -0800
+++ b/postdog/main.c	Mon Jan 19 18:56:54 2026 -0800
@@ -25,7 +25,7 @@
 #include "third_party/raylib/custom.h"
 
 #ifndef POSTDOG_PATHS
-  #define POSTDOG_PATHS "/Users/mrjunejune/zenbu/postdog/history"
+  #define POSTDOG_PATHS "/home/june/zenbu/postdog/history"
 #endif
 
 #define SCREEN_WIDTH 1280
@@ -38,7 +38,8 @@
 #define BODY_BUFFER_LENGTH 1024 * 1024 * 5
 #define RESULT_BUFFER_LENGTH 1024 * 1024 * 5
 
-#define URL_TEXT_DEFAULT "https://httpbin.org/get"
+// #define URL_TEXT_DEFAULT "https://httpbin.org/get"
+#define URL_TEXT_DEFAULT "wss://mrjunejune.com/echo"
 #define HEADER_TEXT_DEFAULT "Content-Type: application/json"
 #define BODY_TEXT_DEFAULT ""
 #define GET_PARAM_TEXT_DEFAULT "foo bar"
@@ -47,7 +48,7 @@
 // TextArea Component
 // ============================================================================
 
-#define TEXT_SIZE_DEFAULT 10 // used to calcualte spacing
+#define TEXT_SIZE_DEFAULT 20 // used to calcualte spacing
 #define TEXT_AREA_LINE_HEIGHT GuiGetStyle(DEFAULT, TEXT_SIZE)
 #define TEXT_AREA_PADDING 30
 #define TEXT_AREA_CURSOR_WIDTH 2
@@ -1550,9 +1551,9 @@
 
   if (uv_thread_create(&thread_id, PostDog_Websocket_Start, NULL) != 0)
   {
-  perror("Failed to create thread");
-  memset(&thread_id, 0, sizeof(thread_id));
-  return thread_id;
+    perror("Failed to create thread");
+    memset(&thread_id, 0, sizeof(thread_id));
+    return thread_id;
   }
 
   return thread_id;
@@ -2179,7 +2180,7 @@
   // Send button
   DrawRectangleRounded(layout->send_button, 0.3f, 8, g_colors.primary);
   Rectangle btn_text_rect = layout->send_button;
-  const char *btn_text = "Send";
+  char *btn_text = "Send";
   int text_width = MeasureText(btn_text, GuiGetStyle(DEFAULT, TEXT_SIZE));
   DrawTextEx(GuiGetFont(),
     btn_text,
@@ -2225,7 +2226,7 @@
     };
 
     DrawRectangleRounded(ws_send_btn, 0.3f, 8, g_colors.highlight);
-    const char *ws_text = "Send";
+    char *ws_text = !ws ? "Connect" : "Send";
     int ws_text_width = MeasureText(ws_text, GuiGetStyle(DEFAULT, TEXT_SIZE));
     DrawTextEx(GuiGetFont(),
       ws_text,
@@ -2247,8 +2248,6 @@
   else
   {
     WS_BREAK = TRUE;
-    if (websocket_thread_id)
-      PostDog_Websocket_Destroy(websocket_thread_id);
   }
 
   // Result tabs
@@ -2274,6 +2273,7 @@
   // ========================================================================
   // INITIALIZATION
   // ========================================================================
+  SetConfigFlags(FLAG_WINDOW_UNDECORATED);
 
   // Initialize libuv
   main_loop = uv_default_loop();
@@ -2290,7 +2290,7 @@
   // Load resources
   Font customFont = LoadFontEx("postdog/Roboto-Regular.ttf", 20, 0, 0);
   GuiSetFont(customFont);
-  GuiSetStyle(DEFAULT, TEXT_SIZE, 16);
+  GuiSetStyle(DEFAULT, TEXT_SIZE, TEXT_SIZE_DEFAULT);
 
   Image logo_original = LoadImage("postdog/logo_bigger.png");
   ImageResize(&logo_original, 200, 200);
@@ -2319,6 +2319,7 @@
   snprintf(input_body_array[TAB_HEADER], HEADER_BUFFER_LENGTH, HEADER_TEXT_DEFAULT);
   snprintf(input_body_array[TAB_BODY], BODY_BUFFER_LENGTH, BODY_TEXT_DEFAULT);
   snprintf(input_body_array[TAB_GET_PARAMS], DEFAULT_TEXT_BUFFER_LENGTH, GET_PARAM_TEXT_DEFAULT);
+  snprintf(input_body_array[TAB_WEBSOCKET], DEFAULT_TEXT_BUFFER_LENGTH, GET_PARAM_TEXT_DEFAULT);
 
   // Initialize result buffers (body and headers tabs)
   Dowa_Array_Push(result_body_array, (char *)malloc(sizeof(char) * RESULT_BUFFER_LENGTH));
@@ -2391,7 +2392,6 @@
       DrawHistoryList(&layout, mouse_pos, padding, ui_state.history_scroll_offset);
       DrawBodyPanels(&layout, &ui_state, padding);
       DrawURLBar(&layout, &ui_state, padding);
-
     EndDrawing();
   }