Compare commits

...

6 Commits
0.2.1 ... main

Author SHA1 Message Date
33f2c5cf07
Deployed to vercel 2023-09-18 15:38:40 +03:00
588e09ac00 Update README.md 2023-09-17 16:44:53 +03:00
e840ac4254
Added zip fb2 file suggestion
Updated docker build instructions and args
2023-09-17 16:42:44 +03:00
c6be8cfa8c
Added screenshots to readme 2023-09-17 14:56:45 +03:00
53ebf925aa Finally fixed envs 2022-12-15 23:59:52 +03:00
b92bd7656c Removed hardcoded env 2022-12-12 09:25:56 +03:00
6 changed files with 28 additions and 12 deletions

3
.gitignore vendored
View File

@ -2,4 +2,5 @@ node_modules/
package-lock.json
build/
pnpm-lock.yaml
.vscode
.vscode
.vercel

View File

@ -4,8 +4,8 @@ WORKDIR /app
COPY ./package.json ./
RUN npm install
COPY ./ ./
ENV SNOWPACK_PUBLIC_API_URL=https://publitebackend.dmitriy.icu
ENV SNOWPACK_PUBLIC_BASE_URL=https://publite.dmitriy.icu
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

View File

@ -8,6 +8,20 @@
Frontend for Publite service — E-Books reader
<table style="margin: auto">
<tr>
<td>
<img style="max-height: 50vh" src="public/images/screenshot3.webp"/>
</td>
<td>
<img style="max-height: 50vh" src="public/images/screenshot2.webp"/>
</td>
<td>
<img style="max-height: 50vh" src="public/images/screenshot1.webp"/>
</td>
</tr>
</table>
## Deploy
Dev environment setup:
@ -27,10 +41,10 @@ Simple docker deployment
```bash
# build docker image
docker build . -t publite_frontend
docker build . --build-arg PUBLIC_API_URL=<https://...> --build-arg PUBLIC_BASE_URL=<https://...> -t publite_frontend
# run it with docker
docker run -p <port>:80 publite_frontend
docker run -p <port>:8080 publite_frontend
```
Dokku deployment with image from Docker Hub

View File

@ -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. \

View File

@ -19,8 +19,8 @@ module.exports = {
plugins: [
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify("development"),
"process.env.PUBLIC_BASE_URL": JSON.stringify("http://localhost:8080"),
"process.env.PUBLIC_API_URL": JSON.stringify("http://localhost:8081"),
"process.env.PUBLIC_BASE_URL": JSON.stringify("http://localhost:8080"),
}),
...webpackConfig.plugins,
],

View File

@ -12,12 +12,8 @@ module.exports = {
plugins: [
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify("production"),
"process.env.PUBLIC_BASE_URL": JSON.stringify(
"https://publite.dmitriy.icu"
),
"process.env.PUBLIC_API_URL": JSON.stringify(
"https://publitebackend.dmitriy.icu"
),
"process.env.PUBLIC_API_URL": JSON.stringify(process.env.PUBLIC_API_URL),
"process.env.PUBLIC_BASE_URL": JSON.stringify(process.env.PUBLIC_BASE_URL),
}),
...webpackConfig.plugins,
],