mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
dns/ddclient - add "get" protocol in custom service type (#3523)
--------- Co-authored-by: Franco Fichtner <franco@lastsummer.de>
This commit is contained in:
@@ -56,7 +56,7 @@ class DynDNS extends BaseModel
|
||||
continue;
|
||||
}
|
||||
$srv = (string)$node->server;
|
||||
if ((string)$node->protocol == 'post') {
|
||||
if (in_array((string)$node->protocol, ['get', 'post', 'put'])) {
|
||||
if (empty($srv) || filter_var($srv, FILTER_VALIDATE_URL) === false) {
|
||||
$messages->appendMessage(
|
||||
new Message(
|
||||
|
||||
@@ -95,7 +95,9 @@
|
||||
<OptionValues>
|
||||
<dyndns1>DynDNS 1</dyndns1>
|
||||
<dyndns2>DynDNS 2</dyndns2>
|
||||
<get>Custom GET</get>
|
||||
<post>Custom POST</post>
|
||||
<put>Custom PUT</put>
|
||||
</OptionValues>
|
||||
</protocol>
|
||||
<server type="TextField">
|
||||
|
||||
@@ -67,11 +67,12 @@ class DynDNS2(BaseAccount):
|
||||
def execute(self):
|
||||
if super().execute():
|
||||
protocol = self.settings.get('protocol', None)
|
||||
if protocol == 'post':
|
||||
if protocol in [ 'get', 'post', 'put' ]:
|
||||
url = self.settings.get('server')
|
||||
url = url.replace('__MYIP__', self.current_address)
|
||||
url = url.replace('__HOSTNAME__', self.settings.get('hostnames'))
|
||||
req = requests.post(
|
||||
req = requests.request(
|
||||
method=protocol,
|
||||
url=url,
|
||||
headers={'User-Agent': 'OPNsense-dyndns'},
|
||||
auth=HTTPBasicAuth(self.settings.get('username'), self.settings.get('password'))
|
||||
|
||||
Reference in New Issue
Block a user