change default umask to 0002 to allow group users to act on files and folders.

This commit is contained in:
ArabCoders 2025-01-28 17:18:54 +03:00
parent d063cf0f52
commit 2b84aad836
3 changed files with 18 additions and 3 deletions

View file

@ -2,7 +2,7 @@ FROM node:lts-alpine AS node_builder
WORKDIR /app
COPY ui ./
RUN if [ ! -d /app/exported ]; then yarn install --production --prefer-offline --frozen-lockfile && yarn run generate; else echo "Skipping UI build, already built."; fi
RUN if [ ! -f "/app/exported/index.html" ]; then yarn install --production --prefer-offline --frozen-lockfile && yarn run generate; else echo "Skipping UI build, already built."; fi
FROM python:3.11-alpine AS python_builder
@ -26,7 +26,7 @@ FROM python:3.11-alpine
ARG TZ=UTC
ARG USER_ID=1000
ENV IN_CONTAINER=1
ENV UMASK=022
ENV UMASK=0002
ENV YTP_CONFIG_PATH=/config
ENV YTP_TEMP_PATH=/tmp
ENV YTP_DOWNLOAD_PATH=/downloads

View file

@ -26,7 +26,6 @@ IGNORED_KEYS: tuple[str] = (
"download_archive",
)
YTDLP_INFO_CLS: yt_dlp.YoutubeDL = None
OS_ALT_SEP: list[str] = list(sep for sep in [os.sep, os.path.altsep] if sep is not None and sep != "/")
class StreamingError(Exception):
@ -119,6 +118,9 @@ def calcDownloadPath(basePath: str, folder: str | None = None, createPath: bool
if not folder:
return basePath
if folder.startswith("/"):
folder = folder[1:]
realBasePath = os.path.realpath(basePath)
download_path = os.path.realpath(os.path.join(basePath, folder))

View file

@ -19,4 +19,17 @@ if [ ! -w "${YTP_CONFIG_PATH}" ]; then
exit 1
fi
if [ ! -w "${YTP_DOWNLOAD_PATH}" ]; then
CH_USER=$(stat -c "%u" "${YTP_DOWNLOAD_PATH}")
CH_GRP=$(stat -c "%g" "${YTP_DOWNLOAD_PATH}")
echo_err "ERROR: Unable to write to '${YTP_DOWNLOAD_PATH}' downloads directory. Current user id '${UID}' while directory owner is '${CH_USER}'."
echo_err "[Running under docker]"
echo_err "change docker-compose.yaml user: to user:\"${CH_USER}:${CH_GRP}\""
echo_err "Run the following command to change the directory ownership"
echo_err "chown -R \"${CH_USER}:${CH_GRP}\" ./config"
echo_err "[Running under podman]"
echo_err "change docker-compose.yaml user: to user:\"0:0\""
exit 1
fi
exec "${@}"