Deleted use of WAError and add defining of language of client everywhere
This commit is contained in:
parent
13b0996c8b
commit
209dd43aac
@ -48,7 +48,6 @@ import { selectCharacterSceneVisibleStore } from "../Stores/SelectCharacterStore
|
|||||||
import { gameManager } from "../Phaser/Game/GameManager";
|
import { gameManager } from "../Phaser/Game/GameManager";
|
||||||
import { SelectCharacterScene, SelectCharacterSceneName } from "../Phaser/Login/SelectCharacterScene";
|
import { SelectCharacterScene, SelectCharacterSceneName } from "../Phaser/Login/SelectCharacterScene";
|
||||||
import { errorScreenStore } from "../Stores/ErrorScreenStore";
|
import { errorScreenStore } from "../Stores/ErrorScreenStore";
|
||||||
import { WAError } from "../Phaser/Reconnecting/WAError";
|
|
||||||
|
|
||||||
const manualPingDelay = 20000;
|
const manualPingDelay = 20000;
|
||||||
|
|
||||||
@ -486,7 +485,7 @@ export class RoomConnection implements RoomConnection {
|
|||||||
this._errorScreenMessageStream.next(message.errorScreenMessage);
|
this._errorScreenMessageStream.next(message.errorScreenMessage);
|
||||||
if (message.errorScreenMessage.code !== "retry") this.closed = true;
|
if (message.errorScreenMessage.code !== "retry") this.closed = true;
|
||||||
console.error("An error occurred server side: " + message.errorScreenMessage.code);
|
console.error("An error occurred server side: " + message.errorScreenMessage.code);
|
||||||
errorScreenStore.setError(message.errorScreenMessage as WAError);
|
errorScreenStore.setError(message.errorScreenMessage);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
@ -6,6 +6,7 @@ import { waScaleManager } from "../Services/WaScaleManager";
|
|||||||
import { ReconnectingTextures } from "../Reconnecting/ReconnectingScene";
|
import { ReconnectingTextures } from "../Reconnecting/ReconnectingScene";
|
||||||
import { localeDetector } from "../../i18n/locales";
|
import { localeDetector } from "../../i18n/locales";
|
||||||
import { errorScreenStore } from "../../Stores/ErrorScreenStore";
|
import { errorScreenStore } from "../../Stores/ErrorScreenStore";
|
||||||
|
import {ErrorScreenMessage} from "../../Messages/ts-proto-generated/protos/messages";
|
||||||
|
|
||||||
export const EntrySceneName = "EntryScene";
|
export const EntrySceneName = "EntryScene";
|
||||||
|
|
||||||
@ -47,19 +48,7 @@ export class EntryScene extends Scene {
|
|||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.response.data?.code) {
|
if (err.response.data?.code) {
|
||||||
errorScreenStore.setError(
|
errorScreenStore.setError(err.response.data);
|
||||||
new WAError(
|
|
||||||
err.response.data.type,
|
|
||||||
err.response.data.code,
|
|
||||||
err.response.data.title,
|
|
||||||
err.response.data.subtitle,
|
|
||||||
err.response.data.details,
|
|
||||||
err.response.data.timeToRetry,
|
|
||||||
err.response.data.canRetryManual,
|
|
||||||
err.response.data.urlToRedirect,
|
|
||||||
err.response.data.buttonTitle
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
ErrorScene.showError(err, this.scene);
|
ErrorScene.showError(err, this.scene);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
import { WAError } from "../Phaser/Reconnecting/WAError";
|
import { WAError } from "../Phaser/Reconnecting/WAError";
|
||||||
|
import {ErrorScreenMessage} from "../Messages/ts-proto-generated/protos/messages";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A store that contains one error of type WAError to be displayed.
|
* A store that contains one error of type WAError to be displayed.
|
||||||
*/
|
*/
|
||||||
function createErrorScreenStore() {
|
function createErrorScreenStore() {
|
||||||
const { subscribe, set } = writable<WAError>(undefined);
|
const { subscribe, set } = writable<ErrorScreenMessage>(undefined);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
subscribe,
|
subscribe,
|
||||||
setError: (e: WAError): void => set(e),
|
setError: (e: ErrorScreenMessage): void => set(e),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,6 +236,8 @@ export class IoSocketController {
|
|||||||
const websocketExtensions = req.getHeader("sec-websocket-extensions");
|
const websocketExtensions = req.getHeader("sec-websocket-extensions");
|
||||||
const IPAddress = req.getHeader("x-forwarded-for");
|
const IPAddress = req.getHeader("x-forwarded-for");
|
||||||
|
|
||||||
|
adminApi.setLocale(req.getHeader("accept-language"));
|
||||||
|
|
||||||
const roomId = query.roomId;
|
const roomId = query.roomId;
|
||||||
try {
|
try {
|
||||||
if (typeof roomId !== "string") {
|
if (typeof roomId !== "string") {
|
||||||
|
@ -107,6 +107,8 @@ export class MapController extends BaseHttpController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
adminApi.setLocale(req.header("accept-language"));
|
||||||
|
|
||||||
// If no admin URL is set, let's react on '/_/[instance]/[map url]' URLs
|
// If no admin URL is set, let's react on '/_/[instance]/[map url]' URLs
|
||||||
if (!ADMIN_API_URL) {
|
if (!ADMIN_API_URL) {
|
||||||
const roomUrl = new URL(query.playUri);
|
const roomUrl = new URL(query.playUri);
|
||||||
|
@ -29,7 +29,7 @@ export type FetchMemberDataByUuidResponse = z.infer<typeof isFetchMemberDataByUu
|
|||||||
class AdminApi implements AdminInterface {
|
class AdminApi implements AdminInterface {
|
||||||
private locale: string = "en";
|
private locale: string = "en";
|
||||||
setLocale(locale: string) {
|
setLocale(locale: string) {
|
||||||
//console.info('PUSHER LOCALE SET TO :', locale);
|
console.info('PUSHER LOCALE SET TO :', locale);
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user