diff --git a/.gitignore b/.gitignore index ab61217..3394cc7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,6 @@ client/.next data/ config.js -config.example.js -yarn.lock .DS_Store dist/ letsencrypt/ diff --git a/README.md b/README.md index df8f8ff..ca1314c 100644 --- a/README.md +++ b/README.md @@ -118,13 +118,14 @@ The best place to start is to copy the `en.json` file and work through it, trans ### Existing translations -| Language | Complete (estimate) | Contributed by | -|--------------------|---------------------|--------------------------------------------| -| English | 100% | | -| Russian | 100% | [@smlinux](https://github.com/smlinux) | -| Esperanto | 100% | [@smlinux](https://github.com/smlinux) | -| German | 15% | [@MikeMatau](https://github.com/MikeMatau) | -| Simplified Chinese | 95% | [@0EAC](https://github.com/0EAC) | +| Language | Complete (estimate) | Contributed by | +|--------------------|---------------------|----------------------------------------------------| +| English | 100% | | +| Russian | 100% | [@smlinux](https://github.com/smlinux) | +| Esperanto | 100% | [@smlinux](https://github.com/smlinux) | +| German | 100% | [@EchterAlsFake](https://github.com/EchterAlsFake) | +| Simplified Chinese | 95% | [@0EAC](https://github.com/0EAC) | +| French | 100% | [@Klaiment](https://github.com/Klaiment) | ## Screenshots diff --git a/api/Dockerfile b/api/Dockerfile index a68bcde..9cd92df 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,9 +1,9 @@ FROM node:16-alpine -ENV NODE_ENV=development +ENV NODE_ENV=production ENV SENTRY_DSN="https://9b9761216607428180ea3b32bd1c8e58@o140996.ingest.sentry.io/4504645996576768" LABEL org.opencontainers.image.source=https://github.com/tdjsnelling/sqtracker WORKDIR /sqtracker/app COPY . . RUN yarn install EXPOSE 3001 -CMD yarn start \ No newline at end of file +CMD yarn start diff --git a/api/package.json b/api/package.json index 9f08ad9..dc02c25 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "@sqtracker/api", - "version": "1.4.0", + "version": "1.5.0", "private": true, "license": "GPL-3.0-only", "scripts": { diff --git a/api/src/controllers/torrent.js b/api/src/controllers/torrent.js index b308361..e82bdc2 100644 --- a/api/src/controllers/torrent.js +++ b/api/src/controllers/torrent.js @@ -508,7 +508,6 @@ export const getTorrentsPage = async ({ created: 1, freeleech: 1, tags: 1, - poster: 1, confidenceScore: 1, }, }, diff --git a/client/Dockerfile b/client/Dockerfile index 1108e35..0b19958 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,6 +1,6 @@ FROM node:16-alpine AS builder ARG SENTRY_AUTH_TOKEN -ENV NODE_ENV=development +ENV NODE_ENV=production ENV SENTRY_ORG=tdjsnelling ENV SENTRY_PROJECT=sqtracker-frontend ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} @@ -11,7 +11,7 @@ RUN echo "{}" > /config.js RUN ./node_modules/.bin/next build FROM node:16-alpine -ENV NODE_ENV=development +ENV NODE_ENV=production ENV SENTRY_DSN="https://22bc43683da04040aa90e7683ffe022a@o140996.ingest.sentry.io/4504646040616960" LABEL org.opencontainers.image.source=https://github.com/tdjsnelling/sqtracker WORKDIR /sqtracker/client diff --git a/client/components/Input.js b/client/components/Input.js index c01b49d..9415317 100644 --- a/client/components/Input.js +++ b/client/components/Input.js @@ -56,18 +56,40 @@ export const WrapLabel = ({ label, children, as = "label", ...rest }) => children ); -const Input = ({ label, rows, my, mt, mb, width, forwardedRef, ...rest }) => { +const Input = ({ + label, + rows, + my, + mt, + mb, + width, + forwardedRef, + required, + ...rest +}) => { return ( - + {rows ? ( ) : ( - + )} ); diff --git a/client/components/Select.js b/client/components/Select.js index c76f35c..20f2a3f 100644 --- a/client/components/Select.js +++ b/client/components/Select.js @@ -31,11 +31,11 @@ const StyledSelect = styled.select( typography ); -const Select = ({ label, fRef, ...rest }) => { +const Select = ({ label, required, fRef, ...rest }) => { return ( - + - + { userStats.ratio < Number(SQ_MINIMUM_RATIO)) || (Number(SQ_MAXIMUM_HIT_N_RUNS) !== -1 && userStats.hitnruns > Number(SQ_MAXIMUM_HIT_N_RUNS)); + function isPngImage(data) { const pngHeader = "data:image/png;base64,"; return data.startsWith(pngHeader); } + return ( <> @@ -606,7 +608,6 @@ const Torrent = ({ token, torrent = {}, userId, userRole, uid, userStats }) => { )} - { : [getLocaleString("torrNo")], }} /> - - - {getLocaleString("PosterImage")} - - Poster - - + {torrent.poster && ( + + + {getLocaleString("posterImage")} + + + + )} { )} - {console.log(torrent)} { setDropError(e.message); } }, []); + const onPosterDrop = useCallback((acceptedFiles) => { try { const [file] = acceptedFiles; @@ -249,13 +250,11 @@ const Upload = ({ token, userId }) => { }; reader.onerror = () => { console.log(`[DEBUG] Poster upload error: ${reader.error}`); - // Gérer les erreurs, si nécessaire }; reader.readAsDataURL(file); } } catch (e) { console.error(e); - // Gérer les erreurs, si nécessaire } }, []); @@ -275,6 +274,7 @@ const Upload = ({ token, userId }) => { "image/png": [".png"], }, maxFiles: 1, + maxSize: 5242880, //5Mo }); function isPngImage(data) { const pngHeader = "data:image/png;base64,"; @@ -287,9 +287,7 @@ const Upload = ({ token, userId }) => { const form = new FormData(e.target); try { - form.append("poster", posterFile.b64); // Ajoutez la valeur de l'image de l'affiche à la requête if (!torrentFile) throw new Error("No .torrent file added"); - const uploadRes = await fetch(`${SQ_API_URL}/torrent/upload`, { method: "POST", headers: { @@ -306,7 +304,7 @@ const Upload = ({ token, userId }) => { tags: form.get("tags"), groupWith, mediaInfo: form.get("mediaInfo"), - poster: posterFile.b64, + poster: posterFile ? posterFile.b64 : null, }), }); @@ -398,55 +396,65 @@ const Upload = ({ token, userId }) => { )}
- - - - - {torrentFile ? ( - - {torrentFile.name} - - ) : isDragActive ? ( - - {getLocaleString("uploadDropFileHere")} - - ) : ( - - {getLocaleString("uploadDragDropClickSelect")} - - )} - - - {dropError && ( - - {getLocaleString("uploadCouldNotUploadTorrent")}: {dropError} - - )} - - - - - - {posterFile ? ( - Poster - ) : isPosterDragActive ? ( - - {getLocaleString("uploadDropImageHere")} - - ) : ( - - {getLocaleString("uploadDragDropClickSelectPoster")} - - )} - - + + + + + + {torrentFile ? ( + + {torrentFile.name} + + ) : isDragActive ? ( + + {getLocaleString("uploadDropFileHere")} + + ) : ( + + {getLocaleString("uploadDragDropClickSelect")} + + )} + + + {dropError && ( + + {getLocaleString("uploadCouldNotUploadTorrent")}: {dropError} + + )} + + + + + + {posterFile ? ( + Poster + ) : isPosterDragActive ? ( + + {getLocaleString("uploadDropImageHere")} + + ) : ( + + {getLocaleString("uploadDragDropClickSelectPoster")} + + )} + + + { ) : undefined } /> - {groupWith && (