Merge branch 'dev' into release

This commit is contained in:
Mike Macgirvin 2022-05-11 14:14:43 -07:00
commit e9cd608b85
24 changed files with 26098 additions and 982 deletions

View file

@ -149,7 +149,7 @@ class Apps
$app['uid'] = local_channel();
$app['guid'] = hash('whirlpool', $app['name']);
$app['system'] = 1;
self::app_install(local_channel(), $app);
self::app_install(local_channel(), $app, true);
}
}
}
@ -643,7 +643,7 @@ class Apps
]);
}
public static function app_install($uid, $app)
public static function app_install($uid, $app, $sync = false)
{
if (!is_array($app)) {
@ -677,27 +677,28 @@ class Apps
}
if ($x['success']) {
if ($sync && $app['uid']) {
$r = q(
"select * from app where app_id = '%s' and app_channel = %d limit 1",
dbesc($x['app_id']),
intval($uid)
);
if ($r) {
if (($app['uid']) && (!$r[0]['app_system'])) {
if ($app['categories'] && (!$app['term'])) {
$r[0]['term'] = q(
"select * from term where otype = %d and oid = %d",
intval(TERM_OBJ_APP),
intval($r[0]['id'])
);
}
if (intval($r[0]['app_system'])) {
Libsync::build_sync_packet($uid, array('sysapp' => $r[0]));
Libsync::build_sync_packet($uid, array('sysapp' => [$r[0]]));
} else {
Libsync::build_sync_packet($uid, array('app' => $r[0]));
}
Libsync::build_sync_packet($uid, array('app' => [$r[0]]));
}
}
}
return $x['app_id'];
}
return false;

View file

@ -944,6 +944,7 @@ class Channel
$ret['compatibility'] = [
'project' => PLATFORM_NAME,
'codebase' => 'zap',
'schema' => 'streams',
'version' => STD_VERSION,
'database' => DB_UPDATE_VERSION
];
@ -1281,6 +1282,7 @@ class Channel
}
$ret['compatibility']['codebase'] = 'zap';
$ret['compatibility']['schema'] = 'streams';
$r = q(
"select * from item where ( item_wall = 1 or item_type != %d ) and item_deleted = 0 and uid = %d and created >= '%s' and created <= '%s' and resource_type = '' order by created",
@ -1350,6 +1352,7 @@ class Channel
}
$ret['compatibility']['codebase'] = 'zap';
$ret['compatibility']['schema'] = 'streams';
$r = q(

View file

@ -99,6 +99,7 @@ class Libsync
$info['type'] = 'sync';
$info['encoding'] = 'red'; // note: not zot, this packet is very platform specific
$info['relocate'] = ['channel_address' => $channel['channel_address'], 'url' => z_root()];
$info['schema'] = 'streams';
if (array_key_exists($uid, App::$config) && array_key_exists('transient', App::$config[$uid])) {
$settings = App::$config[$uid]['transient'];
@ -298,6 +299,7 @@ class Libsync
$result = [];
$schema = (isset($arr['schema']) && $arr['schema']) ? $arr['schema'] : 'unknown';
$keychange = ((array_key_exists('keychange', $arr)) ? true : false);
foreach ($deliveries as $d) {
@ -649,7 +651,7 @@ class Libsync
if ($abconfig) {
/// @fixme does not handle sync of del_abconfig
foreach ($abconfig as $abc) {
if ($abc['cat'] === 'system' && $abc['k'] === 'my_perms') {
if ($abc['cat'] === 'system' && $abc['k'] === 'my_perms' && $schema !== 'streams') {
$x = explode(',', $abc['v']);
if (in_array('view_stream',$x) && ! in_array('deliver_stream',$x)) {
$x[] = 'deliver_stream';

View file

@ -14,6 +14,7 @@ use Code\Render\Theme;
use Code\Extend\Hook;
require_once('include/security.php');
require_once('include/conversation.php');
class Navbar {
@ -65,7 +66,6 @@ class Navbar {
$sitelocation = ((App::$profile['reddress']) ? App::$profile['reddress'] : '@' . App::get_hostname());
}
require_once('include/conversation.php');
$channel_apps[] = ((isset(App::$profile)) ? self::channel_apps($is_owner, App::$profile['channel_address']) : []);

View file

@ -21,6 +21,9 @@ class Security
$anonymous_comments = ((x($_POST, 'anonymous_comments')) ? intval($_POST['anonymous_comments']) : 0);
set_config('system', 'anonymous_comments', $anonymous_comments);
$use_hs2019 = ((x($_POST, 'use_hs2019')) ? intval($_POST['use_hs2019']) : 0);
set_config('system', 'use_hs2019', $use_hs2019);
$block_public = ((x($_POST, 'block_public')) ? true : false);
set_config('system', 'block_public', $block_public);
@ -144,6 +147,7 @@ class Security
'$localdir_hide' => ['localdir_hide', t('Hide local directory'), intval(get_config('system', 'localdir_hide')), t('Only use the global directory')],
'$cloud_noroot' => ['cloud_noroot', t('Provide a cloud root directory'), 1 - intval(get_config('system', 'cloud_disable_siteroot', true)), t('The cloud root directory lists all channel names which provide public files. Otherwise only the names of connections are shown.')],
'$cloud_disksize' => ['cloud_disksize', t('Show total disk space available to cloud uploads'), intval(get_config('system', 'cloud_report_disksize')), ''],
'$use_hs2019' => ['use_hs2019', t('Use hs2019 HTTP-Signature specification'), intval(get_config('system', 'use_hs2019', true)), t('Compliance with this specification is mandatory, yet still not supported by a number of fediverse platforms.')],
'$thumbnail_security' => ['thumbnail_security', t("Allow SVG thumbnails in file browser"), get_config('system', 'thumbnail_security', 0), t("WARNING: SVG images may contain malicious code.")],
'$inline_pdf' => ['inline_pdf', t("Allow embedded (inline) PDF files"), get_config('system', 'inline_pdf', 0), ''],

View file

@ -43,7 +43,7 @@ class Appman extends Controller
'categories' => escape_tags($_REQUEST['categories'])
];
$_REQUEST['appid'] = Apps::app_install($channel_id, $arr);
$_REQUEST['appid'] = Apps::app_install($channel_id, $arr, true);
if (Apps::app_installed($channel_id, $arr)) {
info(t('App installed.') . EOL);
@ -61,7 +61,7 @@ class Appman extends Controller
}
if ($_POST['install']) {
Apps::app_install($channel_id, $papp);
Apps::app_install($channel_id, $papp, true);
if (Apps::app_installed($channel_id, $papp)) {
info(t('App installed.') . EOL);
}

View file

@ -1,6 +1,6 @@
<?php
namespace Code\Module;
namespace Code\Module\Dev;
/*
* Finger diagnostic tool.

View file

@ -144,6 +144,7 @@ class Import extends Controller
notice('Data export format is not compatible with this software');
return;
}
$schema = (array_path_exists('compatibility/schema', $data) && $data['compatibility']['schema']) ? $data['compatibility']['schema'] : 'unknown';
if ($moving) {
$seize = 1;
@ -442,9 +443,18 @@ class Import extends Controller
if ($abconfig) {
foreach ($abconfig as $abc) {
if ($abc['cat'] === 'system' && $abc['k'] === 'my_perms' && $schema !== 'streams') {
$x = explode(',', $abc['v']);
if (in_array('view_stream',$x) && ! in_array('deliver_stream',$x)) {
$x[] = 'deliver_stream';
}
set_abconfig($channel['channel_id'], $abc['xchan'], $abc['cat'], $abc['k'], implode(',', $x));
}
else {
set_abconfig($channel['channel_id'], $abc['xchan'], $abc['cat'], $abc['k'], $abc['v']);
}
}
}
if ($reconnect) {
Connect::connect($channel, $abook['abook_xchan']);
}

19
Code/Update/_1258.php Normal file
View file

@ -0,0 +1,19 @@
<?php
namespace Code\Update;
use Code\Lib\Apps;
class _1258
{
public function run()
{
q("update app set app_photo = 'icon:list-alt' where app_system = 1 and app_photo = 'icon:th'");
return UPDATE_SUCCESS;
}
public function verify() {
return true;
}
}

View file

@ -124,10 +124,6 @@ class WebServer
private function set_identities()
{
if (! App::$install) {
App::$sys_channel = Channel::get_system();
}
if ((x($_GET, 'zid')) && (! App::$install)) {
App::$query_string = strip_zids(App::$query_string);
if (! local_channel()) {

View file

@ -24,3 +24,6 @@ This software will install as a fediverse server using the LAMP stack. There are
This work is dedicated and released to the public domain with no strings attached. Be advised that many others have contributed code to this repository under a number of different OSI-approved software licenses during its existence. This has no effect on any of your fundamental software freedoms; although corporate legal consultants who wish to re-appropriate our work for their employer's profit will likely find this lack of license clarity "troublesome". This is intentional.
The current name of this repository implies fluidity. As a brand or product it technically does not exist. This is also intentional. The software provides general web communications infrastructure. It's your website. Your site is your brand. Not ours.
--
Notes: If you have issues communicating with folks on Misskey or Pleroma after installation, visit admin/security on your site and disable hs2019 signatures.

View file

@ -1,6 +1,6 @@
version: 1
version: 2
url: $baseurl/stream
requires: local_channel
name: Stream
photo: icon:th
photo: icon:list-alt
categories: nav_featured_app, Networking

View file

@ -27,7 +27,7 @@ require_once('version.php');
define ( 'PLATFORM_NAME', 'streams' );
define ( 'DB_UPDATE_VERSION', 1257 );
define ( 'DB_UPDATE_VERSION', 1258 );
define ( 'ZOT_REVISION', '11.0' );
define ( 'PLATFORM_ARCHITECTURE', 'zap' );
@ -693,6 +693,8 @@ function sys_boot() {
App::$session = new Session();
App::$session->init();
App::$sys_channel = Channel::get_system();
Hook::load();
/**
* @hooks 'startup'

View file

@ -6,7 +6,6 @@ require_once('boot.php');
function cli_startup()
{
sys_boot();
App::set_baseurl(get_config('system', 'baseurl'));
}

View file

@ -162,7 +162,7 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
// This is a somewhat expensive operation but important.
// Don't send this item to anybody who doesn't have the deliver_stream permission
$recipients = check_list_permissions($item['uid'],$recipients,'view_stream');
$recipients = check_list_permissions($item['uid'],$recipients,'deliver_stream');
// add ourself just in case we have nomadic clones that need to get a copy.
@ -1664,6 +1664,9 @@ function item_store($arr, $allow_exec = false, $deliver = true, $linkid = true)
$arr['app'] = ((x($arr,'app')) ? notags(trim($arr['app'])) : '');
$arr['replyto'] = ((x($arr,'replyto')) ? serialise($arr['replyto']) : '');
// No longer used but needs to be set to something or the database will complain.
$arr['route'] = '';
$arr['public_policy'] = '';
$arr['comment_policy'] = ((x($arr,'comment_policy')) ? notags(trim($arr['comment_policy'])) : 'contacts' );

View file

@ -544,6 +544,7 @@ function site_default_perms()
$typical = array(
'view_stream' => PERMS_PUBLIC,
'deliver_stream'=> PERMS_SPECIFIC,
'view_profile' => PERMS_PUBLIC,
'view_contacts' => PERMS_PUBLIC,
'view_storage' => PERMS_PUBLIC,

View file

@ -0,0 +1,31 @@
Put your webserver to sleep.
----
cd [zapdir]
mysqldump -u [user name] p [password] --no-create-info [zap-dbname] > /backupdir/dump.sql
cp -rp cache store .htconfig.php /backupdir
cd ..
git clone git@codeberg.org:streams/streams
cd streams
util/add_addon_repo git@codeberg.org:streams/streams-addons addon
composer install --no-dev
mysql -u [user name] -p
create database streams;
use streams;
source install/schema_mysql.sql;
source /backupdir/dump.sql
quit;
cp -rp /backupdir/cache .
cp -rp /backupdir/store .
cp -p /backupdir/.htconfig.php .
Edit .htconfig.php to change the db name to streams
----
Point your webserver at the streams directory and restart it.
Enjoy.

File diff suppressed because it is too large Load diff

36
util/translate Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env bash
# Project translation script.
# Pre-requisites:
# sudo apt install gettext poedit
# Instructions:
# Execute 'util/translate xx' from your webroot,
# where 'xx' is an iso language string.
#
# If the language directory doesn't exist, create it
# by copying the contents of view/en into it.
#
# Additionally, there are a small number of template files
# ending in ".tpl" in the language directory which should
# be translated manually. Do not translate template variables
# which look like {{$variable}} or "%s" or "%d" or "%1$s".
# The text "$projectname" or "$Projectname" should also not
# be translated.
#
# The htconfig.tpl file contains code lines, so just
# translate the comment text.
#
# When finished, commit the result and issue a pull request
# to the project repository using standard git workflows.
if [ $# -lt 1 ]; then
echo usage: $0 language
exit 0
fi
if [ -e view/$1/messages.po ]; then
msgmerge --update view/$1/messages.po util/messages.po
poedit view/$1/messages.po
php util/po2php.php view/$1/messages.po
php -l view/$1/strings.php
fi

View file

@ -1,2 +1,2 @@
<?php
define ( 'STD_VERSION', '22.05.06' );
define ( 'STD_VERSION', '22.05.12' );

12498
view/en-au/messages.po Normal file

File diff suppressed because it is too large Load diff

12498
view/en/messages.po Normal file

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
{{include file="field_checkbox.tpl" field=$use_hs2019}}
{{include file="field_checkbox.tpl" field=$block_public}}
{{include file="field_checkbox.tpl" field=$block_public_search}}
{{include file="field_checkbox.tpl" field=$block_public_dir}}

View file

@ -1,6 +1,6 @@
<h3>{{$page_title}}</h3>
<form action="finger" method="get">
<form action="dev/finger" method="get">
{{include file="field_input.tpl" field=$resource}}
<input type="submit" name="submit" value="{{$submit}}" >
</form>