2
2
mirror of https://github.com/Thream/website.git synced 2024-07-21 09:28:32 +02:00

fix: update dependencies to latest

This commit is contained in:
Divlo 2023-04-03 00:11:19 +02:00
parent c96385edd5
commit ae953d6c1a
No known key found for this signature in database
GPG Key ID: 8F9478F220CE65E9
38 changed files with 7885 additions and 3125 deletions

View File

@ -16,7 +16,7 @@ jobs:
language: ['javascript'] language: ['javascript']
steps: steps:
- uses: 'actions/checkout@v3.3.0' - uses: 'actions/checkout@v3.5.0'
- name: 'Initialize CodeQL' - name: 'Initialize CodeQL'
uses: 'github/codeql-action/init@v2' uses: 'github/codeql-action/init@v2'

View File

@ -10,7 +10,7 @@ jobs:
build: build:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.3.0' - uses: 'actions/checkout@v3.5.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v3.6.0' uses: 'actions/setup-node@v3.6.0'

View File

@ -10,7 +10,7 @@ jobs:
lint: lint:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.3.0' - uses: 'actions/checkout@v3.5.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v3.6.0' uses: 'actions/setup-node@v3.6.0'

View File

@ -8,7 +8,7 @@ jobs:
release: release:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.3.0' - uses: 'actions/checkout@v3.5.0'
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false persist-credentials: false

View File

@ -10,7 +10,7 @@ jobs:
test-unit: test-unit:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.3.0' - uses: 'actions/checkout@v3.5.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v3.6.0' uses: 'actions/setup-node@v3.6.0'
@ -27,7 +27,7 @@ jobs:
test-lighthouse: test-lighthouse:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.3.0' - uses: 'actions/checkout@v3.5.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v3.6.0' uses: 'actions/setup-node@v3.6.0'
@ -52,7 +52,7 @@ jobs:
test-e2e: test-e2e:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
steps: steps:
- uses: 'actions/checkout@v3.3.0' - uses: 'actions/checkout@v3.5.0'
- name: 'Use Node.js' - name: 'Use Node.js'
uses: 'actions/setup-node@v3.6.0' uses: 'actions/setup-node@v3.6.0'

View File

@ -6,5 +6,9 @@
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll": true "source.fixAll": true
} },
"eslint.options": {
"ignorePath": ".gitignore"
},
"prettier.ignorePath": ".gitignore"
} }

View File

@ -1,9 +1,9 @@
FROM node:18.13.0 AS builder-dependencies FROM node:18.15.0 AS builder-dependencies
WORKDIR /usr/src/application WORKDIR /usr/src/application
COPY ./package*.json ./ COPY ./package*.json ./
RUN npm install RUN npm install
FROM node:18.13.0 AS builder FROM node:18.15.0 AS builder
WORKDIR /usr/src/application WORKDIR /usr/src/application
COPY --from=builder-dependencies /usr/src/application/node_modules ./node_modules COPY --from=builder-dependencies /usr/src/application/node_modules ./node_modules
COPY ./ ./ COPY ./ ./

View File

@ -18,7 +18,7 @@
Thream's website to stay close with your friends and communities. Thream's website to stay close with your friends and communities.
It uses [Thream/api](https://github.com/Thream/api) [v1.2.4](https://github.com/Thream/api/releases/tag/v1.2.4). It uses [Thream/api](https://github.com/Thream/api) [v1.2.5](https://github.com/Thream/api/releases/tag/v1.2.5).
## ⚙️ Getting Started ## ⚙️ Getting Started

View File

@ -185,7 +185,7 @@ export const Application: React.FC<
visible={visibleSidebars.left} visible={visibleSidebars.left}
isMobile={isMobile} isMobile={isMobile}
> >
<div className='top-0 left-0 z-50 flex min-w-[92px] flex-col space-y-4 border-r-2 border-gray-500 bg-gray-200 py-2 dark:border-white/20 dark:bg-gray-800'> <div className='left-0 top-0 z-50 flex min-w-[92px] flex-col space-y-4 border-r-2 border-gray-500 bg-gray-200 py-2 dark:border-white/20 dark:bg-gray-800'>
<IconLink <IconLink
href={`/application/users/settings`} href={`/application/users/settings`}
selected={path === `/application/users/settings`} selected={path === `/application/users/settings`}

View File

@ -64,7 +64,7 @@ export const ChannelSettings: React.FC<ChannelSettingsProps> = (props) => {
} catch (error) { } catch (error) {
return { return {
type: 'error', type: 'error',
value: 'errors:server-error' message: 'errors:server-error'
} }
} }
} }

