diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7d2cae507..968e97c44 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,15 @@ -FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:16 -RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && apt-get install ffmpeg gnupg2 -y +# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster +ARG VARIANT=16 +FROM mcr.microsoft.com/devcontainers/javascript-node:0-${VARIANT} as base + +# Setup the node environment ENV NODE_ENV=development + +# Install additional OS packages. +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ + curl tzdata ffmpeg && \ + rm -rf /var/lib/apt/lists/* + +# Move tone executable to appropriate directory +COPY --from=sandreas/tone:v0.1.5 /usr/local/bin/tone /usr/local/bin/ diff --git a/.devcontainer/dev.js b/.devcontainer/dev.js new file mode 100644 index 000000000..0d113a3e5 --- /dev/null +++ b/.devcontainer/dev.js @@ -0,0 +1,9 @@ +// Using port 3333 is important when running the client web app separately +const Path = require('path') +module.exports.config = { + Port: 3333, + ConfigPath: Path.resolve('config'), + MetadataPath: Path.resolve('metadata'), + FFmpegPath: '/usr/bin/ffmpeg', + FFProbePath: '/usr/bin/ffprobe' +} \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 428b7718b..1341b2c83 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,13 +1,40 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node { - "build": { "dockerfile": "Dockerfile" }, - "mounts": [ - "source=abs-node-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume" - ], - "features": { - "fish": "latest" + "name": "Audiobookshelf", + "build": { + "dockerfile": "Dockerfile", + // Update 'VARIANT' to pick a Node version: 18, 16, 14. + // Append -bullseye or -buster to pin to an OS version. + // Use -bullseye variants on local arm64/Apple Silicon. + "args": { + "VARIANT": "16" + } }, - "extensions": [ - "eamodio.gitlens", - "octref.vetur" - ] + "mounts": [ + "source=abs-server-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume", + "source=abs-client-node_modules,target=${containerWorkspaceFolder}/client/node_modules,type=volume" + ], + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 3000, + 3333 + ], + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "sh .devcontainer/post-create.sh", + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "dbaeumer.vscode-eslint", + "octref.vetur" + ] + } + } + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" } \ No newline at end of file diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 000000000..bd1e38733 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# Mark the working directory as safe for use with git +git config --global --add safe.directory $PWD + +# If there is no dev.js file, create it +if [ ! -f dev.js ]; then + cp .devcontainer/dev.js . +fi + +# Update permissions for node_modules folders +# https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-targeted-named-volume +if [ -d node_modules ]; then + sudo chown $(id -u):$(id -g) node_modules +fi + +if [ -d client/node_modules ]; then + sudo chown $(id -u):$(id -g) client/node_modules +fi + +# Install packages for the server +if [ -f package.json ]; then + npm ci +fi + +# Install packages and build the client +if [ -f client/package.json ]; then + (cd client; npm ci; npm run generate) +fi diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..fe61167aa --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Declare files that will always have CRLF line endings on checkout. +.devcontainer/post-create.sh text eol=lf diff --git a/.gitignore b/.gitignore index 8df68f625..25a8a7746 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ .env -dev.js -node_modules/ +/dev.js +**/node_modules/ /config/ /audiobooks/ /audiobooks2/ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..20706b262 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,44 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Debug server", + "runtimeExecutable": "npm", + "args": [ + "run", + "dev" + ], + "skipFiles": [ + "/**" + ] + }, + { + "type": "node", + "request": "launch", + "name": "Debug client (nuxt)", + "runtimeExecutable": "npm", + "args": [ + "run", + "dev" + ], + "cwd": "${workspaceFolder}/client", + "skipFiles": [ + "${workspaceFolder}//**" + ] + } + ], + "compounds": [ + { + "name": "Debug server and client (nuxt)", + "configurations": [ + "Debug server", + "Debug client (nuxt)" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..e041741fb --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,40 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "path": "client", + "type": "npm", + "script": "generate", + "detail": "nuxt generate", + "label": "Build client", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "dependsOn": [ + "Build client" + ], + "type": "npm", + "script": "dev", + "detail": "nodemon --watch server index.js", + "label": "Run server", + "group": { + "kind": "test", + "isDefault": true + } + }, + { + "path": "client", + "type": "npm", + "script": "dev", + "detail": "nuxt", + "label": "Run Live-reload client", + "group": { + "kind": "test", + "isDefault": false + } + } + ] +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index db7642bb9..fe2e00598 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN npm ci && npm cache clean --force RUN npm run generate ### STAGE 1: Build server ### -FROM sandreas/tone:v0.1.2 AS tone +FROM sandreas/tone:v0.1.5 AS tone FROM node:16-alpine ENV NODE_ENV=production @@ -29,4 +29,4 @@ HEALTHCHECK \ --timeout=3s \ --start-period=10s \ CMD curl -f http://127.0.0.1/healthcheck || exit 1 -CMD ["npm", "start"] +CMD ["node", "index.js"] diff --git a/build/debian/DEBIAN/preinst b/build/debian/DEBIAN/preinst index be2d8b794..ad6657efd 100644 --- a/build/debian/DEBIAN/preinst +++ b/build/debian/DEBIAN/preinst @@ -50,7 +50,7 @@ install_ffmpeg() { echo "Starting FFMPEG Install" WGET="wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz --output-document=ffmpeg-git-amd64-static.tar.xz" - WGET_TONE="wget https://github.com/sandreas/tone/releases/download/v0.1.2/tone-0.1.2-linux-x64.tar.gz --output-document=tone-0.1.2-linux-x64.tar.gz" + WGET_TONE="wget https://github.com/sandreas/tone/releases/download/v0.1.5/tone-0.1.5-linux-x64.tar.gz --output-document=tone-0.1.5-linux-x64.tar.gz" if ! cd "$FFMPEG_INSTALL_DIR"; then echo "Creating ffmpeg install dir at $FFMPEG_INSTALL_DIR" @@ -66,8 +66,8 @@ install_ffmpeg() { # Temp downloading tone library to the ffmpeg dir echo "Getting tone.." $WGET_TONE - tar xvf tone-0.1.2-linux-x64.tar.gz --strip-components=1 - rm tone-0.1.2-linux-x64.tar.gz + tar xvf tone-0.1.5-linux-x64.tar.gz --strip-components=1 + rm tone-0.1.5-linux-x64.tar.gz echo "Good to go on Ffmpeg (& tone)... hopefully" } diff --git a/client/assets/app.css b/client/assets/app.css index c823af2f8..b7b8499d2 100644 --- a/client/assets/app.css +++ b/client/assets/app.css @@ -112,7 +112,7 @@ input[type=number] { background-color: #373838; } -.tracksTable tr:hover { +.tracksTable tr:hover:not(:has(th)) { background-color: #474747; } @@ -232,6 +232,20 @@ Bookshelf Label -webkit-box-orient: vertical; } +.episode-subtitle-long { + word-break: break-word; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + line-height: 16px; + /* fallback */ + max-height: 72px; + /* fallback */ + -webkit-line-clamp: 6; + /* number of lines to show */ + -webkit-box-orient: vertical; +} + /* Padding for toastification toasts in the top right to not cover appbar/toolbar */ .app-bar-and-toolbar .Vue-Toastification__container.top-right { diff --git a/client/components/app/Appbar.vue b/client/components/app/Appbar.vue index 5f22febe6..3ae1f3ed8 100644 --- a/client/components/app/Appbar.vue +++ b/client/components/app/Appbar.vue @@ -15,8 +15,6 @@
-
+