1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-11 09:11:50 +00:00

Minor globalConfig and unused code cleanup

Remove secrets that are no longer used and fetchDiscounts preload step.
This commit is contained in:
Даниїл Григор'єв 2024-07-26 17:01:57 +03:00
parent bf0e3f7949
commit e618776013
No known key found for this signature in database
GPG Key ID: B890DF16341D8C1D
2 changed files with 3 additions and 30 deletions

View File

@ -114,18 +114,10 @@ export const globalConfig = {
rendering: {},
debug,
currentDiscount: 0,
// Secret vars
info: {
// Binary file salt
file: "Ec'])@^+*9zMevK3uMV4432x9%iK'=",
// Savegame salt
sgSalt: "}95Q3%8/.837Lqym_BJx%q7)pAHJbF",
// Analytics key
analyticsApiKey: "baf6a50f0cc7dfdec5a0e21c88a1c69a4b34bc4a",
},
};

View File

@ -2,10 +2,10 @@ import { CHANGELOG } from "../changelog";
import { globalConfig } from "../core/config";
import { GameState } from "../core/game_state";
import { createLogger } from "../core/logging";
import { getLogoSprite, timeoutPromise } from "../core/utils";
import { getLogoSprite } from "../core/utils";
import { getRandomHint } from "../game/hints";
import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
import { autoDetectLanguageId, T, updateApplicationLanguage } from "../translations";
import { T, autoDetectLanguageId, updateApplicationLanguage } from "../translations";
const logger = createLogger("state/preload");
@ -44,22 +44,6 @@ export class PreloadState extends GameState {
this.startLoading();
}
async fetchDiscounts() {
await timeoutPromise(
fetch("https://analytics.shapez.io/v1/discounts")
.then(res => res.json())
.then(data => {
globalConfig.currentDiscount = Number(
data["1318690"].data.price_overview.discount_percent
);
logger.log("Fetched current discount:", globalConfig.currentDiscount);
}),
2000
).catch(err => {
logger.warn("Failed to fetch current discount:", err);
});
}
async sendBeacon() {
// TODO: Get rid of this analytics stuff
}
@ -78,9 +62,6 @@ export class PreloadState extends GameState {
return this.app.storage.initialize();
})
.then(() => this.setStatus("Connecting to api", 15))
.then(() => this.fetchDiscounts())
.then(() => this.setStatus("Initializing settings", 20))
.then(() => {
return this.app.settings.initialize();
@ -256,7 +237,7 @@ export class PreloadState extends GameState {
subElement.innerHTML = `
<div class="logo">
<img src="res/getLogoSprite()" alt="Shapez.io Logo">
<img src="res/${getLogoSprite()}" alt="Shapez.io Logo">
</div>
<div class="failureInner">
<div class="errorHeader">