Compare commits

..

No commits in common. 'develop' and 'test-c' have entirely different histories.

  1. 53
      .drone.yml
  2. 9
      Makefile
  3. BIN
      public/clients/facr/favicon/android-chrome-192x192.png
  4. BIN
      public/clients/facr/favicon/android-chrome-512x512.png
  5. BIN
      public/clients/facr/favicon/apple-touch-icon.png
  6. BIN
      public/clients/facr/favicon/favicon-16x16.png
  7. BIN
      public/clients/facr/favicon/favicon-32x32.png
  8. BIN
      public/clients/facr/favicon/favicon.ico
  9. BIN
      public/clients/fqtv/favicon/android-chrome-192x192.png
  10. BIN
      public/clients/fqtv/favicon/android-chrome-512x512.png
  11. BIN
      public/clients/fqtv/favicon/apple-touch-icon.png
  12. BIN
      public/clients/fqtv/favicon/favicon-16x16.png
  13. BIN
      public/clients/fqtv/favicon/favicon-32x32.png
  14. BIN
      public/clients/fqtv/favicon/favicon.ico
  15. BIN
      public/clients/lff/favicon/android-chrome-192x192.png
  16. BIN
      public/clients/lff/favicon/android-chrome-512x512.png
  17. BIN
      public/clients/lff/favicon/apple-touch-icon.png
  18. BIN
      public/clients/lff/favicon/favicon-16x16.png
  19. BIN
      public/clients/lff/favicon/favicon-32x32.png
  20. BIN
      public/clients/lff/favicon/favicon.ico
  21. 23
      public/silent-refresh.html
  22. 2
      src/features/AuthServiceApp/config/lexics.tsx
  23. 30
      src/features/AuthStore/hooks/useAuth.tsx
  24. 17
      src/features/MatchCard/CardFrontside/hooks.tsx
  25. 5
      src/features/SystemSettings/hooks.tsx
  26. 13
      src/helpers/token/index.tsx

@ -1007,56 +1007,3 @@ steps:
- aws cloudfront create-invalidation --distribution-id E15IFY23VM147K --paths "/*" - aws cloudfront create-invalidation --distribution-id E15IFY23VM147K --paths "/*"
depends_on: depends_on:
- make-rustat - make-rustat
---
kind: pipeline
type: docker
name: deploy insport.live
concurrency:
limit: 1
platform:
os: linux
arch: amd64
trigger:
ref:
- refs/heads/insport.live
steps:
- name: npm-install
image: node:16-alpine
environment:
REACT_APP_STRIPE_PK:
from_secret: REACT_APP_STRIPE_PK
commands:
- apk add --no-cache make
- npm install --legacy-peer-deps
- name: make-insport-live
image: node:16-alpine
environment:
REACT_APP_STRIPE_PK:
from_secret: REACT_APP_STRIPE_PK
commands:
- apk add --no-cache make
- make insport-live-prod
depends_on:
- npm-install
- name: deploy-insport-live
image: amazon/aws-cli:latest
environment:
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION:
from_secret: AWS_DEFAULT_REGION
AWS_MAX_ATTEMPTS: 10
commands:
- aws s3 sync build_insport_live s3://insports-live --delete
- aws cloudfront create-invalidation --distribution-id E1LBC88VYP6XVB --paths "/*"
depends_on:
- make-insport-live

@ -225,15 +225,6 @@ rustat-prod:
BUILD_PATH=build_rustat \ BUILD_PATH=build_rustat \
npm run build && cp -r .well-known build_rustat npm run build && cp -r .well-known build_rustat
insport-live-prod:
rm -rf build_insport_live && \
REACT_APP_TYPE=ott \
REACT_APP_ENV=staging \
REACT_APP_CLIENT=lff \
REACT_APP_STRIPE_PK=pk_live_51J5TEYEDSxVnTgDW5XxhC6ntKZKddXgKHq5HOCDmJTdfSKluMYCdLHOcUA3Miuy8HesxG1eS4c0dQRQpMsEHRrQL00USpu5xIq \
BUILD_PATH=build_insport_live \
npm run build && cp -r .well-known build_insport_live
deploy-all: prod preprod facr-prod lff-prod diwansport-prod india-prod fqtv-prod rustat-prod deploy-all: prod preprod facr-prod lff-prod diwansport-prod india-prod fqtv-prod rustat-prod
test: test:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 793 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 102 KiB