View File

@ -25,7 +25,7 @@ const ChannelMemo: React.FC<ChannelProps> = (props) => {
<Link <Link
href={`/application/${path.guildId}/${channel.id}`} href={`/application/${path.guildId}/${channel.id}`}
className={classNames( className={classNames(
'group relative my-3 mx-3 flex items-center justify-between overflow-hidden rounded-lg py-2 text-sm transition-all duration-200 hover:bg-gray-100 dark:hover:bg-gray-600', 'group relative mx-3 my-3 flex items-center justify-between overflow-hidden rounded-lg py-2 text-sm transition-all duration-200 hover:bg-gray-100 dark:hover:bg-gray-600',
{ {
'font-semibold text-green-800 dark:text-green-400': selected 'font-semibold text-green-800 dark:text-green-400': selected
} }

View File

@ -27,7 +27,7 @@ export const ConfirmPopup: React.FC<ConfirmPopupProps> = ({ ...props }) => {
<div className={props.className}> <div className={props.className}>
<Loader <Loader
className={classNames( className={classNames(
'absolute top-1/2 left-1/2 scale-0 transition-all', 'absolute left-1/2 top-1/2 scale-0 transition-all',
{ {
'scale-100': isLoading 'scale-100': isLoading
} }

View File

@ -38,7 +38,7 @@ export const CreateChannel: React.FC = () => {
} catch (error) { } catch (error) {
return { return {
type: 'error', type: 'error',
value: 'errors:server-error' message: 'errors:server-error'
} }
} }
} }

View File

@ -45,7 +45,7 @@ export const CreateGuild: React.FC = () => {
} catch (error) { } catch (error) {
return { return {
type: 'error', type: 'error',
value: 'errors:server-error' message: 'errors:server-error'
} }
} }
} }

View File

@ -56,12 +56,12 @@ export const GuildSettings: React.FC = () => {
setInputValues(formData as unknown as any) setInputValues(formData as unknown as any)
return { return {
type: 'success', type: 'success',
value: 'application:saved-information' message: 'application:saved-information'
} }
} catch (error) { } catch (error) {
return { return {
type: 'error', type: 'error',
value: 'errors:server-error' message: 'errors:server-error'
} }
} }
} }

View File

@ -96,7 +96,7 @@ export const GuildPublic: React.FC<GuildPublicProps> = (props) => {
<ConfirmPopup <ConfirmPopup
title={`${t('application:join-the-guild')} ?`} title={`${t('application:join-the-guild')} ?`}
className={classNames( className={classNames(
'w-ful h-ful translate-x- absolute top-1/2 left-full flex h-full w-full -translate-y-1/2 flex-col items-center justify-center rounded-2xl transition-all', 'w-ful h-ful translate-x- absolute left-full top-1/2 flex h-full w-full -translate-y-1/2 flex-col items-center justify-center rounded-2xl transition-all',
{ {
'!left-0': isConfirmed '!left-0': isConfirmed
} }

View File

@ -49,7 +49,7 @@ export const JoinGuildsPublic: React.FC = () => {
<input <input
data-cy='search-guild-input' data-cy='search-guild-input'
onChange={handleChange} onChange={handleChange}
className='my-6 mx-auto mt-16 w-10/12 rounded-md border border-gray-500 bg-white p-3 dark:border-gray-700 dark:bg-[#3B3B3B] sm:w-8/12 md:w-6/12 lg:w-5/12' className='mx-auto my-6 mt-16 w-10/12 rounded-md border border-gray-500 bg-white p-3 dark:border-gray-700 dark:bg-[#3B3B3B] sm:w-8/12 md:w-6/12 lg:w-5/12'
type='search' type='search'
name='search-guild' name='search-guild'
placeholder={`🔎 ${t('application:search')}...`} placeholder={`🔎 ${t('application:search')}...`}

View File

@ -14,7 +14,7 @@ const MemberMemo: React.FC<MemberProps> = (props) => {
return ( return (
<Link href={`/application/users/${member.user.id}`}> <Link href={`/application/users/${member.user.id}`}>
<div className='flex cursor-pointer items-center overflow-hidden py-2 px-6 pr-10 hover:bg-gray-300 dark:hover:bg-gray-900'> <div className='flex cursor-pointer items-center overflow-hidden px-6 py-2 pr-10 hover:bg-gray-300 dark:hover:bg-gray-900'>
<div className='flex min-w-[50px] rounded-full'> <div className='flex min-w-[50px] rounded-full'>
<Image <Image
src={ src={

View File

@ -22,7 +22,7 @@ export const MessageOptions: React.FC<
} }
return ( return (
<div className='absolute right-6 -top-8 flex opacity-0 transition-opacity group-hover:opacity-100'> <div className='absolute -top-8 right-6 flex opacity-0 transition-opacity group-hover:opacity-100'>
{message.type === 'text' && ( {message.type === 'text' && (
<div <div
className='message-options rounded-l-lg border-l-slate-600' className='message-options rounded-l-lg border-l-slate-600'

View File

@ -21,13 +21,13 @@ export const Sidebar: React.FC<React.PropsWithChildren<SidebarProps>> = (
className={classNames( className={classNames(
'h-full-without-header visible z-50 flex bg-gray-200 drop-shadow-2xl transition-all dark:bg-gray-800', 'h-full-without-header visible z-50 flex bg-gray-200 drop-shadow-2xl transition-all dark:bg-gray-800',
{ {
'scrollbar-firefox-support top-0 right-0 flex-col space-y-1 overflow-y-auto': 'scrollbar-firefox-support right-0 top-0 flex-col space-y-1 overflow-y-auto':
direction === 'right', direction === 'right',
'w-72': direction === 'right' && visible, 'w-72': direction === 'right' && visible,
'invisible w-0 opacity-0': !visible, 'invisible w-0 opacity-0': !visible,
'w-80': direction === 'left' && visible, 'w-80': direction === 'left' && visible,
'max-w-max': typeof path !== 'string' && direction === 'left', 'max-w-max': typeof path !== 'string' && direction === 'left',
'top-0 right-0': direction === 'right' && isMobile, 'right-0 top-0': direction === 'right' && isMobile,
absolute: isMobile absolute: isMobile
} }
)} )}

View File

@ -58,7 +58,7 @@ export const UserProfile: React.FC<UserProfileProps> = (props) => {
<a <a
href={`mailto:${user.email}`} href={`mailto:${user.email}`}
target='_blank' target='_blank'
className='relative ml-2 font-normal tracking-wide no-underline opacity-80 transition-all after:absolute after:left-0 after:bottom-[-1px] after:h-[1px] after:w-0 after:bg-black after:transition-all hover:opacity-100 hover:after:w-full dark:after:bg-white' className='relative ml-2 font-normal tracking-wide no-underline opacity-80 transition-all after:absolute after:bottom-[-1px] after:left-0 after:h-[1px] after:w-0 after:bg-black after:transition-all hover:opacity-100 hover:after:w-full dark:after:bg-white'
rel='noreferrer' rel='noreferrer'
data-cy='user-email' data-cy='user-email'
> >
@ -73,7 +73,7 @@ export const UserProfile: React.FC<UserProfileProps> = (props) => {
target='_blank' target='_blank'
rel='noreferrer' rel='noreferrer'
href={user.website} href={user.website}
className='relative ml-2 font-normal tracking-wide no-underline opacity-80 transition-all after:absolute after:left-0 after:bottom-[-2px] after:h-[1px] after:w-0 after:bg-black after:transition-all hover:opacity-100 hover:after:w-full dark:after:bg-white' className='relative ml-2 font-normal tracking-wide no-underline opacity-80 transition-all after:absolute after:bottom-[-2px] after:left-0 after:h-[1px] after:w-0 after:bg-black after:transition-all hover:opacity-100 hover:after:w-full dark:after:bg-white'
> >
{user.website} {user.website}
</a> </a>

View File

@ -75,7 +75,7 @@ export const UserSettings: React.FC = () => {
if (hasEmailChanged) { if (hasEmailChanged) {
return { return {
type: 'success', type: 'success',
value: 'application:success-email-changed' message: 'application:success-email-changed'
} }
} }
const { data: userCurrentSettings } = await authentication.api.put( const { data: userCurrentSettings } = await authentication.api.put(
@ -94,7 +94,7 @@ export const UserSettings: React.FC = () => {
}) })
return { return {
type: 'success', type: 'success',
value: 'application:saved-information' message: 'application:saved-information'
} }
} catch (error) { } catch (error) {
if (axios.isAxiosError(error) && error.response?.status === 400) { if (axios.isAxiosError(error) && error.response?.status === 400) {
@ -102,22 +102,22 @@ export const UserSettings: React.FC = () => {
if (message.endsWith('already taken.')) { if (message.endsWith('already taken.')) {
return { return {
type: 'error', type: 'error',
value: 'authentication:already-used' message: 'authentication:already-used'
} }
} else if (message.endsWith('email to sign in.')) { } else if (message.endsWith('email to sign in.')) {
return { return {
type: 'error', type: 'error',
value: 'authentication:email-required-to-sign-in' message: 'authentication:email-required-to-sign-in'
} }
} }
return { return {
type: 'error', type: 'error',
value: 'errors:server-error' message: 'errors:server-error'
} }
} }
return { return {
type: 'error', type: 'error',
value: 'errors:server-error' message: 'errors:server-error'
} }
} }
} }

View File

@ -54,7 +54,7 @@ export const Authentication: React.FC<AuthenticationProps> = (props) => {
formElement.reset() formElement.reset()
return { return {
type: 'success', type: 'success',
value: 'authentication:success-signup' message: 'authentication:success-signup'
} }
} catch (error) { } catch (error) {
if (axios.isAxiosError(error) && error.response?.status === 400) { if (axios.isAxiosError(error) && error.response?.status === 400) {
@ -62,17 +62,17 @@ export const Authentication: React.FC<AuthenticationProps> = (props) => {
if (message.endsWith('already taken.')) { if (message.endsWith('already taken.')) {
return { return {
type: 'error', type: 'error',
value: 'authentication:already-used' message: 'authentication:already-used'
} }
} }
return { return {
type: 'error', type: 'error',
value: 'errors:server-error' message: 'errors:server-error'
} }
} }
return { return {
type: 'error', type: 'error',
value: 'errors:server-error' message: 'errors:server-error'
} }
} }
} else { } else {
@ -86,12 +86,12 @@ export const Authentication: React.FC<AuthenticationProps> = (props) => {
if (axios.isAxiosError(error) && error.response?.status === 400) { if (axios.isAxiosError(error) && error.response?.status === 400) {
return { return {
type: 'error', type: 'error',
value: 'authentication:wrong-credentials' message: 'authentication:wrong-credentials'
} }
} }
return { return {
type: 'error', type: 'error',
value: 'errors:server-error' message: 'errors:server-error'
} }
} }
} }

View File

@ -29,7 +29,7 @@ export const SwitchTheme: React.FC = () => {
<div <div
data-cy='switch-theme-dark' data-cy='switch-theme-dark'
className={classNames( className={classNames(
'absolute top-0 bottom-0 left-[8px] mt-auto mb-auto h-[10px] w-[14px] leading-[0] transition-opacity duration-[250ms] ease-in-out', 'absolute bottom-0 left-[8px] top-0 mb-auto mt-auto h-[10px] w-[14px] leading-[0] transition-opacity duration-[250ms] ease-in-out',
{ {
'opacity-100': theme === 'dark', 'opacity-100': theme === 'dark',
'opacity-0': theme === 'light' 'opacity-0': theme === 'light'
@ -43,7 +43,7 @@ export const SwitchTheme: React.FC = () => {
<div <div
data-cy='switch-theme-light' data-cy='switch-theme-light'
className={classNames( className={classNames(
'absolute right-[10px] top-0 bottom-0 mt-auto mb-auto h-[10px] w-[10px] leading-[0]', 'absolute bottom-0 right-[10px] top-0 mb-auto mt-auto h-[10px] w-[10px] leading-[0]',
{ {
'opacity-100': theme === 'light', 'opacity-100': theme === 'light',
'opacity-0': theme === 'dark' 'opacity-0': theme === 'dark'

View File

@ -13,7 +13,7 @@ export const Checkbox: React.FC<CheckboxProps> = (props) => {
{...props} {...props}
type='checkbox' type='checkbox'
id={id} id={id}
className='relative mr-3 min-h-[25px] min-w-[25px] cursor-pointer appearance-none rounded-md bg-gradient-to-t from-[#bcc7d4] to-[#d3dfed] transition-all before:absolute before:top-[50%] before:left-[59%] before:h-[12px] before:w-[2px] before:translate-x-[-59%] before:translate-y-[-50%] before:rotate-[40deg] before:scale-0 before:bg-black before:transition-all after:absolute after:top-[62.5%] after:left-[36%] after:h-[7px] after:w-[2px] after:translate-x-[-35%] after:translate-y-[-62.5%] after:rotate-[-50deg] after:scale-0 after:bg-black after:transition-all after:duration-200 checked:before:scale-100 checked:after:scale-100 dark:from-[#1f2937] dark:to-[#273547] dark:before:bg-white dark:after:bg-white' className='relative mr-3 min-h-[25px] min-w-[25px] cursor-pointer appearance-none rounded-md bg-gradient-to-t from-[#bcc7d4] to-[#d3dfed] transition-all before:absolute before:left-[59%] before:top-[50%] before:h-[12px] before:w-[2px] before:translate-x-[-59%] before:translate-y-[-50%] before:rotate-[40deg] before:scale-0 before:bg-black before:transition-all after:absolute after:left-[36%] after:top-[62.5%] after:h-[7px] after:w-[2px] after:translate-x-[-35%] after:translate-y-[-62.5%] after:rotate-[-50deg] after:scale-0 after:bg-black after:transition-all after:duration-200 checked:before:scale-100 checked:after:scale-100 dark:from-[#1f2937] dark:to-[#273547] dark:before:bg-white dark:after:bg-white'
/> />
<label <label
className='duration-400 cursor-pointer select-none opacity-80 transition hover:opacity-100 ' className='duration-400 cursor-pointer select-none opacity-80 transition hover:opacity-100 '

View File

@ -36,7 +36,7 @@ export const Input: React.FC<InputProps> = (props) => {
return ( return (
<div className='flex flex-col'> <div className='flex flex-col'>
<div className={classNames('mt-6 mb-2 flex justify-between', className)}> <div className={classNames('mb-2 mt-6 flex justify-between', className)}>
<label className='pl-1' htmlFor={name}> <label className='pl-1' htmlFor={name}>
{label} {label}
</label> </label>
@ -66,7 +66,7 @@ export const Input: React.FC<InputProps> = (props) => {
style={{ style={{
backgroundImage: `url('/images/svg/icons/input/${inputType}.svg')` backgroundImage: `url('/images/svg/icons/input/${inputType}.svg')`
}} }}
className='absolute top-3 right-4 z-10 h-5 w-5 cursor-pointer bg-[#f1f1f1] bg-cover' className='absolute right-4 top-3 z-10 h-5 w-5 cursor-pointer bg-[#f1f1f1] bg-cover'
/> />
)} )}
<FormState <FormState

View File

@ -13,7 +13,7 @@ export const Loader: React.FC<LoaderProps> = (props) => {
<div className={props.className}> <div className={props.className}>
<div <div
data-cy='progress-spinner' data-cy='progress-spinner'
className='relative my-0 mx-auto before:block before:pt-[100%] before:content-none' className='relative mx-auto my-0 before:block before:pt-[100%] before:content-none'
style={{ width: `${width}px`, height: `${height}px` }} style={{ width: `${width}px`, height: `${height}px` }}
> >
<svg className={styles['progressSpinnerSvg']} viewBox='25 25 50 50'> <svg className={styles['progressSpinnerSvg']} viewBox='25 25 50 50'>

View File

@ -10,7 +10,7 @@ export const Textarea: React.FC<TextareaProps> = (props) => {
return ( return (
<div className='flex flex-col'> <div className='flex flex-col'>
<div className='mt-6 mb-2 flex justify-between'> <div className='mb-2 mt-6 flex justify-between'>
<label className='pl-1' htmlFor={id}> <label className='pl-1' htmlFor={id}>
{label} {label}
</label> </label>

View File

@ -17,9 +17,7 @@ export interface Guilds {
const defaultGuildsContext = {} as any const defaultGuildsContext = {} as any
const GuildsContext = createContext<Guilds>(defaultGuildsContext) const GuildsContext = createContext<Guilds>(defaultGuildsContext)
export const GuildsProvider: React.FC<React.PropsWithChildren<{}>> = ( export const GuildsProvider: React.FC<React.PropsWithChildren> = (props) => {
props
) => {
const { children } = props const { children } = props
const { authentication } = useAuthentication() const { authentication } = useAuthentication()

View File

@ -5,7 +5,7 @@ import { getLocal } from 'mockttp'
import type { Mockttp } from 'mockttp' import type { Mockttp } from 'mockttp'
import { API_DEFAULT_PORT } from './tools/api' import { API_DEFAULT_PORT } from './tools/api'
import type { Handlers, Method } from './cypress/fixtures/handler' import type { Handlers } from './cypress/fixtures/handler'
const UPLOADS_FIXTURES_DIRECTORY = path.join( const UPLOADS_FIXTURES_DIRECTORY = path.join(
process.cwd(), process.cwd(),
@ -26,25 +26,38 @@ export default defineConfig({
setupNodeEvents(on, config) { setupNodeEvents(on, config) {
on('task', { on('task', {
async startMockServer(handlers: Handlers): Promise<null> { async startMockServer(handlers: Handlers): Promise<null> {
server = getLocal({ server = getLocal({ cors: true })
cors: true
})
await server.start(API_DEFAULT_PORT) await server.start(API_DEFAULT_PORT)
for (const handler of handlers) { for (const handler of handlers) {
const { isFile = false } = handler.response const { isFile = false } = handler.response
const method = handler.method.toLowerCase() as Lowercase<Method> let requestBuilder = server.forGet(handler.url)
switch (handler.method) {
case 'GET':
requestBuilder = server.forGet(handler.url)
break
case 'POST':
requestBuilder = server.forPost(handler.url)
break
case 'PUT':
requestBuilder = server.forPut(handler.url)
break
case 'DELETE':
requestBuilder = server.forDelete(handler.url)
break
}
if (isFile) { if (isFile) {
await server[method](handler.url).thenFromFile( await requestBuilder.thenFromFile(
handler.response.statusCode, handler.response.statusCode,
path.join(UPLOADS_FIXTURES_DIRECTORY, ...handler.response.body) path.join(UPLOADS_FIXTURES_DIRECTORY, ...handler.response.body)
) )
} else { } else {
await server[method](handler.url).thenJson( await requestBuilder.thenJson(
handler.response.statusCode, handler.response.statusCode,
handler.response.body handler.response.body
) )
} }
} }
return null return null
}, },

View File

@ -2,7 +2,7 @@ const nextPWA = require('next-pwa')({
disable: process.env.NODE_ENV !== 'production', disable: process.env.NODE_ENV !== 'production',
dest: 'public' dest: 'public'
}) })
const nextTranslate = require('next-translate') const nextTranslate = require('next-translate-plugin')
/** @type {import("next").NextConfig} */ /** @type {import("next").NextConfig} */
const nextConfig = { const nextConfig = {

10748
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
"lint:commit": "commitlint", "lint:commit": "commitlint",
"lint:editorconfig": "editorconfig-checker", "lint:editorconfig": "editorconfig-checker",
"lint:markdown": "markdownlint-cli2", "lint:markdown": "markdownlint-cli2",
"lint:eslint": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"", "lint:eslint": "eslint \".\" --ignore-path \".gitignore\"",
"lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"", "lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"",
"lint:staged": "lint-staged", "lint:staged": "lint-staged",
"test:unit": "cypress run --component", "test:unit": "cypress run --component",
@ -32,82 +32,84 @@
"postinstall": "husky install" "postinstall": "husky install"
}, },
"dependencies": { "dependencies": {
"@fontsource/montserrat": "4.5.13", "@fontsource/montserrat": "4.5.14",
"@fontsource/roboto": "4.5.8", "@fontsource/roboto": "4.5.8",
"@heroicons/react": "1.0.6", "@heroicons/react": "1.0.6",
"@sinclair/typebox": "0.25.20", "@sinclair/typebox": "0.26.8",
"axios": "1.2.1", "@thream/socketio-jwt": "3.0.4",
"axios": "1.3.4",
"clsx": "1.2.1", "clsx": "1.2.1",
"date-and-time": "2.4.1", "date-and-time": "2.4.3",
"emoji-mart": "3.0.1", "emoji-mart": "3.0.1",
"katex": "0.16.4", "katex": "0.16.4",
"next": "13.1.1", "next": "13.2.4",
"next-pwa": "5.6.0", "next-pwa": "5.6.0",
"next-themes": "0.2.1", "next-themes": "0.2.1",
"next-translate": "1.6.0", "next-translate": "2.0.4",
"pretty-bytes": "6.0.0", "pretty-bytes": "6.1.0",
"react": "18.2.0", "react": "18.2.0",
"react-component-form": "3.1.2", "react-component-form": "4.0.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-infinite-scroll-component": "6.1.0", "react-infinite-scroll-component": "6.1.0",
"react-markdown": "8.0.4", "react-markdown": "8.0.6",
"react-responsive": "9.0.2", "react-responsive": "9.0.2",
"react-swipeable": "7.0.0", "react-swipeable": "7.0.0",
"react-syntax-highlighter": "15.5.0", "react-syntax-highlighter": "15.5.0",
"react-textarea-autosize": "8.4.0", "react-textarea-autosize": "8.4.1",
"read-pkg": "7.1.0", "read-pkg": "7.1.0",
"rehype-katex": "6.0.2", "rehype-katex": "6.0.2",
"remark-breaks": "3.0.2", "remark-breaks": "3.0.2",
"remark-gfm": "3.0.1", "remark-gfm": "3.0.1",
"remark-math": "5.1.1", "remark-math": "5.1.1",
"sharp": "0.31.3", "sharp": "0.32.0",
"socket.io-client": "4.5.4", "socket.io-client": "4.6.1",
"unified": "10.1.2", "unified": "10.1.2",
"unist-util-visit": "4.1.1", "unist-util-visit": "4.1.2",
"universal-cookie": "4.0.4" "universal-cookie": "4.0.4"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "17.4.1", "@commitlint/cli": "17.5.1",
"@commitlint/config-conventional": "17.4.0", "@commitlint/config-conventional": "17.4.4",
"@lhci/cli": "0.10.0", "@lhci/cli": "0.11.0",
"@saithodev/semantic-release-backmerge": "2.1.2", "@saithodev/semantic-release-backmerge": "3.1.0",
"@semantic-release/git": "10.0.1", "@semantic-release/git": "10.0.1",
"@tsconfig/strictest": "1.0.2", "@tsconfig/strictest": "2.0.0",
"@types/emoji-mart": "3.0.9", "@types/emoji-mart": "3.0.9",
"@types/hast": "2.3.4", "@types/hast": "2.3.4",
"@types/katex": "0.16.0", "@types/katex": "0.16.0",
"@types/node": "18.11.18", "@types/node": "18.15.11",
"@types/react": "18.0.26", "@types/react": "18.0.32",
"@types/react-responsive": "8.0.5", "@types/react-responsive": "8.0.5",
"@types/react-syntax-highlighter": "15.5.6", "@types/react-syntax-highlighter": "15.5.6",
"@types/unist": "2.0.6", "@types/unist": "2.0.6",
"@typescript-eslint/eslint-plugin": "5.48.1", "@typescript-eslint/eslint-plugin": "5.57.0",
"@typescript-eslint/parser": "5.48.1", "@typescript-eslint/parser": "5.57.0",
"autoprefixer": "10.4.13", "autoprefixer": "10.4.14",
"cypress": "12.3.0", "cypress": "12.9.0",
"editorconfig-checker": "4.0.2", "editorconfig-checker": "5.0.1",
"eslint": "8.31.0", "eslint": "8.37.0",
"eslint-config-conventions": "6.0.0", "eslint-config-conventions": "8.0.0",
"eslint-config-next": "13.1.1", "eslint-config-next": "13.2.4",
"eslint-config-prettier": "8.6.0", "eslint-config-prettier": "8.8.0",
"eslint-plugin-import": "2.26.0", "eslint-plugin-import": "2.27.5",
"eslint-plugin-prettier": "4.2.1", "eslint-plugin-prettier": "4.2.1",
"eslint-plugin-promise": "6.1.1", "eslint-plugin-promise": "6.1.1",
"eslint-plugin-unicorn": "45.0.2", "eslint-plugin-unicorn": "46.0.0",
"html-w3c-validator": "1.2.2", "html-w3c-validator": "1.2.2",
"husky": "8.0.3", "husky": "8.0.3",
"lint-staged": "13.1.0", "lint-staged": "13.2.0",
"markdownlint-cli2": "0.6.0", "markdownlint-cli2": "0.6.0",
"markdownlint-rule-relative-links": "1.1.1", "markdownlint-rule-relative-links": "1.1.2",
"mockttp": "2.7.0", "mockttp": "3.7.0",
"plop": "3.1.1", "next-translate-plugin": "2.0.4",
"plop": "3.1.2",
"postcss": "8.4.21", "postcss": "8.4.21",
"prettier": "2.8.2", "prettier": "2.8.7",
"prettier-plugin-tailwindcss": "0.2.1", "prettier-plugin-tailwindcss": "0.2.6",
"semantic-release": "19.0.5", "semantic-release": "21.0.1",
"start-server-and-test": "1.15.2", "start-server-and-test": "2.0.0",
"tailwindcss": "3.2.4", "tailwindcss": "3.3.1",
"typescript": "4.9.4", "typescript": "5.0.3",
"vercel": "28.11.0" "vercel": "28.18.3"
} }
} }

View File

@ -42,18 +42,18 @@ const ForgotPassword: NextPage<FooterProps> = (props) => {
formElement.reset() formElement.reset()
return { return {
type: 'success', type: 'success',
value: 'authentication:success-forgot-password' message: 'authentication:success-forgot-password'
} }
} catch (error) { } catch (error) {
if (axios.isAxiosError(error) && error.response?.status === 400) { if (axios.isAxiosError(error) && error.response?.status === 400) {
return { return {
type: 'error', type: 'error',
value: 'errors:invalid-email' message: 'errors:invalid-email'
} }
} }
return { return {
type: 'error', type: 'error',
value: 'errors:server-error' message: 'errors:server-error'
} }
} }
} }

View File

@ -43,12 +43,12 @@ const ResetPassword: NextPage<FooterProps> = (props) => {
if (axios.isAxiosError(error) && error.response?.status === 400) { if (axios.isAxiosError(error) && error.response?.status === 400) {
return { return {
type: 'error', type: 'error',
value: 'errors:invalid' message: 'errors:invalid'
} }
} }
return { return {
type: 'error', type: 'error',
value: 'errors:server-error' message: 'errors:server-error'
} }
} }
} }

View File

@ -1,6 +1,6 @@
import axios from 'axios' import axios from 'axios'
export const API_VERSION = '1.2.4' export const API_VERSION = '1.2.5'
export const API_DEFAULT_PORT = 8080 export const API_DEFAULT_PORT = 8080

View File

@ -2,6 +2,7 @@ import type { AxiosInstance } from 'axios'
import axios from 'axios' import axios from 'axios'
import type { Socket } from 'socket.io-client' import type { Socket } from 'socket.io-client'
import { io } from 'socket.io-client' import { io } from 'socket.io-client'
import { isUnauthorizedError } from '@thream/socketio-jwt'
import { API_URL } from '../api' import { API_URL } from '../api'
import { cookies } from '../cookies' import { cookies } from '../cookies'
@ -30,7 +31,7 @@ export class Authentication {
) )
}) })
this.socket.on('connect_error', (error) => { this.socket.on('connect_error', (error) => {
if (error.message.startsWith('Unauthorized')) { if (isUnauthorizedError(error)) {
fetchRefreshToken(this.tokens.refreshToken) fetchRefreshToken(this.tokens.refreshToken)
.then(({ accessToken }) => { .then(({ accessToken }) => {
this.setAccessToken(accessToken) this.setAccessToken(accessToken)
@ -58,10 +59,7 @@ export class Authentication {
) )
this.setAccessToken(accessToken) this.setAccessToken(accessToken)
} }
config.headers = config.headers == null ? {} : config.headers config.headers.Authorization = `${this.tokens.type} ${this.tokens.accessToken}`
config.headers[
'Authorization'
] = `${this.tokens.type} ${this.tokens.accessToken}`
return config return config
}, },
async (error) => { async (error) => {

View File

@ -3,19 +3,22 @@
"compilerOptions": { "compilerOptions": {
"target": "ESNext", "target": "ESNext",
"module": "ESNext", "module": "ESNext",
"moduleResolution": "node",
"allowJs": true,
"jsx": "preserve",
"sourceMap": true,
"removeComments": true,
"noEmit": true,
"types": ["cypress"],
"lib": ["dom", "dom.iterable", "ESNext"], "lib": ["dom", "dom.iterable", "ESNext"],
"allowJs": true,
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
},
"types": ["cypress"],
"noEmit": true,
"moduleResolution": "node",
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "jsx": "preserve",
"incremental": true, "incremental": true,
"exactOptionalPropertyTypes": false "exactOptionalPropertyTypes": false,
"verbatimModuleSyntax": false,
"isolatedModules": true
}, },
"exclude": ["dist", ".next", "out", "next.config.js"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"] "exclude": ["node_modules"]
} }