backup dnstt keys

This commit is contained in:
mercury
2025-12-03 00:16:19 +04:00
parent eb4641a58d
commit 3bdebd95ab
+11
View File
@@ -1834,6 +1834,10 @@ class Bot
'private' => file_get_contents('/certs/cert_private'),
'public' => file_get_contents('/certs/cert_public'),
] : false,
'dnstt' => file_exists('/config/dnstt/server.key') ? [
'private' => file_get_contents('/config/dnstt/server.key'),
'public' => file_get_contents('/config/dnstt/server.pub'),
] : false,
'mtproto' => file_get_contents('/config/mtprotosecret'),
'mtprotodomain' => file_get_contents('/config/mtprotodomain'),
'xray' => $this->getXray(),
@@ -1986,6 +1990,13 @@ class Bot
$this->setUpstreamDomainOcserv($json['pac']['domain']);
$this->setUpstreamDomainNaive($json['pac']['domain']);
}
// dnstt
if (!empty($json['dnstt'])) {
$out[] = 'update dnstt certificates';
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
file_put_contents('/config/dnstt/server.key', $json['dnstt']['private']);
file_put_contents('/config/dnstt/server.pub', $json['dnstt']['public']);
}
// nginx
$out[] = 'reset nginx';
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));