Attempt to fix web viewer being unable to load NBT
This commit is contained in:
parent
4a8d515f4d
commit
b1063f5057
4 changed files with 16 additions and 7 deletions
|
@ -35,10 +35,9 @@ switch($jsx['cmd']) {
|
|||
$stmt->close();
|
||||
|
||||
// Prepare data as JSON and insert into `data` table
|
||||
if(is_array($jsx['data'])) {
|
||||
if($jsx['type'] == "json") {
|
||||
$data = json_encode($jsx['data']);
|
||||
} // else: The data is binary or NBT.
|
||||
else {
|
||||
}else if($jsx ['type'] == "nbt") {
|
||||
$data = base64_decode($jsx['data']);
|
||||
}
|
||||
|
||||
|
@ -79,12 +78,16 @@ switch($jsx['cmd']) {
|
|||
$stmt->close();
|
||||
|
||||
// Decode the JSON blob (optional — if you want raw JSON output)
|
||||
if(substr($sessionData, 0, 1) == "{") {
|
||||
$testDecoded = json_decode($sessionData, true);
|
||||
if(json_last_error() == JSON_ERROR_NONE) {
|
||||
|
||||
header("Content-Type: application/json");
|
||||
die($sessionData);
|
||||
|
||||
}else {
|
||||
header("Content-Type: application/nbt");
|
||||
die(base64_encode($sessionData));
|
||||
//die($sessionData);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue