build(deps): bump dependencies (#2427)

* build(deps): bump dependencies

* build(deps): bump next to 12.0.8

* build(deps): bump swr to 1.1.2

* build(deps): bump more dependencies

* build(deps): bump husky to 7.0.4

* fix: remove user list button outlines

* build(deps): bump dependencies again

* build(deps): bump dependencies once more
pull/2407/head
TheCatLady 3 years ago committed by GitHub
parent 5707566cf7
commit 114366fa4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,6 +10,7 @@
.gitconfig
.github
.gitignore
.husky
.next
.prettierignore
config/db/*

@ -15,7 +15,7 @@ jobs:
container: node:14.18-alpine
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
- name: Install dependencies
env:
HUSKY_SKIP_INSTALL: 1
@ -32,31 +32,31 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.3.0
uses: docker/setup-buildx-action@v1.6.0
- name: Cache Docker layers
uses: actions/cache@v2.1.6
uses: actions/cache@v2.1.7
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to Docker Hub
uses: docker/login-action@v1.9.0
uses: docker/login-action@v1.12.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1.9.0
uses: docker/login-action@v1.12.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2.5.0
uses: docker/build-push-action@v2.8.0
with:
context: .
file: ./Dockerfile
@ -86,7 +86,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Get Build Job Status
uses: technote-space/workflow-conclusion-action@v2.1.6
uses: technote-space/workflow-conclusion-action@v2.2.2
- name: Combine Job Status
id: status
run: |

@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Generate Swagger UI
uses: Legion2/swagger-ui-action@v1.1.2
uses: Legion2/swagger-ui-action@v1.1.3
with:
output: swagger-ui
spec-file: overseerr-api.yml

@ -11,27 +11,27 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.3.0
uses: docker/setup-buildx-action@v1.6.0
- name: Log in to Docker Hub
uses: docker/login-action@v1.9.0
uses: docker/login-action@v1.12.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1.9.0
uses: docker/login-action@v1.12.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2.5.0
uses: docker/build-push-action@v2.8.0
with:
context: .
file: ./Dockerfile

@ -12,7 +12,7 @@ jobs:
container: node:14.18-alpine
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
- name: Install dependencies
env:
HUSKY_SKIP_INSTALL: 1
@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
with:
fetch-depth: 0
- name: Set up Node.js
@ -38,14 +38,14 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.3.0
uses: docker/setup-buildx-action@v1.6.0
- name: Log in to Docker Hub
uses: docker/login-action@v1.9.0
uses: docker/login-action@v1.12.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1.9.0
uses: docker/login-action@v1.12.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
@ -72,7 +72,7 @@ jobs:
- armhf
steps:
- name: Checkout Code
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
with:
fetch-depth: 0
- name: Switch to master branch
@ -120,7 +120,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Get Build Job Status
uses: technote-space/workflow-conclusion-action@v2.1.6
uses: technote-space/workflow-conclusion-action@v2.2.2
- name: Combine Job Status
id: status
run: |

@ -12,7 +12,7 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.0
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
@ -23,7 +23,7 @@ jobs:
container: node:14.18-alpine
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
- name: Install dependencies
env:
HUSKY_SKIP_INSTALL: 1
@ -46,7 +46,7 @@ jobs:
- armhf
steps:
- name: Checkout Code
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2.4.0
- name: Prepare
id: prepare
run: |
@ -88,7 +88,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Get Build Job Status
uses: technote-space/workflow-conclusion-action@v2.1.6
uses: technote-space/workflow-conclusion-action@v2.2.2
- name: Combine Job Status
id: status
run: |

@ -8,7 +8,7 @@ jobs:
support:
runs-on: ubuntu-20.04
steps:
- uses: dessant/support-requests@v2.0.1
- uses: dessant/support-requests@v2.1.2
with:
github-token: ${{ github.token }}
support-label: 'support'

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
[[ -n $HUSKY_BYPASS ]] || npx commitlint --edit $1

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
exec < /dev/tty && npx cz --hook || true

1
next-env.d.ts vendored

@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited

@ -13,7 +13,8 @@
"migration:generate": "ts-node --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:generate",
"migration:create": "ts-node --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:create",
"migration:run": "ts-node --project server/tsconfig.json ./node_modules/typeorm/cli.js migration:run",
"format": "prettier --write ."
"format": "prettier --write .",
"prepare": "husky install"
},
"repository": {
"type": "git",
@ -21,45 +22,45 @@
},
"license": "MIT",
"dependencies": {
"@headlessui/react": "^1.4.1",
"@heroicons/react": "^1.0.4",
"@headlessui/react": "^1.4.3",
"@heroicons/react": "^1.0.5",
"@supercharge/request-ip": "^1.1.2",
"@svgr/webpack": "^5.5.0",
"@tanem/react-nprogress": "^3.0.79",
"ace-builds": "^1.4.12",
"@svgr/webpack": "^6.2.0",
"@tanem/react-nprogress": "^4.0.2",
"ace-builds": "^1.4.13",
"axios": "^0.21.4",
"bcrypt": "^5.0.1",
"bowser": "^2.11.0",
"connect-typeorm": "^1.1.4",
"cookie-parser": "^1.4.5",
"cookie-parser": "^1.4.6",
"copy-to-clipboard": "^3.3.1",
"country-flag-icons": "^1.4.10",
"country-flag-icons": "^1.4.19",
"csurf": "^1.11.0",
"email-templates": "^8.0.8",
"express": "^4.17.1",
"express-openapi-validator": "^4.13.1",
"express-rate-limit": "^5.3.0",
"express": "^4.17.2",
"express-openapi-validator": "^4.13.5",
"express-rate-limit": "^6.1.0",
"express-session": "^1.17.2",
"formik": "^2.2.9",
"gravatar-url": "3.1.0",
"gravatar-url": "^3.1.0",
"intl": "^1.2.5",
"lodash": "^4.17.21",
"next": "11.1.2",
"next": "12.0.8",
"node-cache": "^5.1.2",
"node-schedule": "^2.0.0",
"nodemailer": "^6.6.3",
"openpgp": "^5.0.0-3",
"plex-api": "^5.3.1",
"node-schedule": "^2.1.0",
"nodemailer": "^6.7.2",
"openpgp": "^5.0.1",
"plex-api": "^5.3.2",
"pug": "^3.0.2",
"react": "17.0.2",
"react-ace": "^9.3.0",
"react-ace": "^9.5.0",
"react-animate-height": "^2.0.23",
"react-dom": "17.0.2",
"react-intersection-observer": "^8.32.1",
"react-intl": "5.20.10",
"react-markdown": "^6.0.2",
"react-intersection-observer": "^8.33.1",
"react-intl": "5.24.3",
"react-markdown": "^8.0.0",
"react-select": "^4.3.1",
"react-spring": "^9.2.4",
"react-spring": "^9.4.2",
"react-toast-notifications": "^2.5.1",
"react-transition-group": "^4.4.2",
"react-truncate-markup": "^5.1.0",
@ -67,93 +68,84 @@
"reflect-metadata": "^0.1.13",
"secure-random-password": "^0.2.3",
"sqlite3": "^5.0.2",
"swagger-ui-express": "^4.1.6",
"swr": "^0.5.6",
"typeorm": "0.2.37",
"swagger-ui-express": "^4.3.0",
"swr": "^1.1.2",
"typeorm": "0.2.41",
"web-push": "^3.4.5",
"winston": "^3.3.3",
"winston": "^3.4.0",
"winston-daily-rotate-file": "^4.5.5",
"xml2js": "^0.4.23",
"yamljs": "^0.3.0",
"yup": "^0.32.9"
"yup": "^0.32.11"
},
"devDependencies": {
"@babel/cli": "^7.15.7",
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/commit-analyzer": "^9.0.1",
"@semantic-release/exec": "^5.0.0",
"@semantic-release/git": "^9.0.1",
"@tailwindcss/aspect-ratio": "^0.2.1",
"@tailwindcss/forms": "^0.3.3",
"@tailwindcss/typography": "^0.4.1",
"@babel/cli": "^7.16.8",
"@commitlint/cli": "^16.0.3",
"@commitlint/config-conventional": "^16.0.0",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@tailwindcss/aspect-ratio": "^0.4.0",
"@tailwindcss/forms": "^0.4.0",
"@tailwindcss/typography": "^0.5.0",
"@types/bcrypt": "^5.0.0",
"@types/cookie-parser": "^1.4.2",
"@types/country-flag-icons": "^1.2.0",
"@types/csurf": "^1.11.2",
"@types/email-templates": "^8.0.4",
"@types/express": "^4.17.13",
"@types/express-rate-limit": "^5.1.3",
"@types/express-session": "^1.17.3",
"@types/lodash": "^4.14.173",
"@types/node": "^15.6.1",
"@types/express-session": "^1.17.4",
"@types/lodash": "^4.14.178",
"@types/node": "^17.0.10",
"@types/node-schedule": "^1.3.2",
"@types/nodemailer": "^6.4.4",
"@types/react": "^17.0.22",
"@types/react-dom": "^17.0.9",
"@types/react": "^17.0.38",
"@types/react-dom": "^17.0.11",
"@types/react-select": "^4.0.17",
"@types/react-toast-notifications": "^2.4.1",
"@types/react-transition-group": "^4.4.3",
"@types/react-transition-group": "^4.4.4",
"@types/secure-random-password": "^0.2.1",
"@types/swagger-ui-express": "^4.1.3",
"@types/web-push": "^3.3.2",
"@types/xml2js": "^0.4.9",
"@types/yamljs": "^0.2.31",
"@types/yup": "^0.29.13",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"autoprefixer": "^10.3.4",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"autoprefixer": "^10.4.2",
"babel-plugin-react-intl": "^8.2.25",
"babel-plugin-react-intl-auto": "^3.3.0",
"commitizen": "^4.2.4",
"copyfiles": "^2.4.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.32.0",
"eslint-config-next": "^11.1.2",
"eslint": "^8.7.0",
"eslint-config-next": "^12.0.8",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-formatjs": "^2.17.6",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-formatjs": "^2.20.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.25.3",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"extract-react-intl-messages": "^4.1.1",
"husky": "4.3.8",
"lint-staged": "^11.1.2",
"nodemon": "^2.0.12",
"postcss": "^8.3.6",
"prettier": "^2.4.1",
"semantic-release": "^18.0.0",
"husky": "^7.0.4",
"lint-staged": "^12.2.1",
"nodemon": "^2.0.15",
"postcss": "^8.4.5",
"prettier": "^2.5.1",
"semantic-release": "^19.0.2",
"semantic-release-docker-buildx": "^1.0.1",
"tailwindcss": "^2.2.15",
"ts-node": "^10.2.1",
"typescript": "^4.4.3"
"tailwindcss": "^3.0.15",
"ts-node": "^10.4.0",
"typescript": "^4.5.4"
},
"resolutions": {
"sqlite3/node-gyp": "^5.1.0"
"sqlite3/node-gyp": "^8.4.1"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true",
"commit-msg": "[[ -n $HUSKY_BYPASS ]] || commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"**/*.{ts,tsx,js}": [
"prettier --write",

@ -1,8 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"target": "ES2019",
"lib": ["ES2019"],
"target": "ES2020",
"module": "commonjs",
"outDir": "../dist",
"noEmit": false

@ -41,13 +41,14 @@ const CollectionDetails: React.FC<CollectionDetailsProps> = ({
const [requestModal, setRequestModal] = useState(false);
const [is4k, setIs4k] = useState(false);
const { data, error, revalidate } = useSWR<Collection>(
`/api/v1/collection/${router.query.collectionId}`,
{
initialData: collection,
revalidateOnMount: true,
}
);
const {
data,
error,
mutate: revalidate,
} = useSWR<Collection>(`/api/v1/collection/${router.query.collectionId}`, {
fallbackData: collection,
revalidateOnMount: true,
});
const { data: genres } =
useSWR<{ id: number; name: string }[]>(`/api/v1/genres/movie`);

@ -80,7 +80,7 @@ const IssueDetails: React.FC = () => {
const intl = useIntl();
const [showDeleteModal, setShowDeleteModal] = useState(false);
const { user: currentUser, hasPermission } = useUser();
const { data: issueData, revalidate: revalidateIssue } = useSWR<Issue>(
const { data: issueData, mutate: revalidateIssue } = useSWR<Issue>(
`/api/v1/issue/${router.query.issueId}`
);
const { data, error } = useSWR<MovieDetails | TvDetails>(

@ -1,7 +1,7 @@
import { ArrowCircleRightIcon } from '@heroicons/react/outline';
import Link from 'next/link';
import React, { useEffect } from 'react';
import { useSWRInfinite } from 'swr';
import useSWRInfinite from 'swr/infinite';
import { MediaStatus } from '../../../server/constants/media';
import type {
MovieResult,

@ -90,12 +90,13 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
const [showMoreStudios, setShowMoreStudios] = useState(false);
const [showIssueModal, setShowIssueModal] = useState(false);
const { data, error, revalidate } = useSWR<MovieDetailsType>(
`/api/v1/movie/${router.query.movieId}`,
{
initialData: movie,
}
);
const {
data,
error,
mutate: revalidate,
} = useSWR<MovieDetailsType>(`/api/v1/movie/${router.query.movieId}`, {
fallbackData: movie,
});
const { data: ratingData } = useSWR<RTRating>(
`/api/v1/movie/${router.query.movieId}/ratings`

@ -112,9 +112,9 @@ const RequestCard: React.FC<RequestCardProps> = ({ request, onTitleData }) => {
const {
data: requestData,
error: requestError,
revalidate,
mutate: revalidate,
} = useSWR<MediaRequest>(`/api/v1/request/${request.id}`, {
initialData: request,
fallbackData: request,
});
const modifyRequest = async (type: 'approve' | 'decline') => {

@ -106,13 +106,12 @@ const RequestItem: React.FC<RequestItemProps> = ({
const { data: title, error } = useSWR<MovieDetails | TvDetails>(
inView ? url : null
);
const {
data: requestData,
revalidate,
mutate,
} = useSWR<MediaRequest>(`/api/v1/request/${request.id}`, {
initialData: request,
});
const { data: requestData, mutate: revalidate } = useSWR<MediaRequest>(
`/api/v1/request/${request.id}`,
{
fallbackData: request,
}
);
const [isRetrying, setRetrying] = useState(false);
@ -135,7 +134,7 @@ const RequestItem: React.FC<RequestItemProps> = ({
try {
const result = await axios.post(`/api/v1/request/${request.id}/retry`);
mutate(result.data);
revalidate(result.data);
} catch (e) {
addToast(intl.formatMessage(messages.failedretry), {
autoDismiss: true,

@ -51,7 +51,11 @@ const RequestList: React.FC = () => {
const pageIndex = page - 1;
const updateQueryParams = useUpdateQueryParams({ page: page.toString() });
const { data, error, revalidate } = useSWR<RequestResultsResponse>(
const {
data,
error,
mutate: revalidate,
} = useSWR<RequestResultsResponse>(
`/api/v1/request?take=${currentPageSize}&skip=${
pageIndex * currentPageSize
}&filter=${currentFilter}&sort=${currentSort}${

@ -34,9 +34,11 @@ const NotificationsDiscord: React.FC = () => {
const settings = useSettings();
const { addToast, removeToast } = useToasts();
const [isTesting, setIsTesting] = useState(false);
const { data, error, revalidate } = useSWR(
'/api/v1/settings/notifications/discord'
);
const {
data,
error,
mutate: revalidate,
} = useSWR('/api/v1/settings/notifications/discord');
const NotificationsDiscordSchema = Yup.object().shape({
botAvatarUrl: Yup.string()

@ -58,9 +58,11 @@ const NotificationsEmail: React.FC = () => {
const intl = useIntl();
const { addToast, removeToast } = useToasts();
const [isTesting, setIsTesting] = useState(false);
const { data, error, revalidate } = useSWR(
'/api/v1/settings/notifications/email'
);
const {
data,
error,
mutate: revalidate,
} = useSWR('/api/v1/settings/notifications/email');
const NotificationsEmailSchema = Yup.object().shape(
{

@ -30,9 +30,11 @@ const NotificationsGotify: React.FC = () => {
const intl = useIntl();
const { addToast, removeToast } = useToasts();
const [isTesting, setIsTesting] = useState(false);
const { data, error, revalidate } = useSWR(
'/api/v1/settings/notifications/gotify'
);
const {
data,
error,
mutate: revalidate,
} = useSWR('/api/v1/settings/notifications/gotify');
const NotificationsGotifySchema = Yup.object().shape({
url: Yup.string()

@ -31,9 +31,11 @@ const NotificationsLunaSea: React.FC = () => {
const intl = useIntl();
const { addToast, removeToast } = useToasts();
const [isTesting, setIsTesting] = useState(false);
const { data, error, revalidate } = useSWR(
'/api/v1/settings/notifications/lunasea'
);
const {
data,
error,
mutate: revalidate,
} = useSWR('/api/v1/settings/notifications/lunasea');
const NotificationsLunaSeaSchema = Yup.object().shape({
webhookUrl: Yup.string()

@ -31,9 +31,11 @@ const NotificationsPushbullet: React.FC = () => {
const intl = useIntl();
const { addToast, removeToast } = useToasts();
const [isTesting, setIsTesting] = useState(false);
const { data, error, revalidate } = useSWR(
'/api/v1/settings/notifications/pushbullet'
);
const {
data,
error,
mutate: revalidate,
} = useSWR('/api/v1/settings/notifications/pushbullet');
const NotificationsPushbulletSchema = Yup.object().shape({
accessToken: Yup.string().when('enabled', {

@ -33,9 +33,11 @@ const NotificationsPushover: React.FC = () => {
const intl = useIntl();
const { addToast, removeToast } = useToasts();
const [isTesting, setIsTesting] = useState(false);
const { data, error, revalidate } = useSWR(
'/api/v1/settings/notifications/pushover'
);
const {
data,
error,
mutate: revalidate,
} = useSWR('/api/v1/settings/notifications/pushover');
const NotificationsPushoverSchema = Yup.object().shape({
accessToken: Yup.string()

@ -29,9 +29,11 @@ const NotificationsSlack: React.FC = () => {
const intl = useIntl();
const { addToast, removeToast } = useToasts();
const [isTesting, setIsTesting] = useState(false);
const { data, error, revalidate } = useSWR(
'/api/v1/settings/notifications/slack'
);
const {
data,
error,
mutate: revalidate,
} = useSWR('/api/v1/settings/notifications/slack');
const NotificationsSlackSchema = Yup.object().shape({
webhookUrl: Yup.string()

@ -38,9 +38,11 @@ const NotificationsTelegram: React.FC = () => {
const intl = useIntl();
const { addToast, removeToast } = useToasts();
const [isTesting, setIsTesting] = useState(false);
const { data, error, revalidate } = useSWR(
'/api/v1/settings/notifications/telegram'
);
const {
data,
error,
mutate: revalidate,
} = useSWR('/api/v1/settings/notifications/telegram');
const NotificationsTelegramSchema = Yup.object().shape({
botAPI: Yup.string().when('enabled', {

@ -26,9 +26,11 @@ const NotificationsWebPush: React.FC = () => {
const { addToast, removeToast } = useToasts();
const [isTesting, setIsTesting] = useState(false);
const [isHttps, setIsHttps] = useState(false);
const { data, error, revalidate } = useSWR(
'/api/v1/settings/notifications/webpush'
);
const {
data,
error,
mutate: revalidate,
} = useSWR('/api/v1/settings/notifications/webpush');
useEffect(() => {
setIsHttps(window.location.protocol.startsWith('https'));

@ -74,9 +74,11 @@ const NotificationsWebhook: React.FC = () => {
const intl = useIntl();
const { addToast, removeToast } = useToasts();
const [isTesting, setIsTesting] = useState(false);
const { data, error, revalidate } = useSWR(
'/api/v1/settings/notifications/webhook'
);
const {
data,
error,
mutate: revalidate,
} = useSWR('/api/v1/settings/notifications/webhook');
const NotificationsWebhookSchema = Yup.object().shape({
webhookUrl: Yup.string()

@ -77,10 +77,14 @@ interface Job {
const SettingsJobs: React.FC = () => {
const intl = useIntl();
const { addToast } = useToasts();
const { data, error, revalidate } = useSWR<Job[]>('/api/v1/settings/jobs', {
const {
data,
error,
mutate: revalidate,
} = useSWR<Job[]>('/api/v1/settings/jobs', {
refreshInterval: 5000,
});
const { data: cacheData, revalidate: cacheRevalidate } = useSWR<CacheItem[]>(
const { data: cacheData, mutate: cacheRevalidate } = useSWR<CacheItem[]>(
'/api/v1/settings/cache',
{
refreshInterval: 10000,

@ -65,9 +65,11 @@ const SettingsMain: React.FC = () => {
const { user: currentUser, hasPermission: userHasPermission } = useUser();
const intl = useIntl();
const { setLocale } = useLocale();
const { data, error, revalidate } = useSWR<MainSettings>(
'/api/v1/settings/main'
);
const {
data,
error,
mutate: revalidate,
} = useSWR<MainSettings>('/api/v1/settings/main');
const { data: userData } = useSWR<UserSettingsGeneralResponse>(
currentUser ? `/api/v1/user/${currentUser.id}/settings/main` : null
);

@ -96,10 +96,12 @@ const SettingsPlex: React.FC<SettingsPlexProps> = ({ onComplete }) => {
const [availableServers, setAvailableServers] = useState<PlexDevice[] | null>(
null
);
const { data, error, revalidate } = useSWR<PlexSettings>(
'/api/v1/settings/plex'
);
const { data: dataSync, revalidate: revalidateSync } = useSWR<SyncStatus>(
const {
data,
error,
mutate: revalidate,
} = useSWR<PlexSettings>('/api/v1/settings/plex');
const { data: dataSync, mutate: revalidateSync } = useSWR<SyncStatus>(
'/api/v1/settings/plex/sync',
{
refreshInterval: 1000,

@ -165,12 +165,12 @@ const SettingsServices: React.FC = () => {
const {
data: radarrData,
error: radarrError,
revalidate: revalidateRadarr,
mutate: revalidateRadarr,
} = useSWR<RadarrSettings[]>('/api/v1/settings/radarr');
const {
data: sonarrData,
error: sonarrError,
revalidate: revalidateSonarr,
mutate: revalidateSonarr,
} = useSWR<SonarrSettings[]>('/api/v1/settings/sonarr');
const [editRadarrModal, setEditRadarrModal] = useState<{
open: boolean;

@ -33,9 +33,11 @@ const messages = defineMessages({
const SettingsUsers: React.FC = () => {
const { addToast } = useToasts();
const intl = useIntl();
const { data, error, revalidate } = useSWR<MainSettings>(
'/api/v1/settings/main'
);
const {
data,
error,
mutate: revalidate,
} = useSWR<MainSettings>('/api/v1/settings/main');
if (!data && !error) {
return <LoadingSpinner />;

@ -83,12 +83,13 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
const [showManager, setShowManager] = useState(false);
const [showIssueModal, setShowIssueModal] = useState(false);
const { data, error, revalidate } = useSWR<TvDetailsType>(
`/api/v1/tv/${router.query.tvId}`,
{
initialData: tv,
}
);
const {
data,
error,
mutate: revalidate,
} = useSWR<TvDetailsType>(`/api/v1/tv/${router.query.tvId}`, {
fallbackData: tv,
});
const { data: ratingData } = useSWR<RTRating>(
`/api/v1/tv/${router.query.tvId}/ratings`

@ -93,7 +93,11 @@ const UserList: React.FC = () => {
const pageIndex = page - 1;
const updateQueryParams = useUpdateQueryParams({ page: page.toString() });
const { data, error, revalidate } = useSWR<UserResultsResponse>(
const {
data,
error,
mutate: revalidate,
} = useSWR<UserResultsResponse>(
`/api/v1/user?take=${currentPageSize}&skip=${
pageIndex * currentPageSize
}&sort=${currentSort}`
@ -472,7 +476,7 @@ const UserList: React.FC = () => {
<div className="flex flex-col flex-grow mt-2 lg:flex-row lg:flex-grow-0">
<div className="flex flex-col justify-between flex-grow mb-2 sm:flex-row lg:mb-0 lg:flex-grow-0">
<Button
className="flex-grow mb-2 sm:mb-0 sm:mr-2 outline"
className="flex-grow mb-2 sm:mb-0 sm:mr-2"
buttonType="primary"
onClick={() => setCreateModal({ isOpen: true })}
>
@ -480,7 +484,7 @@ const UserList: React.FC = () => {
<span>{intl.formatMessage(messages.createlocaluser)}</span>
</Button>
<Button
className="flex-grow outline lg:mr-2"
className="flex-grow lg:mr-2"
buttonType="primary"
onClick={() => setShowImportModal(true)}
>

@ -55,12 +55,20 @@ const UserGeneralSettings: React.FC = () => {
const [movieQuotaEnabled, setMovieQuotaEnabled] = useState(false);
const [tvQuotaEnabled, setTvQuotaEnabled] = useState(false);
const router = useRouter();
const { user, hasPermission, mutate } = useUser({
const {
user,
hasPermission,
revalidate: revalidateUser,
} = useUser({
id: Number(router.query.userId),
});
const { user: currentUser, hasPermission: currentHasPermission } = useUser();
const { currentSettings } = useSettings();
const { data, error, revalidate } = useSWR<UserSettingsGeneralResponse>(
const {
data,
error,
mutate: revalidate,
} = useSWR<UserSettingsGeneralResponse>(
user ? `/api/v1/user/${user?.id}/settings/main` : null
);
@ -140,7 +148,7 @@ const UserGeneralSettings: React.FC = () => {
});
} finally {
revalidate();
mutate();
revalidateUser();
}
}}
>

@ -28,7 +28,11 @@ const UserNotificationsDiscord: React.FC = () => {
const { addToast } = useToasts();
const router = useRouter();
const { user } = useUser({ id: Number(router.query.userId) });
const { data, error, revalidate } = useSWR<UserSettingsNotificationsResponse>(
const {
data,
error,
mutate: revalidate,
} = useSWR<UserSettingsNotificationsResponse>(
user ? `/api/v1/user/${user?.id}/settings/notifications` : null
);

@ -33,7 +33,11 @@ const UserEmailSettings: React.FC = () => {
const { addToast } = useToasts();
const router = useRouter();
const { user } = useUser({ id: Number(router.query.userId) });
const { data, error, revalidate } = useSWR<UserSettingsNotificationsResponse>(
const {
data,
error,
mutate: revalidate,
} = useSWR<UserSettingsNotificationsResponse>(
user ? `/api/v1/user/${user?.id}/settings/notifications` : null
);

@ -29,7 +29,11 @@ const UserPushbulletSettings: React.FC = () => {
const { addToast } = useToasts();
const router = useRouter();
const { user } = useUser({ id: Number(router.query.userId) });
const { data, error, revalidate } = useSWR<UserSettingsNotificationsResponse>(
const {
data,
error,
mutate: revalidate,
} = useSWR<UserSettingsNotificationsResponse>(
user ? `/api/v1/user/${user?.id}/settings/notifications` : null
);

@ -34,7 +34,11 @@ const UserPushoverSettings: React.FC = () => {
const { addToast } = useToasts();
const router = useRouter();
const { user } = useUser({ id: Number(router.query.userId) });
const { data, error, revalidate } = useSWR<UserSettingsNotificationsResponse>(
const {
data,
error,
mutate: revalidate,
} = useSWR<UserSettingsNotificationsResponse>(
user ? `/api/v1/user/${user?.id}/settings/notifications` : null
);

@ -30,7 +30,11 @@ const UserTelegramSettings: React.FC = () => {
const { addToast } = useToasts();
const router = useRouter();
const { user } = useUser({ id: Number(router.query.userId) });
const { data, error, revalidate } = useSWR<UserSettingsNotificationsResponse>(
const {
data,
error,
mutate: revalidate,
} = useSWR<UserSettingsNotificationsResponse>(
user ? `/api/v1/user/${user?.id}/settings/notifications` : null
);

@ -25,7 +25,11 @@ const UserWebPushSettings: React.FC = () => {
const { addToast } = useToasts();
const router = useRouter();
const { user } = useUser({ id: Number(router.query.userId) });
const { data, error, revalidate } = useSWR<UserSettingsNotificationsResponse>(
const {
data,
error,
mutate: revalidate,
} = useSWR<UserSettingsNotificationsResponse>(
user ? `/api/v1/user/${user?.id}/settings/notifications` : null
);

@ -45,7 +45,11 @@ const UserPasswordChange: React.FC = () => {
const router = useRouter();
const { user: currentUser } = useUser();
const { user, hasPermission } = useUser({ id: Number(router.query.userId) });
const { data, error, revalidate } = useSWR<{ hasPassword: boolean }>(
const {
data,
error,
mutate: revalidate,
} = useSWR<{ hasPassword: boolean }>(
user ? `/api/v1/user/${user?.id}/settings/password` : null
);

@ -27,8 +27,14 @@ const UserPermissions: React.FC = () => {
const { addToast } = useToasts();
const router = useRouter();
const { user: currentUser } = useUser();
const { user, mutate } = useUser({ id: Number(router.query.userId) });
const { data, error, revalidate } = useSWR<{ permissions?: number }>(
const { user, revalidate: revalidateUser } = useUser({
id: Number(router.query.userId),
});
const {
data,
error,
mutate: revalidate,
} = useSWR<{ permissions?: number }>(
user ? `/api/v1/user/${user?.id}/settings/permissions` : null
);
@ -90,7 +96,7 @@ const UserPermissions: React.FC = () => {
});
} finally {
revalidate();
mutate();
revalidateUser();
}
}}
>

@ -35,7 +35,7 @@ export const SettingsProvider: React.FC<SettingsContextProps> = ({
}) => {
const { data, error } = useSWR<PublicSettingsResponse>(
'/api/v1/settings/public',
{ initialData: currentSettings }
{ fallbackData: currentSettings }
);
let newSettings = defaultSettings;

@ -1,6 +1,6 @@
import React, { useEffect, useRef } from 'react';
import { useUser, User } from '../hooks/useUser';
import { useRouter } from 'next/dist/client/router';
import React, { useEffect, useRef } from 'react';
import { User, useUser } from '../hooks/useUser';
interface UserContextProps {
initialUser: User;

@ -1,4 +1,4 @@
import { useSWRInfinite } from 'swr';
import useSWRInfinite from 'swr/infinite';
import { MediaStatus } from '../../server/constants/media';
import useSettings from './useSettings';

@ -1,4 +1,4 @@
import useSwr from 'swr';
import useSWR from 'swr';
import { MutatorCallback } from 'swr/dist/types';
import { UserType } from '../../server/constants/user';
import {
@ -40,8 +40,7 @@ interface UserHookResponse {
user?: User;
loading: boolean;
error: string;
revalidate: () => Promise<boolean>;
mutate: (
revalidate: (
data?: User | Promise<User> | MutatorCallback<User> | undefined,
shouldRevalidate?: boolean | undefined
) => Promise<User | undefined>;
@ -55,15 +54,16 @@ export const useUser = ({
id,
initialData,
}: { id?: number; initialData?: User } = {}): UserHookResponse => {
const { data, error, revalidate, mutate } = useSwr<User>(
id ? `/api/v1/user/${id}` : `/api/v1/auth/me`,
{
initialData,
refreshInterval: 30000,
errorRetryInterval: 30000,
shouldRetryOnError: false,
}
);
const {
data,
error,
mutate: revalidate,
} = useSWR<User>(id ? `/api/v1/user/${id}` : `/api/v1/auth/me`, {
fallbackData: initialData,
refreshInterval: 30000,
errorRetryInterval: 30000,
shouldRetryOnError: false,
});
const checkPermission = (
permission: Permission | Permission[],
@ -76,8 +76,7 @@ export const useUser = ({
user: data,
loading: !data && !error,
error,
revalidate,
hasPermission: checkPermission,
mutate,
revalidate,
};
};

@ -12,24 +12,25 @@ const CollectionPage: NextPage<CollectionPageProps> = ({ collection }) => {
return <CollectionDetails collection={collection} />;
};
export const getServerSideProps: GetServerSideProps<CollectionPageProps> =
async (ctx) => {
const response = await axios.get<Collection>(
`http://localhost:${process.env.PORT || 5055}/api/v1/collection/${
ctx.query.collectionId
}`,
{
headers: ctx.req?.headers?.cookie
? { cookie: ctx.req.headers.cookie }
: undefined,
}
);
export const getServerSideProps: GetServerSideProps<
CollectionPageProps
> = async (ctx) => {
const response = await axios.get<Collection>(
`http://localhost:${process.env.PORT || 5055}/api/v1/collection/${
ctx.query.collectionId
}`,
{
headers: ctx.req?.headers?.cookie
? { cookie: ctx.req.headers.cookie }
: undefined,
}
);
return {
props: {
collection: response.data,
},
};
return {
props: {
collection: response.data,
},
};
};
export default CollectionPage;

@ -3,7 +3,7 @@ const defaultTheme = require('tailwindcss/defaultTheme');
module.exports = {
mode: 'jit',
purge: ['./src/pages/**/*.{ts,tsx}', './src/components/**/*.{ts,tsx}'],
content: ['./src/pages/**/*.{ts,tsx}', './src/components/**/*.{ts,tsx}'],
theme: {
extend: {
transitionProperty: {

@ -16,7 +16,8 @@
"strictPropertyInitialization": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"useUnknownInCatchVariables": false
"useUnknownInCatchVariables": false,
"incremental": true
},
"include": ["next-env.d.ts", "src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules"]

10516
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save