diff --git a/.gitignore b/.gitignore index aaa587d..78cfa55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ # Config files: /config/*.json !/config/pb-dydns.example.json + +# Composer files: +/vendor/ diff --git a/bin/pb-dydns.php b/bin/pb-dydns.php index 2612956..d74f2af 100755 --- a/bin/pb-dydns.php +++ b/bin/pb-dydns.php @@ -1,13 +1,14 @@ #!/usr/bin/env php run($argv); diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..c15ba43 --- /dev/null +++ b/composer.json @@ -0,0 +1,13 @@ +{ + "name": "ramoncaballero.dev/pb-dydns", + "description": "Dynamic DNS updater for Porkbun", + "type": "project", + "autoload": + { + "psr-4": + { + "App\\": "src/" + } + }, + "require": {} +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..0cd2bf5 --- /dev/null +++ b/composer.lock @@ -0,0 +1,18 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "9462733d0fea3fd21d03aa382b606406", + "packages": [], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": {}, + "platform-dev": {}, + "plugin-api-version": "2.6.0" +} diff --git a/src/Api/PorkbunAPI.php b/src/Api/PorkbunAPI.php index 1f3e4cb..14da9e0 100644 --- a/src/Api/PorkbunAPI.php +++ b/src/Api/PorkbunAPI.php @@ -1,5 +1,10 @@ content != $myIp) { Console::echo("Let's change that... "); + $name = rtrim(strstr($record->name, $domain, true), "."); $result = json_decode($api->edit($domain, $record->id, $myIp, $name)); - if ($result->status == "SUCCESS") Console::echo("Done!" . PHP_EOL); + + if ($result->status == "SUCCESS") + { + Console::echo("Done!" . PHP_EOL); + } $this->logger->log("Updated DNS on $record->name from $record->content to $myIp"); } @@ -89,6 +96,8 @@ class UpdateDnsCommand { Console::echo("Nothing needs to be changed!" . PHP_EOL); } + + Console::echo(""); } } } diff --git a/src/Config/Config.php b/src/Config/Config.php index 0c14b81..26f4eed 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -1,5 +1,9 @@