@ -1,28 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title></title> <title></title>
</head> </head>
<body> <body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/oidc-client/1.11.5/oidc-client.min.js" <script src="https://cdnjs.cloudflare.com/ajax/libs/oidc-client/1.11.5/oidc-client.min.js" integrity="sha512-pGtU1n/6GJ8fu6bjYVGIOT9Dphaw5IWPwVlqkpvVgqBxFkvdNbytUh0H8AP15NYF777P4D3XEeA/uDWFCpSQ1g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
integrity="sha512-pGtU1n/6GJ8fu6bjYVGIOT9Dphaw5IWPwVlqkpvVgqBxFkvdNbytUh0H8AP15NYF777P4D3XEeA/uDWFCpSQ1g=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script> <script>
new Oidc.UserManager().signinSilentCallback() new Oidc.UserManager().signinSilentCallback()
// обновляем рефреш токен в локалсторадже .catch((err) => {
// так как safari не дает доступ к кукам console.error('OIDC: silent refresh callback error', err);
.then(() => { });
const refreshToken = localStorage.getItem('refresh_token');
if (refreshToken) {
localStorage.setItem('refresh_token', new URLSearchParams(document.location.search).get('refresh_token'));
}
})
.catch((err) => {
console.error('OIDC: silent refresh callback error', err);
});
</script> </script>
</body> </body>
</html>
</html>

