Skip to content

Commit

Permalink
fix(webui): incorrect docker permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
bambanah committed Sep 12, 2024
1 parent 03735c1 commit 3b975de
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
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

0 comments on commit 3b975de

Please sign in to comment.