assorted fixes for assorted stuff

This commit is contained in:
zotlabs 2019-08-25 17:35:14 -07:00
parent 22669bb701
commit d478571b6d
9 changed files with 37 additions and 91 deletions

View file

@ -99,68 +99,6 @@ class Onepoll {
if(! $responded)
return;
if($contact['xchan_connurl']) {
$fetch_feed = true;
$x = null;
// They haven't given us permission to see their stream
$can_view_stream = their_perms_contains($importer_uid,$contact['abook_xchan'],'view_stream');
if(! $can_view_stream)
$fetch_feed = false;
// we haven't given them permission to send us their stream
$can_send_stream = ((strpos(get_abconfig($importer_uid,$contact['abook_xchan'],'system','my_perms',EMPTY_STR),'send_stream') !== false) ? true : false);
if(! $can_send_stream)
$fetch_feed = false;
if($fetch_feed) {
if(strpos($contact['xchan_connurl'],z_root()) === 0) {
// local channel - save a network fetch
$c = channelx_by_hash($contact['xchan_hash']);
if($c) {
$x = [
'success' => true,
'body' => json_encode( [
'success' => true,
'messages' => zot_feed($c['channel_id'], $importer['xchan_hash'], [ 'mindate' => $last_update ])
])
];
}
}
else {
// remote fetch
$feedurl = str_replace('/poco/','/zotfeed/',$contact['xchan_connurl']);
$feedurl .= '?f=&mindate=' . urlencode($last_update) . '&zid=' . $importer['channel_address'] . '@' . \App::get_hostname();
$recurse = 0;
$x = z_fetch_url($feedurl, false, $recurse, [ 'session' => true ]);
}
logger('feed_update: ' . print_r($x,true), LOGGER_DATA);
}
if(($x) && ($x['success'])) {
$total = 0;
logger('onepoll: feed update ' . $contact['xchan_name'] . ' ' . $feedurl);
$j = json_decode($x['body'],true);
if($j['success'] && $j['messages']) {
foreach($j['messages'] as $message) {
$results = Libzot::process_delivery($contact['xchan_hash'], null, get_item_elements($message), [ $importer['xchan_hash'] ], false);
logger('onepoll: feed_update: process_delivery: ' . print_r($results,true), LOGGER_DATA);
$total ++;
}
logger("onepoll: $total messages processed");
}
}
}
// update the poco details for this connection
if($contact['xchan_connurl']) {

View file

@ -982,7 +982,7 @@ class Activity {
$ret['outbox'] = z_root() . '/nullbox';
}
$ret['publicKey'] = [
'id' => $p['xchan_url'] . '/public_key_pem',
'id' => $p['xchan_url'],
'owner' => $p['xchan_url'],
'publicKeyPem' => $p['xchan_pubkey']
];

View file

@ -164,12 +164,7 @@ class Profiles extends Controller {
echo json_encode($r1[0]);
killme();
}
// Run Libprofile::load() here to make sure the theme is set before
// we start loading content
if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_channel(),'multi_profiles')) {
if(feature_enabled(local_channel(),'multi_profiles'))
$id = argv(1);
@ -324,7 +319,7 @@ class Profiles extends Controller {
$orig_vcard = null;
$channel = \App::get_channel();
$channel = App::get_channel();
$default_vcard_cat = ((defined('DEFAULT_VCARD_CAT')) ? DEFAULT_VCARD_CAT : 'HOME');
@ -595,12 +590,12 @@ class Profiles extends Controller {
if($r)
info( t('Profile updated.') . EOL);
$r = q("select * from profile where id = %d and uid = %d limit 1",
$sync = q("select * from profile where id = %d and uid = %d limit 1",
intval(argv(1)),
intval(local_channel())
);
if($r) {
Libsync::build_sync_packet(local_channel(),array('profile' => $r));
if($sync) {
Libsync::build_sync_packet(local_channel(),array('profile' => $sync));
}
$channel = App::get_channel();
@ -618,10 +613,8 @@ class Profiles extends Controller {
}
if($is_default) {
// reload the info for the sidebar widget - Q: why does this not work?
// A: The page is already loaded. Perhaps need to redirect instead to force widget updates.
Libprofile::load($channel['channel_address']);
Master::Summon(array('Directory',local_channel()));
goaway(z_root() . '/profiles/' . $sync[0]['id']);
}
}
}

View file

@ -41,6 +41,7 @@ class Zotfeed extends \Zotlabs\Web\Controller {
logger('zotfeed request: ' . $r[0]['channel_name'], LOGGER_DEBUG);
$result['project'] = 'Zap';
$result['messages'] = zot_feed($r[0]['channel_id'],$observer['xchan_hash'],array('mindate' => $mindate));
$result['success'] = true;
json_return_and_die($result);

View file

@ -48,7 +48,7 @@ require_once('include/items.php');
define ( 'STD_VERSION', '19.8.19' );
define ( 'STD_VERSION', '19.8.21' );
define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1234 );

View file

@ -1309,9 +1309,9 @@ function sync_files($channel, $files) {
logger('sync_files duplicate check: attach_by_hash() returned ' . print_r($x,true), LOGGER_DEBUG);
if ($x['success']) {
$orig_attach = $x[0];
$orig_attach = $x['data'];
$attach_exists = true;
$attach_id = $x[0]['id'];
$attach_id = $orig_attach['id'];
}
$newfname = 'store/' . $channel['channel_address'] . '/' . get_attach_binname($att['content']);

View file

@ -1505,21 +1505,35 @@ function prepare_body(&$item,$attach = false,$opts = false) {
$is_photo = ((($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO)) ? true : false);
if($is_photo && ! $censored) {
if ($is_photo && ! $censored) {
$object = json_decode($item['obj'],true);
$ptr = null;
if (array_key_exists('url',$object) && is_array($object['url'])) {
if (array_key_exists(0,$object['url'])) {
foreach ($object['url'] as $link) {
if(array_key_exists('width',$link) && $link['width'] >= 640 && $link['width'] <= 1024) {
$ptr = $link;
}
}
if (! $ptr) {
$ptr = $object['url'][0];
}
}
else {
$ptr = $object['url'];
}
if(array_key_exists('url',$object) && is_array($object['url']) && array_key_exists(0,$object['url'])) {
// if original photo width is > 640px make it a cover photo
if(array_key_exists('width',$object['url'][0]) && $object['url'][0]['width'] > 640) {
$scale = ((($object['url'][1]['width'] == 1024) || ($object['url'][1]['height'] == 1024)) ? 1 : 0);
$photo = '<a href="' . zid(rawurldecode($object['id'])) . '" target="_blank" rel="nofollow noopener"><img style="max-width:' . $object['url'][$scale]['width'] . 'px; width:100%; height:auto;" src="' . zid(rawurldecode($object['url'][$scale]['href'])) . '"></a>';
if ($ptr) {
if (array_key_exists('width',$ptr) && $ptr['width'] > 640) {
$photo = '<a href="' . zid(rawurldecode($object['id'])) . '" target="_blank" rel="nofollow noopener"><img style="max-width:' . $ptr['width'] . 'px; width:100%; height:auto;" src="' . zid(rawurldecode($ptr['href'])) . '"></a>';
}
else {
$item['body'] = '[zmg]' . $ptr['href'] . '[/zmg]' . "\n\n" . $item['body'];
}
}
// if original photo width is <= 640px prepend it to item body
elseif(array_key_exists('width',$object['url'][0]) && $object['url'][0]['width'] <= 640) {
$item['body'] = '[zmg]' . $object['url'][0]['href'] . '[/zmg]' . "\n\n" . $item['body'];
}
}
}

View file

@ -107,7 +107,7 @@ $(document).ready(function() {
if (event.ctrlKey) {
totStopped = true;
}
$('#pause').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />');
$('#pause').html('<i class="fa fa-pause fa-fw"></i>');
} else {
unpause();
}

View file

@ -805,7 +805,7 @@ div.jGrowl div.info {
}
#jGrowl.top-right {
top: 4.5rem;
right: 15px;
left: 150px;
}
div.jGrowl div.jGrowl-notification {