mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-09 16:21:51 +00:00
Remove some compression leftovers
Remove the CRC dependency and "binary file salt" in globalConfig.
This commit is contained in:
parent
fc33cc2fbf
commit
6e81afd372
13
package-lock.json
generated
13
package-lock.json
generated
@ -12,7 +12,6 @@
|
||||
"ajv": "^6.10.2",
|
||||
"circular-json": "^0.5.9",
|
||||
"clipboard-copy": "^3.1.0",
|
||||
"crc": "^3.8.0",
|
||||
"debounce-promise": "^3.1.2",
|
||||
"howler": "^2.1.2",
|
||||
"lz-string": "^1.4.4"
|
||||
@ -2434,6 +2433,7 @@
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@ -3253,6 +3253,7 @@
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@ -4363,15 +4364,6 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/crc": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz",
|
||||
"integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"buffer": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "6.0.5",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
||||
@ -9937,6 +9929,7 @@
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
"ajv": "^6.10.2",
|
||||
"circular-json": "^0.5.9",
|
||||
"clipboard-copy": "^3.1.0",
|
||||
"crc": "^3.8.0",
|
||||
"debounce-promise": "^3.1.2",
|
||||
"howler": "^2.1.2",
|
||||
"lz-string": "^1.4.4"
|
||||
|
||||
@ -110,12 +110,6 @@ export const globalConfig = {
|
||||
|
||||
rendering: {},
|
||||
debug,
|
||||
|
||||
// Secret vars
|
||||
info: {
|
||||
// Binary file salt
|
||||
file: "Ec'])@^+*9zMevK3uMV4432x9%iK'=",
|
||||
},
|
||||
};
|
||||
|
||||
export const IS_MOBILE = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
||||
|
||||
@ -3,7 +3,7 @@ import { Storage } from "@/platform/storage";
|
||||
/* typehints:end */
|
||||
|
||||
import { FsError } from "@/platform/fs_error";
|
||||
import { IS_DEBUG, globalConfig } from "./config";
|
||||
import { IS_DEBUG } from "./config";
|
||||
import { ExplainedResult } from "./explained_result";
|
||||
import { createLogger } from "./logging";
|
||||
|
||||
@ -11,8 +11,6 @@ import debounce from "debounce-promise";
|
||||
|
||||
const logger = createLogger("read_write_proxy");
|
||||
|
||||
const salt = globalConfig.info.file;
|
||||
|
||||
// Helper which only writes / reads if verify() works. Also performs migration
|
||||
export class ReadWriteProxy {
|
||||
constructor(storage, filename) {
|
||||
@ -139,23 +137,12 @@ export class ReadWriteProxy {
|
||||
logger.log("File not found, using default data");
|
||||
|
||||
// File not found or unreadable, assume default file
|
||||
return Promise.resolve(null);
|
||||
return Promise.resolve(this.getDefaultData());
|
||||
}
|
||||
|
||||
return Promise.reject("file-error: " + err);
|
||||
})
|
||||
|
||||
// Decrypt data (if its encrypted)
|
||||
// @ts-ignore
|
||||
.then(rawData => {
|
||||
if (rawData == null) {
|
||||
// So, the file has not been found, use default data
|
||||
return this.getDefaultData();
|
||||
}
|
||||
|
||||
return rawData;
|
||||
})
|
||||
|
||||
// Verify basic structure
|
||||
.then(contents => {
|
||||
const result = this.internalVerifyBasicStructure(contents);
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
import crc32 from "crc/crc32";
|
||||
|
||||
// Distinguish legacy crc prefixes
|
||||
export const CRC_PREFIX = "crc32".padEnd(32, "-");
|
||||
|
||||
/**
|
||||
* Computes the crc for a given string
|
||||
* @param {string} str
|
||||
*/
|
||||
export function computeCrc(str) {
|
||||
return CRC_PREFIX + crc32(str).toString(16).padStart(8, "0");
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user