Compare commits

...

2 Commits

Author SHA1 Message Date
e7979fe9db test: Add more retries until selenium cooperates.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 17m51s
2024-11-11 21:06:04 -05:00
7a276adbbc ssb: Size blob ID buffers appropriately. 2024-11-11 21:05:29 -05:00
3 changed files with 16 additions and 9 deletions

View File

@ -1246,7 +1246,7 @@ static void _httpd_endpoint_view_work(tf_ssb_t* ssb, void* user_data)
{ {
view_t* view = user_data; view_t* view = user_data;
tf_http_request_t* request = view->request; tf_http_request_t* request = view->request;
char blob_id[128] = ""; char blob_id[k_blob_id_len] = "";
user_app_t* user_app = _parse_user_app_from_path(request->path, "/view"); user_app_t* user_app = _parse_user_app_from_path(request->path, "/view");
if (user_app) if (user_app)
@ -1339,7 +1339,7 @@ typedef struct _save_t
{ {
tf_http_request_t* request; tf_http_request_t* request;
int response; int response;
char blob_id[256]; char blob_id[k_blob_id_len];
} save_t; } save_t;
static void _httpd_endpoint_save_work(tf_ssb_t* ssb, void* user_data) static void _httpd_endpoint_save_work(tf_ssb_t* ssb, void* user_data)
@ -1416,12 +1416,12 @@ static void _httpd_endpoint_save_work(tf_ssb_t* ssb, void* user_data)
size_t new_app_length = 0; size_t new_app_length = 0;
const char* new_app_str = JS_ToCStringLen(context, &new_app_length, new_app_json); const char* new_app_str = JS_ToCStringLen(context, &new_app_length, new_app_json);
char blob_id[250] = { 0 }; char blob_id[k_blob_id_len] = { 0 };
if (tf_ssb_db_blob_store(ssb, (const uint8_t*)new_app_str, new_app_length, blob_id, sizeof(blob_id), NULL) && if (tf_ssb_db_blob_store(ssb, (const uint8_t*)new_app_str, new_app_length, blob_id, sizeof(blob_id), NULL) &&
tf_ssb_db_set_property(ssb, user_app->user, app_path, blob_id)) tf_ssb_db_set_property(ssb, user_app->user, app_path, blob_id))
{ {
tf_ssb_db_add_value_to_array_property(ssb, user_app->user, "apps", user_app->app); tf_ssb_db_add_value_to_array_property(ssb, user_app->user, "apps", user_app->app);
snprintf(save->blob_id, sizeof(save->blob_id), "/%s", blob_id); snprintf(save->blob_id, sizeof(save->blob_id), "%s", blob_id);
save->response = 200; save->response = 200;
} }
@ -1446,10 +1446,10 @@ static void _httpd_endpoint_save_work(tf_ssb_t* ssb, void* user_data)
} }
else if (strcmp(request->path, "/save") == 0) else if (strcmp(request->path, "/save") == 0)
{ {
char blob_id[250] = { 0 }; char blob_id[k_blob_id_len] = { 0 };
if (tf_ssb_db_blob_store(ssb, request->body, request->content_length, blob_id, sizeof(blob_id), NULL)) if (tf_ssb_db_blob_store(ssb, request->body, request->content_length, blob_id, sizeof(blob_id), NULL))
{ {
snprintf(save->blob_id, sizeof(save->blob_id), "/%s", blob_id); snprintf(save->blob_id, sizeof(save->blob_id), "%s", blob_id);
save->response = 200; save->response = 200;
} }
} }
@ -1473,7 +1473,9 @@ static void _httpd_endpoint_save_after_work(tf_ssb_t* ssb, int status, void* use
tf_http_request_t* request = save->request; tf_http_request_t* request = save->request;
if (*save->blob_id) if (*save->blob_id)
{ {
tf_http_respond(request, 200, NULL, 0, save->blob_id, strlen(save->blob_id)); char body[256] = "";
int length = snprintf(body, sizeof(body), "/%s", save->blob_id);
tf_http_respond(request, 200, NULL, 0, body, length);
} }
tf_http_request_unref(request); tf_http_request_unref(request);
tf_free(save); tf_free(save);

View File

@ -90,7 +90,7 @@ void tf_ssb_export(tf_ssb_t* ssb, const char* key)
return; return;
} }
char app_blob_id[64] = { 0 }; char app_blob_id[k_blob_id_len] = { 0 };
sqlite3* db = tf_ssb_acquire_db_reader(ssb); sqlite3* db = tf_ssb_acquire_db_reader(ssb);
sqlite3_busy_timeout(db, 10000); sqlite3_busy_timeout(db, 10000);
sqlite3_stmt* statement; sqlite3_stmt* statement;

View File

@ -260,7 +260,12 @@ try:
driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'confirm').send_keys('new_password') driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'confirm').send_keys('new_password')
driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'loginButton').click() driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'loginButton').click()
wait.until(expected_conditions.presence_of_element_located((By.ID, 'document'))) wait.until(expected_conditions.presence_of_element_located((By.ID, 'document')))
while True:
try:
driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.ID, 'identity').click() driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.ID, 'identity').click()
break
except:
pass
driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.ID, 'logout').click() driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.ID, 'logout').click()
driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'login_label').click() driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'login_label').click()
driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'name').send_keys('testuser') driver.find_element(By.TAG_NAME, 'tf-auth').shadow_root.find_element(By.ID, 'name').send_keys('testuser')