aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/Activity.php37
-rw-r--r--Zotlabs/Lib/Enotify.php12
-rw-r--r--Zotlabs/Module/Feed.php2
-rw-r--r--Zotlabs/Module/Fhubloc_id_url.php58
-rw-r--r--Zotlabs/Update/_1238.php28
-rwxr-xr-xboot.php2
-rw-r--r--include/api_zot.php15
-rw-r--r--include/network.php2
-rw-r--r--include/zot.php5
-rw-r--r--util/zotsh/easywebdav/__init__.pycbin483 -> 457 bytes
-rw-r--r--util/zotsh/easywebdav/__version__.pycbin187 -> 174 bytes
-rw-r--r--util/zotsh/easywebdav/client.pycbin9211 -> 8886 bytes
-rw-r--r--view/js/main.js124
-rw-r--r--view/tpl/notifications_widget.tpl8
14 files changed, 200 insertions, 93 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index d883eac67..25f19510d 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -1456,11 +1456,35 @@ class Activity {
$icon = $person_obj['icon'];
}
- if(is_array($person_obj['url']) && array_key_exists('href', $person_obj['url']))
- $profile = $person_obj['url']['href'];
- else
- $profile = $url;
+ $links = false;
+ $profile = false;
+
+ if (is_array($person_obj['url'])) {
+ if (! array_key_exists(0,$person_obj['url'])) {
+ $links = [ $person_obj['url'] ];
+ }
+ else {
+ $links = $person_obj['url'];
+ }
+ }
+
+ if ($links) {
+ foreach ($links as $link) {
+ if (array_key_exists('mediaType',$link) && $link['mediaType'] === 'text/html') {
+ $profile = $link['href'];
+ }
+ }
+ if (! $profile) {
+ $profile = $links[0]['href'];
+ }
+ }
+ elseif (isset($person_obj['url']) && is_string($person_obj['url'])) {
+ $profile = $person_obj['url'];
+ }
+ if (! $profile) {
+ $profile = $url;
+ }
$inbox = $person_obj['inbox'];
@@ -1492,6 +1516,7 @@ class Activity {
);
if(! $r) {
// create a new record
+
$r = xchan_store_lowlevel(
[
'xchan_hash' => $url,
@@ -2561,8 +2586,8 @@ class Activity {
switch($a->type) {
case 'Create':
case 'Update':
- case 'Like':
- case 'Dislike':
+ //case 'Like':
+ //case 'Dislike':
case 'Announce':
$item = self::decode_note($a);
break;
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index f706b0fb9..90c498d78 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -856,11 +856,11 @@ class Enotify {
'photo' => $item[$who]['xchan_photo_s'],
'when' => (($edit) ? datetime_convert('UTC', date_default_timezone_get(), $item['edited']) : datetime_convert('UTC', date_default_timezone_get(), $item['created'])),
'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'),
- 'b64mid' => 'b64.' . base64url_encode($item['mid']),
+ 'b64mid' => (($item['mid']) ? 'b64.' . base64url_encode($item['mid']) : ''),
//'b64mid' => ((in_array($item['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) ? 'b64.' . base64url_encode($item['thr_parent']) : 'b64.' . base64url_encode($item['mid'])),
- 'notify_id' => 'undefined',
'thread_top' => (($item['item_thread_top']) ? true : false),
'message' => bbcode(escape_tags($itemem_text)),
+ 'body' => htmlentities(html2plain(bbcode($item['body'])), ENT_COMPAT, 'UTF-8', false),
// these are for the superblock addon
'hash' => $item[$who]['xchan_hash'],
'uid' => $item['uid'],
@@ -885,7 +885,6 @@ class Enotify {
$mid = basename($tt['link']);
$b64mid = ((strpos($mid, 'b64.') === 0) ? $mid : 'b64.' . base64url_encode($mid));
-
$x = [
'notify_link' => z_root() . '/notify/view/' . $tt['id'],
'name' => $tt['xname'],
@@ -893,8 +892,8 @@ class Enotify {
'photo' => $tt['photo'],
'when' => datetime_convert('UTC', date_default_timezone_get(), $tt['created']),
'hclass' => (($tt['seen']) ? 'notify-seen' : 'notify-unseen'),
- 'b64mid' => (($tt['otype'] == 'item') ? $b64mid : 'undefined'),
- 'notify_id' => (($tt['otype'] == 'item') ? $tt['id'] : 'undefined'),
+ 'b64mid' => (($tt['otype'] == 'item') ? $b64mid : ''),
+ 'notify_id' => (($tt['otype'] == 'item') ? $tt['id'] : ''),
'message' => $message
];
@@ -980,8 +979,7 @@ class Enotify {
$x = [
'notify_link' => z_root() . '/admin/accounts',
'name' => $rr['account_email'],
- 'addr' => $rr['account_email'],
- 'url' => '',
+ //'addr' => $rr['account_email'],
'photo' => z_root() . '/' . get_default_profile_photo(48),
'when' => datetime_convert('UTC', date_default_timezone_get(),$rr['account_created']),
'hclass' => ('notify-unseen'),
diff --git a/Zotlabs/Module/Feed.php b/Zotlabs/Module/Feed.php
index 36869abbe..b5e7b28fa 100644
--- a/Zotlabs/Module/Feed.php
+++ b/Zotlabs/Module/Feed.php
@@ -17,7 +17,7 @@ class Feed extends \Zotlabs\Web\Controller {
$params['pages'] = ((x($_REQUEST,'pages')) ? intval($_REQUEST['pages']) : 0);
$params['top'] = ((x($_REQUEST,'top')) ? intval($_REQUEST['top']) : 0);
$params['start'] = ((x($_REQUEST,'start')) ? intval($_REQUEST['start']) : 0);
- $params['records'] = ((x($_REQUEST,'records')) ? intval($_REQUEST['records']) : 40);
+ $params['records'] = ((x($_REQUEST,'records')) ? intval($_REQUEST['records']) : 10);
$params['direction'] = ((x($_REQUEST,'direction')) ? dbesc($_REQUEST['direction']) : 'desc');
$params['cat'] = ((x($_REQUEST,'cat')) ? escape_tags($_REQUEST['cat']) : '');
$params['compat'] = ((x($_REQUEST,'compat')) ? intval($_REQUEST['compat']) : 0);
diff --git a/Zotlabs/Module/Fhubloc_id_url.php b/Zotlabs/Module/Fhubloc_id_url.php
new file mode 100644
index 000000000..d332c7400
--- /dev/null
+++ b/Zotlabs/Module/Fhubloc_id_url.php
@@ -0,0 +1,58 @@
+<?php
+namespace Zotlabs\Module;
+
+/* fix missing or hubloc_id_url entries */
+
+class Fhubloc_id_url extends \Zotlabs\Web\Controller {
+
+ function get() {
+
+ if(! is_site_admin())
+ return;
+
+ // fix legacy zot hubloc_id_url
+ $r1 = dbq("UPDATE hubloc
+ SET hubloc_id_url = CONCAT(hubloc_url, '/channel/', SUBSTRING(hubloc_addr FROM 1 FOR POSITION('@' IN hubloc_addr) -1))
+ WHERE hubloc_network = 'zot'
+ AND hubloc_id_url = ''"
+ );
+
+ // fix singleton networks hubloc_id_url
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = dbq("UPDATE hubloc
+ LEFT JOIN xchan ON hubloc_hash = xchan_hash
+ SET hubloc_id_url = xchan_url
+ WHERE hubloc_network IN ('activitypub', 'diaspora', 'friendica-over-diaspora', 'gnusoc')
+ AND hubloc_id_url = ''"
+ );
+
+ }
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = dbq("UPDATE hubloc
+ SET hubloc_id_url = xchan_url
+ FROM xchan
+ WHERE hubloc_hash = xchan_hash
+ AND hubloc_network IN ('activitypub', 'diaspora', 'friendica-over-diaspora', 'gnusoc')
+ AND hubloc_id_url = ''"
+ );
+
+
+ }
+ }
+}
diff --git a/Zotlabs/Update/_1238.php b/Zotlabs/Update/_1238.php
index 77a14c3fa..32c21f161 100644
--- a/Zotlabs/Update/_1238.php
+++ b/Zotlabs/Update/_1238.php
@@ -21,26 +21,40 @@ class _1238 {
// fix singleton networks hubloc_id_url
if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
- $r2 = dbq("UPDATE hubloc
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = dbq("UPDATE hubloc
LEFT JOIN xchan ON hubloc_hash = xchan_hash
SET hubloc_id_url = xchan_url
WHERE hubloc_network IN ('activitypub', 'diaspora', 'friendica-over-diaspora', 'gnusoc')
- AND hubloc_id_url = ''
- AND xchan_url != ''"
+ AND hubloc_id_url = ''"
);
}
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
- $r2 = dbq("UPDATE hubloc
+ // fix entries for activitypub which miss the xchan_url due to an earlier bug
+ $r2 = dbq("UPDATE xchan
+ SET xchan_url = xchan_hash
+ WHERE xchan_network = 'activitypub'
+ AND xchan_url = ''
+ AND xchan_hash != ''"
+ );
+
+ $r3 = dbq("UPDATE hubloc
SET hubloc_id_url = xchan_url
FROM xchan
WHERE hubloc_hash = xchan_hash
AND hubloc_network IN ('activitypub', 'diaspora', 'friendica-over-diaspora', 'gnusoc')
- AND hubloc_id_url = ''
- AND xchan_url != ''"
+ AND hubloc_id_url = ''"
);
}
- if($r1 && $r2) {
+ if($r1 && $r2 && $r3) {
q("COMMIT");
return UPDATE_SUCCESS;
}
diff --git a/boot.php b/boot.php
index 96f339ef9..a6aa74ca7 100755
--- a/boot.php
+++ b/boot.php
@@ -50,7 +50,7 @@ require_once('include/attach.php');
require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
-define ( 'STD_VERSION', '4.7.10' );
+define ( 'STD_VERSION', '4.7.12' );
define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1238 );
diff --git a/include/api_zot.php b/include/api_zot.php
index 287720484..8f621d998 100644
--- a/include/api_zot.php
+++ b/include/api_zot.php
@@ -1,7 +1,9 @@
<?php
function zot_api_init() {
- api_register_func('api/red/version','api_zot_version',false);
+ api_register_func('api/z/1.0/verify','api_verify', true);
+
+ api_register_func('api/red/version','api_zot_version',false);
api_register_func('api/z/1.0/version','api_zot_version',false);
api_register_func('api/export/basic','api_export_basic', true);
api_register_func('api/red/channel/export/basic','api_export_basic', true);
@@ -47,6 +49,17 @@
return;
}
+ function api_verify($type) {
+ if (api_user() === false) {
+ logger('no channel');
+ return false;
+ }
+ $channel = channelx_by_n(api_user());
+ // logger('channel: ' . print_r($channel,true));
+
+ json_return_and_die($channel);
+ }
+
function api_zot_version($type) {
diff --git a/include/network.php b/include/network.php
index aada36fba..d9d534cd7 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1101,7 +1101,7 @@ function discover_by_webbie($webbie, $protocol = '') {
$network = null;
$x = webfinger_rfc7033($webbie, true);
- if($x && array_key_exists('links',$x) && $x['links']) {
+ if($x && array_key_exists('links',$x) && is_array($x['links'])) {
foreach($x['links'] as $link) {
if(array_key_exists('rel',$link)) {
diff --git a/include/zot.php b/include/zot.php
index fb0804aa7..e10ef6fd7 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -2763,6 +2763,8 @@ function sync_locations($sender, $arr, $absolute = false) {
}
logger('New hub: ' . $location['url']);
+ $addr_arr = explode('@', $location['address']);
+
$r = hubloc_store_lowlevel(
[
'hubloc_guid' => $sender['guid'],
@@ -2777,7 +2779,8 @@ function sync_locations($sender, $arr, $absolute = false) {
'hubloc_callback' => $location['callback'],
'hubloc_sitekey' => $location['sitekey'],
'hubloc_updated' => datetime_convert(),
- 'hubloc_connected' => datetime_convert()
+ 'hubloc_connected' => datetime_convert(),
+ 'hubloc_id_url' => $location['url'] . '/channel/' . $addr_arr[0]
]
);
diff --git a/util/zotsh/easywebdav/__init__.pyc b/util/zotsh/easywebdav/__init__.pyc
index b69303d1b..61b28285f 100644
--- a/util/zotsh/easywebdav/__init__.pyc
+++ b/util/zotsh/easywebdav/__init__.pyc
Binary files differ
diff --git a/util/zotsh/easywebdav/__version__.pyc b/util/zotsh/easywebdav/__version__.pyc
index bdc53441f..ceb251aeb 100644
--- a/util/zotsh/easywebdav/__version__.pyc
+++ b/util/zotsh/easywebdav/__version__.pyc
Binary files differ
diff --git a/util/zotsh/easywebdav/client.pyc b/util/zotsh/easywebdav/client.pyc
index d53caed92..86dd3aece 100644
--- a/util/zotsh/easywebdav/client.pyc
+++ b/util/zotsh/easywebdav/client.pyc
Binary files differ
diff --git a/view/js/main.js b/view/js/main.js
index 82de0d06f..4d3b2d770 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -627,89 +627,84 @@ function updateConvItems(mode,data) {
$('.thread-wrapper').remove(); // clear existing content
}
- $('.thread-wrapper.toplevel_item',data).each(function() {
-
- var ident = $(this).attr('id');
- var convId = ident.replace('thread-wrapper-','');
- var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
-
-
- var itmId = 0;
- var isVisible = false;
+ $('.thread-wrapper', data).each(function() {
+ if(this.classList.contains('toplevel_item')) {
- // figure out the comment state
- if(typeof commentWrap !== 'undefined')
- itmId = commentWrap.replace('collapsed-comments-','');
-
- if($('#collapsed-comments-'+itmId).is(':visible'))
- isVisible = true;
+ var ident = this.id;
+ var convId = ident.replace('thread-wrapper-','');
+ var commentWrap = $('#'+ident+' .collapsed-comments').attr('id');
+ var itmId = 0;
+ var isVisible = false;
+ // figure out the comment state
+ if(typeof commentWrap !== 'undefined')
+ itmId = commentWrap.replace('collapsed-comments-','');
+ if($('#collapsed-comments-'+itmId).is(':visible'))
+ isVisible = true;
- // insert the content according to the mode and first_page
- // and whether or not the content exists already (overwrite it)
+ // insert the content according to the mode and first_page
+ // and whether or not the content exists already (overwrite it)
- if($('#' + ident).length == 0) {
- if((mode === 'update' || mode === 'replace') && profile_page == 1) {
- $('#' + prev).after($(this));
- prev = ident;
+ if($('#' + ident).length == 0) {
+ if((mode === 'update' || mode === 'replace') && profile_page == 1) {
+ $('#' + prev).after($(this));
+ prev = ident;
+ }
+ if(mode === 'append') {
+ $('#' + next).before($(this));
+ }
}
- if(mode === 'append') {
- $('#' + next).before($(this));
+ else {
+ $('#' + ident).replaceWith($(this));
}
- }
- else {
- $('#' + ident).replaceWith($(this));
- }
- // set the comment state to the state we discovered earlier
+ // set the comment state to the state we discovered earlier
- if(isVisible)
- showHideComments(itmId);
+ if(isVisible)
+ showHideComments(itmId);
- var commentBody = localStorage.getItem("comment_body-" + convId);
+ var commentBody = localStorage.getItem("comment_body-" + convId);
- if(commentBody) {
- var commentElm = $('#comment-edit-text-' + convId);
- if(auto_save_draft) {
- if($(commentElm).val() === '') {
- $('#comment-edit-form-' + convId).show();
- $(commentElm).addClass("expanded");
- openMenu("comment-tools-" + convId);
- $(commentElm).val(commentBody);
+ if(commentBody) {
+ var commentElm = $('#comment-edit-text-' + convId);
+ if(auto_save_draft) {
+ if($(commentElm).val() === '') {
+ $('#comment-edit-form-' + convId).show();
+ $(commentElm).addClass("expanded");
+ openMenu("comment-tools-" + convId);
+ $(commentElm).val(commentBody);
+ }
+ } else {
+ localStorage.removeItem("comment_body-" + convId);
}
- } else {
- localStorage.removeItem("comment_body-" + convId);
}
- }
- // trigger the autotime function on all newly created content
- $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
- $("> .shared_header .autotime",this).timeago();
+ // trigger the autotime function on all newly created content
+ $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
+ $("> .shared_header .autotime",this).timeago();
- if((mode === 'append' || mode === 'replace') && (loadingPage)) {
- loadingPage = false;
- }
+ if((mode === 'append' || mode === 'replace') && (loadingPage)) {
+ loadingPage = false;
+ }
- // if single thread view and the item has a title, display it in the title bar
+ // if single thread view and the item has a title, display it in the title bar
- if(mode === 'replace') {
- if (window.location.search.indexOf("mid=") != -1 || window.location.pathname.indexOf("display") != -1) {
- var title = $(".wall-item-title").text();
- title.replace(/^\s+/, '');
- title.replace(/\s+$/, '');
- if (title) {
- savedTitle = title + " " + savedTitle;
- document.title = title;
+ if(mode === 'replace') {
+ if (window.location.search.indexOf("mid=") != -1 || window.location.pathname.indexOf("display") != -1) {
+ var title = $(".wall-item-title").text();
+ title.replace(/^\s+/, '');
+ title.replace(/\s+$/, '');
+ if (title) {
+ savedTitle = title + " " + savedTitle;
+ document.title = title;
+ }
}
}
}
- });
-
- // take care of the notifications count updates
- $('.thread-wrapper', data).each(function() {
+ // take care of the notifications count updates
var nmids = $(this).data('b64mids');
nmids.forEach(function(nmid, index) {
@@ -976,7 +971,7 @@ function liveUpdate(notify_id) {
var orgHeight = $("#region_2").height();
}
- if(page_cache.data && bParam_page == page_cache.page && page_cache.time > (Date.now() - 60000)) {
+ if(page_cache.data && bParam_page == page_cache.page && page_cache.time > (Date.now() - 180000)) {
page_load = false;
scroll_next = false;
updateConvItems(update_mode,page_cache.data);
@@ -1080,6 +1075,7 @@ function cache_next_page() {
if((data.indexOf("<html>") != (-1)) && (data.indexOf("</html>") == (-1))) {
console.log('Incomplete data. Reloading');
in_progress = false;
+ bParam_page = bParam_page - 1;
liveRecurse ++;
if(liveRecurse < 10) {
liveUpdate();
@@ -1554,7 +1550,7 @@ String.prototype.format = function() {
var formatted = this;
for (var i = 0; i < arguments.length; i++) {
var regexp = new RegExp('\\{'+i+'\\}', 'gi');
- formatted = formatted.replace(regexp, arguments[i]);
+ formatted = formatted.replace(regexp, ((typeof arguments[i] !== 'undefined') ? arguments[i] : ''));
}
return formatted;
};
@@ -1880,7 +1876,7 @@ function sse_handleNotificationsItems(notifyType, data, replace, followup) {
}
$(data).each(function() {
- html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.addr,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top,this.unseen,this.private_forum, encodeURIComponent(this.mids));
+ html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.addr,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top,this.unseen,this.private_forum, encodeURIComponent(this.mids), this.body);
notify_menu.append(html);
});
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index bf2c4c945..d8cc76ccb 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -36,12 +36,12 @@
var path = $(this)[0].pathname.substr(1,7);
var stateObj = { b64mid: b64mid };
- if(b64mid === 'undefined' && notify_id === 'undefined')
+ if(! b64mid && ! notify_id)
return;
{{if $module != 'hq' && $startpage == 'hq'}}
e.preventDefault();
- if(typeof notify_id !== 'undefined' && notify_id !== 'undefined') {
+ if(notify_id != null) {
$.post(
"hq",
{
@@ -142,9 +142,9 @@
{{$no_notifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
</div>
<div id="nav-notifications-template" rel="template">
- <a class="list-group-item clearfix notification {6}" href="{0}" title="{3}" data-b64mid="{7}" data-notify_id="{8}" data-thread_top="{9}" data-contact_name="{2}" data-contact_addr="{3}" data-when="{5}">
+ <a class="list-group-item clearfix notification {6}" href="{0}" title="{13}" data-b64mid="{7}" data-notify_id="{8}" data-thread_top="{9}" data-contact_name="{2}" data-contact_addr="{3}" data-when="{5}">
<img class="menu-img-3" src="{1}">
- <span class="contactname">{2}</span>
+ <span class="contactname">{2} <span class="font-weight-normal text-muted">{3}</span></span>
<span class="dropdown-sub-text">{4}</span><br>
<span class="dropdown-sub-text notifications-autotime" title="{5}">{5}</span>
</a>