diff --git a/next.config.js b/next.config.js index 31fc7b641..a6c9032b0 100644 --- a/next.config.js +++ b/next.config.js @@ -9,8 +9,6 @@ module.exports = withBundleAnalyzer({ eslint: { ignoreDuringBuilds: true, }, - experimental: { - outputStandalone: true, - }, + output: 'standalone', basePath: env.BASE_URL, }); diff --git a/package.json b/package.json index a04acfa24..3d0cae17c 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "dockerode": "^3.3.2", "framer-motion": "^6.3.1", "js-file-download": "^0.4.12", - "next": "12.1.6", + "next": "^12.2.0", "prism-react-renderer": "^1.3.1", "react": "^17.0.1", "react-dom": "^17.0.1", @@ -57,8 +57,8 @@ }, "devDependencies": { "@babel/core": "^7.17.8", - "@next/bundle-analyzer": "^12.1.4", - "@next/eslint-plugin-next": "^12.1.4", + "@next/bundle-analyzer": "^12.2.0", + "@next/eslint-plugin-next": "^12.2.0", "@storybook/react": "^6.5.4", "@types/dockerode": "^3.3.9", "@types/node": "^17.0.23", diff --git a/src/middleware.ts b/src/middleware.ts new file mode 100644 index 000000000..b8d9cd942 --- /dev/null +++ b/src/middleware.ts @@ -0,0 +1,15 @@ +import { NextFetchEvent, NextRequest, NextResponse } from 'next/server'; + +export function middleware(req: NextRequest, ev: NextFetchEvent) { + const ok = req.cookies.get('password') === process.env.PASSWORD; + const url = req.nextUrl.clone(); + if ( + !ok && + url.pathname !== '/login' && + process.env.PASSWORD && + url.pathname !== '/api/configs/tryPassword' + ) { + url.pathname = '/login'; + } + return NextResponse.rewrite(url); +} diff --git a/yarn.lock b/yarn.lock index 929ce5a86..527c01988 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2409,111 +2409,118 @@ __metadata: languageName: node linkType: hard -"@next/bundle-analyzer@npm:^12.1.4": - version: 12.1.6 - resolution: "@next/bundle-analyzer@npm:12.1.6" +"@next/bundle-analyzer@npm:^12.2.0": + version: 12.2.0 + resolution: "@next/bundle-analyzer@npm:12.2.0" dependencies: webpack-bundle-analyzer: 4.3.0 - checksum: cf37be49d45d706aea95df489656341bec64783e567067d15036b25330d7a69204987b2c402277f201b9bf943de588323b120fd8096bb3d6846a054bbb2cdc7e + checksum: e08770ed2f7bfa4fb38c29d58d1e3ad198fa7e9a8c061ea5e15950dd10576bed0b5b8c19266e18503af1d211a0d8d450b5fed4926f6863135b38e585d6fd1980 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 -"@next/eslint-plugin-next@npm:^12.1.4": - version: 12.1.6 - resolution: "@next/eslint-plugin-next@npm:12.1.6" +"@next/eslint-plugin-next@npm:^12.2.0": + version: 12.2.0 + resolution: "@next/eslint-plugin-next@npm:12.2.0" dependencies: glob: 7.1.7 - checksum: 33dcaf71f299d3c8a0744cad512369f92d7a355f3c0d57f2496e888e4242080c49226ec2c59ba2efac04b3a1df51c36019b853b4177df082ca4621a1713a2229 + checksum: 2e33b9af79af680fd873d74e91bed397930a91802c1d7a293db757227ebc431d3d856de69477dc178dec8b531635ea69d79b188293024f1371afe6c348dbe647 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 @@ -3783,6 +3790,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:^5.0.1": version: 5.0.1 resolution: "@szmarczak/http-timer@npm:5.0.1" @@ -9565,8 +9581,8 @@ __metadata: "@mantine/next": ^4.2.8 "@mantine/notifications": ^4.2.8 "@mantine/prism": ^4.2.8 - "@next/bundle-analyzer": ^12.1.4 - "@next/eslint-plugin-next": ^12.1.4 + "@next/bundle-analyzer": ^12.2.0 + "@next/eslint-plugin-next": ^12.2.0 "@nivo/core": ^0.79.0 "@nivo/line": ^0.79.1 "@storybook/react": ^6.5.4 @@ -9596,7 +9612,7 @@ __metadata: framer-motion: ^6.3.1 jest: ^28.1.0 js-file-download: ^0.4.12 - next: 12.1.6 + next: ^12.2.0 prettier: ^2.6.2 prism-react-renderer: ^1.3.1 react: ^17.0.1 @@ -12119,26 +12135,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 @@ -12154,6 +12173,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": @@ -12179,7 +12200,7 @@ __metadata: optional: true bin: next: dist/bin/next - checksum: 670d544fd47670c29681d10824e6da625e9d4a048e564c8d9cb80d37f33c9ff9b5ca0a53e6d84d8d618b1fe7c9bb4e6b45040cb7e57a5c46b232a8f914425dc1 + checksum: 38456c33935122ac1581367e4982034be23269039a8470a66443d710334336f8f3fb587f25d172d138d84cf18c01d3a76627fb610c2e2e57bd1692277c23fa2b languageName: node linkType: hard @@ -15662,7 +15683,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.0.0, tslib@npm:^2.0.1, tslib@npm:^2.0.3, tslib@npm:^2.1.0": +"tslib@npm:^2.0.0, tslib@npm:^2.0.1, tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.4.0": version: 2.4.0 resolution: "tslib@npm:2.4.0" checksum: 8c4aa6a3c5a754bf76aefc38026134180c053b7bd2f81338cb5e5ebf96fefa0f417bff221592bf801077f5bf990562f6264fecbc42cd3309b33872cb6fc3b113 @@ -16098,6 +16119,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@npm:^3.1.0": version: 3.1.1 resolution: "use@npm:3.1.1"