Fix -t auto.

This commit is contained in:
Cory McWilliams 2024-04-13 20:32:17 -04:00
parent c52331a23a
commit 26165e30de
5 changed files with 33 additions and 6 deletions

View File

@ -142,7 +142,9 @@ class TfNavigationElement extends LitElement {
} }
create_identity(event) { create_identity(event) {
send({action: 'createIdentity'}); if (confirm('Are you sure you want to create a new identity?')) {
send({action: 'createIdentity'});
}
} }
render_identity() { render_identity() {
@ -163,6 +165,7 @@ class TfNavigationElement extends LitElement {
return html` return html`
<link type="text/css" rel="stylesheet" href="/static/w3.css" /> <link type="text/css" rel="stylesheet" href="/static/w3.css" />
<button <button
id="create_identity"
@click=${this.create_identity} @click=${this.create_identity}
class="w3-button w3-blue w3-right" class="w3-button w3-blue w3-right"
> >

View File

@ -580,6 +580,19 @@ async function getProcessBlob(blobId, key, options) {
) { ) {
let id = ssb.createIdentity(process.credentials.session.name); let id = ssb.createIdentity(process.credentials.session.name);
await process.sendIdentities(); await process.sendIdentities();
broadcastAppEventToUser(
process?.credentials?.session?.name,
options.packageOwner,
options.packageName,
'setActiveIdentity',
[
await getActiveIdentity(
process.credentials?.session?.name,
options.packageOwner,
options.packageName
)
]
);
return id; return id;
} }
}; };

View File

@ -472,8 +472,8 @@ static JSValue _httpd_auth_query(JSContext* context, JSValueConst this_val, int
const char* settings = tf_ssb_db_get_property(ssb, "core", "settings"); const char* settings = tf_ssb_db_get_property(ssb, "core", "settings");
JSValue settings_value = settings ? JS_ParseJSON(context, settings, strlen(settings), NULL) : JS_UNDEFINED; JSValue settings_value = settings ? JS_ParseJSON(context, settings, strlen(settings), NULL) : JS_UNDEFINED;
JSValue permissions = JS_GetPropertyStr(context, settings_value, "permissions"); JSValue permissions = !JS_IsUndefined(settings_value) ? JS_GetPropertyStr(context, settings_value, "permissions") : JS_UNDEFINED;
JSValue user_permissions = JS_GetPropertyStr(context, permissions, name_string); JSValue user_permissions = !JS_IsUndefined(permissions) ? JS_GetPropertyStr(context, permissions, name_string) : JS_UNDEFINED;
int length = !JS_IsUndefined(user_permissions) ? tf_util_get_length(context, user_permissions) : 0; int length = !JS_IsUndefined(user_permissions) ? tf_util_get_length(context, user_permissions) : 0;
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {

View File

@ -147,7 +147,12 @@ void tf_packetstream_send(tf_packetstream_t* stream, int packet_type, const char
uv_buf_t write_buffer; uv_buf_t write_buffer;
write_buffer.base = buffer; write_buffer.base = buffer;
write_buffer.len = sizeof(packet_type) + sizeof(length) + length; write_buffer.len = sizeof(packet_type) + sizeof(length) + length;
uv_write(request, (uv_stream_t*)&stream->stream, &write_buffer, 1, _packetstream_on_write); int result = uv_write(request, (uv_stream_t*)&stream->stream, &write_buffer, 1, _packetstream_on_write);
if (result)
{
tf_printf("uv_write: %s\n", uv_strerror(result));
tf_free(request);
}
} }
} }

View File

@ -34,11 +34,18 @@ try:
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')))
driver.switch_to.frame(driver.find_element(By.ID, 'document'))
wait.until(expected_conditions.presence_of_element_located((By.LINK_TEXT, 'identity')))
driver.switch_to.default_content()
driver.find_element(By.TAG_NAME, 'tf-navigation').shadow_root.find_element(By.ID, 'create_identity').click()
wait.until(expected_conditions.alert_is_present()).accept()
driver.switch_to.frame(driver.find_element(By.ID, 'document')) driver.switch_to.frame(driver.find_element(By.ID, 'document'))
wait.until(expected_conditions.presence_of_element_located((By.LINK_TEXT, 'identity'))).click() wait.until(expected_conditions.presence_of_element_located((By.LINK_TEXT, 'identity'))).click()
driver.switch_to.default_content() driver.switch_to.default_content()
wait.until(expected_conditions.presence_of_element_located((By.ID, 'content'))) wait.until(expected_conditions.presence_of_element_located((By.ID, 'content')))
# StaleElementReferenceException # StaleElementReferenceException
while True: while True:
try: try:
@ -77,6 +84,7 @@ try:
driver.switch_to.default_content() driver.switch_to.default_content()
wait.until(expected_conditions.presence_of_element_located((By.ID, 'content'))) wait.until(expected_conditions.presence_of_element_located((By.ID, 'content')))
# StaleElementReferenceException # StaleElementReferenceException
while True: while True:
try: try:
@ -91,8 +99,6 @@ try:
break break
except: except:
pass pass
wait.until(expected_conditions.element_to_be_clickable(tf_app.find_element(By.ID, 'create_identity'))).click()
wait.until(expected_conditions.alert_is_present()).accept()
tf_tab_news = wait.until(exists_in_shadow_root(tf_app, By.ID, 'tf-tab-news')).shadow_root tf_tab_news = wait.until(exists_in_shadow_root(tf_app, By.ID, 'tf-tab-news')).shadow_root
tf_tab_news.find_element(By.ID, 'tf-compose').shadow_root.find_element(By.ID, 'edit').send_keys('Hello, world!') tf_tab_news.find_element(By.ID, 'tf-compose').shadow_root.find_element(By.ID, 'edit').send_keys('Hello, world!')