mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-03-25 23:41:39 +01:00
Withot this, it's not possible to submit data to BeaconDB, only retrieve it. This patch has been merged upstream, but it's not clear how long it'll be until the next GeoClue release, thus this backport.
92 lines
4.2 KiB
Diff
92 lines
4.2 KiB
Diff
From 7500e385a1a0f0f9985f74870f8504bd9ac77ea1 Mon Sep 17 00:00:00 2001
|
|
From: Chris Talbot <chris@talbothome.com>
|
|
Date: Sun, 1 Dec 2024 21:33:38 -0700
|
|
Subject: [PATCH 1/2] Mozilla: Include SSID for geolocate and submission
|
|
requests
|
|
|
|
---
|
|
src/gclue-mozilla.c | 10 ++++++++++
|
|
1 file changed, 10 insertions(+)
|
|
|
|
diff --git a/src/gclue-mozilla.c b/src/gclue-mozilla.c
|
|
index 9e8feb1d..abb2280c 100644
|
|
--- a/src/gclue-mozilla.c
|
|
+++ b/src/gclue-mozilla.c
|
|
@@ -257,6 +257,7 @@ gclue_mozilla_create_query (GClueMozilla *mozilla,
|
|
for (iter = bss_list; iter != NULL; iter = iter->next) {
|
|
WPABSS *bss = WPA_BSS (iter->data);
|
|
char mac[BSSID_STR_LEN + 1] = { 0 };
|
|
+ char ssid[MAX_SSID_LEN + 1] = { 0 };
|
|
gint16 strength_dbm;
|
|
guint age_ms;
|
|
|
|
@@ -269,6 +270,10 @@ gclue_mozilla_create_query (GClueMozilla *mozilla,
|
|
get_bssid_from_bss (bss, mac);
|
|
json_builder_add_string_value (builder, mac);
|
|
|
|
+ json_builder_set_member_name (builder, "ssid");
|
|
+ get_ssid_from_bss (bss, ssid);
|
|
+ json_builder_add_string_value (builder, ssid);
|
|
+
|
|
json_builder_set_member_name (builder, "signalStrength");
|
|
strength_dbm = wpa_bss_get_signal (bss);
|
|
json_builder_add_int_value (builder, strength_dbm);
|
|
@@ -486,6 +491,7 @@ gclue_mozilla_create_submit_query (GClueMozilla *mozilla,
|
|
for (iter = bss_list; iter != NULL; iter = iter->next) {
|
|
WPABSS *bss = WPA_BSS (iter->data);
|
|
char mac[BSSID_STR_LEN + 1] = { 0 };
|
|
+ char ssid[MAX_SSID_LEN + 1] = { 0 };
|
|
gint16 strength_dbm;
|
|
guint16 frequency;
|
|
guint age_ms;
|
|
@@ -499,6 +505,10 @@ gclue_mozilla_create_submit_query (GClueMozilla *mozilla,
|
|
get_bssid_from_bss (bss, mac);
|
|
json_builder_add_string_value (builder, mac);
|
|
|
|
+ json_builder_set_member_name (builder, "ssid");
|
|
+ get_ssid_from_bss (bss, ssid);
|
|
+ json_builder_add_string_value (builder, ssid);
|
|
+
|
|
json_builder_set_member_name (builder, "signalStrength");
|
|
strength_dbm = wpa_bss_get_signal (bss);
|
|
json_builder_add_int_value (builder, strength_dbm);
|
|
--
|
|
GitLab
|
|
|
|
|
|
From 87efd9a932cf9b723d6fc84f7b61ebb4cc09d635 Mon Sep 17 00:00:00 2001
|
|
From: Chris Talbot <chris@talbothome.com>
|
|
Date: Sun, 1 Dec 2024 21:34:44 -0700
|
|
Subject: [PATCH 2/2] Mozilla: replace rather than append User-Agent
|
|
|
|
It won't actually attach if you don't do this
|
|
---
|
|
src/gclue-mozilla.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/gclue-mozilla.c b/src/gclue-mozilla.c
|
|
index abb2280c..2b3467d4 100644
|
|
--- a/src/gclue-mozilla.c
|
|
+++ b/src/gclue-mozilla.c
|
|
@@ -301,7 +301,7 @@ gclue_mozilla_create_query (GClueMozilla *mozilla,
|
|
uri = gclue_mozilla_get_locate_url (mozilla);
|
|
ret = soup_message_new ("POST", uri);
|
|
request_headers = soup_message_get_request_headers (ret);
|
|
- soup_message_headers_append (request_headers, "User-Agent", USER_AGENT);
|
|
+ soup_message_headers_replace (request_headers, "User-Agent", USER_AGENT);
|
|
body = g_bytes_new_take (data, data_len);
|
|
soup_message_set_request_body_from_bytes (ret, "application/json", body);
|
|
g_debug ("Sending following request to '%s':\n%s", uri, data);
|
|
@@ -566,7 +566,7 @@ gclue_mozilla_create_submit_query (GClueMozilla *mozilla,
|
|
|
|
ret = soup_message_new ("POST", url);
|
|
request_headers = soup_message_get_request_headers (ret);
|
|
- soup_message_headers_append (request_headers, "User-Agent", USER_AGENT);
|
|
+ soup_message_headers_replace (request_headers, "User-Agent", USER_AGENT);
|
|
if (nick != NULL && nick[0] != '\0')
|
|
soup_message_headers_append (request_headers,
|
|
"X-Nickname",
|
|
--
|
|
GitLab
|
|
|