mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 16:55:18 +00:00
Merge branch 'dev' of /home/macgirvin/roadhouse into dev
This commit is contained in:
commit
b2a1861070
8 changed files with 45 additions and 47 deletions
|
@ -223,6 +223,7 @@ class Channel extends Controller {
|
||||||
|
|
||||||
|
|
||||||
if ($this->loading && ! $mid) {
|
if ($this->loading && ! $mid) {
|
||||||
|
|
||||||
$_SESSION['loadtime_channel'] = datetime_convert();
|
$_SESSION['loadtime_channel'] = datetime_convert();
|
||||||
if ($is_owner) {
|
if ($is_owner) {
|
||||||
PConfig::Set(local_channel(),'system','loadtime_channel',$_SESSION['loadtime_channel']);
|
PConfig::Set(local_channel(),'system','loadtime_channel',$_SESSION['loadtime_channel']);
|
||||||
|
@ -360,7 +361,6 @@ class Channel extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($this->updating) && (! $this->loading)) {
|
if (($this->updating) && (! $this->loading)) {
|
||||||
|
|
||||||
if ($mid) {
|
if ($mid) {
|
||||||
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal_update
|
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal_update
|
||||||
AND item_wall = 1 $simple_update $sql_extra limit 1",
|
AND item_wall = 1 $simple_update $sql_extra limit 1",
|
||||||
|
@ -379,7 +379,6 @@ class Channel extends Controller {
|
||||||
intval(App::$profile['profile_uid'])
|
intval(App::$profile['profile_uid'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,9 @@ class Ping extends Controller {
|
||||||
|
|
||||||
$vnotify = false;
|
$vnotify = false;
|
||||||
$evdays = 3;
|
$evdays = 3;
|
||||||
|
|
||||||
|
$my_activity = 0;
|
||||||
|
|
||||||
$item_normal = item_normal();
|
$item_normal = item_normal();
|
||||||
|
|
||||||
if (local_channel()) {
|
if (local_channel()) {
|
||||||
|
@ -154,20 +156,25 @@ class Ping extends Controller {
|
||||||
$loadtime = get_loadtime('pubstream');
|
$loadtime = get_loadtime('pubstream');
|
||||||
|
|
||||||
if ($notify_pubs) {
|
if ($notify_pubs) {
|
||||||
$pubs = q("SELECT count(id) as total from item
|
$pubs = q("SELECT id, author_xchan from item
|
||||||
WHERE uid = %d
|
WHERE uid = %d
|
||||||
AND author_xchan != '%s'
|
|
||||||
AND created > '%s'
|
AND created > '%s'
|
||||||
$seenstr
|
$seenstr
|
||||||
$item_normal
|
$item_normal
|
||||||
$sql_extra",
|
$sql_extra",
|
||||||
intval($sys['channel_id']),
|
intval($sys['channel_id']),
|
||||||
dbesc(get_observer_hash()),
|
|
||||||
dbesc($loadtime)
|
dbesc($loadtime)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($pubs) {
|
if ($pubs) {
|
||||||
$result['pubs'] = intval($pubs[0]['total']);
|
foreach($pubs as $p) {
|
||||||
|
if ($p['author_xchan'] === get_observer_hash()) {
|
||||||
|
$my_activity ++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$result['pubs'] ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +552,8 @@ class Ping extends Controller {
|
||||||
/**
|
/**
|
||||||
* Normal ping - just the counts, no detail
|
* Normal ping - just the counts, no detail
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if ($vnotify & VNOTIFY_SYSTEM) {
|
if ($vnotify & VNOTIFY_SYSTEM) {
|
||||||
$t = q("select count(*) as total from notify where uid = %d and seen = 0",
|
$t = q("select count(*) as total from notify where uid = %d and seen = 0",
|
||||||
intval(local_channel())
|
intval(local_channel())
|
||||||
|
@ -573,15 +581,13 @@ class Ping extends Controller {
|
||||||
|
|
||||||
if ($vnotify & VNOTIFY_NETWORK) {
|
if ($vnotify & VNOTIFY_NETWORK) {
|
||||||
$loadtime = get_loadtime('stream');
|
$loadtime = get_loadtime('stream');
|
||||||
$r = q("SELECT id FROM item
|
$r = q("SELECT id, author_xchan FROM item
|
||||||
WHERE uid = %d and changed > '%s'
|
WHERE uid = %d and changed > '%s'
|
||||||
$seenstr
|
$seenstr
|
||||||
$item_normal
|
$item_normal
|
||||||
$sql_extra
|
$sql_extra ",
|
||||||
AND author_xchan != '%s'",
|
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
dbesc($loadtime),
|
dbesc($loadtime)
|
||||||
dbesc($ob_hash)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
|
@ -589,7 +595,12 @@ class Ping extends Controller {
|
||||||
call_hooks('network_ping', $arr);
|
call_hooks('network_ping', $arr);
|
||||||
|
|
||||||
foreach ($r as $it) {
|
foreach ($r as $it) {
|
||||||
$result['stream'] ++;
|
if ($it['author_xchan'] === $ob_hash) {
|
||||||
|
$my_activity ++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$result['stream'] ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -599,20 +610,23 @@ class Ping extends Controller {
|
||||||
|
|
||||||
if ($vnotify & VNOTIFY_CHANNEL) {
|
if ($vnotify & VNOTIFY_CHANNEL) {
|
||||||
$loadtime = get_loadtime('channel');
|
$loadtime = get_loadtime('channel');
|
||||||
$r = q("SELECT id FROM item
|
$r = q("SELECT id, author_xchan FROM item
|
||||||
WHERE item_wall = 1 and uid = %d and changed > '%s'
|
WHERE item_wall = 1 and uid = %d and changed > '%s'
|
||||||
$seenstr
|
$seenstr
|
||||||
$item_normal
|
$item_normal
|
||||||
$sql_extra
|
$sql_extra ",
|
||||||
AND author_xchan != '%s'",
|
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
dbesc($loadtime),
|
dbesc($loadtime)
|
||||||
dbesc($ob_hash)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($r) {
|
if ($r) {
|
||||||
foreach ($r as $it) {
|
foreach ($r as $it) {
|
||||||
$result['home'] ++;
|
if ($it['author_xchan'] === $ob_hash) {
|
||||||
|
$my_activity ++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$result['home'] ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -752,9 +766,9 @@ class Ping extends Controller {
|
||||||
// Mark all of the stream notifications seen if all three of them are caught up.
|
// Mark all of the stream notifications seen if all three of them are caught up.
|
||||||
// This also resets the pconfig storage for items_seen
|
// This also resets the pconfig storage for items_seen
|
||||||
|
|
||||||
if (! (intval($result['home']) + intval($result['stream']) + intval($result['pubs']))) {
|
if ((! $my_activity) && (! (intval($result['home']) + intval($result['stream']) + intval($result['pubs'])))) {
|
||||||
PConfig::Delete(local_channel(),'system','seen_items');
|
PConfig::Delete(local_channel(),'system','seen_items');
|
||||||
|
|
||||||
$_SESSION['loadtime_channel'] = datetime_convert();
|
$_SESSION['loadtime_channel'] = datetime_convert();
|
||||||
$_SESSION['loadtime_stream'] = datetime_convert();
|
$_SESSION['loadtime_stream'] = datetime_convert();
|
||||||
$_SESSION['loadtime_pubstream'] = datetime_convert();
|
$_SESSION['loadtime_pubstream'] = datetime_convert();
|
||||||
|
|
3
boot.php
3
boot.php
|
@ -17,8 +17,7 @@ use Zotlabs\Daemon\Run;
|
||||||
* @brief This file defines some global constants and includes the central App class.
|
* @brief This file defines some global constants and includes the central App class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
define ( 'STD_VERSION', '21.11.14' );
|
||||||
define ( 'STD_VERSION', '21.11.11' );
|
|
||||||
define ( 'PLATFORM_NAME', 'streams' );
|
define ( 'PLATFORM_NAME', 'streams' );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1254 );
|
define ( 'DB_UPDATE_VERSION', 1254 );
|
||||||
|
|
|
@ -348,6 +348,7 @@ function can_comment_on_post($observer_xchan, $item) {
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
case 'any connections':
|
case 'any connections':
|
||||||
|
case 'specific':
|
||||||
case 'contacts':
|
case 'contacts':
|
||||||
case '':
|
case '':
|
||||||
|
|
||||||
|
@ -1194,6 +1195,9 @@ function map_scope($scope, $strip = false) {
|
||||||
return 'site: ' . App::get_hostname();
|
return 'site: ' . App::get_hostname();
|
||||||
case PERMS_PENDING:
|
case PERMS_PENDING:
|
||||||
return 'any connections';
|
return 'any connections';
|
||||||
|
// uncomment a few releases after the corresponding changes are made in can_comment_on_post. Here it was done on 2021-11-18
|
||||||
|
// case PERMS_SPECIFIC:
|
||||||
|
// return 'specific';
|
||||||
case PERMS_CONTACTS:
|
case PERMS_CONTACTS:
|
||||||
default:
|
default:
|
||||||
return 'contacts';
|
return 'contacts';
|
||||||
|
@ -2420,17 +2424,7 @@ function item_update_parent_commented($item) {
|
||||||
|
|
||||||
|
|
||||||
$update_parent = true;
|
$update_parent = true;
|
||||||
$update_changed = true;
|
|
||||||
|
|
||||||
$c = channelx_by_n($item['uid']);
|
|
||||||
|
|
||||||
// don't modify the changed time on the parent if we commented on it.
|
|
||||||
// This messes up the notification system, which ignores changes made by us
|
|
||||||
|
|
||||||
if ($c && $item['author_xchan'] === $c['channel_hash']) {
|
|
||||||
$update_changed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the commented timestamp on the parent
|
// update the commented timestamp on the parent
|
||||||
// - unless this is a moderated comment or a potential clone of an older item
|
// - unless this is a moderated comment or a potential clone of an older item
|
||||||
// which we don't wish to bring to the surface. As the queue only holds deliveries
|
// which we don't wish to bring to the surface. As the queue only holds deliveries
|
||||||
|
@ -2449,16 +2443,11 @@ function item_update_parent_commented($item) {
|
||||||
intval($item['uid'])
|
intval($item['uid'])
|
||||||
);
|
);
|
||||||
|
|
||||||
q("UPDATE item set commented = '%s' WHERE id = %d",
|
q("UPDATE item set commented = '%s', changed = '%s' WHERE id = %d",
|
||||||
dbesc(($z) ? $z[0]['commented'] : datetime_convert()),
|
dbesc(($z) ? $z[0]['commented'] : datetime_convert()),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
intval($item['parent'])
|
intval($item['parent'])
|
||||||
);
|
);
|
||||||
if ($update_changed) {
|
|
||||||
q("UPDATE item set changed = '%s' WHERE id = %d",
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
intval($item['parent'])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3256,9 +3256,6 @@ function item_url_replace($channel,&$item,$old,$new,$oldnick = '') {
|
||||||
json_url_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['target']);
|
json_url_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['target']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$root_replaced = null;
|
|
||||||
$nick_replaced = null;
|
|
||||||
|
|
||||||
$item['body'] = str_replace($old, $new, $item['body']);
|
$item['body'] = str_replace($old, $new, $item['body']);
|
||||||
|
|
||||||
if($oldnick && ($oldnick !== $channel['channel_address'])) {
|
if($oldnick && ($oldnick !== $channel['channel_address'])) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ class JSalmon:
|
||||||
|
|
||||||
def verify(x,key):
|
def verify(x,key):
|
||||||
if x['signed'] != True:
|
if x['signed'] != True:
|
||||||
return false
|
return False
|
||||||
|
|
||||||
signed_data = re.sub(r'\s+','', x['data'] + "." + base64urlnopad_encode(x['data_type'].encode("utf-8")) + "." + base64urlnopad_encode(x['encoding'].encode("utf-8")) + "." + base64urlnopad_encode(x['alg'].encode("utf-8")))
|
signed_data = re.sub(r'\s+','', x['data'] + "." + base64urlnopad_encode(x['data_type'].encode("utf-8")) + "." + base64urlnopad_encode(x['encoding'].encode("utf-8")) + "." + base64urlnopad_encode(x['alg'].encode("utf-8")))
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ def base64urlnopad_decode(data: str) -> bytes:
|
||||||
return base64.urlsafe_b64decode(data)
|
return base64.urlsafe_b64decode(data)
|
||||||
|
|
||||||
|
|
||||||
def generate_rsa_keypair() -> (str, str):
|
def generate_rsa_keypair() -> tuple(str, str):
|
||||||
key = rsa.generate_private_key(
|
key = rsa.generate_private_key(
|
||||||
public_exponent = 65537,
|
public_exponent = 65537,
|
||||||
key_size = 4096,
|
key_size = 4096,
|
||||||
|
|
|
@ -1028,7 +1028,7 @@ function liveUpdate(notify_id) {
|
||||||
let expanded = $('.comment-edit-text.expanded');
|
let expanded = $('.comment-edit-text.expanded');
|
||||||
|
|
||||||
|
|
||||||
if(typeof profile_uid === 'undefined') profile_uid = false; /* Should probably be unified with channelId defined in head.tpl */
|
if(typeof profile_uid === 'undefined') profile_uid = false;
|
||||||
|
|
||||||
if((src === null) || (! profile_uid)) { $('.like-rotator').hide(); return; }
|
if((src === null) || (! profile_uid)) { $('.like-rotator').hide(); return; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue