Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions core/class/dyndns.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,35 @@ public function updateIP() {
}
break;
case 'gandinet':
$url = 'https://dns.api.gandi.net/api/v5/domains/' . $this->getConfiguration('domainname') . '/records/' . $this->getConfiguration('hostname') .'/A';
$payload = array('rrset_type'=>'A','rrset_ttl'=>'3600','rrset_name'=>$this->getConfiguration('hostname'),'rrset_values'=>array($ip));
$url = 'https://api.gandi.net/v5/livedns/domains/' . $this->getConfiguration('domainname') . '/records/' . $this->getConfiguration('hostname') .'/A';
$payload = array(
'rrset_type'=>'A',
'rrset_ttl'=>'3600',
'rrset_name'=>$this->getConfiguration('hostname'),
'rrset_values'=>array($ip)
);
$payload_json = json_encode($payload);
$request_http = new com_http($url);
$request_http->setUserAgent('Jeedom dyndns plugin');
$request_http->setHeader(array('Content-Type: application/json', 'Content-Length: ' . strlen($payload_json), 'X-API-Key:' . $this->getConfiguration('token')));
// Manage compatibility with old version of the plugin where the auth-method was apikey by default
if ($this->getConfiguration('auth-method') == ""){
$authMethod = "apikey";
} else {
$authMethod = $this->getConfiguration('auth-method');
}
if ($authMethod == "apikey"){
$request_http->setHeader(array('Content-Type: application/json', 'Content-Length: ' . strlen($payload_json), 'Authorization: Apikey ' . $this->getConfiguration('token')));
}
if ($authMethod == "pat"){
$request_http->setHeader(array('Content-Type: application/json', 'Content-Length: ' . strlen($payload_json), 'Authorization: Bearer ' . $this->getConfiguration('token')));
}
$request_http->setPut($payload_json);
$result = $request_http->exec();
if (strpos($result, 'error') !== false) {
throw new Exception(__('Erreur de mise à jour de gandinet : ' . $url, __FILE__) . $result);
$status_code = $request_http->getHttpCode();
if ($status_code !== 200 && $status_code !== 201) {
throw new Exception(__('Erreur de mise à jour de gandinet : ' . $url, __FILE__) . ' Response code: ' . $status_code . ' Result: ' . $result);
} else {
log::add('dyndns', 'debug', 'Gandi.net update success on: ' . $url );
}
break;
case 'infomaniak':
Expand Down
3 changes: 3 additions & 0 deletions core/i18n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"Domainname": "Domänenname",
"Nom d'utilisateur": "Benutzername",
"Mot de passe": "Passwort",
"Méthode d'authentification": "Authentifizierungsmethode",
"API Key": "API key",
"Personal Access Token (PAT)": "Persönlicher Zugriffstoken (PAT)",
"Token": "Zeichen",
"IPv6": "IPv6",
"Nom": "Name",
Expand Down
3 changes: 3 additions & 0 deletions core/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"Domainname": "Domain name",
"Nom d'utilisateur": "Username",
"Mot de passe": "Password",
"Méthode d'authentification": "Authentication method",
"API Key": "API key",
"Personal Access Token (PAT)": "Personal Access Token (PAT)",
"Token": "Token",
"IPv6": "IPv6",
"Nom": "Name",
Expand Down
3 changes: 3 additions & 0 deletions core/i18n/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"Domainname": "Nombre de dominio",
"Nom d'utilisateur": "Nombre de usuario",
"Mot de passe": "Contraseña",
"Méthode d'authentification": "Método de autenticación",
"API Key": "API key",
"Personal Access Token (PAT)": "Token de acceso personal (PAT)",
"Token": "Simbólico",
"IPv6": "IPv6",
"Nom": "Nombre",
Expand Down
3 changes: 3 additions & 0 deletions core/i18n/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"Domainname": "Domainname",
"Nom d'utilisateur": "Nom d'utilisateur",
"Mot de passe": "Mot de passe",
"Méthode d'authentification": "Méthode d'authentification",
"API Key": "API key",
"Personal Access Token (PAT)": "Personal Access Token (PAT)",
"Token": "Token",
"IPv6": "IPv6",
"Nom": "Nom",
Expand Down
3 changes: 3 additions & 0 deletions core/i18n/id_ID.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"Domainname": "Domainname",
"Nom d'utilisateur": "Nama pemakai",
"Mot de passe": "Password",
"Méthode d'authentification": "Metode autentikasi",
"API Key": "API key",
"Personal Access Token (PAT)": "Token akses pribadi (PAT)",
"Token": "Token",
"IPv6": "IPv6",
"Nom": "Nama",
Expand Down
3 changes: 3 additions & 0 deletions core/i18n/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"Domainname": "Domainname",
"Nom d'utilisateur": "Nome utente",
"Mot de passe": "Password",
"Méthode d'authentification": "Metodo di autenticazionen",
"API Key": "API key",
"Personal Access Token (PAT)": "Token di accesso personale (PAT)",
"Token": "Token",
"IPv6": "IPv6",
"Nom": "Nome",
Expand Down
3 changes: 3 additions & 0 deletions core/i18n/ja_JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"Domainname": "Domainname",
"Nom d'utilisateur": "ユーザー名",
"Mot de passe": "パスワード",
"Méthode d'authentification": "認証方法",
"API Key": "API key",
"Personal Access Token (PAT)": "個人アクセストークン (PAT)",
"Token": "Token",
"IPv6": "IPv6",
"Nom": "表題",
Expand Down
3 changes: 3 additions & 0 deletions core/i18n/pt_PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"Domainname": "Nome do domínio",
"Nom d'utilisateur": "Nome de Usuário",
"Mot de passe": "Senha",
"Méthode d'authentification": "Método de autenticação",
"API Key": "API key",
"Personal Access Token (PAT)": "Token de acesso pessoal (PAT)",
"Token": "Token",
"IPv6": "IPv6",
"Nom": "Nome",
Expand Down
3 changes: 3 additions & 0 deletions core/i18n/ru_RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"Domainname": "Domainname",
"Nom d'utilisateur": "Имя пользователя",
"Mot de passe": "Пароль",
"Méthode d'authentification": "Метод аутентификации",
"API Key": "API key",
"Personal Access Token (PAT)": "Персональный токен доступа (PAT)",
"Token": "Token",
"IPv6": "IPv6",
"Nom": "Имя",
Expand Down
3 changes: 3 additions & 0 deletions core/i18n/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"Domainname": "Domainname",
"Nom d'utilisateur": "Kullanıcı adı",
"Mot de passe": "Şifre",
"Méthode d'authentification": "Kimlik doğrulama yöntemi",
"API Key": "API key",
"Personal Access Token (PAT)": "Kişisel erişim anahtarı (PAT)",
"Token": "Token",
"IPv6": "IPv6",
"Nom": "İsim",
Expand Down
9 changes: 9 additions & 0 deletions desktop/php/dyndns.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@
<input type="password" class="eqLogicAttr form-control" data-l1key="configuration" data-l2key="password" />
</div>
</div>
<div class="form-group gandinet">
<label class="col-sm-4 control-label">{{Méthode d'authentification}}</label>
<div class="col-sm-6">
<select class="eqLogicAttr" data-l1key="configuration" data-l2key="auth-method">
<option value="apikey">{{API Key}}</option>
<option value="pat">{{Personal Access Token (PAT)}}</option>
</select>
</div>
</div>
<div class="form-group serviceType duckdns gandinet">
<label class="col-sm-4 control-label">{{Token}}</label>
<div class="col-sm-6">
Expand Down