Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps #72

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
// diabled optimizeForSpeed becasue styled-jsx style not found error wehn updating styles
// diabled optimiuzeForSpeed becasue styled-jsx style not fond error wehn updating styles
// framework.cb05d56be993eb6b088a.js:1 DOMException: Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to insert the rule.
//https://github.com/vercel/styled-jsx/issues/295
"presets": [["next/babel", { "styled-jsx": { "optimizeForSpeed": false } }]]
Expand Down
109 changes: 0 additions & 109 deletions .github/workflows/browsertesting.yml

This file was deleted.

8 changes: 2 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@ jobs:
# Maps tcp port 5432 on service container to the host
- 5432:5432

# strategy:
# matrix:
# node-version: [14.x]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js 14.x
- name: Set up Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 18.x

- name: Cache node modules
uses: actions/cache@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on:
push:
branches:
- master

jobs:
Publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
# if: ${{ github.event.workflow_run.conclusion == 'success' }}

runs-on: ubuntu-latest

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG DATABASE_URL
ARG HASHSALT
ARG RAILWAY=0
# Install dependencies only when needed
FROM node:alpine AS deps
FROM node:18-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.

ENV NEXT_TELEMETRY_DISABLED 1
Expand All @@ -16,7 +16,7 @@ RUN npm ci


# Rebuild the source code only when needed
FROM node:alpine AS builder
FROM node:18-alpine AS builder

ARG DATABASE_URL
ARG RAILWAY=0
Expand All @@ -38,7 +38,7 @@ RUN npm run build-next
#&& yarn install --production --ignore-scripts --prefer-offline

# Production image, copy all the files and run next
FROM node:alpine AS runner
FROM node:18-alpine AS runner

ARG DATABASE_URL
ARG HASHSALT
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- "3000:3000"
environment:
DATABASE_URL: "postgres://linkin:linkin123@db:5432/linkin"
HASHSALT: "123" # random secret key
HASHSALT: "1234" # random secret key
NODE_ENV: "production"
depends_on:
- db
Expand All @@ -34,7 +34,6 @@ services:
POSTGRES_USER: "linkin"
POSTGRES_PASSWORD: "linkin123"
volumes:
# - ./scripts/db-migrate.sql:/docker-entrypoint-initdb.d/db-migrate.sql
- linkin-data:/var/lib/postgresql/data
volumes:
linkin-data:
26 changes: 19 additions & 7 deletions middleware/middleware.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// import Cors from "cors";

import { parse } from "cookie";
import { parseSecureToken } from "../lib/crypto";

Expand Down Expand Up @@ -46,9 +44,15 @@ export function jwtAuth(req, res, next) {
export function cookieValidate(req, res) {
let cookie = req.headers?.cookie;

// console.log("dashboard cookie");

if (!cookie) {
res.setHeader("location", "/admin");
res.statusCode = 302;
res.writeHead(302, {
location: "/admin",
"Content-Type": "text/html",
});
// res.setHeader("location", "/admin");
// res.statusCode = 302;
res.end();
return new Error("cookie invalid");
}
Expand All @@ -58,7 +62,11 @@ export function cookieValidate(req, res) {
let decodedToken = parseSecureToken(token);

if (!decodedToken) {
res.setHeader("location", "/admin");
res.writeHead(302, {
location: "/admin",
"Content-Type": "text/html",
});
// res.setHeader("location", "/admin");
res.statusCode = 302;
res.end();
return new Error("cookie invalid");
Expand All @@ -75,8 +83,12 @@ export function cookieValidateLogin(req, res) {
let decodedToken = parseSecureToken(token);

if (decodedToken) {
res.setHeader("location", "/dashboard");
res.statusCode = 302;
res.writeHead(302, {
location: "/dashboard",
"Content-Type": "text/html",
});
// res.setHeader("location", "/dashboard");
// res.statusCode = 302;
res.end();
}
}
Loading
Loading