Add verification for playbase.pro
Closed this issue ยท 6 comments
First of all, thanks for creating such a useful plugin. I would like to suggest adding playbase.pro to the list of supported sites.
The list has an API and from December 1 will require a Bearer API Token to support the following endpoints:
- Info (GET): https://playbase.pro/api/vote/{server}/{ip}
{
"id": 5143,
"server": 245,
"user_id": 0,
"nickname": "Notch",
"date": "2022-08-01T18:54:06.000Z",
"received": false
}
- Redeem (POST): https://playbase.pro/api/vote/{server}/{ip}/redeem
{
"status": 200,
"response": "Successfully received."
}
Swagger: https://playbase.pro/en/api
Added in above commit, but untested because I can't register on the given website: I have "The field must be accepted." error for TOS and privacy policy, even when checking the box...
Added in above commit, but untested because I can't register on the given website: I have "The field must be accepted." error for TOS and privacy policy, even when checking the box...
Thanks for your work, however, I found two bugs while testing.
- The API key is returned instead of the server ID in the link, which is incorrect. Corrected code:
playbase.pro/en/minecraft/3
-hypixel-network-1-8-1-19-holidays-event-double-coins-and-exp
$this->register(VoteVerifier::for('playbase.pro')
->setApiUrl('https://playbase.pro/api/vote/{server}/{ip}')
//->requireKey('api_key')
->retrieveKeyByRegex('/\/(\d+)-/') // get ID from url provided by user
->transformRequest(function (PendingRequest $request, User $user, Site $site) {
return $request->withToken($site->verification_key);
})
->verifyByJson('date', true));
- Too few arguments to function Azuriom\Plugin\Vote\Verification\VoteChecker::Azuriom\Plugin\Vote\Verification{closure}(), 1 passed in \vendor\laravel\framework\src\Illuminate\Support\helpers.php on line 432 and exactly 3 expected {"userId":1,"exception":"[object] (ArgumentCountError(code: 0): Too few arguments to function Azuriom\Plugin\Vote\Verification\VoteChecker::Azuriom\Plugin\Vote\Verification\{closure}(), 1 passed in \vendor\laravel\framework\src\Illuminate\Support\helpers.php on line 432 and exactly 3 expected at \plugins\vote\src\Verification\VoteChecker.php:176)
V
->transformRequest(function (PendingRequest $request, User $user, Site $site) {
return $request->withToken($site->verification_key);
})
Thanks for the feedback, do you think you could create a pull request with the updated fixed code ? As I can't test it's not convenient ๐
Thanks for the feedback, do you think you could create a pull request with the updated fixed code ? As I can't test it's not convenient ๐
The checkbox during registration is fixed. Actually, problem 2 remains. For some reason transformRequest
is not receiving User $user, Site $site.
For some reason
transformRequest
is not receiving User $user, Site $site. - @RikoDEV
Could you test by replacing this line
Plugin-Vote/src/Verification/VoteVerifier.php
Line 213 in 874c82c
With these lines, and tell me if it fixes the issues (or directly open a PR if you prefer):
$request = Http::asJson();
if ($this->transformRequest !== null) {
$request = ($this->transformRequest)($request, $user, $site);
}
$res = $request->get($url);
For some reason
transformRequest
is not receiving User $user, Site $site. - @RikoDEVCould you test by replacing this line
Plugin-Vote/src/Verification/VoteVerifier.php
Line 213 in 874c82c
With these lines, and tell me if it fixes the issues (or directly open a PR if you prefer):
$request = Http::asJson(); if ($this->transformRequest !== null) { $request = ($this->transformRequest)($request, $user, $site); } $res = $request->get($url);