diff --git a/Dockerfile b/Dockerfile index 05908b9..c176c30 100644 --- a/Dockerfile +++ b/Dockerfile @@ -138,6 +138,7 @@ echo "Database: SQLite" # Set global environment variables export DATABASE_URL="file:/app/server/prisma/palmr.db" +export NEXT_PUBLIC_DEFAULT_LANGUAGE=\${DEFAULT_LANGUAGE:-en-US} # Ensure /app/server directory exists for bind mounts mkdir -p /app/server/uploads /app/server/temp-uploads /app/server/prisma diff --git a/apps/docs/content/docs/3.1-beta/quick-start.mdx b/apps/docs/content/docs/3.1-beta/quick-start.mdx index c953216..26186fa 100644 --- a/apps/docs/content/docs/3.1-beta/quick-start.mdx +++ b/apps/docs/content/docs/3.1-beta/quick-start.mdx @@ -58,6 +58,7 @@ services: - ENCRYPTION_KEY=change-this-key-in-production-min-32-chars # CHANGE THIS KEY FOR SECURITY # - DISABLE_FILESYSTEM_ENCRYPTION=false # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional) # - SECURE_SITE=false # Set to true if you are using a reverse proxy + # - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) ports: - "5487:5487" # Web interface - "3333:3333" # API port (OPTIONAL EXPOSED - ONLY IF YOU WANT TO ACCESS THE API DIRECTLY) @@ -107,6 +108,7 @@ services: - PALMR_GID=1000 # GID for the container processes (default is 1001) # - DISABLE_FILESYSTEM_ENCRYPTION=false # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional) # - SECURE_SITE=false # Set to true if you are using a reverse proxy + # - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) ports: - "5487:5487" # Web port - "3333:3333" # API port (OPTIONAL EXPOSED - ONLY IF YOU WANT TO ACCESS THE API DIRECTLY) @@ -130,12 +132,15 @@ docker-compose up -d Configure Palmr. behavior through environment variables: -| Variable | Default | Description | -| ------------------------------- | ------- | ------------------------------------------------------------------------------------ | -| `ENABLE_S3` | `false` | Enable S3-compatible storage | -| `ENCRYPTION_KEY` | - | **Required** (unless encryption disabled): Minimum 32 characters for file encryption | -| `DISABLE_FILESYSTEM_ENCRYPTION` | `false` | Disable file encryption for direct filesystem access | -| `SECURE_SITE` | `false` | Enable secure cookies for HTTPS/reverse proxy setups | +| Variable | Default | Description | +| ------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | +| `ENABLE_S3` | `false` | Enable S3-compatible storage | +| `ENCRYPTION_KEY` | - | **Required** (unless encryption disabled): Minimum 32 characters for file encryption | +| `DISABLE_FILESYSTEM_ENCRYPTION` | `false` | Disable file encryption for direct filesystem access | +| `SECURE_SITE` | `false` | Enable secure cookies for HTTPS/reverse proxy setups | +| `DEFAULT_LANGUAGE` | `en-US` | Set the default application language (see supported languages in docs [here](/docs/3.1-beta/available-languages)) | +| `PALMR_UID` | `1001` | Set the UID for the container processes (OPTIONAL - default is 1001) | +| `PALMR_GID` | `1001` | Set the GID for the container processes (OPTIONAL - default is 1001) | > **⚠️ Security Warning**: Always change the `ENCRYPTION_KEY` in production when encryption is enabled. This key encrypts your files - losing it makes files permanently inaccessible. @@ -184,8 +189,11 @@ docker run -d \ --name palmr \ -e ENABLE_S3=false \ -e ENCRYPTION_KEY=your-secure-key-min-32-chars \ + # -e PALMR_UID=1000 # UID for the container processes (default is 1001) + # -e PALMR_GID=1000 # GID for the container processes (default is 1001) # -e DISABLE_FILESYSTEM_ENCRYPTION=true # Uncomment to disable file encryption (ENCRYPTION_KEY becomes optional) # -e SECURE_SITE=false # Set to true if you are using a reverse proxy + # -e DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) -p 5487:5487 \ -p 3333:3333 \ -v palmr_data:/app/server \ @@ -206,6 +214,7 @@ docker run -d \ -e PALMR_GID=1000 # GID for the container processes (default is 1001) # -e DISABLE_FILESYSTEM_ENCRYPTION=true # Uncomment to disable file encryption (ENCRYPTION_KEY becomes optional) # -e SECURE_SITE=false # Set to true if you are using a reverse proxy + # -e DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) -p 5487:5487 \ -p 3333:3333 \ -v $(pwd)/data:/app/server \ diff --git a/apps/web/.env.example b/apps/web/.env.example index 98f7f50..0fcf045 100644 --- a/apps/web/.env.example +++ b/apps/web/.env.example @@ -1 +1,2 @@ -API_BASE_URL=http:localhost:3333 \ No newline at end of file +API_BASE_URL=http:localhost:3333 +NEXT_PUBLIC_DEFAULT_LANGUAGE=en-US \ No newline at end of file diff --git a/apps/web/src/app/(shares)/r/[alias]/components/transparent-footer.tsx b/apps/web/src/app/(shares)/r/[alias]/components/transparent-footer.tsx index 950f385..1e2ed78 100644 --- a/apps/web/src/app/(shares)/r/[alias]/components/transparent-footer.tsx +++ b/apps/web/src/app/(shares)/r/[alias]/components/transparent-footer.tsx @@ -1,7 +1,9 @@ import Link from "next/link"; import { useTranslations } from "next-intl"; -import { version } from "../../../../../../package.json"; +import packageJson from "../../../../../../package.json"; + +const { version } = packageJson; export function TransparentFooter() { const t = useTranslations(); diff --git a/apps/web/src/components/general/language-switcher.tsx b/apps/web/src/components/general/language-switcher.tsx index e218de5..2b6c0da 100644 --- a/apps/web/src/components/general/language-switcher.tsx +++ b/apps/web/src/components/general/language-switcher.tsx @@ -65,7 +65,7 @@ export function LanguageSwitcher() { {Object.entries(languages).map(([code, name]) => { - const isCurrentLocale = locale === code.split("-")[0]; + const isCurrentLocale = locale === code; return ( { const cookieStore = cookies(); @@ -9,11 +28,12 @@ export default getRequestConfig(async ({ locale }) => { const localeCookie = cookiesList.get("NEXT_LOCALE"); const resolvedLocale = localeCookie?.value || locale || DEFAULT_LOCALE; + const finalLocale = supportedLocales.includes(resolvedLocale) ? resolvedLocale : DEFAULT_LOCALE; try { return { - locale: resolvedLocale, - messages: (await import(`../../messages/${resolvedLocale}.json`)).default, + locale: finalLocale, + messages: (await import(`../../messages/${finalLocale}.json`)).default, }; } catch { return { diff --git a/docker-compose-bind-mount-example.yaml b/docker-compose-bind-mount-example.yaml index ba5ce61..4a84adf 100644 --- a/docker-compose-bind-mount-example.yaml +++ b/docker-compose-bind-mount-example.yaml @@ -7,6 +7,7 @@ services: - ENCRYPTION_KEY=change-this-key-in-production-min-32-chars # CHANGE THIS KEY FOR SECURITY (REQUIRED if DISABLE_FILESYSTEM_ENCRYPTION is false) - PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information - PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information + # - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) | See the docs for see all supported languages # - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false) # - DISABLE_FILESYSTEM_ENCRYPTION=true # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional) | (OPTIONAL - default is false) ports: diff --git a/docker-compose-minio.yaml b/docker-compose-minio.yaml index d7462fc..5b41d67 100644 --- a/docker-compose-minio.yaml +++ b/docker-compose-minio.yaml @@ -14,6 +14,7 @@ services: - S3_FORCE_PATH_STYLE=true # For MinIO compatibility we have to set this to true - PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information - PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information + # - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) | See the docs for see all supported languages # - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false) ports: - "5487:5487" # Web port diff --git a/docker-compose-s3.yaml b/docker-compose-s3.yaml index d021ae7..8985181 100644 --- a/docker-compose-s3.yaml +++ b/docker-compose-s3.yaml @@ -14,6 +14,7 @@ services: - S3_FORCE_PATH_STYLE=false # For S3 compatibility we have to set this to false - PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information - PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information + # - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) | See the docs for see all supported languages # - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false) ports: - "5487:5487" # Web port diff --git a/docker-compose.yaml b/docker-compose.yaml index a3c2760..76c2af6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,6 +7,7 @@ services: - ENCRYPTION_KEY=change-this-key-in-production-min-32-chars # CHANGE THIS KEY FOR SECURITY (REQUIRED if DISABLE_FILESYSTEM_ENCRYPTION is false) - PALMR_UID=1000 # UID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information - PALMR_GID=1000 # GID for the container processes (OPTIONAL - default is 1001) | See our UID/GID Documentation for more information + # - DEFAULT_LANGUAGE=en-US # Default language for the application (optional, defaults to en-US) | See the docs to see all supported languages # - SECURE_SITE=true # Set to true if you are using a reverse proxy (OPTIONAL - default is false) # - DISABLE_FILESYSTEM_ENCRYPTION=true # Set to true to disable file encryption (ENCRYPTION_KEY becomes optional) | (OPTIONAL - default is false) ports: