A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
feat: Allow storing assets in a separate directory. Fixes #1091
Mohamed Bassemd86f601f554c
diff --git a/docs/docs/03-configuration.md b/docs/docs/03-configuration.mdindex 235462ef..51ee23a5 100644--- a/docs/docs/03-configuration.md+++ b/docs/docs/03-configuration.md@@ -4,7 +4,8 @@ The app is mainly configured by environment variables. All the used environment| Name | Required | Default | Description || ------------------------- | ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |-| DATA_DIR | Yes | Not set | The path for the persistent data directory. This is where the db and the uploaded assets live. |+| DATA_DIR | Yes | Not set | The path for the persistent data directory. This is where the db lives. Assets are stored here by default unless `ASSETS_DIR` is set. |+| ASSETS_DIR | No | Not set | The path where crawled assets will be stored. If not set, defaults to `${DATA_DIR}/assets`. || NEXTAUTH_URL | Yes | Not set | Should point to the address of your server. The app will function without it, but will redirect you to wrong addresses on signout for example. || NEXTAUTH_SECRET | Yes | Not set | Random string used to sign the JWT tokens. Generate one with `openssl rand -base64 36`. || MEILI_ADDR | No | Not set | The address of meilisearch. If not set, Search will be disabled. E.g. (`http://meilisearch:7700`) |@@ -35,7 +36,7 @@ When setting up OAuth, the allowed redirect URLs configured at the provider shou| OAUTH_SCOPE | No | "openid email profile" | "Full list of scopes to request (space delimited)" || OAUTH_PROVIDER_NAME | No | "Custom Provider" | The name of your provider. Will be shown on the signup page as "Sign in with `<name>`" || OAUTH_ALLOW_DANGEROUS_EMAIL_ACCOUNT_LINKING | No | false | Whether existing accounts in hoarder stored in the database should automatically be linked with your OAuth account. Only enable it if you trust the OAuth provider! |-| OAUTH_TIMEOUT | No | 3500 | The wait time in milliseconds for the OAuth provider response. Increase this if you are having `outgoing request timed out` errors |+| OAUTH_TIMEOUT | No | 3500 | The wait time in milliseconds for the OAuth provider response. Increase this if you are having `outgoing request timed out` errors |For more information on `OAUTH_ALLOW_DANGEROUS_EMAIL_ACCOUNT_LINKING`, check the [next-auth.js documentation](https://next-auth.js.org/configuration/providers/oauth#allowdangerousemailaccountlinking-option).@@ -89,7 +90,7 @@ Either `OPENAI_API_KEY` or `OLLAMA_BASE_URL` need to be set for automatic taggin| CRAWLER_VIDEO_DOWNLOAD_MAX_SIZE | No | 50 | The maximum file size for the downloaded video. The quality will be chosen accordingly. Use -1 to disable the limit. || CRAWLER_VIDEO_DOWNLOAD_TIMEOUT_SEC | No | 600 | How long to wait for the video download to finish || CRAWLER_ENABLE_ADBLOCKER | No | true | Whether to enable an adblocker in the crawler or not. If you're facing troubles downloading the adblocking lists on worker startup, you can disable this. |-| CRAWLER_YTDLP_ARGS | No | [] | Include additional yt-dlp arguments to be passed at crawl time separated by %%: https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#general-options+| CRAWLER_YTDLP_ARGS | No | [] | Include additional yt-dlp arguments to be passed at crawl time separated by %%: https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#general-options |## OCR Configsdiff --git a/packages/shared/assetdb.ts b/packages/shared/assetdb.tsindex 974f7893..3ac92067 100644--- a/packages/shared/assetdb.ts+++ b/packages/shared/assetdb.ts@@ -6,7 +6,7 @@ import { z } from "zod";import serverConfig from "./config";import logger from "./logger";-const ROOT_PATH = path.join(serverConfig.dataDir, "assets");+const ROOT_PATH = serverConfig.assetsDir;export const enum ASSET_TYPES {IMAGE_JPEG = "image/jpeg",diff --git a/packages/shared/config.ts b/packages/shared/config.tsindex 55c13df5..fd224ea7 100644--- a/packages/shared/config.ts+++ b/packages/shared/config.ts@@ -1,3 +1,4 @@+import path from "path";import { z } from "zod";const stringBool = (defaultValue: string) =>@@ -62,6 +63,7 @@ const allEnv = z.object({DEMO_MODE_EMAIL: z.string().optional(),DEMO_MODE_PASSWORD: z.string().optional(),DATA_DIR: z.string().default(""),+ ASSETS_DIR: z.string().optional(),MAX_ASSET_SIZE_MB: z.coerce.number().default(50),INFERENCE_LANG: z.string().default("english"),WEBHOOK_TIMEOUT_SEC: z.coerce.number().default(5),@@ -145,6 +147,7 @@ const serverConfigSchema = allEnv.transform((val) => {}: undefined,dataDir: val.DATA_DIR,+ assetsDir: val.ASSETS_DIR ?? path.join(val.DATA_DIR, "assets"),maxAssetSizeMb: val.MAX_ASSET_SIZE_MB,serverVersion: val.SERVER_VERSION,disableNewReleaseCheck: val.DISABLE_NEW_RELEASE_CHECK,