mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-14 10:41:52 +00:00
Minor globalConfig and unused code cleanup
Remove secrets that are no longer used and fetchDiscounts preload step.
This commit is contained in:
parent
bf0e3f7949
commit
e618776013
@ -114,18 +114,10 @@ export const globalConfig = {
|
|||||||
rendering: {},
|
rendering: {},
|
||||||
debug,
|
debug,
|
||||||
|
|
||||||
currentDiscount: 0,
|
|
||||||
|
|
||||||
// Secret vars
|
// Secret vars
|
||||||
info: {
|
info: {
|
||||||
// Binary file salt
|
// Binary file salt
|
||||||
file: "Ec'])@^+*9zMevK3uMV4432x9%iK'=",
|
file: "Ec'])@^+*9zMevK3uMV4432x9%iK'=",
|
||||||
|
|
||||||
// Savegame salt
|
|
||||||
sgSalt: "}95Q3%8/.837Lqym_BJx%q7)pAHJbF",
|
|
||||||
|
|
||||||
// Analytics key
|
|
||||||
analyticsApiKey: "baf6a50f0cc7dfdec5a0e21c88a1c69a4b34bc4a",
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import { CHANGELOG } from "../changelog";
|
|||||||
import { globalConfig } from "../core/config";
|
import { globalConfig } from "../core/config";
|
||||||
import { GameState } from "../core/game_state";
|
import { GameState } from "../core/game_state";
|
||||||
import { createLogger } from "../core/logging";
|
import { createLogger } from "../core/logging";
|
||||||
import { getLogoSprite, timeoutPromise } from "../core/utils";
|
import { getLogoSprite } from "../core/utils";
|
||||||
import { getRandomHint } from "../game/hints";
|
import { getRandomHint } from "../game/hints";
|
||||||
import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
|
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");
|
const logger = createLogger("state/preload");
|
||||||
|
|
||||||
@ -44,22 +44,6 @@ export class PreloadState extends GameState {
|
|||||||
this.startLoading();
|
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() {
|
async sendBeacon() {
|
||||||
// TODO: Get rid of this analytics stuff
|
// TODO: Get rid of this analytics stuff
|
||||||
}
|
}
|
||||||
@ -78,9 +62,6 @@ export class PreloadState extends GameState {
|
|||||||
return this.app.storage.initialize();
|
return this.app.storage.initialize();
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(() => this.setStatus("Connecting to api", 15))
|
|
||||||
.then(() => this.fetchDiscounts())
|
|
||||||
|
|
||||||
.then(() => this.setStatus("Initializing settings", 20))
|
.then(() => this.setStatus("Initializing settings", 20))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return this.app.settings.initialize();
|
return this.app.settings.initialize();
|
||||||
@ -256,7 +237,7 @@ export class PreloadState extends GameState {
|
|||||||
|
|
||||||
subElement.innerHTML = `
|
subElement.innerHTML = `
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<img src="res/getLogoSprite()" alt="Shapez.io Logo">
|
<img src="res/${getLogoSprite()}" alt="Shapez.io Logo">
|
||||||
</div>
|
</div>
|
||||||
<div class="failureInner">
|
<div class="failureInner">
|
||||||
<div class="errorHeader">
|
<div class="errorHeader">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user