Merge branch 'dev' of /home/macgirvin/roadhouse into dev

This commit is contained in:
nobody 2021-11-17 11:47:38 -08:00
commit b2a1861070
8 changed files with 45 additions and 47 deletions

View file

@ -223,6 +223,7 @@ class Channel extends Controller {
if ($this->loading && ! $mid) {
$_SESSION['loadtime_channel'] = datetime_convert();
if ($is_owner) {
PConfig::Set(local_channel(),'system','loadtime_channel',$_SESSION['loadtime_channel']);
@ -360,7 +361,6 @@ class Channel extends Controller {
}
if (($this->updating) && (! $this->loading)) {
if ($mid) {
$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",
@ -379,7 +379,6 @@ class Channel extends Controller {
intval(App::$profile['profile_uid'])
);
}
}
else {

View file

@ -52,7 +52,9 @@ class Ping extends Controller {
$vnotify = false;
$evdays = 3;
$my_activity = 0;
$item_normal = item_normal();
if (local_channel()) {
@ -154,20 +156,25 @@ class Ping extends Controller {
$loadtime = get_loadtime('pubstream');
if ($notify_pubs) {
$pubs = q("SELECT count(id) as total from item
$pubs = q("SELECT id, author_xchan from item
WHERE uid = %d
AND author_xchan != '%s'
AND created > '%s'
$seenstr
$item_normal
$sql_extra",
intval($sys['channel_id']),
dbesc(get_observer_hash()),
dbesc($loadtime)
);
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
*/
if ($vnotify & VNOTIFY_SYSTEM) {
$t = q("select count(*) as total from notify where uid = %d and seen = 0",
intval(local_channel())
@ -573,15 +581,13 @@ class Ping extends Controller {
if ($vnotify & VNOTIFY_NETWORK) {
$loadtime = get_loadtime('stream');
$r = q("SELECT id FROM item
$r = q("SELECT id, author_xchan FROM item
WHERE uid = %d and changed > '%s'
$seenstr
$item_normal
$sql_extra
AND author_xchan != '%s'",
$sql_extra ",
intval(local_channel()),
dbesc($loadtime),
dbesc($ob_hash)
dbesc($loadtime)
);
if($r) {
@ -589,7 +595,12 @@ class Ping extends Controller {
call_hooks('network_ping', $arr);
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) {
$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'
$seenstr
$item_normal
$sql_extra
AND author_xchan != '%s'",
$sql_extra ",
intval(local_channel()),
dbesc($loadtime),
dbesc($ob_hash)
dbesc($loadtime)
);
if ($r) {
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.
// 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');
$_SESSION['loadtime_channel'] = datetime_convert();
$_SESSION['loadtime_stream'] = datetime_convert();
$_SESSION['loadtime_pubstream'] = datetime_convert();

View file

@ -17,8 +17,7 @@ use Zotlabs\Daemon\Run;
* @brief This file defines some global constants and includes the central App class.
*/
define ( 'STD_VERSION', '21.11.11' );
define ( 'STD_VERSION', '21.11.14' );
define ( 'PLATFORM_NAME', 'streams' );
define ( 'DB_UPDATE_VERSION', 1254 );

View file

@ -348,6 +348,7 @@ function can_comment_on_post($observer_xchan, $item) {
return true;
break;
case 'any connections':
case 'specific':
case 'contacts':
case '':
@ -1194,6 +1195,9 @@ function map_scope($scope, $strip = false) {
return 'site: ' . App::get_hostname();
case PERMS_PENDING:
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:
default:
return 'contacts';
@ -2420,17 +2424,7 @@ function item_update_parent_commented($item) {
$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
// - 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
@ -2449,16 +2443,11 @@ function item_update_parent_commented($item) {
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(datetime_convert()),
intval($item['parent'])
);
if ($update_changed) {
q("UPDATE item set changed = '%s' WHERE id = %d",
dbesc(datetime_convert()),
intval($item['parent'])
);
}
}
}

View file

@ -3256,9 +3256,6 @@ function item_url_replace($channel,&$item,$old,$new,$oldnick = '') {
json_url_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['target']);
}
$root_replaced = null;
$nick_replaced = null;
$item['body'] = str_replace($old, $new, $item['body']);
if($oldnick && ($oldnick !== $channel['channel_address'])) {

View file

@ -26,7 +26,7 @@ class JSalmon:
def verify(x,key):
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")))

View file

@ -20,7 +20,7 @@ def base64urlnopad_decode(data: str) -> bytes:
return base64.urlsafe_b64decode(data)
def generate_rsa_keypair() -> (str, str):
def generate_rsa_keypair() -> tuple(str, str):
key = rsa.generate_private_key(
public_exponent = 65537,
key_size = 4096,

View file

@ -1028,7 +1028,7 @@ function liveUpdate(notify_id) {
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; }