# HG changeset patch # User June Park # Date 1767790965 28800 # Node ID b91f2dd6f84df0a6fc5637dab4ff88fdafa6223a # Parent 7bd795bac99731f17d21dc47d83382914722b634 [PostDog] Fixed delete logic. diff -r 7bd795bac997 -r b91f2dd6f84d postdog/history/d8ff107c-856d-e516-4863-53fe587855eb.txt --- a/postdog/history/d8ff107c-856d-e516-4863-53fe587855eb.txt Wed Jan 07 04:52:17 2026 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,240 +0,0 @@ -https:/mrjunejune.com ---- -GET ---- -Content-Type: application/json ---- - ---- -HTTP Status: 200 - - - - - MrJuneJune - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-

MrJuneJune

-
- - - -
-

Hi, my name is Juntae, but most people call me June or MrJuneJune.

- -

I am a software engineer with experience spanning a wide range of companies, from small startups to FAANGs....

-

I know it is lame to work for them, but I have a dog so I need to put foods on my table.

- -
- -
- -

During my free time, I like to write codes mostly in C, Python, and Typescript; all in mono repo styles using bazel. (I know that is mentally ill...)

-

Feel free to check it out my bad code!

- -

Links

- -
-
- © 2026 June Park -
- - - - - diff -r 7bd795bac997 -r b91f2dd6f84d postdog/history/fca62761-983e-c04b-2f77-c3bfde99f400.txt --- a/postdog/history/fca62761-983e-c04b-2f77-c3bfde99f400.txt Wed Jan 07 04:52:17 2026 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -https://httpbin.org/get ---- -GET ---- -Content-Type: application/json ---- - ---- -HTTP Status: 200 - -{ - "args": {}, - "headers": { - "Accept": "*/*", - "Content-Type": "application/json", - "Host": "httpbin.org", - "X-Amzn-Trace-Id": "Root=1-695d2b83-44f5bafa141af3382d8e56b8" - }, - "origin": "134.128.194.38", - "url": "https://httpbin.org/get" -} - diff -r 7bd795bac997 -r b91f2dd6f84d postdog/history/test.txt --- a/postdog/history/test.txt Wed Jan 07 04:52:17 2026 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -https://httpbin.org/get ---- -GET ---- -Content-Type: application/json -June: Park ---- - ---- -HTTP Status: 200 - -{ - "args": {}, - "headers": { - "Accept": "*/*", - "Content-Type": "application/json", - "Host": "httpbin.org", - "X-Amzn-Trace-Id": "Root=1-695bdbd6-243c50b9737c539f43a5badc" - }, - "origin": "134.128.194.38", - "url": "https://httpbin.org/get" -} - diff -r 7bd795bac997 -r b91f2dd6f84d postdog/main.c --- a/postdog/main.c Wed Jan 07 04:52:17 2026 -0800 +++ b/postdog/main.c Wed Jan 07 05:02:45 2026 -0800 @@ -48,6 +48,7 @@ char *filename; Rectangle rect; long time_modified; + boolean deleted; } HistoryItem; typedef struct { @@ -90,8 +91,8 @@ do { HistoryItem item = {0}; item.filename = strdup(fileinfo.name); - item.rect = (Rectangle){0}; item.time_modified = fileinfo.time_write; + item.deleted = FALSE; Dowa_Array_Push(file_arr, item); } while (_findnext(handle, &fileinfo) == 0); _findclose(handle); @@ -113,6 +114,7 @@ HistoryItem item = {0}; item.filename = strdup(entry->d_name); item.time_modified = file_stat.st_mtime; + item.deleted = FALSE; Dowa_Array_Push(file_arr, item); } } @@ -232,7 +234,9 @@ snprintf(filename, 1024, "%s.txt", uuid4); PostDog_History_CreateFile(filename, new_file); - HistoryItem item = (HistoryItem){ .filename = malloc(sizeof(char) * strlen(filename) + 1), .rect = (Rectangle){0} }; + HistoryItem item = {0}; + item.filename = strdup(filename); + item.deleted = FALSE; memcpy(item.filename, filename, strlen(filename) + 1); Dowa_Array_Push(new_history_items, item); @@ -685,22 +689,15 @@ int32 number_of_skipped_items = 0; for (int i = 0; i < total; i++) { - boolean skip = FALSE; - for (int32 j = 0; j < Dowa_Array_Length(history_deleted_items); j++) - { - if (i == j) - { - skip = TRUE; - number_of_skipped_items++; - break; - } - } - if (skip) - continue; - HistoryItem *curr_history_items = i < new_history_items_length ? &new_history_items[i] : &history_items[i - new_history_items_length]; + if (curr_history_items->deleted) + { + number_of_skipped_items++; + continue; + } + curr_history_items->rect = (Rectangle){ .x = history_list_area.x, .y = history_list_area.y + (padding + item_height) * (i - number_of_skipped_items) + history_scroll_offset, @@ -821,18 +818,11 @@ BeginScissorMode(history_list_area.x, history_list_area.y, history_list_area.width, history_list_area.height); for (int i = 0; i < total; i++) { - boolean skip = FALSE; - for (int32 j = 0; j < Dowa_Array_Length(history_deleted_items); j++) - { - if (i == j) - { - skip = TRUE; - break; - } - } - if (skip) + HistoryItem *curr_history_items = i < new_history_items_length ? + &new_history_items[i] : &history_items[i - new_history_items_length]; + + if (curr_history_items->deleted) continue; - HistoryItem *curr_history_items = i < new_history_items_length ? &new_history_items[i] : &history_items[i - new_history_items_length]; float diff = curr_history_items->rect.height*0.3; // DrawRectangleRec(curr_history_items->rect, Fade(RED, 0.1f)); @@ -860,11 +850,9 @@ if (GuiButton(AddPaddingHorizontal(icon_area_right_column,padding), "delete")) { if (!remove(PostDog_Construct_URL(curr_history_items->filename))) - Dowa_Array_Push(history_deleted_items, i); + curr_history_items->deleted = TRUE; else - { fprintf(stderr, "Wasn't able to delete file: %s \n", curr_history_items->filename); - } } } EndScissorMode(); diff -r 7bd795bac997 -r b91f2dd6f84d previous.c --- a/previous.c Wed Jan 07 04:52:17 2026 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,447 +0,0 @@ - char urlInput[1024] = "https://httpbin.org/get"; - bool urlEditMode = false; - - char jsonInput[JSON_INPUT_BUFFER_LEN] = "{\"key\":\"value\"}"; - bool jsonEditMode = false; - - char headersInput[HEADER_INPUT_BUFFER_LEN] = "Content-Type: application/json"; - bool headersEditMode = false; - - char responseText[16384] = "Response will appear here...\n\nTry the default URL or enter your own!"; - - char paramsInput[PARAM_INPUT_BUFFER_LEN] = "key1=value1\nkey2=value2"; - bool paramsEditMode = false; - - ActiveTab activeTab = ActiveTab_JSON; // 0 = JSON, 1 = Headers, 2 = Params - - // HTTP method selection - int methodActive = 0; - bool methodDropdown = false; - const char *methods[] = { "GET", "POST", "PUT", "DELETE" }; - - // Scroll support - Vector2 jsonScroll = { 0, 0 }; - Vector2 headersScroll = { 0, 0 }; - Vector2 paramsScroll = { 0, 0 }; - Vector2 responseScroll = { 0, 0 }; - Vector2 historyScroll = { 0, 0 }; - - // History - HistoryItem historyItems[MAX_HISTORY_ITEMS]; - int historyCount = 0; - int selectedHistoryIndex = -1; - - // Load initial history - historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS); - - while (!WindowShouldClose()) - { - // Get current window dimensions for responsive layout - int screenWidth = GetScreenWidth(); - int screenHeight = GetScreenHeight(); - - // Layout calculations - Rectangle sidebar = { 0, 10, SIDEBAR_WIDTH, screenHeight }; - - float mainX = SIDEBAR_WIDTH + GENERIC_PADDING; - float mainWidth = screenWidth - SIDEBAR_WIDTH - GENERIC_PADDING * 2; - - // URL input box - leave space for SEND button on the right - Rectangle urlBox = { - mainX, - GENERIC_PADDING, - mainWidth - SEND_BUTTON_WIDTH - GENERIC_PADDING, - URL_INPUT_HEIGHT - }; - - // SEND button positioned beside URL input - Rectangle sendButton = { - urlBox.x + urlBox.width + GENERIC_PADDING, - GENERIC_PADDING, - SEND_BUTTON_WIDTH, - SEND_BUTTON_HEIGHT - }; - - // Method dropdown below URL - Rectangle methodButton = { - mainX, - urlBox.y + urlBox.height + GENERIC_PADDING, - METHOD_BUTTON_WIDTH, - METHOD_BUTTON_HEIGHT - }; - - float tabHeight = 30; - float contentY = methodButton.y + methodButton.height + GENERIC_PADDING + tabHeight; - float contentHeight = screenHeight - contentY - GENERIC_PADDING; - - float panelWidth = (mainWidth - GENERIC_PADDING) / 2; - - Rectangle tabBar = { - mainX, - methodButton.y + methodButton.height + GENERIC_PADDING, - panelWidth, - tabHeight - }; - - Rectangle requestPanel = { - mainX, - contentY, - panelWidth, - contentHeight - }; - - Rectangle responsePanel = { - mainX + panelWidth + GENERIC_PADDING, - contentY, - panelWidth, - contentHeight - }; - - BeginDrawing(); - ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); - - // --- Sidebar Component--- - DrawRectangleRec(sidebar, Fade(GRAY, 0.1f)); - GuiGroupBox(sidebar, "HISTORY"); - - Rectangle refreshBtn = { - sidebar.x + SIDEBAR_PADDING_GENERAL, - sidebar.y + SIDEBAR_PADDING_GENERAL, - SIDEBAR_REFERSH_BUTTON_WIDTH, - SIDEBAR_REFERSH_BUTTON_HEIGHT - }; - if (GuiButton(refreshBtn, "Refresh")) - { - historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS); - } - - Rectangle historyArea = { - sidebar.x + SIDEBAR_PADDING_GENERAL, - sidebar.y + SIDEBAR_AREA_PADDING_Y, - sidebar.width - SIDEBAR_AREA_PADDING_X, - sidebar.height - SIDEBAR_AREA_PADDING_Y - }; - if (CheckCollisionPointRec(GetMousePosition(), historyArea)) - { - float wheel = GetMouseWheelMove(); - historyScroll.y += wheel * 20; - if (historyScroll.y < 0) historyScroll.y = 0; - } - - BeginScissorMode(historyArea.x, historyArea.y, historyArea.width, historyArea.height); - - if (historyCount == 0) - { - DrawText("No requests yet", historyArea.x + 5, historyArea.y + 25, 10, DARKGRAY); - } - else - { - int item_y_position = historyArea.y + SIDEBAR_AREA_PADDING_Y + 5 - (int)historyScroll.y; - for ( - int current_history_item_number = 0; - current_history_item_number < historyCount; - current_history_item_number++ - ) - { - if (item_y_position > historyArea.y - SIDEBAR_HISTORY_ITEM_HEIGHT && item_y_position < historyArea.y + historyArea.height) - { - Rectangle itemRect = { historyArea.x, item_y_position, historyArea.width, SIDEBAR_HISTORY_ITEM_HEIGHT - 2 }; - - // Draw button for history item - Color bgColor = (selectedHistoryIndex == current_history_item_number) ? Fade(BLUE, 0.3f) : Fade(LIGHTGRAY, 0.5f); - if (CheckCollisionPointRec(GetMousePosition(), itemRect) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - // TODO: This is cringe as fuck probably should just have a strucut that we assign and then zero out lol - char tempUrl[1024], tempMethod[16], tempHeaders[HEADER_INPUT_BUFFER_LEN], tempBody[JSON_INPUT_BUFFER_LEN]; - - if (PostDog_HistoryDirectory_LoadRequest( - historyItems[current_history_item_number].filename, tempUrl, tempMethod, tempHeaders, tempBody) == 0) - { - strncpy(urlInput, tempUrl, sizeof(urlInput) - 1); - strncpy(headersInput, tempHeaders, sizeof(headersInput) - 1); - strncpy(jsonInput, tempBody, sizeof(jsonInput) - 1); - - // Set method - for (int m = 0; m < 4; m++) - { - if (strcmp(methods[m], tempMethod) == 0) - { - methodActive = m; - break; - } - } - - selectedHistoryIndex = current_history_item_number; - strcpy(responseText, "Request loaded from history. Click SEND to execute."); - } - } - - DrawRectangleRec(itemRect, bgColor); - DrawRectangleLinesEx(itemRect, 1, GRAY); - - // Draw method badge - DrawText(historyItems[current_history_item_number].method, itemRect.x + 5, item_y_position + 5, 10, BLACK); - - // Draw timestamp (date only) - char dateStr[16] = ""; - if (strlen(historyItems[current_history_item_number].filename) >= 8) - { - snprintf(dateStr, sizeof(dateStr), "%.4s-%.2s-%.2s", - historyItems[current_history_item_number].filename, historyItems[current_history_item_number].filename + 4, historyItems[current_history_item_number].filename + 6); - } - DrawText(dateStr, itemRect.x + 5, item_y_position + 18, 8, DARKGRAY); - - // Draw time - char timeStr[16] = ""; - if (strlen(historyItems[current_history_item_number].filename) >= 15) { - snprintf(timeStr, sizeof(timeStr), "%.2s:%.2s:%.2s", - historyItems[current_history_item_number].filename + 9, historyItems[current_history_item_number].filename + 11, historyItems[current_history_item_number].filename + 13); - } - DrawText(timeStr, itemRect.x + 5, item_y_position + 28, 8, DARKGRAY); - } - - item_y_position += SIDEBAR_HISTORY_ITEM_HEIGHT; - } - } - - EndScissorMode(); - - // --- URL Input Component --- - GuiLabel((Rectangle){ mainX, GENERIC_PADDING - 15, 100, 20 }, "URL:"); - if (GuiTextBox(urlBox, urlInput, 1024, urlEditMode)) - { - urlEditMode = !urlEditMode; - } - if (urlEditMode && (IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C)) - { - SetClipboardText(urlInput); - } - - // Send button (beside URL) - if (GuiButton(sendButton, "SEND") || (urlEditMode && IsKeyDown(KEY_ENTER))) - { - strcpy(responseText, "Sending request...\n"); - - // Make the actual HTTP request - char tempResponse[16384]; - const char *selectedMethod = methods[methodActive]; - - // Use JSON body for POST/PUT, otherwise use empty body - const char *requestBody = (methodActive == 1 || methodActive == 2) ? jsonInput : NULL; - const char *requestHeaders = headersInput; - - // Save request to history - Postdog_SaveRequestToHistory(urlInput, selectedMethod, requestHeaders, requestBody); - - // Reload history to show the new request - historyCount = PostDog_HistoryDistory_ItemsLoad(historyItems, MAX_HISTORY_ITEMS); - - // Making the requests. - PostDog_Make_HttpRequest(urlInput, selectedMethod, requestHeaders, - requestBody, tempResponse, sizeof(tempResponse)); - strncpy(responseText, tempResponse, sizeof(responseText) - 1); - responseText[sizeof(responseText) - 1] = '\0'; - } - - // Tab toggle (3 tabs now) - float tabWidth = tabBar.width / 3; - Rectangle jsonTab = { tabBar.x, tabBar.y - 10, tabWidth, tabBar.height }; - Rectangle headersTab = { tabBar.x + tabWidth, tabBar.y - 10, tabWidth, tabBar.height }; - Rectangle paramsTab = { tabBar.x + tabWidth * 2, tabBar.y - 10, tabWidth, tabBar.height }; - - if (GuiButton(jsonTab, activeTab == ActiveTab_JSON ? "#191#Body" : "Body")) - { - activeTab = ActiveTab_JSON; - } - - if (GuiButton(headersTab, activeTab == ActiveTab_Headers ? "#191#Headers" : "Headers")) - { - activeTab = ActiveTab_Headers; - } - - if (GuiButton(paramsTab, activeTab == ActiveTab_Params ? "#191#Params" : "Params")) - { - activeTab = ActiveTab_Params; - } - - const char *panelTitle; - switch(activeTab) { - case ActiveTab_JSON: - { - panelTitle = "Request Body (JSON)"; - break; - } - case ActiveTab_Headers: - { - panelTitle = "Request Headers"; - break; - } - case ActiveTab_Params: - { - panelTitle = "Query Parameters"; - break; - } - } - - // Panel title - GuiGroupBox(requestPanel, panelTitle); - Rectangle textArea = { - requestPanel.x + 10, - requestPanel.y + 30, - requestPanel.width - 20, - requestPanel.height - 40 - }; - - // Handle click outside to disable edit mode - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - if (!CheckCollisionPointRec(GetMousePosition(), textArea)) - { - jsonEditMode = false; - headersEditMode = false; - paramsEditMode = false; - } - } - - // Draw border for text area - DrawRectangleLinesEx(textArea, 1, GRAY); - - // Manual scroll handling with mouse wheel - if (CheckCollisionPointRec(GetMousePosition(), textArea)) - { - float wheel = GetMouseWheelMove(); - switch(activeTab) - { - case ActiveTab_JSON: - { - jsonScroll.y += wheel * 20; - if (jsonScroll.y < 0) jsonScroll.y = 0; - } - case ActiveTab_Headers: - { - headersScroll.y += wheel * 20; - if (headersScroll.y < 0) headersScroll.y = 0; - } - case ActiveTab_Params: - { - paramsScroll.y += wheel * 20; - if (paramsScroll.y < 0) paramsScroll.y = 0; - } - } - } - - char *copyFromInput; - bool *currentMode; - switch(activeTab) - { - case ActiveTab_JSON: - { - PostDog_Render_TextWithScroll(textArea, jsonScroll, jsonInput); - copyFromInput = jsonInput; - currentMode = &jsonEditMode; - break; - } - case ActiveTab_Headers: - { - PostDog_Render_TextWithScroll(textArea, headersScroll, headersInput); - copyFromInput = headersInput; - currentMode = &headersEditMode; - break; - } - case ActiveTab_Params: - { - PostDog_Render_TextWithScroll(textArea, paramsScroll, paramsInput); - copyFromInput = paramsInput; - currentMode = ¶msEditMode; - - Rectangle updateUrlBtn = { textArea.x + 30, textArea.y + textArea.height - 10, 120, 20 }; - // TODO: Automatic update - if (GuiButton(updateUrlBtn, "Update URL")) - { - char tempUrl[1024]; - strncpy(tempUrl, urlInput, sizeof(tempUrl) - 1); - - // Remove existing params if any - char *questionMark = strchr(tempUrl, '?'); - if (questionMark) *questionMark = '\0'; - - Postdog_UpdateUrlWithParams(urlInput, sizeof(urlInput), tempUrl, paramsInput); - } - break; - } - } - - if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C)) - { - SetClipboardText(copyFromInput); - } - - Rectangle editBtn = { textArea.x + textArea.width - 60, textArea.y + textArea.height - 10, 50, 20 }; - if (GuiButton(editBtn, "Edit")) - { - *currentMode = !(*currentMode); - } - - // Response Panel with scroll - GuiGroupBox(responsePanel, "Response"); - - Rectangle responseArea = { - responsePanel.x + 10, - responsePanel.y + 30, - responsePanel.width - 20, - responsePanel.height - 40 - }; - - // Manual scroll for response - if (CheckCollisionPointRec(GetMousePosition(), responseArea)) - { - float wheel = GetMouseWheelMove(); - responseScroll.y += wheel * 20; - if (responseScroll.y < 0) responseScroll.y = 0; - } - - // Draw border - DrawRectangleLinesEx(responseArea, 1, GRAY); - - // Draw response text with scroll - PostDog_Render_TextWithScroll(responseArea, responseScroll, responseText); - - if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C)) - { - if (CheckCollisionPointRec(GetMousePosition(), responseArea)) { - SetClipboardText(responseText); - } - } - - // --- Edit modal ---- - if (jsonEditMode) - { - GuiTextBox( - (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 }, - jsonInput, JSON_INPUT_BUFFER_LEN, true); - } - - if (headersEditMode) - { - GuiTextBox( - (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 }, - headersInput, HEADER_INPUT_BUFFER_LEN, true); - } - - if (paramsEditMode) - { - GuiTextBox( - (Rectangle){ screenWidth/2 - 300, screenHeight/2 - 200, 600, 400 }, - paramsInput, PARAM_INPUT_BUFFER_LEN, true); - } - - if (GuiDropdownBox(methodButton, "GET;POST;PUT;DELETE", &methodActive, methodDropdown)) - { - methodDropdown = !methodDropdown; - } - - - EndDrawing(); - } - -