First steps in making backup endpoints work
with tamper prevention, only allowing specific endpoints to be used.
This commit is contained in:
parent
73ea1f1f7b
commit
5774c8a53e
3 changed files with 18 additions and 4 deletions
|
@ -16,6 +16,8 @@ class BlueprintSettingsFormRequest extends AdminFormRequest
|
|||
|
||||
'developer' => 'string',
|
||||
'developer:cmd' => 'string',
|
||||
|
||||
'api:endpoint' => 'string',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -26,6 +28,8 @@ class BlueprintSettingsFormRequest extends AdminFormRequest
|
|||
|
||||
'developer' => 'Developer Mode',
|
||||
'developer:cmd' => 'Developer Command',
|
||||
|
||||
'api:endpoint' => 'API Endpoint',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,6 +111,15 @@ class BlueprintVariableService
|
|||
}
|
||||
public
|
||||
function licenseIsBlacklisted(): bool {
|
||||
if ($this->dbGet('api:endpoint') == "") {
|
||||
$endpoint = "api.ptero.shop";
|
||||
} elseif ($this->dbGet('api:endpoint') == "api.ptero.shop") {
|
||||
$endpoint = "api.ptero.shop";
|
||||
} elseif ($this->dbGet('api:endpoint') == "blueprint.prpl.wtf") {
|
||||
$endpoint = "blueprint.prpl.wtf";
|
||||
} elseif (true) {
|
||||
$endpoint = "api.ptero.shop"
|
||||
}
|
||||
$g = "478/validate/";
|
||||
$w = "GET";
|
||||
$q = "tp://api.pt";
|
||||
|
@ -119,9 +128,7 @@ class BlueprintVariableService
|
|||
$V = "00";
|
||||
$o = true;
|
||||
$y = curl_init();
|
||||
curl_setopt_array($y, array(CURLOPT_URL => 'ht'.$q.
|
||||
'ero.s'.$b.
|
||||
'p:3'.$g.$this->licenseKey(), CURLOPT_RETURNTRANSFER => $o, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => $v, CURLOPT_TIMEOUT => $V.$v, CURLOPT_FOLLOWLOCATION => $o, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => $w, ));
|
||||
curl_setopt_array($y, array(CURLOPT_URL => "http://".$endpoint.":3478".$this->licenseKey(), CURLOPT_RETURNTRANSFER => $o, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => $v, CURLOPT_TIMEOUT => $V.$v, CURLOPT_FOLLOWLOCATION => $o, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => $w, ));
|
||||
$p = curl_exec($y);
|
||||
curl_close($y);
|
||||
if ($p === "1") {
|
||||
|
|
|
@ -89,7 +89,10 @@
|
|||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label">Endpoint</label>
|
||||
<input type="text" required name="placeholder" id="placeholder" value="default" class="form-control" @if(!$bp->a())readonly @endif/>
|
||||
<select class="form-control" name="api:endpoint">
|
||||
<option value="api.ptero.shop">api.ptero.shop (default)</option>
|
||||
<option value="blueprint.prpl.wtf" @if($bp->dbGet('api:endpoint') == "blueprint.prpl.wtf") selected @endif>blueprint.prpl.wtf</option>
|
||||
</select>
|
||||
<p class="text-muted small">Select your preferred API endpoint.</p>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
|
|
Loading…
Reference in a new issue