refactor: swap Aternos codex deps for IndifferentKetchup\Codex
Drops aternos/codex (and its codex-minecraft / codex-hytale satellites)
plus aternos/sherlock from composer.json. Adds indifferentketchup/codex
pinned to ^0.2.0, sourced via a Composer vcs repository pointing at the
Gitea-hosted ik-codex repo. composer.lock regenerated against the new
dep tree.
Re-points the seven Aternos\Codex\* import sites in src/ to their
IndifferentKetchup\Codex\* equivalents:
- src/Log.php (5 imports)
- src/Api/Response/CodexLogResponse.php (1 import)
- src/Printer/Printer.php (5 imports)
- src/Detective.php (rewritten — see below)
Stubs three sites that depend on Minecraft-specific code with no
analogue in IndifferentKetchup\Codex:
- src/Detective.php no longer extends the Aternos Detective with
Minecraft + Hytale satellites. Instead it extends our codex's
Detective and registers ProjectZomboidDetective, which itself
pre-registers all 11 PZ log subclasses.
- src/Data/Deobfuscator.php is reduced to a no-op shell. mclogs used
aternos/sherlock to fetch Mojang/Yarn obfuscation maps and
deobfuscate Vanilla / Fabric stack traces. Project Zomboid uses no
such mapping scheme; the deobfuscator returns null until iblogs
supports Minecraft logs again. Class signature preserved so callers
in src/Log.php and elsewhere don't break.
- src/Printer/FormatModification.php no longer extends the Minecraft
section-sign-code translator. It extends IndifferentKetchup\Codex's
Modification base class with a pass-through modify() implementation.
The format-* CSS color classes are retained for any future game's
own format-code scheme to reuse.
Updates composer.json metadata: description rewritten to drop the
"Minecraft" framing, authors entry replaced with indifferentketchup /
samkintop@gmail.com.
Verification:
composer update --ignore-platform-req=ext-frankenphp \
--ignore-platform-req=ext-mongodb
-> resolves cleanly: 1 install (indifferentketchup/codex 0.2.0),
4 removals (the aternos/* set).
php -l on every touched file -> no syntax errors.
Autoload smoke test -> Detective registers 11 PZ log classes;
Printer instantiates; FormatModification stub returns input
unchanged.
This commit is contained in:
@@ -2,27 +2,19 @@
|
||||
|
||||
namespace IndifferentKetchup\Iblogs\Data;
|
||||
|
||||
use Aternos\Codex\Analysis\Information;
|
||||
use Aternos\Codex\Log\AnalysableLog;
|
||||
use Aternos\Codex\Log\LogInterface;
|
||||
use Aternos\Codex\Minecraft\Analysis\Information\Vanilla\VanillaVersionInformation;
|
||||
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Fabric\FabricLog;
|
||||
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaClientLog;
|
||||
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportLog;
|
||||
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaLog;
|
||||
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaNetworkProtocolErrorReportLog;
|
||||
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaServerLog;
|
||||
use IndifferentKetchup\Iblogs\Cache\CacheEntry;
|
||||
use Aternos\Sherlock\MapLocator\FabricMavenMapLocator;
|
||||
use Aternos\Sherlock\MapLocator\LauncherMetaMapLocator;
|
||||
use Aternos\Sherlock\Maps\GZURLYarnMap;
|
||||
use Aternos\Sherlock\Maps\ObfuscationMap;
|
||||
use Aternos\Sherlock\Maps\URLVanillaObfuscationMap;
|
||||
use Aternos\Sherlock\Maps\VanillaObfuscationMap;
|
||||
use Aternos\Sherlock\Maps\YarnMap;
|
||||
use Aternos\Sherlock\ObfuscatedString;
|
||||
use Exception;
|
||||
use IndifferentKetchup\Codex\Log\LogInterface;
|
||||
|
||||
/**
|
||||
* Stub for v1 — `mclogs` used `aternos/sherlock` plus the Vanilla / Fabric
|
||||
* Minecraft codex log subclasses to deobfuscate Mojang and Yarn mappings
|
||||
* in stack traces. iblogs targets Project Zomboid, which uses no such
|
||||
* mapping scheme, so the deobfuscator is a no-op until iblogs gains
|
||||
* Minecraft support.
|
||||
*
|
||||
* Restore the original mapping flow (Sherlock map locators + obfuscation
|
||||
* maps) when re-introducing Minecraft logs. The historical implementation
|
||||
* lives in mclogs upstream commits prior to the iblogs fork.
|
||||
*/
|
||||
class Deobfuscator
|
||||
{
|
||||
public function __construct(protected LogInterface $codexLog)
|
||||
@@ -31,108 +23,6 @@ class Deobfuscator
|
||||
|
||||
public function deobfuscate(): ?string
|
||||
{
|
||||
if (!$this->codexLog instanceof AnalysableLog) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->codexLog instanceof VanillaLog) {
|
||||
return null;
|
||||
}
|
||||
$analysis = $this->codexLog->analyse();
|
||||
|
||||
/**
|
||||
* @var ?Information $version
|
||||
*/
|
||||
$version = $analysis->getFilteredInsights(VanillaVersionInformation::class)[0] ?? null;
|
||||
if (!$version) {
|
||||
return null;
|
||||
}
|
||||
$version = $version->getValue();
|
||||
|
||||
try {
|
||||
$map = $this->getObfuscationMap($version);
|
||||
} catch (Exception) {
|
||||
$map = null;
|
||||
}
|
||||
|
||||
if ($map === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$obfuscatedContent = new ObfuscatedString($this->codexLog->getLogFile()->getContent(), $map);
|
||||
if ($content = $obfuscatedContent->getMappedContent()) {
|
||||
return $content;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the obfuscation map matching this log
|
||||
*
|
||||
* @param $version
|
||||
* @return ObfuscationMap|null
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function getObfuscationMap($version): ?ObfuscationMap
|
||||
{
|
||||
if (in_array(get_class($this->codexLog), [
|
||||
VanillaServerLog::class,
|
||||
VanillaClientLog::class,
|
||||
VanillaCrashReportLog::class,
|
||||
VanillaNetworkProtocolErrorReportLog::class
|
||||
])) {
|
||||
$urlCache = new CacheEntry("sherlock:vanilla:$version:client");
|
||||
|
||||
$mapURL = $urlCache->get();
|
||||
if (!$mapURL) {
|
||||
$mapURL = new LauncherMetaMapLocator($version, "client")->findMappingURL();
|
||||
|
||||
if (!$mapURL) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$urlCache->set($mapURL, 30 * 24 * 60 * 60);
|
||||
}
|
||||
|
||||
try {
|
||||
$mapCache = new CacheEntry("sherlock:$mapURL");
|
||||
if ($mapContent = $mapCache->get()) {
|
||||
$map = new VanillaObfuscationMap($mapContent);
|
||||
} else {
|
||||
$map = new URLVanillaObfuscationMap($mapURL);
|
||||
$mapCache->set($map->getContent());
|
||||
}
|
||||
} catch (Exception) {
|
||||
}
|
||||
return $map ?? null;
|
||||
}
|
||||
|
||||
if ($this->codexLog instanceof FabricLog) {
|
||||
$urlCache = new CacheEntry("sherlock:yarn:$version:server");
|
||||
|
||||
$mapURL = $urlCache->get();
|
||||
if (!$mapURL) {
|
||||
$mapURL = new FabricMavenMapLocator($version)->findMappingURL();
|
||||
|
||||
if (!$mapURL) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$urlCache->set($mapURL, 24 * 60 * 60);
|
||||
}
|
||||
|
||||
try {
|
||||
$mapCache = new CacheEntry("sherlock:$mapURL");
|
||||
if ($mapContent = $mapCache->get()) {
|
||||
$map = new YarnMap($mapContent);
|
||||
} else {
|
||||
$map = new GZURLYarnMap($mapURL);
|
||||
$mapCache->set($map->getContent());
|
||||
}
|
||||
} catch (Exception) {
|
||||
}
|
||||
return $map ?? null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user