fix adguard upstreams, new config

add reset settings adguard button
This commit is contained in:
mercury
2023-02-10 15:42:33 +04:00
parent 6e6cab5709
commit a06252d8f0
4 changed files with 32 additions and 3 deletions
+22
View File
@@ -110,6 +110,9 @@ class Bot
case preg_match('~^/adguardpsswd$~', $this->input['callback'], $m):
$this->adguardpsswd();
break;
case preg_match('~^/adguardreset$~', $this->input['callback'], $m):
$this->adguardreset();
break;
case preg_match('~^/addupstream$~', $this->input['callback'], $m):
$this->addupstream();
break;
@@ -697,6 +700,21 @@ class Bot
$this->menu('adguard');
}
public function adguardreset()
{
$out[] = 'Restart Adguard Home';
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
$out[] = $this->ssh("/AdGuardHome/AdGuardHome -s stop 2>&1", 'ad');
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
$c = yaml_parse_file('/config/AdGuardHome.yaml');
$this->sd($c);
yaml_emit_file('/config/adguard/AdGuardHome.yaml', $c);
$out[] = $this->ssh("/AdGuardHome/AdGuardHome -s start 2>&1", 'ad');
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
sleep(3);
$this->menu('adguard');
}
public function checkdns()
{
$r = $this->send(
@@ -1526,6 +1544,10 @@ DNS-over-HTTPS with IP:
'text' => 'change password',
'callback_data' => "/adguardpsswd",
],
[
'text' => 'reset settings',
'callback_data' => "/adguardreset",
],
],
];
$data[] = [