1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Update translations and minor fixes

This commit is contained in:
tobspr
2022-06-20 19:08:14 +02:00
parent d3d364b0f2
commit 8001727196
36 changed files with 764 additions and 255 deletions

View File

@@ -49,45 +49,6 @@
}
}
.steamSso {
position: fixed;
@include S(top, 0px);
@include S(left, 10px);
background: rgba(88, 92, 102, 0.4);
@include SuperSmallText;
color: #fff;
@include S(max-width, 150px);
@include S(border-radius, $globalBorderRadius);
border-top-left-radius: 0;
border-top-right-radius: 0;
@include S(padding, 5px);
box-shadow: 0 D(5px) D(15px) rgba(#000, 0.1);
display: flex;
color: #000;
flex-direction: column;
a.ssoSignIn {
background: #171a23 uiResource("steam_signin.png") center center / contain no-repeat;
@include S(width, 110px);
@include S(height, 19px);
display: inline-flex;
@include S(border-radius, $globalBorderRadius);
@include S(margin-top, 3px);
overflow: hidden;
text-indent: -999em;
&:hover {
opacity: 0.95;
}
}
@include DarkThemeOverride {
color: #333539;
a {
color: #111;
}
}
}
.fullscreenBackgroundVideo {
// display: none !important;
z-index: -1;
@@ -972,6 +933,51 @@
}
}
> .steamSso {
background: rgba($colorBlueBright, 0.9);
&:hover {
background: rgba($colorBlueBright, 0.9);
}
// @include SuperSmallText;
// color: #fff;
// @include S(max-width, 150px);
// @include S(border-radius, $globalBorderRadius);
// border-top-left-radius: 0;
// border-top-right-radius: 0;
@include S(padding, 5px);
// box-shadow: 0 D(5px) D(15px) rgba(#000, 0.1);
// color: #000;
display: flex;
color: #222428;
flex-direction: column;
@include S(font-size, 9px);
a.ssoSignIn {
background: #171a23 uiResource("steam_signin.png") center center / contain no-repeat;
width: 100%;
box-sizing: border-box;
@include S(height, 16px);
@include S(min-height, 16px);
display: inline-flex;
@include S(border-radius, $globalBorderRadius * 0.5);
@include S(margin-top, 3px);
overflow: hidden;
text-indent: -999em;
&:hover {
opacity: 0.95;
}
}
@include DarkThemeOverride {
color: #333539;
a {
color: #111;
}
}
}
> .sidelinks {
display: grid;
align-items: flex-start;

View File

@@ -51,29 +51,37 @@ export async function authorizeViaSSOToken(app, dialogs) {
return;
}
const response = await Promise.race([
fetch(apiUrl + "/v1/sso/refresh", {
method: "POST",
body: token,
headers: {
"x-api-key": "d5c54aaa491f200709afff082c153ef2",
},
}),
new Promise((resolve, reject) => {
setTimeout(() => reject("timeout exceeded"), 20000);
}),
]);
const responseText = await response.json();
if (!responseText.token) {
console.warn("Failed to register");
window.localStorage.setItem("steam_sso_auth_token", "");
window.location.replace("?sso_logout");
return;
}
try {
const response = await Promise.race([
fetch(apiUrl + "/v1/sso/refresh", {
method: "POST",
body: token,
headers: {
"x-api-key": "d5c54aaa491f200709afff082c153ef2",
},
}),
new Promise((resolve, reject) => {
setTimeout(() => reject("timeout exceeded"), 20000);
}),
]);
window.localStorage.setItem("steam_sso_auth_token", responseText.token);
app.clientApi.token = responseText.token;
WEB_STEAM_SSO_AUTHENTICATED = true;
const responseText = await response.json();
if (!responseText.token) {
console.warn("Failed to register");
window.localStorage.setItem("steam_sso_auth_token", "");
window.location.replace("?sso_logout");
return;
}
window.localStorage.setItem("steam_sso_auth_token", responseText.token);
app.clientApi.token = responseText.token;
WEB_STEAM_SSO_AUTHENTICATED = true;
} catch (ex) {
console.warn("Auth failure", ex);
window.localStorage.setItem("steam_sso_auth_token", "");
window.location.replace("/");
return new Promise(() => null);
}
};
await verify();

View File

@@ -120,25 +120,6 @@ export class MainMenuState extends GameState {
${showExitAppButton ? `<button class="exitAppButton" aria-label="Exit App"></button>` : ""}
</div>
${
G_IS_STANDALONE || WEB_STEAM_SSO_AUTHENTICATED
? ""
: `<div class="steamSso">
${T.mainMenu.playFullVersion}
<a class="ssoSignIn" href="${
this.app.clientApi.getEndpoint() + "/v1/noauth/steam-sso"
}">Sign in</a>
</div>`
}
${
WEB_STEAM_SSO_AUTHENTICATED
? `
<div class="steamSso">${T.mainMenu.playingFullVersion}
<a href="?sso_logout_silent">${T.mainMenu.logout}</a>
</div>
`
: ""
}
<video autoplay muted loop class="fullscreenBackgroundVideo">
<source src="${cachebust("res/bg_render.webm")}" type="video/webm">
@@ -243,6 +224,27 @@ export class MainMenuState extends GameState {
: `
<div class="footer ${showExternalLinks ? "" : "noLinks"} ">
${
G_IS_STANDALONE || WEB_STEAM_SSO_AUTHENTICATED
? ""
: `<div class="steamSso boxLink">
${T.mainMenu.playFullVersion}
<a class="ssoSignIn" href="${
this.app.clientApi.getEndpoint() + "/v1/noauth/steam-sso"
}">Sign in</a>
</div>`
}
${
WEB_STEAM_SSO_AUTHENTICATED
? `
<div class="steamSso boxLink">${T.mainMenu.playingFullVersion}
<a href="?sso_logout_silent">${T.mainMenu.logout}</a>
</div>
`
: ""
}
${
showExternalLinks && !G_IS_STEAM_DEMO
? `