Skip to content

Commit

Permalink
spring clean
Browse files Browse the repository at this point in the history
  • Loading branch information
0x1DEA committed Mar 9, 2024
1 parent ddf4b1a commit 120adfb
Show file tree
Hide file tree
Showing 43 changed files with 2,059 additions and 2,550 deletions.
22 changes: 21 additions & 1 deletion app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,25 @@ public function home()
$q = Article::query()->latest()->first();
}

$dcr = Http::asForm()->withUserAgent('')
->post('https://www.boomlings.com/database/getGJComments21.php', [
'levelID' => '60805571',
'page' => '0',
'secret' => 'Wmfd2893gb7'
])->body();

$dcr = explode('#', $dcr)[0];
$dcr = explode('|', $dcr);

foreach ($dcr as &$d) {
$bits = explode(':', $d);
$d = gj_map($bits[0], '~');
sort($d);
$d[6] = base64_urldecode($d[6]);
$d[7] = gj_map($bits[1], '~');
//$d[7] = $bits[1];
}

return page('Home', [
'frontpage_article' => $q,
'recent_articles' => Article::query()
Expand All @@ -47,7 +66,8 @@ public function home()
->latest()
->limit(6)
->get(),
'newest_user' => User::query()->latest()->first()
'newest_user' => User::query()->latest()->first(),
'daily_chat' => $dcr
])->meta('Home', 'Hyperbolus, your home for Geometry Dash');
}

Expand Down
132 changes: 132 additions & 0 deletions app/Http/Controllers/ToolsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?php

namespace App\Http\Controllers;

use App\Models\Article;
use App\Models\Content\Post;
use App\Models\Content\Review;
use App\Models\Content\Video;
use App\Models\System\Setting;
use App\Models\System\User;
use Illuminate\Contracts\Support\Responsable;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
use Inertia\Inertia;
use Inertia\Response;

class ToolsController extends Controller
{
function sfxLibrary(): Responsable
{
$library = Cache::get('boomlings:sfxLibrary');
if (!$library || true) {
$secret = '8501f9c2-75ba-4230-8188-51037c4da102';
$expires = 9_999_999_999;
$token = base64_urldecode(hash('sha256', $secret . $secret));
//$res = Http::get('https://geometrydashfiles.b-cdn.net/sfx/sfxLibrary.dat?token=' . $token . '&expires=' . $expires)->body();
$res = Http::get('https://geometrydashfiles.b-cdn.net/sfx/sfxLibrary.dat')->body();
$res = mb_convert_encoding($res, 'UTF-8', 'UTF-8');;
$res = base64_urldecode($res);
$res = zlib_decode($res);
$res = explode('|', $res);
$library = [];
for ($i = 0; $i < count($res); $i++) {
$res[$i] = explode(';', $res[$i]);
array_pop($res[$i]); // Remove trailing ';'
if ($i === 0) $library['version'] = (int)explode(',', $res[0][0])[1];
for ($j = 1; $j < count($res[$i]); $j++) {
$bits = explode(',', $res[$i][$j]);
switch ($i) {
case 0: // File/Folder
if ($bits[2]) {
$library['folders'][(int)$bits[0]] = [
'name' => $bits[1],
'parent' => (int)$bits[3],
];
} else {
$library['files'][(int)$bits[0]] = [
'name' => $bits[1],
'parent' => (int)$bits[3],
'bytes' => (int)$bits[4],
'milliseconds' => (int)$bits[5],
];
}
break;
case 1: // Credit
$library['credits'][] = [
'name' => $bits[0],
'website' => $bits[1],
];
break;
}
}
}
$library = json_decode(json_encode($library, JSON_INVALID_UTF8_IGNORE));
Cache::put('boomlings:sfxLibrary', $library, 60 * 60);
}
return page('Tools/SFX', [
'library' => $library
])
->meta('SFX Browser', 'Browse the official Geometry Dash sound effect library in your browser')
->breadcrumbs([
crumb('Tools', '')
]);
}

function musicLibrary(): Responsable
{
$library = Cache::get('boomlings:musicLibrary');
if (!$library) {
$secret = '8501f9c2-75ba-4230-8188-51037c4da102';
$expires = 9_999_999_999;
$token = base64_urldecode(hash('sha256', $secret . $secret));
//$res = Http::get('https://geometrydashfiles.b-cdn.net/music/musiclibrary.dat?token=' . $token . '&expires=' . $expires)->body();
$res = Http::get('https://geometrydashfiles.b-cdn.net/music/musiclibrary.dat')->body();
$res = mb_convert_encoding($res, 'UTF-8', 'UTF-8');;
$res = base64_urldecode($res);
$res = zlib_decode($res);
$res = explode('|', $res);
$library = [];
for ($i = 1; $i < count($res); $i++) {
$res[$i] = explode(';', $res[$i]);
array_pop($res[$i]); // Remove trailing ';'
for ($j = 0; $j < count($res[$i]); $j++) {
$bits = explode(',', $res[$i][$j]);
switch ($i) {
case 1: // Artist
$library['artists'][(int)$bits[0]] = [
'name' => $bits[1],
'website' => empty(trim($bits[2])) ? null : $bits[2],
'youtube' => empty(trim($bits[3])) ? null : $bits[3],
];
break;
case 2: // Song
$tags = explode('.', $bits[5]);
array_pop($tags);
array_shift($tags); // todo: slice?
for ($k = 0; $k < count($tags); $k++) $tags[$k] = (int)$tags[$k];
$library['songs'][(int)$bits[0]] = [
'name' => $bits[1],
'artist' => (int)$bits[2],
'bytes' => (int)$bits[3],
'seconds' => (int)$bits[4],
'tags' => $tags,
];
break;
case 3: // Tag
$library['tags'][(int)$bits[0]] = [
'name' => $bits[1],
];
break;
}
}
}
$library['version'] = $res[0];
$library = json_decode(json_encode($library, JSON_INVALID_UTF8_IGNORE));
Cache::put('boomlings:musicLibrary', $library, 60 * 60);
}
return page('Tools/Music', [
'library' => json_decode(json_encode($library, JSON_INVALID_UTF8_IGNORE)) // FIXME: this sucks
]);
}
}
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"license": "proprietary",
"require": {
"php": "^8.1",
"ext-zlib": "*",
"bacon/bacon-qr-code": "^2.0",
"cviebrock/eloquent-sluggable": "^10.0",
"deployer/deployer": "^v7.0.0-rc.8",
Expand All @@ -24,10 +25,10 @@
"meilisearch/meilisearch-php": "^1.4",
"pion/laravel-chunk-upload": "^1.5",
"pragmarx/google2fa": "^8.0",
"rybakit/msgpack": "^0.9.1",
"spatie/laravel-permission": "^5.7",
"stancl/tenancy": "^3.7",
"tightenco/ziggy": "^v1.4.3",
"ext-zlib": "*"
"tightenco/ziggy": "^v1.4.3"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.12",
Expand Down
Loading

0 comments on commit 120adfb

Please sign in to comment.