Refactor texture handling and update route structure
Moved sessionserver routes to correct directory and removed subdirectory logic from texture file lookup. Updated texture URLs to remove leading slashes and fixed endpoint concatenation. Added default textures for Alex and Steve.
This commit is contained in:
@@ -9,12 +9,7 @@ const TEXTURES_DIR = path.join(process.cwd(), "data", "textures")
|
||||
router.get("/", async (req, res, next) => {
|
||||
try {
|
||||
const hash = req.params.hash
|
||||
if (!/^[a-f0-9]{64}$/i.test(hash)) {
|
||||
throw new DefaultError(404, "Texture not found")
|
||||
}
|
||||
|
||||
const subDir = hash.substring(0, 2)
|
||||
const filePath = path.join(TEXTURES_DIR, subDir, hash)
|
||||
const filePath = path.join(TEXTURES_DIR, hash)
|
||||
if (!fs.existsSync(filePath)) {
|
||||
throw new DefaultError(404, "Texture not found")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user