Skip to content

Commit 413221b

Browse files
committed
Merge branch 'develop'
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2 parents dc5415e + 6d3c149 commit 413221b

82 files changed

Lines changed: 3935 additions & 3234 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Fluidd AI Development Guide
2+
3+
Fluidd is a Vue 2.7 + TypeScript web interface for Klipper 3D printers that communicates with Moonraker via WebSocket.
4+
5+
## Architecture Overview
6+
7+
- **Vue 2.7 + Vuetify 2**: UI framework with Material Design components
8+
- **Vuex Store**: Modular state management mirroring Klipper/Moonraker domains (`printer/`, `files/`, `console/`, etc.)
9+
- **WebSocket Communication**: Real-time bidirectional communication with Moonraker API via `socketActions.ts`
10+
- **Component Structure**: Mixins-based architecture with `StateMixin` providing common printer state access
11+
12+
## Key Patterns
13+
14+
### State Management
15+
- Store modules in `src/store/` mirror Moonraker API endpoints (printer, files, macros, etc.)
16+
- Use `$typedState` and `$typedGetters` for type-safe store access
17+
- WebSocket actions in `api/socketActions.ts` follow pattern: `baseEmit(method, {dispatch, wait, params})`
18+
19+
### Component Architecture
20+
```typescript
21+
// Standard component pattern
22+
@Component({
23+
components: { /* ... */ }
24+
})
25+
export default class MyComponent extends Vue {
26+
// Component logic here
27+
}
28+
29+
// Widget component needing printer state
30+
@Component({
31+
components: { /* ... */ }
32+
})
33+
export default class PrinterWidget extends Mixins(StateMixin) {
34+
// Access printer state via StateMixin getters
35+
get printerState() { return this.printerState } // 'printing' | 'paused' | etc.
36+
}
37+
```
38+
39+
### WebSocket Integration
40+
- All printer communication through `SocketActions` (not direct HTTP)
41+
- Use `wait` parameter for loading states: `wait: Waits.onPrintStart`
42+
- Real-time updates handled via store mutations from socket events
43+
44+
## Development Workflow
45+
46+
### Essential Commands
47+
```bash
48+
npm run bootstrap # Install git hooks (after clone)
49+
npm run dev # Start development server
50+
npm run build # Production build
51+
npm run type-check # TypeScript validation
52+
npm run lint # ESLint with Vue/TS rules
53+
npm run test # Vitest unit tests
54+
```
55+
56+
### File Organization
57+
- `src/components/widgets/`: Dashboard cards organized by domain (status/, thermals/, macros/)
58+
- `src/views/`: Page-level components (Dashboard.vue, Console.vue, etc.)
59+
- `src/store/[domain]/`: Vuex modules matching Moonraker API structure
60+
- `src/api/`: WebSocket and HTTP client abstractions
61+
62+
### Router & Authentication
63+
- Routes in `src/router/` with authentication guards
64+
65+
### Icons & Theming
66+
- Material Design Icons via `src/globals.ts` constants
67+
- Vuetify theme system with custom color schemes
68+
- PWA support with service worker in `src/sw.ts`
69+
70+
## Integration Points
71+
72+
### Klipper/Moonraker Communication
73+
- All printer commands via `SocketActions` methods
74+
- Store updates from WebSocket events (not polling)
75+
- File operations through Moonraker's file API (`src/store/files/`)
76+
77+
### Component Communication
78+
- Parent-child: Props down, events up
79+
- Cross-component: Vuex store or event bus
80+
- Use `vue-property-decorator` for TypeScript components
81+
82+
## Testing Conventions
83+
- Unit tests in `tests/unit/` with Vitest + jsdom
84+
- Mock WebSocket connections for component testing
85+
- Test store actions/mutations independently from UI
86+
87+
## Code Style
88+
- Vue class-style components with `vue-property-decorator`
89+
- ESLint enforced: neostandard + Vue 2 rules and further rules defined in 'eslint.config.mjs'
90+
- camelCase for variables/methods, PascalCase for components
91+
- Use `consola` for logging, not `console.log`
92+
- Type imports: `import type { ... }` for types only
93+
94+
## Common Gotchas
95+
- Vue 2.7 limitations: No Composition API in production builds
96+
- WebSocket reconnection handled automatically by `socketClient.ts`
97+
- File uploads use FormData with progress tracking in store
98+
- Dynamic imports for code splitting (see `vue-echarts-chunk.ts`)

