Compare commits
2
Commits
main
...
ec5671ec9f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec5671ec9f | ||
|
|
9be459b522 |
@@ -25,18 +25,24 @@ jobs:
|
|||||||
|
|
||||||
lint-frontend:
|
lint-frontend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Bun
|
||||||
|
uses: oven-sh/setup-bun@v1
|
||||||
|
|
||||||
|
- name: Restore Bun cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.bun/install/cache
|
||||||
|
key: ${{ runner.os }}-bun-${{ hashFiles('kotosoft-id-frontend/bun.lock') }}
|
||||||
|
|
||||||
- name: Lint frontend
|
- name: Lint frontend
|
||||||
run: |
|
run: |
|
||||||
docker run --rm \
|
cd kotosoft-id-frontend
|
||||||
-v "$PWD/kotosoft-id-frontend:/app" \
|
bun install
|
||||||
-w /app \
|
bun run lint
|
||||||
node:20-alpine \
|
|
||||||
sh -c 'npm install && npm run lint'
|
|
||||||
|
|
||||||
build-backend:
|
build-backend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export async function proxy(request: NextRequest) {
|
|||||||
const isPublicPath = PUBLIC_PATHS.includes(pathname);
|
const isPublicPath = PUBLIC_PATHS.includes(pathname);
|
||||||
const session = request.nextUrl.searchParams.get("session");
|
const session = request.nextUrl.searchParams.get("session");
|
||||||
|
|
||||||
if (hasRefreshToken && session && pathname === "/login") {
|
if (session && pathname === "/login") {
|
||||||
const accessToken = request.cookies.get("access_token")?.value;
|
const accessToken = request.cookies.get("access_token")?.value;
|
||||||
try {
|
try {
|
||||||
await fetch(`${process.env.KOTOSOFT_ID_API_URL}/oauth/session/attach`, {
|
await fetch(`${process.env.KOTOSOFT_ID_API_URL}/oauth/session/attach`, {
|
||||||
@@ -27,7 +27,11 @@ export async function proxy(request: NextRequest) {
|
|||||||
return NextResponse.redirect(new URL(`/consent?session=${session}`, request.url));
|
return NextResponse.redirect(new URL(`/consent?session=${session}`, request.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasRefreshToken && (isPublicPath || pathname === "/")) {
|
if (session && pathname === "/consent") {
|
||||||
|
return NextResponse.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasRefreshToken && !session && (isPublicPath || pathname === "/")) {
|
||||||
return NextResponse.redirect(new URL("/me", request.url));
|
return NextResponse.redirect(new URL("/me", request.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user