diff --git a/Dockerfile b/Dockerfile index 0be2ff5..0ae34c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,8 @@ WORKDIR /app COPY ./package.json ./ RUN npm install COPY ./ ./ -ENV PUBLIC_API_URL=https://publitebackend.dm1sh.ru -ENV PUBLIC_BASE_URL=https://publite.dm1sh.ru +ARG PUBLIC_API_URL=https://publitebackend.dm1sh.ru +ARG PUBLIC_BASE_URL=https://publite.dm1sh.ru RUN NODE_ENV=production npm run build FROM node:alpine diff --git a/README.md b/README.md index ded6ca8..c82b09d 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,10 @@ Simple docker deployment ```bash # build docker image -docker build . -t publite_frontend +docker build . --build-arg PUBLIC_API_URL=<> --build-arg PUBLIC_BASE_URL=<> -t publite_frontend # run it with docker -docker run -p :80 publite_frontend +docker run -p :8080 publite_frontend ``` Dokku deployment with image from Docker Hub diff --git a/src/utils/api.ts b/src/utils/api.ts index 4ea53a8..3810ae1 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -5,6 +5,11 @@ import { API_URL } from "~/constants"; export const validState = (file: File | undefined): file is File => { if (!file) throw new Error("Book file is required. Please, attach one"); + if (file.name.endsWith(".zip")) + throw new Error( + "Please, unzip file before sending to reader if it is fb2.zip" + ) + if (!file.name.match(/\.(fb2|epub)/)) throw new Error( "Wrong file type. Only FB2 and Epub files are supported. \