bundle htmx and alpine
Some checks failed
ci / test (push) Waiting to run
ci / build (push) Has been cancelled

This commit is contained in:
CJ_Clippy 2025-09-25 01:03:39 -08:00
parent ab1ac88031
commit 293e38951b
7 changed files with 86 additions and 135 deletions

View File

@ -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.

View File

@ -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",

View File

@ -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",

View File

@ -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"]

View File

@ -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');
});
});
});

View File

@ -21,7 +21,7 @@ player.ready(() => {
const funscripts = collectFunscripts()
const funscriptsOptions = {
buttplugClientName: "future.porn",
debug: true,
debug: false,
funscripts,
}

View File

@ -44,7 +44,8 @@
{{{body}}}
<script src="/assets/js/htmx.min.js"></script>
{{!-- the client bundle --}}
<script src="/assets/index.js"></script>
<script>
document.addEventListener('alpine:init', () => {
@ -57,32 +58,7 @@
})
</script>
<script src="/assets/js/alpine/cdn.min.js"></script>
{{!-- JS for Bulma's navbar --}}
<script>
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');
});
});
});
</script>
</body>