Compare commits
2 Commits
34804d5162
...
resolve
Author | SHA1 | Date | |
---|---|---|---|
e55548b105 | |||
cea3f7e33c |
@ -1123,4 +1123,4 @@ docs:
|
||||
.PHONY: docs
|
||||
|
||||
fdroid: out/apk/TildeFriends-release.fdroid.unsigned.apk
|
||||
.PHONY: fdroid
|
||||
.PHONE: fdroid
|
||||
|
@ -188,10 +188,6 @@ class TfProfileElement extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
copy_id() {
|
||||
navigator.clipboard.writeText(this.id);
|
||||
}
|
||||
|
||||
render() {
|
||||
if (
|
||||
this.id == this.whoami &&
|
||||
@ -291,14 +287,6 @@ class TfProfileElement extends LitElement {
|
||||
let description = this.editing?.description ?? profile.description;
|
||||
return html`<div style="border: 2px solid black; background-color: rgba(255, 255, 255, 0.2); padding: 16px">
|
||||
<tf-user id=${this.id} .users=${this.users}></tf-user> (${tfutils.human_readable_size(this.size)})
|
||||
<div class="w3-row">
|
||||
<div class="w3-col s1 w3-container w3-right">
|
||||
<button class="w3-button w3-theme-d1 w3-ripple" @click=${this.copy_id}>Copy</button>
|
||||
</div>
|
||||
<div class="w3-rest w3-container">
|
||||
<input type="text" class="w3-theme-d1" style="width: 100%; vertical-align: middle" readonly value=${this.id}></input>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: row; gap: 1em">
|
||||
${edit_profile}
|
||||
<div style="flex: 1 0 50%">
|
||||
|
15
deps/c-ares_config/ares_build.h
vendored
15
deps/c-ares_config/ares_build.h
vendored
@ -34,27 +34,26 @@
|
||||
#define CARES_TYPEOF_ARES_SSIZE_T ssize_t
|
||||
#endif
|
||||
|
||||
#if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__OpenBSD__)
|
||||
#if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__OpenBSD__) && !defined(__HAIKU__)
|
||||
#define GETSERVBYNAME_R_ARGS 6
|
||||
#define GETSERVBYPORT_R_ARGS 6
|
||||
#define HAVE_GETSERVBYNAME_R 1
|
||||
#define HAVE_GETSERVBYPORT_R 1
|
||||
#endif
|
||||
|
||||
#if !defined(__APPLE__) && !defined(_WIN32) && !defined(__OpenBSD__)
|
||||
#define HAVE_PIPE2 1
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#if defined(__OpenBSD__) || defined(__HAIKU__)
|
||||
#define GETSERVBYNAME_R_ARGS 4
|
||||
#define GETSERVBYPORT_R_ARGS 4
|
||||
#endif
|
||||
|
||||
#if !defined(__APPLE__) && !defined(_WIN32) && !defined(__OpenBSD__)
|
||||
#define HAVE_MALLOC_H 1
|
||||
#if !defined(__HAIKU__)
|
||||
#define HAVE_SYS_RANDOM_H 1
|
||||
#define HAVE_EPOLL 1
|
||||
#define HAVE_SYS_EPOLL_H 1
|
||||
#define HAVE_SYS_RANDOM_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(__WIN32)
|
||||
@ -86,7 +85,9 @@
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_GETHOSTNAME 1
|
||||
#define HAVE_GETNAMEINFO 1
|
||||
#if !defined(__HAIKU__)
|
||||
#define HAVE_GETRANDOM 1
|
||||
#endif
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
#define HAVE_IF_INDEXTONAME 1
|
||||
#define HAVE_IF_NAMETOINDEX 1
|
||||
@ -137,7 +138,9 @@
|
||||
#define HAVE_IFADDRS_H 1
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define HAVE_WRITEV 1
|
||||
#if !defined(__HAIKU__)
|
||||
#define HAVE_ARC4RANDOM_BUF 1
|
||||
#endif
|
||||
#define HAVE_GETIFADDRS 1
|
||||
#define HAVE_STAT 1
|
||||
#define CARES_RANDOM_FILE "/dev/urandom"
|
||||
|
@ -15,7 +15,6 @@ import android.os.Parcel;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.RemoteException;
|
||||
import android.os.StrictMode;
|
||||
import android.text.InputType;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
@ -33,7 +32,6 @@ import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import java.io.BufferedReader;
|
||||
@ -193,6 +191,30 @@ public class TildeFriendsActivity extends Activity {
|
||||
});
|
||||
|
||||
web_view.setWebChromeClient(new WebChromeClient() {
|
||||
@Override
|
||||
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
|
||||
new AlertDialog.Builder(view.getContext())
|
||||
.setTitle("Tilde Friends")
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
result.confirm();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
result.cancel();
|
||||
}
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
|
||||
new AlertDialog.Builder(view.getContext())
|
||||
@ -210,59 +232,6 @@ public class TildeFriendsActivity extends Activity {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {
|
||||
new AlertDialog.Builder(view.getContext())
|
||||
.setTitle("Tilde Friends")
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
result.confirm();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
result.cancel();
|
||||
}
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
|
||||
EditText input = new EditText(view.getContext());
|
||||
input.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
input.setText(defaultValue);
|
||||
|
||||
new AlertDialog.Builder(view.getContext())
|
||||
.setTitle("Tilde Friends")
|
||||
.setMessage(message)
|
||||
.setView(input)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
result.confirm(input.getText().toString());
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
result.cancel();
|
||||
}
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
** https://stackoverflow.com/questions/5907369/file-upload-in-webview
|
||||
** https://stackoverflow.com/questions/8586691/how-to-open-file-save-dialog-in-android
|
||||
|
29
src/ssb.c
29
src/ssb.c
@ -77,9 +77,6 @@ enum
|
||||
k_tf_ssb_rpc_message_body_length_max = 1 * 1024 * 1024,
|
||||
k_debug_close_message_count = 256,
|
||||
k_debug_close_connection_count = 32,
|
||||
k_seed_expire_seconds = 10 * 60,
|
||||
k_seed_check_interval_seconds = 5 * 50,
|
||||
k_udp_discovery_expires_seconds = 10,
|
||||
};
|
||||
|
||||
typedef struct _tf_ssb_broadcast_t tf_ssb_broadcast_t;
|
||||
@ -119,7 +116,6 @@ typedef struct _tf_ssb_broadcast_t
|
||||
tf_ssb_broadcast_t* next;
|
||||
time_t ctime;
|
||||
time_t mtime;
|
||||
time_t expires_at;
|
||||
char host[256];
|
||||
struct sockaddr_in addr;
|
||||
tf_ssb_connection_t* tunnel_connection;
|
||||
@ -266,7 +262,6 @@ typedef struct _tf_ssb_t
|
||||
bool is_room;
|
||||
char* room_name;
|
||||
char seeds_host[256];
|
||||
time_t last_seed_check;
|
||||
|
||||
tf_ssb_timer_t** timers;
|
||||
int timers_count;
|
||||
@ -362,7 +357,7 @@ static JSClassID _connection_class_id;
|
||||
static int s_connection_index;
|
||||
static int s_tunnel_index;
|
||||
|
||||
static void _tf_ssb_add_broadcast(tf_ssb_t* ssb, const tf_ssb_broadcast_t* broadcast, int expires_seconds);
|
||||
static void _tf_ssb_add_broadcast(tf_ssb_t* ssb, const tf_ssb_broadcast_t* broadcast);
|
||||
static void _tf_ssb_connection_client_send_hello(tf_ssb_connection_t* connection);
|
||||
static void _tf_ssb_connection_close(tf_ssb_connection_t* connection, const char* reason);
|
||||
static void _tf_ssb_connection_destroy(tf_ssb_connection_t* connection, const char* reason);
|
||||
@ -2951,7 +2946,7 @@ static void _tf_ssb_update_seeds_after_work(tf_ssb_t* ssb, int status, void* use
|
||||
tf_ssb_broadcast_t broadcast = { 0 };
|
||||
if (_tf_ssb_parse_broadcast(seeds->seeds[i], &broadcast))
|
||||
{
|
||||
_tf_ssb_add_broadcast(ssb, &broadcast, k_seed_expire_seconds);
|
||||
_tf_ssb_add_broadcast(ssb, &broadcast);
|
||||
}
|
||||
tf_free(seeds->seeds[i]);
|
||||
}
|
||||
@ -2976,12 +2971,11 @@ static void _tf_ssb_broadcast_timer(uv_timer_t* timer)
|
||||
uv_free_interface_addresses(info, count);
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
if (*ssb->seeds_host && now - ssb->last_seed_check > k_seed_check_interval_seconds)
|
||||
seeds_t* seeds = tf_malloc(sizeof(seeds_t));
|
||||
*seeds = (seeds_t) { 0 };
|
||||
|
||||
if (*ssb->seeds_host)
|
||||
{
|
||||
seeds_t* seeds = tf_malloc(sizeof(seeds_t));
|
||||
*seeds = (seeds_t) { 0 };
|
||||
ssb->last_seed_check = now;
|
||||
tf_ssb_run_work(ssb, _tf_ssb_update_seeds_work, _tf_ssb_update_seeds_after_work, seeds);
|
||||
}
|
||||
}
|
||||
@ -3096,7 +3090,7 @@ static void _tf_ssb_notify_broadcasts_changed(tf_ssb_t* ssb)
|
||||
}
|
||||
}
|
||||
|
||||
static void _tf_ssb_add_broadcast(tf_ssb_t* ssb, const tf_ssb_broadcast_t* broadcast, int expires_seconds)
|
||||
static void _tf_ssb_add_broadcast(tf_ssb_t* ssb, const tf_ssb_broadcast_t* broadcast)
|
||||
{
|
||||
if (memcmp(broadcast->pub, ssb->pub, sizeof(ssb->pub)) == 0)
|
||||
{
|
||||
@ -3110,7 +3104,6 @@ static void _tf_ssb_add_broadcast(tf_ssb_t* ssb, const tf_ssb_broadcast_t* broad
|
||||
if (node->tunnel_connection == broadcast->tunnel_connection && memcmp(node->pub, broadcast->pub, sizeof(node->pub)) == 0)
|
||||
{
|
||||
node->mtime = time(NULL);
|
||||
node->expires_at = node->mtime + expires_seconds;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -3123,7 +3116,6 @@ static void _tf_ssb_add_broadcast(tf_ssb_t* ssb, const tf_ssb_broadcast_t* broad
|
||||
node->addr.sin_addr.s_addr == broadcast->addr.sin_addr.s_addr && memcmp(node->pub, broadcast->pub, sizeof(node->pub)) == 0)
|
||||
{
|
||||
node->mtime = time(NULL);
|
||||
node->expires_at = node->mtime + expires_seconds;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -3140,7 +3132,6 @@ static void _tf_ssb_add_broadcast(tf_ssb_t* ssb, const tf_ssb_broadcast_t* broad
|
||||
node->next = ssb->broadcasts;
|
||||
node->ctime = time(NULL);
|
||||
node->mtime = node->ctime;
|
||||
node->expires_at = node->mtime + expires_seconds;
|
||||
ssb->broadcasts = node;
|
||||
ssb->broadcasts_count++;
|
||||
|
||||
@ -3166,7 +3157,7 @@ static void _tf_ssb_on_broadcast_listener_recv(uv_udp_t* handle, ssize_t nread,
|
||||
tf_ssb_broadcast_t broadcast = { 0 };
|
||||
if (_tf_ssb_parse_broadcast(entry, &broadcast))
|
||||
{
|
||||
_tf_ssb_add_broadcast(ssb, &broadcast, k_udp_discovery_expires_seconds);
|
||||
_tf_ssb_add_broadcast(ssb, &broadcast);
|
||||
}
|
||||
entry = strtok_r(NULL, k_delim, &state);
|
||||
}
|
||||
@ -3197,7 +3188,7 @@ static void _tf_ssb_broadcast_cleanup_timer(uv_timer_t* timer)
|
||||
time_t now = time(NULL);
|
||||
for (tf_ssb_broadcast_t** it = &ssb->broadcasts; *it;)
|
||||
{
|
||||
if (!(*it)->tunnel_connection && now > (*it)->expires_at)
|
||||
if (!(*it)->tunnel_connection && (*it)->mtime < now - 10)
|
||||
{
|
||||
tf_ssb_broadcast_t* node = *it;
|
||||
*it = node->next;
|
||||
@ -3613,7 +3604,7 @@ void tf_ssb_connection_add_room_attendant(tf_ssb_connection_t* connection, const
|
||||
.tunnel_connection = connection,
|
||||
};
|
||||
tf_ssb_id_str_to_bin(broadcast.pub, id);
|
||||
_tf_ssb_add_broadcast(connection->ssb, &broadcast, 0);
|
||||
_tf_ssb_add_broadcast(connection->ssb, &broadcast);
|
||||
}
|
||||
|
||||
void tf_ssb_connection_remove_room_attendant(tf_ssb_connection_t* connection, const char* id)
|
||||
|
Reference in New Issue
Block a user