mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-26 00:33:12 +09:00
Fix lint, use of sync method in web UI
This commit is contained in:
1 parent
c4d4cb3afd
commit
70ef8a60ad
2 files changed
+8
-2
No files matched your search
@@ -69,12 +69,18 @@ const CHUNK_SIZE = 32; // 32x32 pixels per chunk
|
|||||||
const TILE_SIZE = 256; // 256x256 pixels per tile (8x8 chunks)
|
const TILE_SIZE = 256; // 256x256 pixels per tile (8x8 chunks)
|
||||||
const CHUNKS_PER_TILE = 8;
|
const CHUNKS_PER_TILE = 8;
|
||||||
|
|
||||||
|
const inflateAsync = (data: Uint8Array): Promise<Uint8Array> => new Promise((resolve, reject) => {
|
||||||
|
zlib.inflate(data, (err, result) => {
|
||||||
|
if (err) { reject(err); }
|
||||||
|
resolve(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Convert raw chart data to ImageData
|
// Convert raw chart data to ImageData
|
||||||
async function chartDataToImageData(chartData: string): Promise<ImageData> {
|
async function chartDataToImageData(chartData: string): Promise<ImageData> {
|
||||||
// Decode base64 and decompress
|
// Decode base64 and decompress
|
||||||
const compressedData = Buffer.from(chartData, "base64");
|
const compressedData = Buffer.from(chartData, "base64");
|
||||||
const decompressed = zlib.inflateSync(compressedData);
|
const decompressed = Buffer.from(await inflateAsync(compressedData));
|
||||||
|
|
||||||
// Create RGBA image data (32x32 pixels)
|
// Create RGBA image data (32x32 pixels)
|
||||||
const imageData = new Uint8ClampedArray(32 * 32 * 4);
|
const imageData = new Uint8ClampedArray(32 * 32 * 4);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const path = require("path");
|
|||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const { merge } = require("webpack-merge");
|
const { merge } = require("webpack-merge");
|
||||||
|
|
||||||
// eslint-disable-next-line node/no-unpublished-require
|
|
||||||
const common = require("@clusterio/web_ui/webpack.common");
|
const common = require("@clusterio/web_ui/webpack.common");
|
||||||
|
|
||||||
module.exports = (env = {}) => merge(common(env), {
|
module.exports = (env = {}) => merge(common(env), {
|
||||||
|
|||||||
Reference in new issue
Block a user