mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 07:55:52 +01:00
⬆️ Updated: Next.js 12.1.6 -> 12.2.0
This commit is contained in:
@@ -11,9 +11,6 @@ module.exports = withBundleAnalyzer({
|
||||
domains: ['cdn.jsdelivr.net'],
|
||||
},
|
||||
reactStrictMode: false,
|
||||
experimental: {
|
||||
outputStandalone: true,
|
||||
},
|
||||
output: 'standalone',
|
||||
i18n,
|
||||
});
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
"i18next-browser-languagedetector": "^6.1.5",
|
||||
"i18next-http-backend": "^1.4.1",
|
||||
"js-file-download": "^0.4.12",
|
||||
"next": "12.1.6",
|
||||
"next": "12.2.0",
|
||||
"next-i18next": "^11.3.0",
|
||||
"prism-react-renderer": "^1.3.5",
|
||||
"react": "^18.2.0",
|
||||
|
||||
23
src/middleware.ts
Normal file
23
src/middleware.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { NextFetchEvent, NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
export function middleware(req: NextRequest, ev: NextFetchEvent) {
|
||||
const isCorrectPassword = req.cookies.get('password') === process.env.PASSWORD;
|
||||
const url = req.nextUrl.clone();
|
||||
const skipURL = url.pathname && (
|
||||
url.pathname.includes('login') || url.pathname === ('/api/configs/tryPassword') || (
|
||||
url.pathname.includes('/_next/') && !url.pathname.includes('/pages/')
|
||||
) ||
|
||||
url.pathname === '/favicon.ico' ||
|
||||
url.pathname === '/404' ||
|
||||
url.pathname.includes('pages/_app')
|
||||
);
|
||||
if (
|
||||
!skipURL &&
|
||||
!isCorrectPassword &&
|
||||
process.env.PASSWORD
|
||||
) {
|
||||
url.pathname = '/login';
|
||||
return NextResponse.rewrite(url);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import { NextFetchEvent, NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
export function middleware(req: NextRequest, ev: NextFetchEvent) {
|
||||
const isCorrectPassword = req.cookies.password === process.env.PASSWORD;
|
||||
const url = req.nextUrl.clone();
|
||||
if (
|
||||
!isCorrectPassword &&
|
||||
url.pathname !== '/login' &&
|
||||
process.env.PASSWORD &&
|
||||
url.pathname !== '/api/configs/tryPassword'
|
||||
) {
|
||||
url.pathname = '/login';
|
||||
return NextResponse.rewrite(url);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ function Post(req: NextApiRequest, res: NextApiResponse) {
|
||||
}
|
||||
|
||||
export default async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
// Filter out if the reuqest is a POST or a GET
|
||||
// Filter out if the request is a POST or a GET
|
||||
if (req.method === 'POST') {
|
||||
return Post(req, res);
|
||||
}
|
||||
|
||||
146
yarn.lock
146
yarn.lock
@@ -1353,10 +1353,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/env@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/env@npm:12.1.6"
|
||||
checksum: e6a4f189f0d653d13dc7ad510f6c9d2cf690bfd9e07c554bd501b840f8dabc3da5adcab874b0bc01aab86c3647cff4fb84692e3c3b28125af26f0b05cd4c7fcf
|
||||
"@next/env@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/env@npm:12.2.0"
|
||||
checksum: 5fb317bdb5eb2d5df12ff55e335368792dba21874c5ece3cabf8cd312cec911a1d54ecf368e69dc08640b0244669b8a98c86cd035c7874b17640602e67c1b9d9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1369,86 +1369,93 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-android-arm-eabi@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-android-arm-eabi@npm:12.1.6"
|
||||
"@next/swc-android-arm-eabi@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-android-arm-eabi@npm:12.2.0"
|
||||
conditions: os=android & cpu=arm
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-android-arm64@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-android-arm64@npm:12.1.6"
|
||||
"@next/swc-android-arm64@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-android-arm64@npm:12.2.0"
|
||||
conditions: os=android & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-darwin-arm64@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-darwin-arm64@npm:12.1.6"
|
||||
"@next/swc-darwin-arm64@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-darwin-arm64@npm:12.2.0"
|
||||
conditions: os=darwin & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-darwin-x64@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-darwin-x64@npm:12.1.6"
|
||||
"@next/swc-darwin-x64@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-darwin-x64@npm:12.2.0"
|
||||
conditions: os=darwin & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-linux-arm-gnueabihf@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-linux-arm-gnueabihf@npm:12.1.6"
|
||||
"@next/swc-freebsd-x64@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-freebsd-x64@npm:12.2.0"
|
||||
conditions: os=freebsd & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-linux-arm-gnueabihf@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-linux-arm-gnueabihf@npm:12.2.0"
|
||||
conditions: os=linux & cpu=arm
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-linux-arm64-gnu@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-linux-arm64-gnu@npm:12.1.6"
|
||||
"@next/swc-linux-arm64-gnu@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-linux-arm64-gnu@npm:12.2.0"
|
||||
conditions: os=linux & cpu=arm64 & libc=glibc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-linux-arm64-musl@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-linux-arm64-musl@npm:12.1.6"
|
||||
"@next/swc-linux-arm64-musl@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-linux-arm64-musl@npm:12.2.0"
|
||||
conditions: os=linux & cpu=arm64 & libc=musl
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-linux-x64-gnu@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-linux-x64-gnu@npm:12.1.6"
|
||||
"@next/swc-linux-x64-gnu@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-linux-x64-gnu@npm:12.2.0"
|
||||
conditions: os=linux & cpu=x64 & libc=glibc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-linux-x64-musl@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-linux-x64-musl@npm:12.1.6"
|
||||
"@next/swc-linux-x64-musl@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-linux-x64-musl@npm:12.2.0"
|
||||
conditions: os=linux & cpu=x64 & libc=musl
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-win32-arm64-msvc@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-win32-arm64-msvc@npm:12.1.6"
|
||||
"@next/swc-win32-arm64-msvc@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-win32-arm64-msvc@npm:12.2.0"
|
||||
conditions: os=win32 & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-win32-ia32-msvc@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-win32-ia32-msvc@npm:12.1.6"
|
||||
"@next/swc-win32-ia32-msvc@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-win32-ia32-msvc@npm:12.2.0"
|
||||
conditions: os=win32 & cpu=ia32
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@next/swc-win32-x64-msvc@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "@next/swc-win32-x64-msvc@npm:12.1.6"
|
||||
"@next/swc-win32-x64-msvc@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "@next/swc-win32-x64-msvc@npm:12.2.0"
|
||||
conditions: os=win32 & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
@@ -1885,6 +1892,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@swc/helpers@npm:0.4.2":
|
||||
version: 0.4.2
|
||||
resolution: "@swc/helpers@npm:0.4.2"
|
||||
dependencies:
|
||||
tslib: ^2.4.0
|
||||
checksum: 0b8c86ad03b17b8fe57dc4498e25dc294ea6bc42558a6b92d8fcd789351dac80199409bef38a2e3ac06aae0fedddfc0ab9c34409acbf74e55d1bbbd74f68b6b7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@szmarczak/http-timer@npm:^4.0.5":
|
||||
version: 4.0.6
|
||||
resolution: "@szmarczak/http-timer@npm:4.0.6"
|
||||
@@ -4833,7 +4849,7 @@ __metadata:
|
||||
i18next-http-backend: ^1.4.1
|
||||
jest: ^28.1.3
|
||||
js-file-download: ^0.4.12
|
||||
next: 12.1.6
|
||||
next: 12.2.0
|
||||
next-i18next: ^11.3.0
|
||||
prettier: ^2.7.1
|
||||
prism-react-renderer: ^1.3.5
|
||||
@@ -6369,26 +6385,29 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"next@npm:12.1.6":
|
||||
version: 12.1.6
|
||||
resolution: "next@npm:12.1.6"
|
||||
"next@npm:12.2.0":
|
||||
version: 12.2.0
|
||||
resolution: "next@npm:12.2.0"
|
||||
dependencies:
|
||||
"@next/env": 12.1.6
|
||||
"@next/swc-android-arm-eabi": 12.1.6
|
||||
"@next/swc-android-arm64": 12.1.6
|
||||
"@next/swc-darwin-arm64": 12.1.6
|
||||
"@next/swc-darwin-x64": 12.1.6
|
||||
"@next/swc-linux-arm-gnueabihf": 12.1.6
|
||||
"@next/swc-linux-arm64-gnu": 12.1.6
|
||||
"@next/swc-linux-arm64-musl": 12.1.6
|
||||
"@next/swc-linux-x64-gnu": 12.1.6
|
||||
"@next/swc-linux-x64-musl": 12.1.6
|
||||
"@next/swc-win32-arm64-msvc": 12.1.6
|
||||
"@next/swc-win32-ia32-msvc": 12.1.6
|
||||
"@next/swc-win32-x64-msvc": 12.1.6
|
||||
"@next/env": 12.2.0
|
||||
"@next/swc-android-arm-eabi": 12.2.0
|
||||
"@next/swc-android-arm64": 12.2.0
|
||||
"@next/swc-darwin-arm64": 12.2.0
|
||||
"@next/swc-darwin-x64": 12.2.0
|
||||
"@next/swc-freebsd-x64": 12.2.0
|
||||
"@next/swc-linux-arm-gnueabihf": 12.2.0
|
||||
"@next/swc-linux-arm64-gnu": 12.2.0
|
||||
"@next/swc-linux-arm64-musl": 12.2.0
|
||||
"@next/swc-linux-x64-gnu": 12.2.0
|
||||
"@next/swc-linux-x64-musl": 12.2.0
|
||||
"@next/swc-win32-arm64-msvc": 12.2.0
|
||||
"@next/swc-win32-ia32-msvc": 12.2.0
|
||||
"@next/swc-win32-x64-msvc": 12.2.0
|
||||
"@swc/helpers": 0.4.2
|
||||
caniuse-lite: ^1.0.30001332
|
||||
postcss: 8.4.5
|
||||
styled-jsx: 5.0.2
|
||||
use-sync-external-store: 1.1.0
|
||||
peerDependencies:
|
||||
fibers: ">= 3.1.0"
|
||||
node-sass: ^6.0.0 || ^7.0.0
|
||||
@@ -6404,6 +6423,8 @@ __metadata:
|
||||
optional: true
|
||||
"@next/swc-darwin-x64":
|
||||
optional: true
|
||||
"@next/swc-freebsd-x64":
|
||||
optional: true
|
||||
"@next/swc-linux-arm-gnueabihf":
|
||||
optional: true
|
||||
"@next/swc-linux-arm64-gnu":
|
||||
@@ -6429,7 +6450,7 @@ __metadata:
|
||||
optional: true
|
||||
bin:
|
||||
next: dist/bin/next
|
||||
checksum: 670d544fd47670c29681d10824e6da625e9d4a048e564c8d9cb80d37f33c9ff9b5ca0a53e6d84d8d618b1fe7c9bb4e6b45040cb7e57a5c46b232a8f914425dc1
|
||||
checksum: 38456c33935122ac1581367e4982034be23269039a8470a66443d710334336f8f3fb587f25d172d138d84cf18c01d3a76627fb610c2e2e57bd1692277c23fa2b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -8191,6 +8212,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"use-sync-external-store@npm:1.1.0":
|
||||
version: 1.1.0
|
||||
resolution: "use-sync-external-store@npm:1.1.0"
|
||||
peerDependencies:
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0
|
||||
checksum: 8993a0b642f91d7fcdbb02b7b3ac984bd3af4769686f38291fe7fcfe73dfb73d6c64d20dfb7e5e7fbf5a6da8f5392d6f8e5b00c243a04975595946e82c02b883
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"use-sync-external-store@npm:^1.2.0":
|
||||
version: 1.2.0
|
||||
resolution: "use-sync-external-store@npm:1.2.0"
|
||||
|
||||
Reference in New Issue
Block a user