mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 15:55:13 +00:00
only allow one identity key instance per server - for now.
This commit is contained in:
parent
bfdae7df3f
commit
9f0b1f40c3
1 changed files with 14 additions and 1 deletions
|
@ -18,6 +18,7 @@ use Code\Lib\ServiceClass;
|
|||
use Code\Extend\Hook;
|
||||
use Code\Render\Theme;
|
||||
use Code\Lib\Url;
|
||||
use Code\Lib as Zlib;
|
||||
|
||||
require_once('include/import.php');
|
||||
require_once('include/photo_factory.php');
|
||||
|
@ -193,13 +194,25 @@ class Import extends Controller
|
|||
$eprvkey = $multibase->decode($data['privateKeyMultibase']);
|
||||
|
||||
if ($epubkey && $eprvkey) {
|
||||
$existing = q("select * from channel where epubkey = '%s'",
|
||||
dbesc($epubkey)
|
||||
);
|
||||
if ($existing) {
|
||||
notice(t('Identity key is already in use on this instance.'));
|
||||
return;
|
||||
}
|
||||
q("update channel set epubkey = '%s', eprivkey = '%s' where channel_id = %d",
|
||||
dbesc($epubkey),
|
||||
dbesc($eprvkey),
|
||||
intval($channel['channel_id'])
|
||||
);
|
||||
q("update xchan set xchan_epubkey = '%s' where xchan_hash = '%s'",
|
||||
dbesc($data['publicKeyMultibase']),
|
||||
dbesc($channel['channel_hash'])
|
||||
);
|
||||
notice(t('Import of identity key successful.'));
|
||||
PConfig::Set($channel['channel_id'], 'system', 'nomadicAP', true);
|
||||
Zlib\PConfig::Set($channel['channel_id'], 'system', 'nomadicAP', true);
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue