Skip to content

Commit

Permalink
Merge pull request #100 from SynergyWholesale/feature/remove-whois-js…
Browse files Browse the repository at this point in the history
…on-from-bundle

Remove whois.json and other supporting code for it
  • Loading branch information
Sn0wCrack committed Mar 7, 2024
2 parents 8828c5b + 7be3b4b commit ff4132e
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 75 deletions.
5 changes: 0 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ Please ensure you have cloned the repository and have the [required tools](#requ
### Building the CSS/JS assets
To build the CSS and JS assets, please run `make build-assets`

### Updating `whois.json`
To pull down the latest `whois.json`, please run `make update-whois`.

**Please note:** your IP Address must be whitelisted in our management console. [See here](https://synergywholesale.com/faq/article/does-synergy-wholesale-have-a-whois-domain-availability-checker-i-can-integrate-to-my-whmcs/) for more information

### Running tests
Before running the tests please ensure you've

Expand Down
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ VERSION := $(firstword $(subst -, ,${VERSION}))
build-assets:
npm run-script build

update-whois:
curl -s "https://$(SW_FRONTEND_HOSTNAME)/home/whmcs-whois-json" > "resources/domains/whois.json"

replace:
sed -i${SED_PARAM} "s/{{VERSION}}/${VERSION}/g" "README.txt"
sed -i${SED_PARAM} "s/{{VERSION}}/${VERSION}/g" "modules/registrars/synergywholesaledomains/whmcs.json"
Expand Down Expand Up @@ -51,7 +48,6 @@ package:
build:
test -s node_modules/.bin/minify || npm install
make build-assets
make update-whois
make replace
make package
make revert
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ If you would like to report a bug or request a new feature/improvement for our m
- Includes retrospective premium domain identification
- Manual sync button in the admin area
- API Connectivity Tester
- WHOIS.json updater

# Installation
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Illuminate\Support\Str;

define('API_ENDPOINT', 'https://{{API}}');
define('WHOIS_URL', 'https://{{FRONTEND}}/home/whmcs-whois-json');
define('WHATS_MY_IP_URL', 'https://{{FRONTEND}}/ip');
define('SW_MODULE_VERSION', '{{VERSION}}');
define('SW_MODULE_NAME', 'synergywholesaledomains');
Expand Down Expand Up @@ -296,11 +295,6 @@ function synergywholesaledomains_getConfigArray(array $params)
'Type' => 'yesno',
'Description' => 'Enable to see connectivity status to the Synergy Wholesale API',
],
'whoisUpdate' => [
'FriendlyName' => 'Force update WHOIS.json',
'Type' => 'yesno',
'Description' => 'Enable this option to force update the WHOIS.json data<br><b>NOTE:</b> This option will be disabled automatically again once you have clicked \'Save Changes\' and the update sequence is completed.',
],
'auDirectShowSingleContestedAvailable' => [
'FriendlyName' => 'Ordering Form Support - Single Contested .AU Direct Domains',
'Type' => 'yesno',
Expand Down Expand Up @@ -407,56 +401,6 @@ function synergywholesaledomains_getConfigArray(array $params)
}
}

// If the conversion option is ticked, then we need to process the conversion
if (isset($params['whoisUpdate']) && 'on' === $params['whoisUpdate']) {
$jsonPath = realpath(join(DIRECTORY_SEPARATOR, [__DIR__, '..', '..', '..', 'resources', 'domains', 'whois.json']));
$whoisBackup = file_get_contents($jsonPath);
$whois = file_get_contents(WHOIS_URL);

if (!file_exists($jsonPath)) {
$configuration['whoisUpdate']['Description'] .= "<br><b>NOTICE:</b> WHOIS.json update unsuccessful. File path invalid. The file at $jsonPath does not exist.";
return $configuration;
}

if ($whois === $whoisBackup) {
$configuration['whoisUpdate']['Description'] .= '<br><b>NOTICE:</b> WHOIS.json file is already up to date.';
return $configuration;
}

// Testing to see if retrieved data is valid
@json_decode($whois);
if (JSON_ERROR_NONE !== json_last_error()) {
$configuration['whoisUpdate']['Description'] .= '<br><b>NOTICE:</b> WHOIS.json update unsuccessful. Unable to pull file.';
return $configuration;
}

if (!file_put_contents($jsonPath, $whois)) {
$configuration['whoisUpdate']['Description'] .= '<br><b>NOTICE:</b> <span style="color:red;">WHOIS.json update unsuccessful. Unable to update WHOIS.json file.</span>';

//Revert any changes made to backup file
file_put_contents($filePath, $whoisBackup);

return $configuration;
}

$configuration['whoisUpdate']['Description'] .= '<br><b>NOTICE:</b> <span style="color:green;">WHOIS.json successfully updated.</span>';

try {
/**
* Finally disable the setting for the customer automatically so
* they don't have them needing to turn if off manually
*/
Capsule::table('tblregistrars')->where([
'registrar' => 'synergywholesaledomains',
'setting' => 'whoisUpdate',
])->update([
'value' => 'off',
]);
} catch (\Exception $e) {
$configuration['whoisUpdate']['Description'] .= '<br><b>NOTICE:</b> WHOIS.json successfully updated however we were unable to disable this option automatically for you. Please untick the option yourself manually and click \'Save Changes\' again.';
}
}

return $configuration;
}

Expand Down
3 changes: 1 addition & 2 deletions modules/registrars/synergywholesaledomains/whmcs.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"Advanced Domain/Transfer Sync",
"Includes retrospective premium domain identification",
"Manual sync button in the admin area",
"API Connectivity Tester",
"WHOIS.json updater"
"API Connectivity Tester"
]
},
"logo": {
Expand Down
7 changes: 0 additions & 7 deletions resources/domains/whois.json

This file was deleted.

0 comments on commit ff4132e

Please sign in to comment.