.github/workflows/build.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,22 @@ jobs:
5353
path: ./dist
5454

5555
publish-docker:
56-
name: Publish Docker Image
56+
name: Publish ${{ matrix.type }} Image
5757
needs: build
5858
if: ${{ github.event_name != 'pull_request' }}
5959
runs-on: ubuntu-latest
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
include:
64+
- type: Docker
65+
image-name: ${{ github.repository }}
66+
base-image: nginx:alpine
67+
port: 80
68+
- type: Docker Unprivileged
69+
image-name: ${{ github.repository }}-unprivileged
70+
base-image: nginxinc/nginx-unprivileged:alpine
71+
port: 8080
6072
permissions:
6173
id-token: write
6274
contents: read
@@ -77,7 +89,7 @@ jobs:
7789
uses: docker/metadata-action@v5
7890
with:
7991
images: |
80-
ghcr.io/${{ github.repository }}
92+
ghcr.io/${{ matrix.image-name }}
8193
tags: |
8294
type=semver,pattern={{raw}}
8395
type=ref,event=pr
@@ -105,6 +117,9 @@ jobs:
105117
context: .
106118
file: ./Dockerfile
107119
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
120+
build-args: |
121+
BASE_IMAGE=${{ matrix.base-image }}
122+
PORT=${{ matrix.port }}
108123
push: true
109124
sbom: true
110125
provenance: true
@@ -116,7 +131,7 @@ jobs:
116131
- name: Attest Docker image
117132
uses: actions/attest-build-provenance@v2
118133
with:
119-
subject-name: ghcr.io/${{ github.repository }}
134+
subject-name: ghcr.io/${{ matrix.image-name }}
120135
subject-digest: ${{ steps.docker_push.outputs.digest }}
121136
push-to-registry: true
122137

.husky/pre-commit

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
FILES_TO_LINT=$(git diff --cached --name-only --diff-filter=ACM | grep -iE "\.(js|jsx|mjs|ts|tsx|vue)$" || true)
1+
FILES_TO_LINT=$(git diff --cached --name-only --diff-filter=ACMR | grep -iE "\.(js|jsx|mjs|ts|tsx|vue)$" || true)
22

33
if [ -n "$FILES_TO_LINT" ]; then
44
npx --no eslint -- --max-warnings 0 $FILES_TO_LINT
55
fi
6+
7+
SVG_FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep -iE "\.(svg)$" || true)
8+
9+
if [ -n "$SVG_FILES" ]; then
10+
npx --no svgo -- -q $SVG_FILES
11+
12+
git update-index --again
13+
fi

Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
FROM nginx:alpine
1+
ARG BASE_IMAGE=nginx:alpine
2+
ARG PORT=80
23

3-
ENV PORT=80
4+
FROM $BASE_IMAGE
5+
6+
ARG PORT
7+
8+
ENV PORT=$PORT
49

510
COPY /dist /usr/share/nginx/html
611
COPY /server/nginx /etc/nginx/templates

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ Older releases can be found [here](https://github.com/fluidd-core/fluidd/release
3131

3232
## Docker support
3333

34-
We have an [official docker image](https://github.com/fluidd-core/fluidd/pkgs/container/fluidd). This is updated for each release and on each commit.
34+
We have an [official docker image](https://github.com/fluidd-core/fluidd/pkgs/container/fluidd), serving Fluidd by default on port 80.
35+
36+
For those who have specific security requirements and need/want to run an unprivileged container, we also have an [unprivileged docker image](https://github.com/fluidd-core/fluidd/pkgs/container/fluidd-unprivileged) available, serving Fluidd by default on port 8080.
37+
38+
You can override the default port where Fluidd will be served by setting the `PORT` environment variable when starting the docker container.
39+
40+
Both of these docker images are updated for each release and on each commit.
3541

3642
## Official sponsors
3743

docs/assets/images/fluidd_icon.svg

Lines changed: 6 additions & 10 deletions
Loading

0 commit comments

Comments
 (0)