mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-22 06:15:31 +00:00
Merge branch 'dev' of /home/macgirvin/z into dev
This commit is contained in:
commit
d2c49fa8e6
17 changed files with 312 additions and 54 deletions
|
@ -78,6 +78,11 @@ class PermissionLimits {
|
||||||
* * \b array with all permission limits, if $perm is not set
|
* * \b array with all permission limits, if $perm is not set
|
||||||
*/
|
*/
|
||||||
static public function Get($channel_id, $perm = '') {
|
static public function Get($channel_id, $perm = '') {
|
||||||
|
if (! intval($channel_id)) {
|
||||||
|
btlogger('invalid channel');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if($perm) {
|
if($perm) {
|
||||||
$x = PConfig::Get($channel_id, 'perm_limits', $perm);
|
$x = PConfig::Get($channel_id, 'perm_limits', $perm);
|
||||||
if($x === false) {
|
if($x === false) {
|
||||||
|
@ -89,7 +94,7 @@ class PermissionLimits {
|
||||||
}
|
}
|
||||||
|
|
||||||
PConfig::Load($channel_id);
|
PConfig::Load($channel_id);
|
||||||
if(array_key_exists($channel_id, \App::$config)
|
if(array_key_exists($channel_id, App::$config)
|
||||||
&& array_key_exists('perm_limits', App::$config[$channel_id]))
|
&& array_key_exists('perm_limits', App::$config[$channel_id]))
|
||||||
return App::$config[$channel_id]['perm_limits'];
|
return App::$config[$channel_id]['perm_limits'];
|
||||||
|
|
||||||
|
|
59
Zotlabs/Daemon/Content_importer.php
Normal file
59
Zotlabs/Daemon/Content_importer.php
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Zotlabs\Daemon;
|
||||||
|
|
||||||
|
use Zotlabs\Web\HTTPSig;
|
||||||
|
|
||||||
|
require_once('include/cli_startup.php');
|
||||||
|
require_once('include/attach.php');
|
||||||
|
require_once('include/import.php');
|
||||||
|
|
||||||
|
class Content_importer {
|
||||||
|
|
||||||
|
static public function run($argc,$argv) {
|
||||||
|
cli_startup();
|
||||||
|
|
||||||
|
$page = $argv[1];
|
||||||
|
$since = $argv[2];
|
||||||
|
$until = $argv[3];
|
||||||
|
$channel_address = $argv[4];
|
||||||
|
$hz_server = urldecode($argv[5]);
|
||||||
|
|
||||||
|
$m = parse_url($hz_server);
|
||||||
|
|
||||||
|
$channel = channelx_by_nick($channel_address);
|
||||||
|
if(! $channel) {
|
||||||
|
logger('itemhelper: channel not found');
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
'X-API-Token' => random_string(),
|
||||||
|
'X-API-Request' => $hz_server . '/api/z/1.0/item/export_page?f=&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page ,
|
||||||
|
'Host' => $m['host'],
|
||||||
|
'(request-target)' => 'get /api/z/1.0/item/export_page?f=&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page ,
|
||||||
|
];
|
||||||
|
|
||||||
|
$headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'], channel_url($channel),true,'sha512');
|
||||||
|
|
||||||
|
$x = z_fetch_url($hz_server . '/api/z/1.0/item/export_page?f=&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page,false,$redirects,[ 'headers' => $headers ]);
|
||||||
|
|
||||||
|
if(! $x['success']) {
|
||||||
|
logger('no API response',LOGGER_DEBUG);
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
|
$j = json_decode($x['body'],true);
|
||||||
|
|
||||||
|
if (! $j) {
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(! ($j['item'] || count($j['item'])))
|
||||||
|
killme();
|
||||||
|
|
||||||
|
import_items($channel,$j['item'],false,((array_key_exists('relocate',$j)) ? $j['relocate'] : null));
|
||||||
|
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
}
|
50
Zotlabs/Daemon/File_importer.php
Normal file
50
Zotlabs/Daemon/File_importer.php
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Zotlabs\Daemon;
|
||||||
|
|
||||||
|
use Zotlabs\Web\HTTPSig;
|
||||||
|
|
||||||
|
require_once('include/cli_startup.php');
|
||||||
|
require_once('include/attach.php');
|
||||||
|
require_once('include/import.php');
|
||||||
|
|
||||||
|
class File_importer {
|
||||||
|
|
||||||
|
static public function run($argc,$argv) {
|
||||||
|
|
||||||
|
cli_startup();
|
||||||
|
|
||||||
|
$attach_id = $argv[1];
|
||||||
|
$channel_address = $argv[2];
|
||||||
|
$hz_server = urldecode($argv[3]);
|
||||||
|
|
||||||
|
$m = parse_url($hz_server);
|
||||||
|
|
||||||
|
$channel = channelx_by_nick($channel_address);
|
||||||
|
if(! $channel) {
|
||||||
|
logger('filehelper: channel not found');
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
'X-API-Token' => random_string(),
|
||||||
|
'X-API-Request' => $hz_server . '/api/z/1.0/file/export?f=&file_id=' . $attach_id,
|
||||||
|
'Host' => $m['host'],
|
||||||
|
'(request-target)' => 'get /api/z/1.0/file/export?f=&file_id=' . $attach_id,
|
||||||
|
];
|
||||||
|
|
||||||
|
$headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel),true,'sha512');
|
||||||
|
$x = z_fetch_url($hz_server . '/api/z/1.0/file/export?f=&file_id=' . $attach_id,false,$redirects,[ 'headers' => $headers ]);
|
||||||
|
|
||||||
|
if(! $x['success']) {
|
||||||
|
logger('no API response',LOGGER_DEBUG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$j = json_decode($x['body'],true);
|
||||||
|
|
||||||
|
$r = sync_files($channel,[$j]);
|
||||||
|
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
}
|
|
@ -584,6 +584,9 @@ class Notifier {
|
||||||
$urls = []; // array of urls to check uniqueness of hubs from other networks
|
$urls = []; // array of urls to check uniqueness of hubs from other networks
|
||||||
$hub_env = []; // per-hub envelope so we don't broadcast the entire envelope to all
|
$hub_env = []; // per-hub envelope so we don't broadcast the entire envelope to all
|
||||||
$dead = []; // known dead hubs - report them as undeliverable
|
$dead = []; // known dead hubs - report them as undeliverable
|
||||||
|
$comm = []; // known community mismatches
|
||||||
|
|
||||||
|
$my_community = get_config('system','network_community', EMPTY_STR);
|
||||||
|
|
||||||
foreach ($hubs as $hub) {
|
foreach ($hubs as $hub) {
|
||||||
if (intval($hub['site_dead'])) {
|
if (intval($hub['site_dead'])) {
|
||||||
|
@ -591,6 +594,12 @@ class Notifier {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$their_community = get_sconfig($hub['hubloc_url'],'system','network_community', EMPTY_STR);
|
||||||
|
if ($my_community !== $their_community && $hub['hubloc_url'] !== z_root()) {
|
||||||
|
$comm[] = $hub;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (self::$env_recips) {
|
if (self::$env_recips) {
|
||||||
foreach (self::$env_recips as $er) {
|
foreach (self::$env_recips as $er) {
|
||||||
if ($hub['hubloc_hash'] === $er) {
|
if ($hub['hubloc_hash'] === $er) {
|
||||||
|
@ -743,6 +752,25 @@ class Notifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($comm) {
|
||||||
|
foreach ($comm as $mismatch) {
|
||||||
|
if (is_array($target_item) && (! $target_item['item_deleted']) && (! get_config('system','disable_dreport'))) {
|
||||||
|
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_name, dreport_result, dreport_time, dreport_xchan, dreport_queue )
|
||||||
|
values ( '%s', '%s','%s','%s','%s','%s','%s','%s' ) ",
|
||||||
|
dbesc($target_item['mid']),
|
||||||
|
dbesc($mismatch['hubloc_host']),
|
||||||
|
dbesc($mismatch['hubloc_host']),
|
||||||
|
dbesc($mismatch['hubloc_host']),
|
||||||
|
dbesc('community mismatch - undeliverable site'),
|
||||||
|
dbesc(datetime_convert()),
|
||||||
|
dbesc(self::$channel['channel_hash']),
|
||||||
|
dbesc(new_uuid())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
call_hooks('notifier_end',$target_item);
|
call_hooks('notifier_end',$target_item);
|
||||||
|
|
||||||
logger('notifer: complete.');
|
logger('notifer: complete.');
|
||||||
|
|
|
@ -1449,6 +1449,14 @@ class Activity {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ActivityPub does not support network communities. If this site uses anything but the default community, reject it.
|
||||||
|
|
||||||
|
$community = get_config('system','network_community', EMPTY_STR);
|
||||||
|
if ($community) {
|
||||||
|
logger('community mismatch');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* if $act->type === 'Follow', actor is now following $channel
|
* if $act->type === 'Follow', actor is now following $channel
|
||||||
|
@ -2800,6 +2808,13 @@ class Activity {
|
||||||
|
|
||||||
static function store($channel,$observer_hash,$act,$item,$fetch_parents = true, $force = false) {
|
static function store($channel,$observer_hash,$act,$item,$fetch_parents = true, $force = false) {
|
||||||
|
|
||||||
|
// ActivityPub does not support network communities. If this site uses anything but the default community, reject it.
|
||||||
|
|
||||||
|
$community = get_config('system','network_community', EMPTY_STR);
|
||||||
|
if ($community) {
|
||||||
|
logger('community mismatch');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($act && $act->implied_create && ! $force) {
|
if ($act && $act->implied_create && ! $force) {
|
||||||
// This is originally a S2S object with no associated activity
|
// This is originally a S2S object with no associated activity
|
||||||
|
|
|
@ -114,6 +114,7 @@ class Libzot {
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'encoding' => $encoding,
|
'encoding' => $encoding,
|
||||||
'sender' => $channel['channel_hash'],
|
'sender' => $channel['channel_hash'],
|
||||||
|
'community' => get_config('system','network_community', EMPTY_STR),
|
||||||
'site_id' => self::make_xchan_hash(z_root(), get_config('system','pubkey')),
|
'site_id' => self::make_xchan_hash(z_root(), get_config('system','pubkey')),
|
||||||
'version' => System::get_zot_revision(),
|
'version' => System::get_zot_revision(),
|
||||||
];
|
];
|
||||||
|
@ -1210,6 +1211,13 @@ class Libzot {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$our_community = get_config('system','network_community', EMPTY_STR);
|
||||||
|
$their_community = ((array_key_exists('community',$env)) ? $env['community'] : EMPTY_STR);
|
||||||
|
if ($our_community !== $their_community) {
|
||||||
|
logger('community mismatch');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$message_request = false;
|
$message_request = false;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1327,7 +1335,6 @@ class Libzot {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($has_data) {
|
if ($has_data) {
|
||||||
|
|
||||||
if (in_array($env['type'],['activity','response'])) {
|
if (in_array($env['type'],['activity','response'])) {
|
||||||
|
@ -2766,6 +2773,10 @@ class Libzot {
|
||||||
set_sconfig($arr['url'],'system','zot_version',$arr['zot']);
|
set_sconfig($arr['url'],'system','zot_version',$arr['zot']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('community',$arr)) {
|
||||||
|
set_sconfig($arr['url'],'system','network_community',$arr['community']);
|
||||||
|
}
|
||||||
|
|
||||||
if ($exists) {
|
if ($exists) {
|
||||||
if (($siterecord['site_flags'] != $site_flags)
|
if (($siterecord['site_flags'] != $site_flags)
|
||||||
|| ($siterecord['site_access'] != $access_policy)
|
|| ($siterecord['site_access'] != $access_policy)
|
||||||
|
@ -3280,6 +3291,7 @@ class Libzot {
|
||||||
$ret['site']['sellpage'] = get_config('system','sellpage');
|
$ret['site']['sellpage'] = get_config('system','sellpage');
|
||||||
$ret['site']['location'] = get_config('system','site_location');
|
$ret['site']['location'] = get_config('system','site_location');
|
||||||
$ret['site']['realm'] = get_directory_realm();
|
$ret['site']['realm'] = get_directory_realm();
|
||||||
|
$ret['site']['community'] = get_config('system','network_community', EMPTY_STR);
|
||||||
$ret['site']['sitename'] = System::get_site_name();
|
$ret['site']['sitename'] = System::get_site_name();
|
||||||
$ret['site']['logo'] = System::get_site_icon();
|
$ret['site']['logo'] = System::get_site_icon();
|
||||||
$ret['site']['project'] = System::get_platform_name();
|
$ret['site']['project'] = System::get_platform_name();
|
||||||
|
|
|
@ -87,7 +87,7 @@ class ThreadItem {
|
||||||
* _ false on failure
|
* _ false on failure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function get_template_data($conv_responses, $thread_level = 1, $collapse_all = false) {
|
public function get_template_data($conv_responses, $thread_level = 1) {
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
|
@ -306,10 +306,6 @@ class ThreadItem {
|
||||||
|
|
||||||
localize_item($item);
|
localize_item($item);
|
||||||
|
|
||||||
if($this->is_toplevel() && $collapse_all) {
|
|
||||||
$item['collapse'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$opts = [];
|
$opts = [];
|
||||||
if ($this->is_wall_to_wall()) {
|
if ($this->is_wall_to_wall()) {
|
||||||
if ($this->owner_censored) {
|
if ($this->owner_censored) {
|
||||||
|
@ -466,6 +462,7 @@ class ThreadItem {
|
||||||
'wait' => t('Please wait'),
|
'wait' => t('Please wait'),
|
||||||
'submid' => str_replace(['+','='], ['',''], base64_encode($item['mid'])),
|
'submid' => str_replace(['+','='], ['',''], base64_encode($item['mid'])),
|
||||||
'thread_level' => $thread_level,
|
'thread_level' => $thread_level,
|
||||||
|
'indentpx' => intval(get_pconfig(local_channel(),'system','thread_indent_px',get_config('system','thread_indent_px',0))),
|
||||||
'thread_max' => intval(get_config('system','thread_maxlevel',20)) + 1
|
'thread_max' => intval(get_config('system','thread_maxlevel',20)) + 1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -474,8 +471,6 @@ class ThreadItem {
|
||||||
|
|
||||||
$result = $arr['output'];
|
$result = $arr['output'];
|
||||||
|
|
||||||
$censored = ((strpos($body['html'],"<button id=\"nsfw-wrap-") !== false && $collapse_all === false) ? true : false);
|
|
||||||
|
|
||||||
$result['children'] = [];
|
$result['children'] = [];
|
||||||
|
|
||||||
if (local_channel() && get_pconfig(local_channel(),'system','activitypub',get_config('system','activitypub', ACTIVITYPUB_ENABLED))) {
|
if (local_channel() && get_pconfig(local_channel(),'system','activitypub',get_config('system','activitypub', ACTIVITYPUB_ENABLED))) {
|
||||||
|
@ -488,16 +483,6 @@ class ThreadItem {
|
||||||
else {
|
else {
|
||||||
$result['authors'][] = $profile_addr;
|
$result['authors'][] = $profile_addr;
|
||||||
}
|
}
|
||||||
// if ($children) {
|
|
||||||
// foreach ($children as $child) {
|
|
||||||
// $cdata = $child->get_data();
|
|
||||||
// if ($cdata['author']['xchan_addr']) {
|
|
||||||
// if ($observer && $observer['xchan_hash'] !== $cdata['author']['xchan_hash'] && ! in_array($cdata['author']['xchan_addr'],$result['authors'])) {
|
|
||||||
// $result['authors'][] = $cdata['author']['xchan_addr'];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Add any mentions from the immediate parent, unless they are mentions of the current viewer or duplicates
|
// Add any mentions from the immediate parent, unless they are mentions of the current viewer or duplicates
|
||||||
if ($item['term']) {
|
if ($item['term']) {
|
||||||
|
@ -529,16 +514,10 @@ class ThreadItem {
|
||||||
|
|
||||||
$visible_comments = get_config('system', 'expanded_comments', 3);
|
$visible_comments = get_config('system', 'expanded_comments', 3);
|
||||||
|
|
||||||
if($collapse_all) {
|
|
||||||
$visible_comments = 0;
|
|
||||||
}
|
|
||||||
if(($this->get_display_mode() === 'normal') && ($nb_children > 0)) {
|
if(($this->get_display_mode() === 'normal') && ($nb_children > 0)) {
|
||||||
if ($children) {
|
if ($children) {
|
||||||
foreach($children as $child) {
|
foreach($children as $child) {
|
||||||
$xz = $child->get_template_data($conv_responses, $thread_level + 1);
|
$xz = $child->get_template_data($conv_responses, $thread_level + 1);
|
||||||
if(strpos($xz['body'],"<button id=\"nsfw-wrap-") !== false && $collapse_all === false) {
|
|
||||||
$censored = true;
|
|
||||||
}
|
|
||||||
$result['children'][] = $xz;
|
$result['children'][] = $xz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -547,12 +526,6 @@ class ThreadItem {
|
||||||
$result['children'][0]['comment_firstcollapsed'] = true;
|
$result['children'][0]['comment_firstcollapsed'] = true;
|
||||||
$result['children'][0]['num_comments'] = $comment_count_txt;
|
$result['children'][0]['num_comments'] = $comment_count_txt;
|
||||||
$result['children'][0]['hide_text'] = sprintf( t('%s show all'), '<i class="fa fa-chevron-down"></i>');
|
$result['children'][0]['hide_text'] = sprintf( t('%s show all'), '<i class="fa fa-chevron-down"></i>');
|
||||||
// if($thread_level > 1) {
|
|
||||||
// $result['children'][$nb_children - 1]['comment_lastcollapsed'] = true;
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// $result['children'][$nb_children - ($visible_comments + 1)]['comment_lastcollapsed'] = true;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,12 +541,6 @@ class ThreadItem {
|
||||||
$result['threaded'] = false;
|
$result['threaded'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($result['toplevel'] && $censored && (! $collapse_all) && get_pconfig($conv->get_profile_owner(),'nsfw','collapse_all',true)) {
|
|
||||||
$copy = $conv_responses;
|
|
||||||
$result = $this->get_template_data($copy, 1, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace Zotlabs\Module;
|
||||||
use App;
|
use App;
|
||||||
use URLify;
|
use URLify;
|
||||||
use Zotlabs\Web\Controller;
|
use Zotlabs\Web\Controller;
|
||||||
|
use Zotlabs\Web\HTTPSig;
|
||||||
use Zotlabs\Lib\Libzot;
|
use Zotlabs\Lib\Libzot;
|
||||||
use Zotlabs\Lib\Connect;
|
use Zotlabs\Lib\Connect;
|
||||||
use Zotlabs\Daemon\Run;
|
use Zotlabs\Daemon\Run;
|
||||||
|
@ -39,7 +40,7 @@ class Import extends Controller {
|
||||||
$data = null;
|
$data = null;
|
||||||
$seize = ((x($_REQUEST,'make_primary')) ? intval($_REQUEST['make_primary']) : 0);
|
$seize = ((x($_REQUEST,'make_primary')) ? intval($_REQUEST['make_primary']) : 0);
|
||||||
$import_posts = ((x($_REQUEST,'import_posts')) ? intval($_REQUEST['import_posts']) : 0);
|
$import_posts = ((x($_REQUEST,'import_posts')) ? intval($_REQUEST['import_posts']) : 0);
|
||||||
$moving = intval($_REQUEST['moving']);
|
$moving = false; // intval($_REQUEST['moving']);
|
||||||
$src = $_FILES['filename']['tmp_name'];
|
$src = $_FILES['filename']['tmp_name'];
|
||||||
$filename = basename($_FILES['filename']['name']);
|
$filename = basename($_FILES['filename']['name']);
|
||||||
$filesize = intval($_FILES['filename']['size']);
|
$filesize = intval($_FILES['filename']['size']);
|
||||||
|
@ -525,6 +526,97 @@ class Import extends Controller {
|
||||||
if ($import_posts && array_key_exists('item',$data) && $data['item']) {
|
if ($import_posts && array_key_exists('item',$data) && $data['item']) {
|
||||||
import_items($channel,$data['item'],false,$relocate);
|
import_items($channel,$data['item'],false,$relocate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($api_path && $import_posts) { // we are importing from a server and not a file
|
||||||
|
|
||||||
|
$m = parse_url($api_path);
|
||||||
|
|
||||||
|
$hz_server = $m['scheme'] . '://' . $m['host'];
|
||||||
|
|
||||||
|
$since = datetime_convert(date_default_timezone_get(),date_default_timezone_get(),'0001-01-01 00:00');
|
||||||
|
$until = datetime_convert(date_default_timezone_get(),date_default_timezone_get(),'now + 1 day');
|
||||||
|
|
||||||
|
$poll_interval = get_config('system','poll_interval',3);
|
||||||
|
$page = 0;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
$headers = [
|
||||||
|
'X-API-Token' => random_string(),
|
||||||
|
'X-API-Request' => $hz_server . '/api/z/1.0/item/export_page?f=&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page ,
|
||||||
|
'Host' => $m['host'],
|
||||||
|
'(request-target)' => 'get /api/z/1.0/item/export_page?f=&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page ,
|
||||||
|
];
|
||||||
|
|
||||||
|
$headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'], channel_url($channel),true,'sha512');
|
||||||
|
|
||||||
|
$x = z_fetch_url($hz_server . '/api/z/1.0/item/export_page?f=&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page,false,$redirects,[ 'headers' => $headers ]);
|
||||||
|
|
||||||
|
// logger('z_fetch: ' . print_r($x,true));
|
||||||
|
|
||||||
|
if (! $x['success']) {
|
||||||
|
logger('no API response');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$j = json_decode($x['body'],true);
|
||||||
|
|
||||||
|
if (! $j) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! ($j['item'] || count($j['item']))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Run::Summon([ 'Content_importer', sprintf('%d',$page), $since, $until, $channel['channel_address'], urlencode($hz_server) ]);
|
||||||
|
sleep($poll_interval);
|
||||||
|
|
||||||
|
$page ++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
'X-API-Token' => random_string(),
|
||||||
|
'X-API-Request' => $hz_server . '/api/z/1.0/files?f=&since=' . urlencode($since) . '&until=' . urlencode($until),
|
||||||
|
'Host' => $m['host'],
|
||||||
|
'(request-target)' => 'get /api/z/1.0/files?f=&since=' . urlencode($since) . '&until=' . urlencode($until),
|
||||||
|
];
|
||||||
|
|
||||||
|
$headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'], channel_url($channel),true,'sha512');
|
||||||
|
|
||||||
|
$x = z_fetch_url($hz_server . '/api/z/1.0/files?f=&since=' . urlencode($since) . '&until=' . urlencode($until),false,$redirects,[ 'headers' => $headers ]);
|
||||||
|
|
||||||
|
if (! $x['success']) {
|
||||||
|
logger('no API response');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$j = json_decode($x['body'],true);
|
||||||
|
|
||||||
|
if (! $j) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $j['success']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$poll_interval = get_config('system','poll_interval',3);
|
||||||
|
|
||||||
|
if(count($j['results'])) {
|
||||||
|
$todo = count($j['results']);
|
||||||
|
logger('total to process: ' . $todo,LOGGER_DEBUG);
|
||||||
|
|
||||||
|
foreach($j['results'] as $jj) {
|
||||||
|
Run::Summon([ 'File_importer',$jj['hash'], $channel['channel_address'], urlencode($hz_server) ]);
|
||||||
|
sleep($poll_interval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notice(t('Files and Posts imported.') . EOL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
notifications_on($channel['channel_id'],$saved_notification_flags);
|
notifications_on($channel['channel_id'],$saved_notification_flags);
|
||||||
|
|
||||||
|
|
||||||
|
@ -579,7 +671,7 @@ class Import extends Controller {
|
||||||
'$old_address' => [ 'old_address', t('Your old identity address (xyz@example.com)'), '', ''],
|
'$old_address' => [ 'old_address', t('Your old identity address (xyz@example.com)'), '', ''],
|
||||||
'$email' => [ 'email', t('Your old login email address'), '', '' ],
|
'$email' => [ 'email', t('Your old login email address'), '', '' ],
|
||||||
'$password' => [ 'password', t('Your old login password'), '', '' ],
|
'$password' => [ 'password', t('Your old login password'), '', '' ],
|
||||||
'$import_posts' => [ 'import_posts', t('Import a few months of posts if possible (limited by available memory'), false, '', [ t('No'), t('Yes') ]],
|
'$import_posts' => [ 'import_posts', t('Import a few months of posts if possible (limited by available memory)'), false, '', [ t('No'), t('Yes') ]],
|
||||||
|
|
||||||
'$common' => t('For either option, please choose whether to make this hub your new primary address, or whether your old location should continue this role. You will be able to post from either location, but only one can be marked as the primary location for files, photos, and media.'),
|
'$common' => t('For either option, please choose whether to make this hub your new primary address, or whether your old location should continue this role. You will be able to post from either location, but only one can be marked as the primary location for files, photos, and media.'),
|
||||||
|
|
||||||
|
@ -587,7 +679,7 @@ class Import extends Controller {
|
||||||
'$moving' => [ 'moving', t('Move this channel (disable all previous locations)'), false, '', [ t('No'), t('Yes') ] ],
|
'$moving' => [ 'moving', t('Move this channel (disable all previous locations)'), false, '', [ t('No'), t('Yes') ] ],
|
||||||
'$newname' => [ 'newname', t('Use this channel nickname instead of the one provided'), '', t('Leave blank to keep your existing channel nickname. You will be randomly assigned a similar nickname if either name is already allocated on this site.')],
|
'$newname' => [ 'newname', t('Use this channel nickname instead of the one provided'), '', t('Leave blank to keep your existing channel nickname. You will be randomly assigned a similar nickname if either name is already allocated on this site.')],
|
||||||
|
|
||||||
'$pleasewait' => t('This process may take several minutes to complete. Please submit the form only once and leave this page open until finished.'),
|
'$pleasewait' => t('This process may take several minutes to complete and considerably longer if importing a large amount of posts and files. Please submit the form only once and leave this page open until finished.'),
|
||||||
|
|
||||||
'$form_security_token' => get_form_security_token('channel_import'),
|
'$form_security_token' => get_form_security_token('channel_import'),
|
||||||
'$submit' => t('Submit')
|
'$submit' => t('Submit')
|
||||||
|
|
|
@ -65,7 +65,7 @@ class Search extends Controller {
|
||||||
if (local_channel() && strpos($search,'https://') === 0) {
|
if (local_channel() && strpos($search,'https://') === 0) {
|
||||||
$j = Activity::fetch($search,App::get_channel());
|
$j = Activity::fetch($search,App::get_channel());
|
||||||
if ($j) {
|
if ($j) {
|
||||||
$AS = new ActivityStreams($j);
|
$AS = new ActivityStreams($j, null, true);
|
||||||
if ($AS->is_valid()) {
|
if ($AS->is_valid()) {
|
||||||
if (is_array($AS->obj) && ! ActivityStreams::is_an_actor($AS->obj)) {
|
if (is_array($AS->obj) && ! ActivityStreams::is_an_actor($AS->obj)) {
|
||||||
// The boolean flag enables html cache of the item
|
// The boolean flag enables html cache of the item
|
||||||
|
|
|
@ -142,7 +142,6 @@ class Channel {
|
||||||
$photo_path = ((x($_POST,'photo_path')) ? escape_tags(trim($_POST['photo_path'])) : '');
|
$photo_path = ((x($_POST,'photo_path')) ? escape_tags(trim($_POST['photo_path'])) : '');
|
||||||
$attach_path = ((x($_POST,'attach_path')) ? escape_tags(trim($_POST['attach_path'])) : '');
|
$attach_path = ((x($_POST,'attach_path')) ? escape_tags(trim($_POST['attach_path'])) : '');
|
||||||
$noindex = ((x($_POST,'noindex')) ? intval($_POST['noindex']) : 0);
|
$noindex = ((x($_POST,'noindex')) ? intval($_POST['noindex']) : 0);
|
||||||
|
|
||||||
$channel_menu = ((x($_POST['channel_menu'])) ? htmlspecialchars_decode(trim($_POST['channel_menu']),ENT_QUOTES) : '');
|
$channel_menu = ((x($_POST['channel_menu'])) ? htmlspecialchars_decode(trim($_POST['channel_menu']),ENT_QUOTES) : '');
|
||||||
|
|
||||||
$expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0);
|
$expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Zotlabs\Module\Settings;
|
namespace Zotlabs\Module\Settings;
|
||||||
|
|
||||||
|
use App;
|
||||||
use Zotlabs\Lib\Libsync;
|
use Zotlabs\Lib\Libsync;
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ class Display {
|
||||||
function post() {
|
function post() {
|
||||||
check_form_security_token_redirectOnErr('/settings/display', 'settings_display');
|
check_form_security_token_redirectOnErr('/settings/display', 'settings_display');
|
||||||
|
|
||||||
$themespec = explode(':', \App::$channel['channel_theme']);
|
$themespec = explode(':', App::$channel['channel_theme']);
|
||||||
$existing_theme = $themespec[0];
|
$existing_theme = $themespec[0];
|
||||||
$existing_schema = $themespec[1];
|
$existing_schema = $themespec[1];
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ class Display {
|
||||||
$channel_menu = ((x($_POST,'channel_menu')) ? intval($_POST['channel_menu']) : 0);
|
$channel_menu = ((x($_POST,'channel_menu')) ? intval($_POST['channel_menu']) : 0);
|
||||||
$user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0);
|
$user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0);
|
||||||
$nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
|
$nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
|
||||||
|
$indentpx = ((x($_POST,'indentpx')) ? intval($_POST['indentpx']) : 0);
|
||||||
|
|
||||||
$channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
|
$channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
|
||||||
if($channel_divmore_height < 50)
|
if($channel_divmore_height < 50)
|
||||||
|
@ -45,6 +47,12 @@ class Display {
|
||||||
if($itemspage > 100)
|
if($itemspage > 100)
|
||||||
$itemspage = 100;
|
$itemspage = 100;
|
||||||
|
|
||||||
|
if ($indentpx < 0) {
|
||||||
|
$indentpx = 0;
|
||||||
|
}
|
||||||
|
if ($indentpx > 20) {
|
||||||
|
$indentpx = 20;
|
||||||
|
}
|
||||||
|
|
||||||
set_pconfig(local_channel(),'system','preload_images',$preload_images);
|
set_pconfig(local_channel(),'system','preload_images',$preload_images);
|
||||||
set_pconfig(local_channel(),'system','user_scalable',$user_scalable);
|
set_pconfig(local_channel(),'system','user_scalable',$user_scalable);
|
||||||
|
@ -54,6 +62,7 @@ class Display {
|
||||||
set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height);
|
set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height);
|
||||||
set_pconfig(local_channel(),'system','stream_divmore_height', $stream_divmore_height);
|
set_pconfig(local_channel(),'system','stream_divmore_height', $stream_divmore_height);
|
||||||
set_pconfig(local_channel(),'system','channel_menu', $channel_menu);
|
set_pconfig(local_channel(),'system','channel_menu', $channel_menu);
|
||||||
|
set_pconfig(local_channel(),'system','thread_indent_px',$indentpx);
|
||||||
|
|
||||||
$newschema = '';
|
$newschema = '';
|
||||||
if($theme){
|
if($theme){
|
||||||
|
@ -97,7 +106,7 @@ class Display {
|
||||||
if(! $default_theme)
|
if(! $default_theme)
|
||||||
$default_theme = 'redbasic';
|
$default_theme = 'redbasic';
|
||||||
|
|
||||||
$themespec = explode(':', \App::$channel['channel_theme']);
|
$themespec = explode(':', App::$channel['channel_theme']);
|
||||||
$existing_theme = $themespec[0];
|
$existing_theme = $themespec[0];
|
||||||
$existing_schema = $themespec[1];
|
$existing_schema = $themespec[1];
|
||||||
|
|
||||||
|
@ -196,7 +205,7 @@ class Display {
|
||||||
'$expert' => feature_enabled(local_channel(),'advanced_theming'),
|
'$expert' => feature_enabled(local_channel(),'advanced_theming'),
|
||||||
'$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')),
|
'$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')),
|
||||||
'$stream_divmore_height' => array('stream_divmore_height', t('Stream page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','stream_divmore_height')) ? get_pconfig(local_channel(),'system','stream_divmore_height') : 400) , t('click to expand content exceeding this height')),
|
'$stream_divmore_height' => array('stream_divmore_height', t('Stream page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','stream_divmore_height')) ? get_pconfig(local_channel(),'system','stream_divmore_height') : 400) , t('click to expand content exceeding this height')),
|
||||||
|
'$indentpx' => [ 'indentpx', t('Indent threaded comments this many pixels from the parent'), intval(get_pconfig(local_channel(),'system','thread_indent_px', get_config('system','thread_indent_px',0))), t('0-20') ],
|
||||||
|
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -207,7 +216,7 @@ class Display {
|
||||||
|
|
||||||
function get_theme_config_file($theme){
|
function get_theme_config_file($theme){
|
||||||
|
|
||||||
$base_theme = \App::$theme_info['extends'];
|
$base_theme = App::$theme_info['extends'];
|
||||||
|
|
||||||
if (file_exists("view/theme/$theme/php/config.php")){
|
if (file_exists("view/theme/$theme/php/config.php")){
|
||||||
return "view/theme/$theme/php/config.php";
|
return "view/theme/$theme/php/config.php";
|
||||||
|
|
2
boot.php
2
boot.php
|
@ -16,7 +16,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', '20.12.07' );
|
define ( 'STD_VERSION', '20.12.11' );
|
||||||
define ( 'ZOT_REVISION', '6.0' );
|
define ( 'ZOT_REVISION', '6.0' );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1247 );
|
define ( 'DB_UPDATE_VERSION', 1247 );
|
||||||
|
|
|
@ -114,6 +114,14 @@ function api_login() {
|
||||||
dbesc($keyId),
|
dbesc($keyId),
|
||||||
dbesc($keyId)
|
dbesc($keyId)
|
||||||
);
|
);
|
||||||
|
if (! $r) {
|
||||||
|
HTTPSig::get_zotfinger_key($keyId);
|
||||||
|
$r = q("select * from hubloc where hubloc_addr = '%s' or hubloc_id_url = '%s'",
|
||||||
|
dbesc($keyId),
|
||||||
|
dbesc($keyId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ($r) {
|
if ($r) {
|
||||||
$r = Libzot::zot_record_preferred($r);
|
$r = Libzot::zot_record_preferred($r);
|
||||||
$c = channelx_by_hash($r['hubloc_hash']);
|
$c = channelx_by_hash($r['hubloc_hash']);
|
||||||
|
|
|
@ -32,6 +32,12 @@ a.zrl:hover {
|
||||||
margin-right: 0.1rem;
|
margin-right: 0.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.thread-separator {
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
border-top: 1px dotted #EEE;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
background-color: $bgcolour;
|
background-color: $bgcolour;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<div id="import-common-desc" class="section-content-info-wrapper">{{$common}}</div>
|
<div id="import-common-desc" class="section-content-info-wrapper">{{$common}}</div>
|
||||||
|
|
||||||
{{include file="field_checkbox.tpl" field=$make_primary}}
|
{{include file="field_checkbox.tpl" field=$make_primary}}
|
||||||
{{include file="field_checkbox.tpl" field=$moving}}
|
{{**include file="field_checkbox.tpl" field=$moving**}}
|
||||||
{{include file="field_input.tpl" field=$newname}}
|
{{include file="field_input.tpl" field=$newname}}
|
||||||
|
|
||||||
<div id="import-common-desc" class="section-content-info-wrapper">{{$pleasewait}}</div>
|
<div id="import-common-desc" class="section-content-info-wrapper">{{$pleasewait}}</div>
|
||||||
|
|
|
@ -11,7 +11,11 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="wall-item-outside-wrapper{{if $item.is_comment}} comment{{/if}}{{if $item.previewing}} preview{{/if}}" id="wall-item-outside-wrapper-{{$item.id}}" >
|
<div class="wall-item-outside-wrapper{{if $item.is_comment}} comment{{/if}}{{if $item.previewing}} preview{{/if}}" id="wall-item-outside-wrapper-{{$item.id}}" >
|
||||||
<div class="clearfix wall-item-content-wrapper{{if $item.is_comment}} comment{{/if}}" id="wall-item-content-wrapper-{{$item.id}}">
|
<div class="clearfix wall-item-content-wrapper{{if $item.is_comment}} comment{{/if}}" id="wall-item-content-wrapper-{{$item.id}}">
|
||||||
|
{{if $item.thread_level > 1}}<hr class="thread-separator">{{/if}}
|
||||||
{{for $x=3 to $item.thread_level}}<i class="fa fa-caret-right threadlevel {{if $x is odd}}odd{{else}}even{{/if}}"></i>{{/for}}
|
{{for $x=3 to $item.thread_level}}<i class="fa fa-caret-right threadlevel {{if $x is odd}}odd{{else}}even{{/if}}"></i>{{/for}}
|
||||||
|
{{if $item.indentpx}}
|
||||||
|
<div {{if $item.thread_level > 2}}style="margin-left: {{$item.thread_level * $item.indentpx}}px;"{{/if}}>
|
||||||
|
{{/if}}
|
||||||
{{if $item.photo}}
|
{{if $item.photo}}
|
||||||
<div class="wall-photo-item" id="wall-photo-item-{{$item.id}}">
|
<div class="wall-photo-item" id="wall-photo-item-{{$item.id}}">
|
||||||
{{$item.photo}}
|
{{$item.photo}}
|
||||||
|
@ -246,6 +250,9 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
{{if $item.indentpx}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{if $item.collapsed}}
|
{{if $item.collapsed}}
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
<div class="section-content-wrapper">
|
<div class="section-content-wrapper">
|
||||||
{{include file="field_input.tpl" field=$ajaxint}}
|
{{include file="field_input.tpl" field=$ajaxint}}
|
||||||
{{include file="field_input.tpl" field=$itemspage}}
|
{{include file="field_input.tpl" field=$itemspage}}
|
||||||
|
{{include file="field_input.tpl" field=$indentpx}}
|
||||||
{{include file="field_input.tpl" field=$channel_divmore_height}}
|
{{include file="field_input.tpl" field=$channel_divmore_height}}
|
||||||
{{include file="field_input.tpl" field=$stream_divmore_height}}
|
{{include file="field_input.tpl" field=$stream_divmore_height}}
|
||||||
{{include file="field_checkbox.tpl" field=$nosmile}}
|
{{include file="field_checkbox.tpl" field=$nosmile}}
|
||||||
|
|
Loading…
Reference in a new issue