Skip to content

Commit dacfd59

Browse files
authored
Add files via upload
1 parent 3bb425a commit dacfd59

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

assets/banner-1544x500.png

16.2 KB
Loading

assets/icon-256x256.png

13.7 KB
Loading

includes/rest-endpoints.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ function peaceprotocol_receive_peace($request) {
4747
$target_site = sanitize_url($request->get_param('target_site'));
4848
$message = sanitize_textarea_field($request->get_param('message'));
4949
$token = sanitize_text_field($request->get_param('token'));
50+
$from_site = sanitize_url($request->get_param('from_site'));
5051

5152
// error_log('Peace Protocol REST: Target site: ' . $target_site);
5253
// error_log('Peace Protocol REST: Token: ' . $token);
54+
// error_log('Peace Protocol REST: From site: ' . $from_site);
5355

5456
// Validate token
5557
$identity = peaceprotocol_validate_token($token);
@@ -66,15 +68,19 @@ function peaceprotocol_receive_peace($request) {
6668
return new WP_Error('user_banned', 'You are banned from sending peace', array('status' => 403));
6769
}
6870

71+
// Use from_site if provided, otherwise fall back to token's site_url
72+
$sending_site = $from_site ?: $identity['site_url'];
73+
6974
// error_log('Peace Protocol REST: Identity validated: ' . print_r($identity, true));
75+
// error_log('Peace Protocol REST: Using sending site: ' . $sending_site);
7076

7177
// Save Peace Log directly (don't call send_peace_to_site which would create infinite loop)
7278
$log_id = wp_insert_post([
7379
'post_type' => 'peaceprotocol_log',
74-
'post_title' => 'Peace from ' . $identity['site_url'],
80+
'post_title' => 'Peace from ' . $sending_site,
7581
'post_content' => $message,
7682
'post_status' => 'publish',
77-
'meta_input' => ['from_site' => $identity['site_url'], 'note' => $message]
83+
'meta_input' => ['from_site' => $sending_site, 'note' => $message]
7884
]);
7985

8086
// error_log('Peace Protocol REST: Peace log created with ID: ' . $log_id);
@@ -1536,7 +1542,7 @@ function getIdentities() {
15361542
}
15371543

15381544
$identity = array(
1539-
'site_url' => get_site_url(),
1545+
'site_url' => $federated_site,
15401546
'token' => $active_token
15411547
);
15421548

@@ -1647,7 +1653,7 @@ function peaceprotocol_ajax_send_peace() {
16471653
}
16481654

16491655
$identity = array(
1650-
'site_url' => get_site_url(),
1656+
'site_url' => $federated_site,
16511657
'token' => $active_token
16521658
);
16531659

@@ -2004,7 +2010,8 @@ function peaceprotocol_send_peace_to_site($target_site, $message, $identity) {
20042010
'body' => json_encode(array(
20052011
'target_site' => $target_site,
20062012
'message' => $message,
2007-
'token' => $identity['token']
2013+
'token' => $identity['token'],
2014+
'from_site' => $identity['site_url']
20082015
)),
20092016
'timeout' => 2
20102017
));

peace-protocol.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Peace Protocol
44
* Plugin URI: https://wilcosky.com/peace-protocol
55
* Description: A decentralized way for WordPress admins to share peace, respect, and follow each other with cryptographic handshakes.
6-
* Version: 1.2.5
6+
* Version: 1.2.7
77
* Requires at least: 6.0
88
* Tested up to: 6.8.2
99
* Requires PHP: 7.4
@@ -17,7 +17,7 @@
1717

1818
defined('ABSPATH') || exit;
1919

20-
define('PEACEPROTOCOL_VERSION', '1.2.5');
20+
define('PEACEPROTOCOL_VERSION', '1.2.7');
2121
define('PEACEPROTOCOL_DIR', plugin_dir_path(__FILE__));
2222
define('PEACEPROTOCOL_URL', plugin_dir_url(__FILE__));
2323

readme.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: federation, peace, decentralized, security, cryptographic
44
Requires at least: 6.0
55
Tested up to: 6.8
66
Requires PHP: 7.4
7-
Stable tag: 1.2.5
7+
Stable tag: 1.2.7
88
License: GPLv2 or later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -209,6 +209,16 @@ The plugin includes a comprehensive user banning system. You can ban users with
209209

210210
== Changelog ==
211211

212+
= 1.2.7 =
213+
* **Bug Fix**: Fixed REST API federated site identity issue where peace messages showed incorrect sending site
214+
* **REST API Enhancement**: Added missing from_site parameter to REST API calls for proper federated site attribution
215+
* **Cross-Site Communication**: Peace messages now correctly show the actual federated site that sent them via REST API
216+
217+
= 1.2.6 =
218+
* **Bug Fix**: Fixed federated site identity issue where peace messages showed incorrect sending site
219+
* **Federated Authentication**: Peace messages now correctly show the actual federated site that sent them
220+
* **User Experience**: Improved accuracy of peace attribution when using cross-site authentication
221+
212222
= 1.2.5 =
213223
* **Bug Fix**: Fixed "headers already sent" session warning that occurred when used alongside other plugins
214224
* **Session Security**: Improved session handling to prevent conflicts with AJAX and early-output plugins

0 commit comments

Comments
 (0)