main
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
573d0265f8
|
BLOG-117 Auto generate sitemap and rss file (#303)
Frontend CI / build (push) Successful in 12m2s
## Description This PR generates sitemap.xml and feed.xml from the frontend instead of the manual/toolbox script, so the public URL scheme lives in one place and the documents are never hand-mutated. - New SvelteKit server routes /sitemap.xml and /feed.xml, generated on demand with a short Cache-Control (public, max-age=300). There is no server-side cache, so the app regenerates on a cache miss; browsers, crawlers and any intermediary honour the header. - A shared PostPage entity and ListPostPagesUseCase map published posts to their public URLs using resolve(), so the frontend route table stays the single source of truth. - sitemap.xml (sitemap package) lists every published post plus the static pages only the frontend knows about: home, post list, and the terms documents. - feed.xml (feed package) contains only posts, capped at the 20 most recent. Static pages never appear in the feed. - The backend now exposes, per post, the preview image mime type and size (for a valid RSS enclosure) and the post updated_time. The frontend uses updated_time as sitemap lastmod, while the feed pubDate remains the published time. ## Package Changes | Package | Action | Version | | --- | --- | --- | | feed | Added | 6.0.0 | | sitemap | Added | 9.0.1 | | sanitize-html | Updated | 2.17.3 -> 2.17.7 | No Cargo.toml changes. ## Screenshots N/A (XML endpoints). ## Reference Resolves #117 ## Checklist - [x] A milestone is set - [x] The related issues has been linked to this branch --- Generated by Zed coding agent with Deepseek Flash Reviewed-on: #303 Co-authored-by: SquidSpirit <squid@squidspirit.com> |
||
|
|
3a1bd1f45d
|
BLOG-205 Add social media share buttons (#299)
Frontend CI / build (push) Successful in 8h1m33s
## Description Add social media sharing to the post content page. - Extract a reusable `ShareButton` component that renders an `<a>` when a share URL is provided, or a `<button>` for click-based actions, and takes the icon through a `children` snippet. - Add share buttons on the post page: LinkedIn, Facebook, X, and Email, plus a native share button (Web Share API) that is shown on mobile only. - Add share URL builders to `Links` (`EMAIL_SHARE`, `FACEBOOK_SHARE`, `LINKEDIN_SHARE`, `X_SHARE`) and the related labels to `Strings`. - Move the footer icon labels into `Strings` and add a project skill documenting the frontend strings/links conventions. ## Package Changes _No response_ ## Screenshots <!-- TODO: add screenshots of the share buttons --> ## Reference Resolves #205 ## Checklist - [x] A milestone is set - [x] The related issues has been linked to this branch --- Generated by Zed coding agent with Deepseek Flash Reviewed-on: #299 Co-authored-by: SquidSpirit <squid@squidspirit.com> |
||
|
|
815877efba
|
BLOG-290 Migrate the frontend JS runtime to bun (#294)
Frontend CI / build (push) Successful in 1m33s
### Description This change migrates the frontend environment from Node.js/pnpm to Bun to improve build performance and runtime efficiency. The migration includes updating CI/CD workflows, Docker configurations, and the SvelteKit adapter. Additionally, the PR introduces stricter linting rules via eslint-plugin-simple-import-sort and a global restriction on relative imports to enforce the use of path aliases ($lib/...), ensuring a cleaner and more maintainable import structure across the project. Backend environment variables were also renamed for consistency. ### Package Changes Package | Action | Version -- | -- | -- svelte-adapter-bun | Added | 1.0.1 eslint-plugin-simple-import-sort | Added | 13.0.0 @types/node | Added | 22.19.17 eslint-plugin-import | Removed | 2.32.0 @sveltejs/adapter-node | Removed | 5.5.4 svelte | Updated | 5.55.1 -> 5.55.5 @sentry/sveltekit | Updated | 10.47.0 -> 10.51.0 @sveltejs/kit | Updated | 2.55.0 -> 2.58.0 tailwindcss | Updated | 4.2.2 -> 4.2.4 typescript-eslint | Updated | 8.58.0 -> 8.59.1 ### Screenshots _No response_ ### Reference Resolves #290. ### Checklist - [x] A milestone is set - [x] The related issuse has been linked to this branch Reviewed-on: #294 Co-authored-by: SquidSpirit <squid@squidspirit.com> Co-committed-by: SquidSpirit <squid@squidspirit.com> |
||
|
|
2b59cd52ef
|
BLOG-237 Implement AI-powered RAG search for posts using Qdrant and FastEmbed (#256)
Frontend CI / build (push) Successful in 1m17s
### Description ### Summary This PR replaces the legacy string-matching search logic with an AI-powered semantic vector search (Retrieval-Augmented Generation) for blog posts. By integrating Qdrant as the vector database and FastEmbed for generating local text embeddings, the application now allows users to perform context-aware semantic searches or ask natural language questions to find relevant post content. The backend text processing leverages markdown splitting and tokenization to chunk post content efficiently. The frontend has been updated to provide UI hints regarding this new AI search capability, utilizing a newly added Tooltip component. ### Key Changes * **Backend - New Search Module:** Created a new `search` workspace feature containing `SearchRepository`, `SearchVectorDbService`, and `SearchService`. * **Backend - Post Integration:** Integrated `SearchService` into `CreatePostUseCase`, `UpdatePostUseCase`, and `GetAllPostInfoUseCase`. Post creations and updates now automatically trigger vector document indexing. Retrieving posts with a keyword query now delegates to the vector search to return contextually relevant post IDs. * **Backend - Embeddings & Vector DB:** Added dependency injection and configurations for Qdrant (`QdrantConfiguration`) and local embeddings (`EmbeddingConfiguration`), utilizing the `BAAI/bge-large-zh-v1.5` model for optimized Chinese text embeddings. * **Backend - Environment & Build:** Added required Qdrant and embedding environment variables to `.env.example`. Updated the `Dockerfile` to utilize parallel compilation (`cargo build --release -j2`) for faster build times. * **Frontend - UI Components:** Implemented a new `Tooltip` component architecture using `bits-ui`. * **Frontend - User Experience:** Updated the `FilteringDialog` to display a tooltip hint explaining the new RAG-based semantic search to users. Updated `strings.ts` with relevant placeholders and instructions. ### Testing/Review Notes * Ensure a local Qdrant instance is running and accessible at the URL defined in your `.env` (default is `http://127.0.0.1:6334`). * On initial backend startup, verify that the `BAAI/bge-large-zh-v1.5` embedding model downloads successfully to your designated `EMBEDDING_CACHE_DIR`. * Create or edit an existing post in the system. Check your Qdrant dashboard/API to verify that the post's content chunks are successfully vectorized and upserted into the `blog_post` collection. * Perform a search query using natural language in the frontend to confirm semantic retrieval returns the expected posts. * Verify that the new tooltip renders correctly when hovering over the info icon in the search dialog. ### Package Changes * **Backend (`Cargo.toml` / `Cargo.lock`):** * **Added:** `fastembed` (5.13.0), `qdrant-client` (1.17.0), `text-splitter` (0.29.3, with `markdown` and `tokenizers` features), `tokenizers` (0.22.2). * **Updated:** `tokio` (from 1.50.0 to 1.51.0). * **Frontend (`package.json` / `pnpm-lock.yaml`):** * **Updated:** `bits-ui` (from ^2.11.5 to ^2.16.5), `@internationalized/date` (from ^3.10.0 to ^3.12.0). ### Screenshots _No response_ ### Reference Resolves #237. ### Checklist - [x] A milestone is set - [x] The related issuse has been linked to this branch Reviewed-on: #256 Co-authored-by: SquidSpirit <squid@squidspirit.com> Co-committed-by: SquidSpirit <squid@squidspirit.com> |
||
|
|
49df26b919
|
BLOG-243 Implement safe image deletion and cross-entity reference tracking (#250)
Frontend CI / build (push) Successful in 1m16s
### Description
This PR introduces the ability to delete uploaded images while ensuring data integrity by preventing the deletion of images currently referenced by any posts. It adds a new `post_image` relational table to track these references dynamically. The frontend has been updated to support deleting images from the dashboard, visually disabling the deletion action for in-use images. Additionally, we've extracted image parsing logic into a dedicated service, updated dependencies across the backend, and strengthened our pre-commit hooks to ensure deeper code validation.
#### Key Changes
* **Database Migrations**:
* Created the `post_image` join table to establish a relationship between posts and images and track active references.
* **Backend - Image Module**:
* Added `DeleteImageUseCase` and `delete_image_handler` (`DELETE /image/{id}`) to handle safe deletions.
* Refactored the internal entity `ImageInfo` to `ImageMetaData` and introduced an `is_referred` boolean on API DTOs.
* Updated `GetImageInfoUseCase` and `ListImagesUseCase` to query the `PostRepository` for reference counts, determining if an image is safe to delete.
* **Backend - Post Module**:
* Introduced `ImageExtractor` to automatically parse Markdown content and the `preview_image_url` to extract embedded image IDs.
* Updated `CreatePostUseCase`, `UpdatePostUseCase`, and `PostDbServiceImpl` to synchronize `post_image` relationships upon post creation/updates based on the extracted IDs.
* Refactored label validation logic into a centralized `LabelRelationService`.
* **Frontend**:
* Implemented `ImageDeletedStore` and the corresponding `DeleteImageUseCase`.
* Updated `ImageOverallDashboardPage` to display a delete button, which disables automatically if `isReferred` is true.
* Changed `previewImageUrl` types from `URL` to `string` in post DTOs, ViewModels, and UI components (`OpenGraph`, `StructuredData`) to simplify state hydration/serialization.
* **Tooling & CI**:
* Updated `.pre-commit-config.yaml` to restrict hook executions to their specific directories (`^backend/` and `^frontend/`).
* Added `cargo test` to `backend-check.sh` and `pnpm check` to `frontend-lint.sh`.
#### Testing/Review Notes
* **Database setup**: Run `sqlx migrate run` to apply the new `post_image` table migration.
* **Upload & Reference**: Upload an image via the dashboard. Create a new post referencing the image (either within the Markdown content or as the preview image).
* **Deletion constraint check**: Navigate to the Image Dashboard. Verify the delete button for the referenced image is disabled. Sending a direct `DELETE` request to the API should return a `400 Bad Request` with the `ReferencedImage` error.
* **Successful deletion**: Remove the image reference from the post (or delete the post). Return to the Image Dashboard and verify the image can now be successfully deleted.
* **Tooling check**: Verify that committing changes locally correctly runs `cargo test` and `pnpm check` without failures.
### Package Changes
**Backend (`Cargo.toml` / `Cargo.lock`)**:
* Updated `actix-web` from **4.12.1** to **4.13.0**
* Updated `tokio` from **1.48.0** to **1.50.0**
* Updated `chrono` from **0.4.42** to **0.4.44**
* Updated `anyhow` from **1.0.100** to **1.0.102**
* Updated `env_logger` from **0.11.8** to **0.11.10**
* Updated `futures` from **0.3.31** to **0.3.32**
* Updated `regex` from **1.12.2** to **1.12.3**
* Updated `sentry` from **0.46.0** to **0.47.0**
* Various transitive dependencies updated to reflect the new primary bumps.
### Screenshots
|Is Not Referred|Is Referred|
|-|-|
|||
### Reference
Resolves #243.
### Checklist
- [x] A milestone is set
- [x] The related issuse has been linked to this branch
Reviewed-on: #250
Co-authored-by: SquidSpirit <squid@squidspirit.com>
Co-committed-by: SquidSpirit <squid@squidspirit.com>
|
||
|
|
805807909d
|
BLOG-227 RSS feed entry and generating script (#230)
Frontend CI / build (push) Successful in 1m13s
### Description
#### Summary
This PR introduces a new `script/toolbox` directory containing a Python-based utility service designed to handle background tasks, specifically generating an RSS 2.0 feed (`generate_rss.py`). It includes the necessary Docker infrastructure to build and deploy this toolbox alongside the existing services.
Additionally, this change refactors the location of maintenance shell scripts to `script/pre-commit/` for better organization and optimizes the CI/CD deployment workflow by implementing Docker layer caching and removing redundant frontend build steps.
#### Key Changes
##### Toolbox & RSS
* **New Service:** Added `script/toolbox/` containing a Python 3.14 environment, `Dockerfile`, and `requirements.txt`.
* **RSS Logic:** Implemented `generate_rss.py` to fetch published posts from the PostgreSQL database, scrape site metadata, and generate a `feed.xml` file.
* **Documentation:** Added `README.md` and `.env.example` for the toolbox service.
##### CI/CD & Infrastructure
* **Workflow Update (`deployment.yaml`):**
* Added a new job to build and push the `toolbox` Docker image.
* Enabled `cache-from` and `cache-to` (registry caching) for Frontend, Backend, and Toolbox images to speed up build times.
* **Frontend CI:** Removed the redundant `pnpm run build` step from `frontend-ci.yaml`.
##### Refactoring & UI
* **Script Reorganization:** Moved `backend-check.sh`, `frontend-lint.sh`, and `sqlx-prepare.sh` into `script/pre-commit/` and updated their internal path resolution.
* **Pre-commit:** Updated `.pre-commit-config.yaml` to reflect the new script locations.
* **Frontend UI:** Added an RSS icon link to `Footer.svelte` pointing to the generated feed.
#### Testing & Review Notes
1. **Toolbox Build:** Verify the `toolbox` image builds successfully:
```bash
cd script/toolbox
docker build -t blog-toolbox .
```
2. **RSS Generation:**
* Run the container locally with correct `.env` variables.
* Execute `python generate_rss.py` inside the container.
* Verify the output `feed.xml` validates against RSS 2.0 standards.
3. **Pre-commit Hooks:** Run `pre-commit run --all-files` to ensure the path refactoring hasn't broken local linting/checking.
4. **Deployment:** Monitor the next Gitea Action run to confirm registry caching is functioning correctly.
### Package Changes
```
python-dotenv==1.2.1
psycopg2-binary==2.9.11
requests==2.32.5
```
### Screenshots
> Screenshot at Feeder app on Android
<img src="/attachments/d791ac12-307c-43a7-a146-c423f2600c02" width="200px"/>
### Reference
Resolve #227.
### Checklist
- [x] A milestone is set
- [x] The related issuse has been linked to this branch
Reviewed-on: #230
Co-authored-by: SquidSpirit <squid@squidspirit.com>
Co-committed-by: SquidSpirit <squid@squidspirit.com>
|
||
|
|
d1f085b255 |
BLOG-145 Add pre-commit hooks (#147)
Frontend CI / build (push) Successful in 1m37s
### Description - READMEs are also updated! ### Package Changes _No response_ ### Screenshots _No response_ ### Reference Resolves #145. ### Checklist - [x] A milestone is set - [x] The related issuse has been linked to this branch Reviewed-on: #147 Co-authored-by: SquidSpirit <squid@squidspirit.com> Co-committed-by: SquidSpirit <squid@squidspirit.com> |