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

fix(webui): incorrect docker permissions #86

Merged
merged 1 commit into from
Sep 12, 2024
Merged
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
5 changes: 5 additions & 0 deletions .changeset/lucky-planes-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"deemix-webui": patch
---

Actually fix docker permissions
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**node_modules/
**dist/
gui/
**/tsconfig.tsbuildinfo
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,30 @@ RUN pnpm turbo build --filter=deemix-webui...

FROM base AS runner

RUN apk add --no-cache su-exec

ENV NODE_ENV=production

ENV DEEMIX_DATA_DIR=/config
ENV DEEMIX_MUSIC_DIR=/downloads
ENV DEEMIX_HOST=0.0.0.0

RUN apk add --no-cache shadow
COPY --from=installer /app .

# RUN groupmod -g 1000 users
RUN useradd -u 911 -U -d /config -s /bin/false abc
RUN usermod -G users abc
RUN mkdir -p \
$DEEMIX_DATA_DIR \
$DEEMIX_MUSIC_DIR

COPY --from=installer /app .
# Create an entrypoint script
RUN echo '#!/bin/sh' > /entrypoint.sh && \
echo 'chown -R nobody:users $DEEMIX_DATA_DIR $DEEMIX_MUSIC_DIR' >> /entrypoint.sh && \
echo 'chmod -R 775 $DEEMIX_DATA_DIR $DEEMIX_MUSIC_DIR' >> /entrypoint.sh && \
echo 'exec su-exec nobody:users "$@"' >> /entrypoint.sh && \
chmod +x /entrypoint.sh

EXPOSE 6595

WORKDIR /app/webui

ENTRYPOINT ["node", "dist/main.js"]
ENTRYPOINT ["/entrypoint.sh"]
CMD ["node", "dist/main.js"]
15 changes: 11 additions & 4 deletions deemix/src/utils/getPreferredBitrate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { Deezer, TrackFormats, errors as _errors, utils } from "deezer-sdk";
import { HTTPError, ReadError, TimeoutError, default as got } from "got";
import {
HTTPError,
ReadError,
TimeoutError,
default as got,
type CancelableRequest,
type Response as GotResponse,
} from "got";
import { generateCryptedStreamURL } from "../decryption";
import { PreferredBitrateNotFound, TrackNot360 } from "../errors";
import Track from "../types/Track";
Expand Down Expand Up @@ -35,7 +42,7 @@ export async function getPreferredBitrate(

async function testURL(track: Track, url: string, formatName: string) {
if (!url) return false;
let request;
let request: CancelableRequest<GotResponse<string>>;
try {
request = got
.get(url, {
Expand Down Expand Up @@ -75,8 +82,8 @@ export async function getPreferredBitrate(
let url;
wrongLicense =
((formatName === "FLAC" || formatName.startsWith("MP4_RA")) &&
!dz.current_user.can_stream_lossless) ||
(formatName === "MP3_320" && !dz.current_user.can_stream_hq);
!dz.current_user?.can_stream_lossless) ||
(formatName === "MP3_320" && !dz.current_user?.can_stream_hq);
if (
track.filesizes[`${formatName.toLowerCase()}`] &&
track.filesizes[`${formatName.toLowerCase()}`] !== "0"
Expand Down