@ -34,7 +34,7 @@ export const lexics = {
go_back: 1907, go_back: 1907,
i_accept: 15737, i_accept: 15737,
i_agree: 15430, i_agree: 15430,
login: 20304, login: 13404,
ok: 724, ok: 724,
or_continue_with: 15118, or_continue_with: 15118,
password_changed_success: 17824, password_changed_success: 17824,

@ -24,10 +24,6 @@ import {
setCookie, setCookie,
removeCookie, removeCookie,
isMatchPage, isMatchPage,
REFRESH_TOKEN_KEY,
removeRefreshToken,
writeRefreshToken,
readRefreshToken,
} from 'helpers' } from 'helpers'
import { import {
@ -81,7 +77,6 @@ export const useAuth = () => {
userManager.signoutRedirect({ post_logout_redirect_uri: urlWithLang }) userManager.signoutRedirect({ post_logout_redirect_uri: urlWithLang })
}) })
removeToken() removeToken()
removeRefreshToken()
if (key !== 'saveToken') { if (key !== 'saveToken') {
removeCookie('access_token') removeCookie('access_token')
} }
@ -163,15 +158,12 @@ export const useAuth = () => {
} }
} }
const signinRedirectCallback = useCallback((refreshToken: string | null) => { const signinRedirectCallback = useCallback(() => {
setPage(history.location.pathname) setPage(history.location.pathname)
userManager.signinRedirectCallback() userManager.signinRedirectCallback()
.then((loadedUser) => { .then((loadedUser) => {
storeUser(loadedUser) storeUser(loadedUser)
if (refreshToken) writeRefreshToken(refreshToken)
queryParamStorage.clear() queryParamStorage.clear()
if (page.includes(PAGES.useraccount)) { if (page.includes(PAGES.useraccount)) {
history.push(PAGES.home) history.push(PAGES.home)
@ -183,7 +175,7 @@ export const useAuth = () => {
setPage('') setPage('')
setSearch('') setSearch('')
}).catch(login) }).catch(login)
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [ }, [
login, login,
storeUser, storeUser,
@ -195,14 +187,11 @@ export const useAuth = () => {
const searchToken = urlSearch.get('access_token') const searchToken = urlSearch.get('access_token')
const searchRefToken = urlSearch.get('id_token') const searchRefToken = urlSearch.get('id_token')
const searchExp = urlSearch.get('expires_in') const searchExp = urlSearch.get('expires_in')
const refreshToken = urlSearch.get(REFRESH_TOKEN_KEY)
const isRedirectedBackFromAuthProvider = Boolean(searchToken && searchRefToken && searchExp) const isRedirectedBackFromAuthProvider = Boolean(searchToken && searchRefToken && searchExp)
isRedirectedBackFromAuthProvider isRedirectedBackFromAuthProvider ? signinRedirectCallback() : checkUser()
? signinRedirectCallback(refreshToken) // eslint-disable-next-line react-hooks/exhaustive-deps
: checkUser()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ }, [
checkUser, checkUser,
signinRedirectCallback, signinRedirectCallback,
@ -232,7 +221,7 @@ export const useAuth = () => {
}, [reChekNewDevice]) }, [reChekNewDevice])
useEffect(() => { useEffect(() => {
if (!needCheckNewDeviсe || !user) return undefined if (!needCheckNewDeviсe && !user) return undefined
const startCheckDevice = setInterval(checkNewDevice, 20000) const startCheckDevice = setInterval(checkNewDevice, 20000)
isNewDeviceLogin && clearInterval(startCheckDevice) isNewDeviceLogin && clearInterval(startCheckDevice)
return () => clearInterval(startCheckDevice) return () => clearInterval(startCheckDevice)
@ -242,7 +231,6 @@ export const useAuth = () => {
checkNewDevice, checkNewDevice,
isNewDeviceLogin, isNewDeviceLogin,
setIsNewDeviceLogin, setIsNewDeviceLogin,
user,
]) ])
duel.channel('active_page') // поле в LS, определяющее активность вкладки duel.channel('active_page') // поле в LS, определяющее активность вкладки
@ -252,13 +240,7 @@ export const useAuth = () => {
// библиотека oidc-client не поддерживает обновление токена только на 1 вкладке // библиотека oidc-client не поддерживает обновление токена только на 1 вкладке
// @ts-ignore // @ts-ignore
if (window.isMaster()) { if (window.isMaster()) {
// safari ограничивает доступ к куке через крос доменные запросы userManager.signinSilent().catch(logout)
// передаем рефреш токен через квери параметры
userManager.signinSilent({
extraQueryParams: {
refresh_token: readRefreshToken(),
},
}).catch(logout)
} }
} }
// если запросы вернули 401 | 403 // если запросы вернули 401 | 403

@ -4,20 +4,20 @@ import {
useState, useState,
} from 'react' } from 'react'
import { readToken } from 'helpers'
export type TUseCardFrontside = { export type TUseCardFrontside = {
preview?: string, preview?: string,
previewURL?: string, previewURL?: string,
} }
const PREVIEW_WIDTH = 400 // макс. 1920
export const useCardPreview = ({ export const useCardPreview = ({
preview, preview,
previewURL, previewURL,
}: TUseCardFrontside) => { }: TUseCardFrontside) => {
const [previewImage, setPreviewImage] = useState('') const [previewImage, setPreviewImage] = useState('')
const currentPreviewURL = useMemo(() => ( const currentPreviewURL = useMemo(() => (
previewURL ? `${previewURL}?width=${PREVIEW_WIDTH}` : preview previewURL ? `${previewURL}?access_token=${readToken()}` : preview
), [preview, previewURL]) ), [preview, previewURL])
useEffect(() => { useEffect(() => {
@ -25,11 +25,12 @@ export const useCardPreview = ({
if (!currentPreviewURL) return if (!currentPreviewURL) return
try { try {
const image = await fetch(String(currentPreviewURL)) const image = await fetch(String(currentPreviewURL), {
.then(async (result) => ({ headers: { Authorization: `Bearer ${readToken()}` },
blob: await result.blob(), }).then(async (result) => ({
status: result.status, blob: await result.blob(),
})) status: result.status,
}))
if (image.status === 200) { if (image.status === 200) {
setPreviewImage(URL.createObjectURL(image.blob)) setPreviewImage(URL.createObjectURL(image.blob))

@ -9,8 +9,8 @@ import { SELECTED_API_KEY } from 'helpers/selectedApi'
import { useToggle } from 'hooks/useToggle' import { useToggle } from 'hooks/useToggle'
import { useLocalStore } from 'hooks/useStorage' import { useLocalStore } from 'hooks/useStorage'
import { removeRefreshToken, removeToken } from 'helpers' import { removeToken } from '../../helpers'
import { removeCookie } from 'helpers/cookie' import { removeCookie } from '../../helpers/cookie'
type FormElement = HTMLFormElement & { type FormElement = HTMLFormElement & {
api: HTMLInputElement & { api: HTMLInputElement & {
@ -37,7 +37,6 @@ export const useSystemSettings = () => {
const { api } = e.currentTarget const { api } = e.currentTarget
setSelectedApi(api.value) setSelectedApi(api.value)
removeToken() removeToken()
removeRefreshToken()
removeCookie('access_token') removeCookie('access_token')
window.location.reload() window.location.reload()
} }

@ -1,5 +1,4 @@
export const TOKEN_KEY = 'token' export const TOKEN_KEY = 'token'
export const REFRESH_TOKEN_KEY = 'refresh_token'
export const readToken = () => ( export const readToken = () => (
localStorage.getItem(TOKEN_KEY) localStorage.getItem(TOKEN_KEY)
@ -12,15 +11,3 @@ export const writeToken = (token: string) => (
export const removeToken = () => ( export const removeToken = () => (
localStorage.removeItem(TOKEN_KEY) localStorage.removeItem(TOKEN_KEY)
) )
export const removeRefreshToken = () => {
localStorage.removeItem(REFRESH_TOKEN_KEY)
}
export const writeRefreshToken = (token: string) => (
localStorage.setItem(REFRESH_TOKEN_KEY, token)
)
export const readRefreshToken = () => (
localStorage.getItem(REFRESH_TOKEN_KEY)
)

Loading…
Cancel
Save