mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-14 10:41:52 +00:00
Remove compression prefix fallback
All modern browsers should support \1 as the compression prefix, even outside of Electron or recent Chromium versions. Local storage / IndexedDB platform wrappers were removed a while ago.
This commit is contained in:
parent
89ca498613
commit
bf0e3f7949
@ -1,4 +1,4 @@
|
|||||||
// @ts-ignore
|
// @ts-expect-error FIXME: missing typings
|
||||||
import CompressionWorker from "../webworkers/compression.worker";
|
import CompressionWorker from "../webworkers/compression.worker";
|
||||||
|
|
||||||
import { createLogger } from "./logging";
|
import { createLogger } from "./logging";
|
||||||
@ -6,26 +6,7 @@ import { round2Digits } from "./utils";
|
|||||||
|
|
||||||
const logger = createLogger("async_compression");
|
const logger = createLogger("async_compression");
|
||||||
|
|
||||||
export let compressionPrefix = String.fromCodePoint(1);
|
export const compressionPrefix = String.fromCodePoint(1);
|
||||||
|
|
||||||
function checkCryptPrefix(prefix) {
|
|
||||||
try {
|
|
||||||
window.localStorage.setItem("prefix_test", prefix);
|
|
||||||
window.localStorage.removeItem("prefix_test");
|
|
||||||
return true;
|
|
||||||
} catch (ex) {
|
|
||||||
logger.warn("Prefix '" + prefix + "' not available");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!checkCryptPrefix(compressionPrefix)) {
|
|
||||||
logger.warn("Switching to basic prefix");
|
|
||||||
compressionPrefix = " ";
|
|
||||||
if (!checkCryptPrefix(compressionPrefix)) {
|
|
||||||
logger.warn("Prefix not available, ls seems to be unavailable");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{
|
* @typedef {{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user