From 5d0542e951a4a4e0a5876b606712cc989e5dbdeb Mon Sep 17 00:00:00 2001 From: christiandesantis Date: Mon, 16 Dec 2024 23:38:34 -0400 Subject: [PATCH 01/23] :wrench: add external nginx network and update service port mapping in docker-compose --- docker/docker-compose.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b5782ee717f..d5640dbb620 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -3,6 +3,8 @@ name: anythingllm networks: anything-llm: driver: bridge + nginx_default: + external: true services: anything-llm: @@ -22,10 +24,11 @@ services: - "../collector/outputs/:/app/collector/outputs" user: "${UID:-1000}:${GID:-1000}" ports: - - "3001:3001" + - "3003:3001" env_file: - .env networks: - anything-llm + - nginx_default extra_hosts: - "host.docker.internal:host-gateway" From 9e868769d25218fd507f2d3d6f11e0e5a1211785 Mon Sep 17 00:00:00 2001 From: christiandesantis Date: Mon, 16 Dec 2024 23:43:55 -0400 Subject: [PATCH 02/23] :wrench: add pwa manifest and meta tags --- frontend/index.html | 8 +++++++- frontend/public/manifest.json | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 frontend/public/manifest.json diff --git a/frontend/index.html b/frontend/index.html index 22cc5b0f627..520380b44a5 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -28,6 +28,12 @@ + + + + + + @@ -35,4 +41,4 @@ - \ No newline at end of file + diff --git a/frontend/public/manifest.json b/frontend/public/manifest.json new file mode 100644 index 00000000000..46ef51a9309 --- /dev/null +++ b/frontend/public/manifest.json @@ -0,0 +1,8 @@ +{ + "name":"AnythingLLM", + "short_name":"AnythingLLM", + "display":"standalone", + "orientation":"portrait", + "theme_color":"#0B0C0C", + "background_color":"#0B0C0C" +} From df77b4fb2962d3697498e1fa675a00dd217cf116 Mon Sep 17 00:00:00 2001 From: christiandesantis Date: Tue, 17 Dec 2024 00:14:33 -0400 Subject: [PATCH 03/23] :truck: add pwa meta tags from meta generator instead of directly to index.html --- frontend/index.html | 5 ----- server/utils/boot/MetaGenerator.js | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 520380b44a5..8220ba1cce1 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -29,11 +29,6 @@ - - - - - diff --git a/server/utils/boot/MetaGenerator.js b/server/utils/boot/MetaGenerator.js index 68cd2cbbefa..5a1a7c96f31 100644 --- a/server/utils/boot/MetaGenerator.js +++ b/server/utils/boot/MetaGenerator.js @@ -126,6 +126,10 @@ class MetaGenerator { { tag: "link", props: { rel: "icon", href: "/favicon.png" } }, { tag: "link", props: { rel: "apple-touch-icon", href: "/favicon.png" } }, + // PWA tags + { tag: 'meta', props: { name: 'mobile-web-app-capable', content: 'yes' } }, + { tag: 'meta', props: { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' } }, + { tag: 'link', props: { rel: 'manifest', href: '/manifest.json' } }, ]; } From 14f8bb2fdac7ba6b12974d659096d4b13b65b94c Mon Sep 17 00:00:00 2001 From: christiandesantis Date: Tue, 17 Dec 2024 00:19:38 -0400 Subject: [PATCH 04/23] :art: replace single quotes with double quotes for consistency --- server/utils/boot/MetaGenerator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/utils/boot/MetaGenerator.js b/server/utils/boot/MetaGenerator.js index 5a1a7c96f31..c36ef8b3add 100644 --- a/server/utils/boot/MetaGenerator.js +++ b/server/utils/boot/MetaGenerator.js @@ -127,9 +127,9 @@ class MetaGenerator { { tag: "link", props: { rel: "icon", href: "/favicon.png" } }, { tag: "link", props: { rel: "apple-touch-icon", href: "/favicon.png" } }, // PWA tags - { tag: 'meta', props: { name: 'mobile-web-app-capable', content: 'yes' } }, - { tag: 'meta', props: { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' } }, - { tag: 'link', props: { rel: 'manifest', href: '/manifest.json' } }, + { tag: "meta", props: { name: "mobile-web-app-capable", content: "yes" } }, + { tag: "meta", props: { name: "apple-mobile-web-app-status-bar-style", content: "black-translucent" } }, + { tag: "link", props: { rel: "manifest", href: "/manifest.json" } }, ]; } From 3dcd2cc80b2b3019a76177d690784fefd484d195 Mon Sep 17 00:00:00 2001 From: christiandesantis Date: Tue, 17 Dec 2024 00:34:51 -0400 Subject: [PATCH 05/23] :wrench: remove theme and background colors from manifest.json --- frontend/public/manifest.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/public/manifest.json b/frontend/public/manifest.json index 46ef51a9309..f99301edad4 100644 --- a/frontend/public/manifest.json +++ b/frontend/public/manifest.json @@ -2,7 +2,5 @@ "name":"AnythingLLM", "short_name":"AnythingLLM", "display":"standalone", - "orientation":"portrait", - "theme_color":"#0B0C0C", - "background_color":"#0B0C0C" + "orientation":"portrait" } From cf0b659d911393b79e52876ae3a27164eb7420c9 Mon Sep 17 00:00:00 2001 From: christiandesantis Date: Tue, 17 Dec 2024 00:41:15 -0400 Subject: [PATCH 06/23] :lipstick: add dark mode support for body background color --- frontend/src/index.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/index.css b/frontend/src/index.css index 2cad114f8d0..0c4800164eb 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -147,6 +147,12 @@ body { background-color: white; } +@media (prefers-color-scheme: dark) { + body { + background-color: #0E0F0F; + } +} + a { color: inherit; text-decoration: none; From 9618911fe97929e7dcf41c1abf1d1d1df388c956 Mon Sep 17 00:00:00 2001 From: christiandesantis Date: Tue, 17 Dec 2024 00:44:39 -0400 Subject: [PATCH 07/23] :fire: unnecessary blank line in index.html --- frontend/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/index.html b/frontend/index.html index 8220ba1cce1..0ed6fc79ff9 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -28,7 +28,6 @@ - From cc02cacc0cfb3aeeb267090d1b7a94048e4bfe1f Mon Sep 17 00:00:00 2001 From: christiandesantis Date: Tue, 17 Dec 2024 01:29:52 -0400 Subject: [PATCH 08/23] :children_crossing: update viewport meta tag to include max scale to prevent safari ios auto zoom --- frontend/index.html | 2 +- server/utils/boot/MetaGenerator.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 0ed6fc79ff9..0236b73e756 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,7 +4,7 @@ - + AnythingLLM | Your personal LLM trained on anything diff --git a/server/utils/boot/MetaGenerator.js b/server/utils/boot/MetaGenerator.js index c36ef8b3add..a98d6f7515c 100644 --- a/server/utils/boot/MetaGenerator.js +++ b/server/utils/boot/MetaGenerator.js @@ -222,7 +222,7 @@ class MetaGenerator { - + ${this.#assembleMeta()} From 4dbb7f5705d1a2c98a5983f0f4afa0cea86356b6 Mon Sep 17 00:00:00 2001 From: christiandesantis Date: Tue, 17 Dec 2024 01:30:38 -0400 Subject: [PATCH 09/23] :children_crossing: prevent overscroll behavior for mobile --- frontend/src/index.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/index.css b/frontend/src/index.css index 0c4800164eb..661bb05629c 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -147,6 +147,12 @@ body { background-color: white; } +@media (max-width: 600px) { + html { + overscroll-behavior: none; + } +} + @media (prefers-color-scheme: dark) { body { background-color: #0E0F0F; From 0f6111c078786b208f017779c096db0dded76fbf Mon Sep 17 00:00:00 2001 From: Christian De Santis Date: Thu, 12 Jun 2025 21:51:07 -0400 Subject: [PATCH 10/23] Revert ":wrench: add external nginx network and update service port mapping in docker-compose" This reverts commit 5d0542e951a4a4e0a5876b606712cc989e5dbdeb. --- docker/docker-compose.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d5640dbb620..b5782ee717f 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -3,8 +3,6 @@ name: anythingllm networks: anything-llm: driver: bridge - nginx_default: - external: true services: anything-llm: @@ -24,11 +22,10 @@ services: - "../collector/outputs/:/app/collector/outputs" user: "${UID:-1000}:${GID:-1000}" ports: - - "3003:3001" + - "3001:3001" env_file: - .env networks: - anything-llm - - nginx_default extra_hosts: - "host.docker.internal:host-gateway" From 5895e85db33cc34c73f1427eb40fde9bd0ea6628 Mon Sep 17 00:00:00 2001 From: Christian De Santis Date: Thu, 12 Jun 2025 21:55:41 -0400 Subject: [PATCH 11/23] :wrench: add github actions workflow for deployment --- .github/workflows/deploy.yml | 59 ++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000000..946d5bc3bcd --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,59 @@ +name: Deploy + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + repository-projects: write + env: + SSH_HOST: ${{ vars.SSH_HOST }} + SSH_USER: ${{ vars.SSH_USER }} + SSH_DIR: ${{ vars.SSH_DIR || '~' }} + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + + steps: + # Step 1: Checkout the code (this runs on the GitHub runner, not the server) + - name: Checkout code + uses: actions/checkout@v3 + + # Step 2: Install SSH keys + - name: Install SSH keys + run: | + install -m 600 -D /dev/null ~/.ssh/id_rsa + echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa + ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts + + # Step 3: Create work directory on server + - name: Create work directory + run: | + ssh $SSH_USER@$SSH_HOST " + mkdir -p $SSH_DIR/${GITHUB_REPOSITORY##*/} + " + + # Step 4: Transfer repository files to server + - name: Transfer files to server + run: | + rsync -avz --delete \ + -e "ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no" \ + ./ $SSH_USER@$SSH_HOST:$SSH_DIR/${GITHUB_REPOSITORY##*/}/ + + # Step 5: Deploy on server + - name: Deploy application to server + run: | + ssh $SSH_USER@$SSH_HOST " + cd $SSH_DIR/${GITHUB_REPOSITORY##*/} && + docker compose down || true && + docker compose --profile prod up -d --build + " + + # Step 6: Cleanup SSH keys + - name: Cleanup + run: rm -rf ~/.ssh From e0db743554ee90fc26db24054775cf25154a84ed Mon Sep 17 00:00:00 2001 From: Christian De Santis Date: Thu, 12 Jun 2025 22:10:20 -0400 Subject: [PATCH 12/23] :wrench: update deploy workflow to navigate to docker directory before deploying --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 946d5bc3bcd..b614c6afcbf 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -49,7 +49,7 @@ jobs: - name: Deploy application to server run: | ssh $SSH_USER@$SSH_HOST " - cd $SSH_DIR/${GITHUB_REPOSITORY##*/} && + cd $SSH_DIR/${GITHUB_REPOSITORY##*/}/docker && docker compose down || true && docker compose --profile prod up -d --build " From 83544ddd0e606ac753a82660d6450ecf747e046c Mon Sep 17 00:00:00 2001 From: Christian De Santis Date: Thu, 12 Jun 2025 23:34:21 -0400 Subject: [PATCH 13/23] fix: only run if docker scout if credentials are available --- .../workflows/build-and-push-image-semver.yaml | 14 ++++++++------ .github/workflows/build-and-push-image.yaml | 16 +++++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-and-push-image-semver.yaml b/.github/workflows/build-and-push-image-semver.yaml index 8fb6d35c284..7a4e5d78245 100644 --- a/.github/workflows/build-and-push-image-semver.yaml +++ b/.github/workflows/build-and-push-image-semver.yaml @@ -37,22 +37,22 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Log in to Docker Hub uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # Only login to the Docker Hub if the repo is mintplex/anythingllm, to allow for forks to build on GHCR - if: steps.dockerhub.outputs.enabled == 'true' + if: steps.dockerhub.outputs.enabled == 'true' with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + - name: Log in to the Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 @@ -77,10 +77,10 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - + # For Docker scout there are some intermediary reported CVEs which exists outside # of execution content or are unreachable by an attacker but exist in image. - # We create VEX files for these so they don't show in scout summary. + # We create VEX files for these so they don't show in scout summary. - name: Collect known and verified CVE exceptions id: cve-list run: | @@ -98,6 +98,8 @@ jobs: # About VEX attestations https://docs.docker.com/scout/explore/exceptions/ # Justifications https://github.com/openvex/spec/blob/main/OPENVEX-SPEC.md#status-justifications - name: Add VEX attestations + # Only run if Docker Hub credentials are available (Docker Scout uses same auth) + if: steps.dockerhub.outputs.enabled == 'true' env: CVE_EXCEPTIONS: ${{ steps.cve-list.outputs.CVE_EXCEPTIONS }} run: | diff --git a/.github/workflows/build-and-push-image.yaml b/.github/workflows/build-and-push-image.yaml index 591cf63d031..707c1f309e5 100644 --- a/.github/workflows/build-and-push-image.yaml +++ b/.github/workflows/build-and-push-image.yaml @@ -1,6 +1,6 @@ # This Github action is for publishing of the primary image for AnythingLLM # It will publish a linux/amd64 and linux/arm64 image at the same time -# This file should ONLY BY USED FOR `master` BRANCH. +# This file should ONLY BY USED FOR `master` BRANCH. # TODO: Update `runs-on` for arm64 when GitHub finally supports # native arm environments as QEMU takes around 1 hour to build # ref: https://github.com/actions/runner-images/issues/5631 :( @@ -54,22 +54,22 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Log in to Docker Hub uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # Only login to the Docker Hub if the repo is mintplex/anythingllm, to allow for forks to build on GHCR - if: steps.dockerhub.outputs.enabled == 'true' + if: steps.dockerhub.outputs.enabled == 'true' with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + - name: Log in to the Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 @@ -96,10 +96,10 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - + # For Docker scout there are some intermediary reported CVEs which exists outside # of execution content or are unreachable by an attacker but exist in image. - # We create VEX files for these so they don't show in scout summary. + # We create VEX files for these so they don't show in scout summary. - name: Collect known and verified CVE exceptions id: cve-list run: | @@ -117,6 +117,8 @@ jobs: # About VEX attestations https://docs.docker.com/scout/explore/exceptions/ # Justifications https://github.com/openvex/spec/blob/main/OPENVEX-SPEC.md#status-justifications - name: Add VEX attestations + # Only run if Docker Hub credentials are available (Docker Scout uses same auth) + if: steps.dockerhub.outputs.enabled == 'true' env: CVE_EXCEPTIONS: ${{ steps.cve-list.outputs.CVE_EXCEPTIONS }} run: | From 072c05f1e34827b5493463a3031f5e565209ba51 Mon Sep 17 00:00:00 2001 From: Christian De Santis Date: Tue, 17 Jun 2025 12:26:53 -0400 Subject: [PATCH 14/23] :wrench: ensure .env file is created if it doesn't exist during deployment --- .github/workflows/deploy.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b614c6afcbf..5de4ee02f8a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -50,8 +50,13 @@ jobs: run: | ssh $SSH_USER@$SSH_HOST " cd $SSH_DIR/${GITHUB_REPOSITORY##*/}/docker && + # Create .env file if it doesn't exist + if [ ! -f .env ]; then + cp .env.example .env + echo 'Created .env file from .env.example' + fi && docker compose down || true && - docker compose --profile prod up -d --build + docker compose up -d --build " # Step 6: Cleanup SSH keys From dbe8c4d0bdc47cf5521f8ce18b8b5b34f279fd8a Mon Sep 17 00:00:00 2001 From: Christian De Santis Date: Tue, 17 Jun 2025 13:16:13 -0400 Subject: [PATCH 15/23] :recycle: format meta tag generator file with yarn lint --- server/utils/boot/MetaGenerator.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/server/utils/boot/MetaGenerator.js b/server/utils/boot/MetaGenerator.js index a98d6f7515c..0f59024da8d 100644 --- a/server/utils/boot/MetaGenerator.js +++ b/server/utils/boot/MetaGenerator.js @@ -127,8 +127,17 @@ class MetaGenerator { { tag: "link", props: { rel: "icon", href: "/favicon.png" } }, { tag: "link", props: { rel: "apple-touch-icon", href: "/favicon.png" } }, // PWA tags - { tag: "meta", props: { name: "mobile-web-app-capable", content: "yes" } }, - { tag: "meta", props: { name: "apple-mobile-web-app-status-bar-style", content: "black-translucent" } }, + { + tag: "meta", + props: { name: "mobile-web-app-capable", content: "yes" }, + }, + { + tag: "meta", + props: { + name: "apple-mobile-web-app-status-bar-style", + content: "black-translucent", + }, + }, { tag: "link", props: { rel: "manifest", href: "/manifest.json" } }, ]; } From e6be370d6035532cd31480559924d0505bf56e9c Mon Sep 17 00:00:00 2001 From: christiandesantis Date: Tue, 17 Dec 2024 00:14:33 -0400 Subject: [PATCH 16/23] :truck: add pwa meta tags from meta generator instead of directly to index.html --- frontend/index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/index.html b/frontend/index.html index 0236b73e756..1a11b5fe1f4 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -28,6 +28,10 @@ + + + + From 3573cc5d9e8a3b4179c18b863da1df121bb4aa14 Mon Sep 17 00:00:00 2001 From: Christian De Santis Date: Wed, 18 Jun 2025 12:51:08 -0400 Subject: [PATCH 17/23] :wrench: ensure docker service restarts unless-stopped --- docker/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b5782ee717f..a66abfb9ba1 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -29,3 +29,4 @@ services: - anything-llm extra_hosts: - "host.docker.internal:host-gateway" + restart: unless-stopped From 573712fc46d12032b57926a71291863897cfaf12 Mon Sep 17 00:00:00 2001 From: Christian De Santis Date: Wed, 18 Jun 2025 16:21:58 -0400 Subject: [PATCH 18/23] :recycle: lint css file --- frontend/src/index.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/index.css b/frontend/src/index.css index 24be47d4aff..a29506f1ab9 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -263,7 +263,7 @@ body { @media (prefers-color-scheme: dark) { body { - background-color: #0E0F0F; + background-color: #0e0f0f; } } From f73d36116dbf527e392a5b77c79c11ab9e138da3 Mon Sep 17 00:00:00 2001 From: Christian De Santis Date: Wed, 18 Jun 2025 16:22:29 -0400 Subject: [PATCH 19/23] :bug: ensure the pwa tags are preserved when using custom branding --- server/utils/boot/MetaGenerator.js | 85 +++++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 13 deletions(-) diff --git a/server/utils/boot/MetaGenerator.js b/server/utils/boot/MetaGenerator.js index 8276b915a6a..6f8930b4b45 100644 --- a/server/utils/boot/MetaGenerator.js +++ b/server/utils/boot/MetaGenerator.js @@ -194,19 +194,78 @@ class MetaGenerator { if (customTitle === null && faviconURL === null) { this.#customConfig = this.#defaultMeta(); } else { - this.#customConfig = [ - { - tag: "link", - props: { rel: "icon", href: this.#validUrl(faviconURL) }, - }, - { - tag: "title", - props: null, - content: - customTitle ?? - "AnythingLLM | Your personal LLM trained on anything", - }, - ]; + // When custom settings exist, include all default meta tags but override specific ones + this.#customConfig = this.#defaultMeta().map((tag) => { + // Override favicon link + if (tag.tag === "link" && tag.props?.rel === "icon") { + return { + tag: "link", + props: { rel: "icon", href: this.#validUrl(faviconURL) }, + }; + } + // Override page title + if (tag.tag === "title") { + return { + tag: "title", + props: null, + content: + customTitle ?? + "AnythingLLM | Your personal LLM trained on anything", + }; + } + // Override meta title + if (tag.tag === "meta" && tag.props?.name === "title") { + return { + tag: "meta", + props: { + name: "title", + content: + customTitle ?? + "AnythingLLM | Your personal LLM trained on anything", + }, + }; + } + // Override og:title + if (tag.tag === "meta" && tag.props?.property === "og:title") { + return { + tag: "meta", + props: { + property: "og:title", + content: + customTitle ?? + "AnythingLLM | Your personal LLM trained on anything", + }, + }; + } + // Override twitter:title + if (tag.tag === "meta" && tag.props?.property === "twitter:title") { + return { + tag: "meta", + props: { + property: "twitter:title", + content: + customTitle ?? + "AnythingLLM | Your personal LLM trained on anything", + }, + }; + } + // Override apple-touch-icon if custom favicon is set + if ( + tag.tag === "link" && + tag.props?.rel === "apple-touch-icon" && + faviconURL + ) { + return { + tag: "link", + props: { + rel: "apple-touch-icon", + href: this.#validUrl(faviconURL), + }, + }; + } + // Return original tag for everything else (including PWA tags) + return tag; + }); } return this.#customConfig; From 39bae6ab39b0cf0bffcc6d6e92c061e4ba2b0917 Mon Sep 17 00:00:00 2001 From: Christian De Santis Date: Wed, 18 Jun 2025 21:02:33 -0400 Subject: [PATCH 20/23] :bug: ensure the custom title is added in meta tags --- server/utils/boot/MetaGenerator.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/utils/boot/MetaGenerator.js b/server/utils/boot/MetaGenerator.js index 6f8930b4b45..f97f6b123ba 100644 --- a/server/utils/boot/MetaGenerator.js +++ b/server/utils/boot/MetaGenerator.js @@ -181,10 +181,19 @@ class MetaGenerator { async #fetchConfg() { this.#log(`fetching custom meta tag settings...`); const { SystemSettings } = require("../../models/systemSettings"); - const customTitle = await SystemSettings.getValueOrFallback( + + let customTitle = await SystemSettings.getValueOrFallback( { label: "meta_page_title" }, null ); + + if (!customTitle) { + customTitle = await SystemSettings.getValueOrFallback( + { label: "custom_app_name" }, + null + ); + } + const faviconURL = await SystemSettings.getValueOrFallback( { label: "meta_page_favicon" }, null From e06f5a18ca679669ae5ca5e4d792c9f319df3303 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Wed, 2 Jul 2025 08:34:23 -0700 Subject: [PATCH 21/23] uncheck changes to core workflows --- .../build-and-push-image-semver.yaml | 12 ++-- .github/workflows/build-and-push-image.yaml | 13 ++-- .github/workflows/deploy.yml | 64 ------------------- docker/docker-compose.yml | 1 - 4 files changed, 12 insertions(+), 78 deletions(-) delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/build-and-push-image-semver.yaml b/.github/workflows/build-and-push-image-semver.yaml index f9c3dd40d61..cbef71e52f0 100644 --- a/.github/workflows/build-and-push-image-semver.yaml +++ b/.github/workflows/build-and-push-image-semver.yaml @@ -39,21 +39,22 @@ jobs: uses: docker/setup-buildx-action@v3 with: version: v0.22.0 + - name: Log in to Docker Hub uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # Only login to the Docker Hub if the repo is mintplex/anythingllm, to allow for forks to build on GHCR - if: steps.dockerhub.outputs.enabled == 'true' + if: steps.dockerhub.outputs.enabled == 'true' with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + - name: Log in to the Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 @@ -78,10 +79,10 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - + # For Docker scout there are some intermediary reported CVEs which exists outside # of execution content or are unreachable by an attacker but exist in image. - # We create VEX files for these so they don't show in scout summary. + # We create VEX files for these so they don't show in scout summary. - name: Collect known and verified CVE exceptions id: cve-list run: | @@ -99,7 +100,6 @@ jobs: # About VEX attestations https://docs.docker.com/scout/explore/exceptions/ # Justifications https://github.com/openvex/spec/blob/main/OPENVEX-SPEC.md#status-justifications - name: Add VEX attestations - # Only run if Docker Hub credentials are available (Docker Scout uses same auth) if: steps.dockerhub.outputs.enabled == 'true' env: CVE_EXCEPTIONS: ${{ steps.cve-list.outputs.CVE_EXCEPTIONS }} diff --git a/.github/workflows/build-and-push-image.yaml b/.github/workflows/build-and-push-image.yaml index 8c3f07380a3..609921fc5f7 100644 --- a/.github/workflows/build-and-push-image.yaml +++ b/.github/workflows/build-and-push-image.yaml @@ -58,22 +58,22 @@ jobs: uses: docker/setup-buildx-action@v3 with: version: v0.22.0 - + - name: Log in to Docker Hub uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # Only login to the Docker Hub if the repo is mintplex/anythingllm, to allow for forks to build on GHCR - if: steps.dockerhub.outputs.enabled == 'true' + if: steps.dockerhub.outputs.enabled == 'true' with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + - name: Log in to the Container registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 @@ -100,10 +100,10 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - + # For Docker scout there are some intermediary reported CVEs which exists outside # of execution content or are unreachable by an attacker but exist in image. - # We create VEX files for these so they don't show in scout summary. + # We create VEX files for these so they don't show in scout summary. - name: Collect known and verified CVE exceptions id: cve-list run: | @@ -121,7 +121,6 @@ jobs: # About VEX attestations https://docs.docker.com/scout/explore/exceptions/ # Justifications https://github.com/openvex/spec/blob/main/OPENVEX-SPEC.md#status-justifications - name: Add VEX attestations - # Only run if Docker Hub credentials are available (Docker Scout uses same auth) if: steps.dockerhub.outputs.enabled == 'true' env: CVE_EXCEPTIONS: ${{ steps.cve-list.outputs.CVE_EXCEPTIONS }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 5de4ee02f8a..00000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Deploy - -on: - workflow_dispatch: - push: - branches: - - main - -jobs: - deploy: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - repository-projects: write - env: - SSH_HOST: ${{ vars.SSH_HOST }} - SSH_USER: ${{ vars.SSH_USER }} - SSH_DIR: ${{ vars.SSH_DIR || '~' }} - SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} - - steps: - # Step 1: Checkout the code (this runs on the GitHub runner, not the server) - - name: Checkout code - uses: actions/checkout@v3 - - # Step 2: Install SSH keys - - name: Install SSH keys - run: | - install -m 600 -D /dev/null ~/.ssh/id_rsa - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts - - # Step 3: Create work directory on server - - name: Create work directory - run: | - ssh $SSH_USER@$SSH_HOST " - mkdir -p $SSH_DIR/${GITHUB_REPOSITORY##*/} - " - - # Step 4: Transfer repository files to server - - name: Transfer files to server - run: | - rsync -avz --delete \ - -e "ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no" \ - ./ $SSH_USER@$SSH_HOST:$SSH_DIR/${GITHUB_REPOSITORY##*/}/ - - # Step 5: Deploy on server - - name: Deploy application to server - run: | - ssh $SSH_USER@$SSH_HOST " - cd $SSH_DIR/${GITHUB_REPOSITORY##*/}/docker && - # Create .env file if it doesn't exist - if [ ! -f .env ]; then - cp .env.example .env - echo 'Created .env file from .env.example' - fi && - docker compose down || true && - docker compose up -d --build - " - - # Step 6: Cleanup SSH keys - - name: Cleanup - run: rm -rf ~/.ssh diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index a66abfb9ba1..b5782ee717f 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -29,4 +29,3 @@ services: - anything-llm extra_hosts: - "host.docker.internal:host-gateway" - restart: unless-stopped From 45238d9e957a77b796a348d2701071cb22ef7c34 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Wed, 2 Jul 2025 08:37:37 -0700 Subject: [PATCH 22/23] patch max-scale on index.html --- frontend/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 1a11b5fe1f4..2804ff239cd 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,7 +4,7 @@ - + AnythingLLM | Your personal LLM trained on anything @@ -39,4 +39,4 @@ - + \ No newline at end of file From 3b713f74e98409ba7b05edc688a2e9d3cbe9f836 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Wed, 2 Jul 2025 09:12:04 -0700 Subject: [PATCH 23/23] patch max-scale on index.html --- server/utils/boot/MetaGenerator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/utils/boot/MetaGenerator.js b/server/utils/boot/MetaGenerator.js index f97f6b123ba..5bb9f84f68c 100644 --- a/server/utils/boot/MetaGenerator.js +++ b/server/utils/boot/MetaGenerator.js @@ -299,7 +299,7 @@ class MetaGenerator { - + ${this.#assembleMeta()}