4 Commits

Author SHA1 Message Date
Your Name
840a5bbf5f v0.1.24 - . 2025-12-21 09:17:43 -04:00
Your Name
0f420fc6d0 v0.1.23 - Fixed auth rules on web page 2025-12-16 09:18:37 -04:00
Your Name
29e2421771 v0.1.22 - Cleaned out legacy websocket code in index.js 2025-12-16 07:50:16 -04:00
Your Name
cce1f2f0fd v0.1.21 - Fixed some web page errors. About to clean out websocket functions in index.js. Last push before we do this. 2025-12-16 07:17:19 -04:00
13 changed files with 22743 additions and 17464 deletions

View File

@@ -252,7 +252,7 @@ AUTH RULES MANAGEMENT
</div>
<!-- Auth Rules Table -->
<div id="authRulesTableContainer" style="display: none;">
<div id="authRulesTableContainer" class="config-table-container">
<table class="config-table" id="authRulesTable">
<thead>
<tr>
@@ -264,6 +264,9 @@ AUTH RULES MANAGEMENT
</tr>
</thead>
<tbody id="authRulesTableBody">
<tr>
<td colspan="5" style="text-align: center; font-style: italic;">Loading auth rules...</td>
</tr>
</tbody>
</table>
</div>
@@ -275,8 +278,8 @@ AUTH RULES MANAGEMENT
<div class="input-group">
<label for="authRulePubkey">Pubkey (nsec or hex):</label>
<input type="text" id="authRulePubkey" placeholder="nsec1... or 64-character hex pubkey">
<label for="authRulePubkey">Pubkey (npub or hex):</label>
<input type="text" id="authRulePubkey" placeholder="npub1... or 64-character hex pubkey">
</div>
<div id="whitelistWarning" class="warning-box" style="display: none;">

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

10861
debug.log

File diff suppressed because it is too large Load Diff

View File

@@ -181,16 +181,23 @@ cJSON* admin_cmd_config_query(cJSON* args) {
return response;
}
// Check if specific keys were requested (args[1] should be array of keys or null for all)
// Check if specific keys were requested (args[1] should be array of keys, null, or "all" for all)
cJSON* keys_array = NULL;
if (cJSON_GetArraySize(args) >= 2) {
keys_array = cJSON_GetArrayItem(args, 1);
// Accept array, null, or string "all" for querying all configs
if (!cJSON_IsArray(keys_array) && !cJSON_IsNull(keys_array)) {
cJSON_AddStringToObject(response, "status", "error");
cJSON_AddStringToObject(response, "error", "Keys parameter must be array or null");
cJSON_AddNumberToObject(response, "timestamp", (double)time(NULL));
sqlite3_close(db);
return response;
// Check if it's the string "all"
if (cJSON_IsString(keys_array) && strcmp(keys_array->valuestring, "all") == 0) {
// Treat "all" as null (query all configs)
keys_array = NULL;
} else {
cJSON_AddStringToObject(response, "status", "error");
cJSON_AddStringToObject(response, "error", "Keys parameter must be array, null, or \"all\"");
cJSON_AddNumberToObject(response, "timestamp", (double)time(NULL));
sqlite3_close(db);
return response;
}
}
}
@@ -273,18 +280,18 @@ cJSON* admin_cmd_config_update(cJSON* args) {
cJSON* response = cJSON_CreateObject();
cJSON_AddStringToObject(response, "query_type", "config_update");
// Expected format: ["config_update", {"key1": "value1", "key2": "value2"}]
// Expected format: ["config_update", [{key: "x", value: "y", data_type: "z", category: "w"}]]
if (cJSON_GetArraySize(args) < 2) {
cJSON_AddStringToObject(response, "status", "error");
cJSON_AddStringToObject(response, "error", "Missing config updates object");
cJSON_AddStringToObject(response, "error", "Missing config updates array");
cJSON_AddNumberToObject(response, "timestamp", (double)time(NULL));
return response;
}
cJSON* updates = cJSON_GetArrayItem(args, 1);
if (!cJSON_IsObject(updates)) {
if (!cJSON_IsArray(updates)) {
cJSON_AddStringToObject(response, "status", "error");
cJSON_AddStringToObject(response, "error", "Updates must be an object");
cJSON_AddStringToObject(response, "error", "Updates must be an array of config objects");
cJSON_AddNumberToObject(response, "timestamp", (double)time(NULL));
return response;
}
@@ -311,50 +318,66 @@ cJSON* admin_cmd_config_update(cJSON* args) {
return response;
}
// Process each update
cJSON* updated_keys = cJSON_CreateArray();
cJSON* failed_keys = cJSON_CreateArray();
// Process each update - expecting array of config objects
cJSON* data_array = cJSON_CreateArray();
int success_count = 0;
int fail_count = 0;
cJSON* item = NULL;
cJSON_ArrayForEach(item, updates) {
const char* key = item->string;
const char* value = cJSON_GetStringValue(item);
if (!value) {
cJSON_AddItemToArray(failed_keys, cJSON_CreateString(key));
cJSON* config_obj = NULL;
cJSON_ArrayForEach(config_obj, updates) {
if (!cJSON_IsObject(config_obj)) {
fail_count++;
continue;
}
cJSON* key_item = cJSON_GetObjectItem(config_obj, "key");
cJSON* value_item = cJSON_GetObjectItem(config_obj, "value");
if (!cJSON_IsString(key_item) || !cJSON_IsString(value_item)) {
fail_count++;
continue;
}
const char* key = key_item->valuestring;
const char* value = value_item->valuestring;
sqlite3_reset(stmt);
sqlite3_bind_text(stmt, 1, value, -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 2, key, -1, SQLITE_TRANSIENT);
rc = sqlite3_step(stmt);
// Create result object for this config update
cJSON* result_obj = cJSON_CreateObject();
cJSON_AddStringToObject(result_obj, "key", key);
if (rc == SQLITE_DONE && sqlite3_changes(db) > 0) {
cJSON_AddItemToArray(updated_keys, cJSON_CreateString(key));
cJSON_AddStringToObject(result_obj, "status", "success");
cJSON_AddStringToObject(result_obj, "value", value);
// Add optional fields if present
cJSON* data_type_item = cJSON_GetObjectItem(config_obj, "data_type");
if (cJSON_IsString(data_type_item)) {
cJSON_AddStringToObject(result_obj, "data_type", data_type_item->valuestring);
}
success_count++;
app_log(LOG_INFO, "Updated config key: %s", key);
app_log(LOG_INFO, "Updated config key: %s = %s", key, value);
} else {
cJSON_AddItemToArray(failed_keys, cJSON_CreateString(key));
cJSON_AddStringToObject(result_obj, "status", "error");
cJSON_AddStringToObject(result_obj, "error", "Failed to update");
fail_count++;
}
cJSON_AddItemToArray(data_array, result_obj);
}
sqlite3_finalize(stmt);
sqlite3_close(db);
cJSON_AddStringToObject(response, "status", "success");
cJSON_AddNumberToObject(response, "updated_count", success_count);
cJSON_AddNumberToObject(response, "failed_count", fail_count);
cJSON_AddItemToObject(response, "updated_keys", updated_keys);
if (fail_count > 0) {
cJSON_AddItemToObject(response, "failed_keys", failed_keys);
} else {
cJSON_Delete(failed_keys);
}
cJSON_AddStringToObject(response, "status", success_count > 0 ? "success" : "error");
cJSON_AddNumberToObject(response, "updates_applied", success_count);
cJSON_AddItemToObject(response, "data", data_array);
cJSON_AddNumberToObject(response, "timestamp", (double)time(NULL));
return response;

File diff suppressed because it is too large Load Diff

View File

@@ -10,8 +10,8 @@
// Version information (auto-updated by build system)
#define VERSION_MAJOR 0
#define VERSION_MINOR 1
#define VERSION_PATCH 20
#define VERSION "v0.1.20"
#define VERSION_PATCH 24
#define VERSION "v0.1.24"
#include <stddef.h>
#include <stdint.h>

View File

@@ -11,8 +11,13 @@ SERVER_URL="https://localhost:9443"
UPLOAD_ENDPOINT="${SERVER_URL}/upload"
TEST_FILE="test_blob_$(date +%s).txt"
CLEANUP_FILES=()
NOSTR_PRIVKEY="22cc83aa57928a2800234c939240c9a6f0f44a33ea3838a860ed38930b195afd"
NOSTR_PUBKEY="8ff74724ed641b3c28e5a86d7c5cbc49c37638ace8c6c38935860e7a5eedde0e"
NOSTR_PRIVKEY="39079f9fbdead31b5ec1724479e62c892a6866699c7873613c19832caff447bd"
NOSTR_PUBKEY="2a38db7fc1ffdabb43c79b5ad525f7d97102d4d235efc257dfd1514571f8159f"
# NOSTR_PRIVKEY="22cc83aa57928a2800234c939240c9a6f0f44a33ea3838a860ed38930b195afd"
# NOSTR_PUBKEY="8ff74724ed641b3c28e5a86d7c5cbc49c37638ace8c6c38935860e7a5eedde0e"
# Colors for output
RED='\033[0;31m'