From 293e38951b441e46b5aceb07e14c2cc026e79c23 Mon Sep 17 00:00:00 2001 From: CJ_Clippy Date: Thu, 25 Sep 2025 01:03:39 -0800 Subject: [PATCH] bundle htmx and alpine --- services/our/README.md | 13 +++ services/our/package-lock.json | 36 +++++++- services/our/package.json | 4 +- services/our/slim.Dockerfile | 105 ------------------------ services/our/src/client/index.js | 33 ++++++++ services/our/src/client/vod.js | 2 +- services/our/src/views/layouts/main.hbs | 28 +------ 7 files changed, 86 insertions(+), 135 deletions(-) delete mode 100644 services/our/slim.Dockerfile diff --git a/services/our/README.md b/services/our/README.md index ee2cc4f..ee717f9 100644 --- a/services/our/README.md +++ b/services/our/README.md @@ -55,6 +55,19 @@ Start node app in dev mode. Env vars must be available to the app-- We're using ## troubleshooting +### prisma schema issues + +you may see errors like this + +``` +statusCode 500 +code "P2022" +error "Internal Server Error" +message "\nInvalid `prisma.vod.findMany()` invocation:\n\n\nThe column `Vod.sourceVideoDuration` does not exist in the current database." +``` + +the fix is to run `npx prisma migrate deploy` to apply migrations and get the schema up-to-date + ### npm/pnpm/store issues Any problems with node? Delete the following. diff --git a/services/our/package-lock.json b/services/our/package-lock.json index 1fc655b..6012635 100644 --- a/services/our/package-lock.json +++ b/services/our/package-lock.json @@ -1,12 +1,12 @@ { "name": "futureporn-our", - "version": "2.7.1", + "version": "2.8.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "futureporn-our", - "version": "2.7.1", + "version": "2.8.2", "dependencies": { "@aws-sdk/client-s3": "3.726.1", "@aws-sdk/s3-request-presigner": "^3.844.0", @@ -31,6 +31,7 @@ "@types/node": "^22.16.3", "@types/node-fetch": "^2.6.12", "@types/ssh2": "^1.15.5", + "alpinejs": "^3.15.0", "cache-manager": "^7.0.1", "canvas": "^3.1.2", "chokidar-cli": "^3.0.0", @@ -46,6 +47,7 @@ "fs-extra": "^11.3.1", "graphile-worker": "^0.16.6", "handlebars": "4.7.8", + "htmx.org": "^2.0.7", "jdenticon": "^3.3.0", "js-yaml": "^4.1.0", "keyv": "^4.5.4", @@ -4953,6 +4955,21 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/@vue/reactivity": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.1.5.tgz", + "integrity": "sha512-1tdfLmNjWG6t/CsPldh+foumYFo3cpyCHgBYQ34ylaMsJ+SNHQ1kApMIa8jN+i593zQuaw3AdWH0nJTARzCFhg==", + "license": "MIT", + "dependencies": { + "@vue/shared": "3.1.5" + } + }, + "node_modules/@vue/shared": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.1.5.tgz", + "integrity": "sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA==", + "license": "MIT" + }, "node_modules/@xmldom/xmldom": { "version": "0.8.11", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.11.tgz", @@ -5092,6 +5109,15 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "license": "MIT" }, + "node_modules/alpinejs": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.15.0.tgz", + "integrity": "sha512-lpokA5okCF1BKh10LG8YjqhfpxyHBk4gE7boIgVHltJzYoM7O9nK3M7VlntLEJGsVmu7U/RzUWajmHREGT38Eg==", + "license": "MIT", + "dependencies": { + "@vue/reactivity": "~3.1.1" + } + }, "node_modules/ansi-regex": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", @@ -8248,6 +8274,12 @@ "integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==", "license": "MIT" }, + "node_modules/htmx.org": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/htmx.org/-/htmx.org-2.0.7.tgz", + "integrity": "sha512-YiJqF3U5KyO28VC5mPfehKJPF+n1Gni+cupK+D69TF0nm7wY6AXn3a4mPWIikfAXtl1u1F1+ZhSCS7KT8pVmqA==", + "license": "0BSD" + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", diff --git a/services/our/package.json b/services/our/package.json index 43d50ef..2033b1e 100644 --- a/services/our/package.json +++ b/services/our/package.json @@ -1,7 +1,7 @@ { "name": "futureporn-our", "private": true, - "version": "2.8.2", + "version": "2.8.3", "type": "module", "scripts": { "dev": "concurrently npm:dev:serve npm:dev:build:server npm:dev:build:client npm:dev:worker npm:dev:compose npm:dev:sftp npm:dev:qbittorrent npm:dev:tailscale", @@ -75,6 +75,7 @@ "@types/node": "^22.16.3", "@types/node-fetch": "^2.6.12", "@types/ssh2": "^1.15.5", + "alpinejs": "^3.15.0", "cache-manager": "^7.0.1", "canvas": "^3.1.2", "chokidar-cli": "^3.0.0", @@ -90,6 +91,7 @@ "fs-extra": "^11.3.1", "graphile-worker": "^0.16.6", "handlebars": "4.7.8", + "htmx.org": "^2.0.7", "jdenticon": "^3.3.0", "js-yaml": "^4.1.0", "keyv": "^4.5.4", diff --git a/services/our/slim.Dockerfile b/services/our/slim.Dockerfile deleted file mode 100644 index e101ae9..0000000 --- a/services/our/slim.Dockerfile +++ /dev/null @@ -1,105 +0,0 @@ -# === Build stage === -FROM node:22 AS builder - -# Set working directory -WORKDIR /app - -# Install system-level dependencies required only for building -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update -y && \ - apt-get install -y --no-install-recommends \ - build-essential \ - git \ - inotify-tools \ - && apt-get clean && rm -rf /var/lib/apt/lists/* - -# Copy and install dependencies -COPY package.json package-lock.json ./ -RUN npm install --ignore-scripts=false --foreground-scripts --verbose - -# Copy Prisma schema and generate client -COPY prisma ./prisma -RUN npx prisma generate - -# Copy the rest of the code -COPY . . - -# Build the app -RUN npm run build - - -# === Python pytorch ultralytics stage === -FROM python:3 AS pystuff - -WORKDIR /app - -# Create a virtual environment for Python deps -# we use this venv to transfer built artifacts between Docker image layers -RUN python -m venv /app/venv -ENV PATH="/app/venv/bin:$PATH" -RUN . /app/venv/bin/activate - -COPY requirements.txt . - -# Install python deps -RUN --mount=type=cache,target=/root/.cache/uv \ - python3 -m pip install uv && \ - uv pip install -r requirements.txt - - - -# === Runtime stage === -FROM node:22-slim - -# Set working directory -WORKDIR /app -ENV PATH="/app/venv/bin:$PATH" - -# Install only runtime dependencies -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update -y && \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - ffmpeg \ - wget \ - && apt-get clean && rm -rf /var/lib/apt/lists/* - -# Install Shaka Packager -RUN wget -q https://github.com/shaka-project/shaka-packager/releases/download/v3.4.2/packager-linux-x64 \ - -O /usr/local/bin/packager \ - && chmod +x /usr/local/bin/packager \ - && packager --version - -# Install IPFS Kubo -COPY --from=ipfs/kubo:v0.36.0 /usr/local/bin/ipfs /usr/local/bin/ipfs -RUN ipfs init - -# Bundle the vibeui pytorch model -RUN mkdir -p /app/vibeui \ - && wget -q https://gitea.futureporn.net/futureporn/fp/raw/branch/main/apps/vibeui/public/vibeui.pt -O /app/vibeui/vibeui.pt \ - && wget -q https://gitea.futureporn.net/futureporn/fp/raw/branch/main/apps/vibeui/public/data.yaml -O /app/vibeui/data.yaml - -# Install openwhisper -COPY --from=ghcr.io/ggml-org/whisper.cpp:main-e7bf0294ec9099b5fc21f5ba969805dfb2108cea /app /app/whisper.cpp -ENV PATH="$PATH:/app/whisper.cpp/build/bin" -ENV LD_LIBRARY_PATH="/app/whisper.cpp/build/src:/app/whisper.cpp/build/ggml/src:/usr/local/lib:/usr/lib" - -# Install b2-cli -RUN wget https://github.com/Backblaze/B2_Command_Line_Tool/releases/download/v4.4.1/b2-linux -O /usr/local/bin/b2 && chmod +x /usr/local/bin/b2 - -# Copy runtime artifacts from builder -COPY --from=builder /app/dist ./dist -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/package.json ./package.json -COPY --from=builder /app/prisma ./prisma -COPY --from=pystuff /app/venv /app/venv - -COPY --from=builder /app /app - -# Expose the port -EXPOSE 5000 - -# Start the app -CMD ["npm", "run", "start:server"] diff --git a/services/our/src/client/index.js b/services/our/src/client/index.js index e69de29..b60cdad 100644 --- a/services/our/src/client/index.js +++ b/services/our/src/client/index.js @@ -0,0 +1,33 @@ +// Import HTMX +import htmx from 'htmx.org'; + +// Import Alpine.js +import Alpine from 'alpinejs'; + +// Make Alpine global if needed +window.Alpine = Alpine; +Alpine.start(); + + +// JS for Bulma's navbar +document.addEventListener('DOMContentLoaded', () => { + + // Get all "navbar-burger" elements + const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); + + // Add a click event on each of them + $navbarBurgers.forEach(el => { + el.addEventListener('click', () => { + + // Get the target from the "data-target" attribute + const target = el.dataset.target; + const $target = document.getElementById(target); + + // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu" + el.classList.toggle('is-active'); + $target.classList.toggle('is-active'); + + }); + }); + +}); \ No newline at end of file diff --git a/services/our/src/client/vod.js b/services/our/src/client/vod.js index 9987435..af445da 100644 --- a/services/our/src/client/vod.js +++ b/services/our/src/client/vod.js @@ -21,7 +21,7 @@ player.ready(() => { const funscripts = collectFunscripts() const funscriptsOptions = { buttplugClientName: "future.porn", - debug: true, + debug: false, funscripts, } diff --git a/services/our/src/views/layouts/main.hbs b/services/our/src/views/layouts/main.hbs index 8d05221..959918c 100644 --- a/services/our/src/views/layouts/main.hbs +++ b/services/our/src/views/layouts/main.hbs @@ -44,7 +44,8 @@ {{{body}}} - + {{!-- the client bundle --}} + - - {{!-- JS for Bulma's navbar --}} -