diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 62e90f58..c90987b3 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -353,3 +353,63 @@ jobs: releaseDraft: false prerelease: false args: ${{ matrix.args }} + + + # Create tar.gz archives for AUR (Arch Linux) + create-aur-tarball: + needs: [publish-tauri] + runs-on: ubuntu-22.04 + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - name: Get version from tag + id: get_version + run: | + if [ "${{ github.event_name }}" = "release" ]; then + TAG="${{ github.event.release.tag_name }}" + else + TAG="${{ github.event.inputs.tag }}" + fi + VERSION="${TAG#v}" + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "tag=${TAG}" >> $GITHUB_OUTPUT + + - name: Download Linux deb from release + run: | + VERSION="${{ steps.get_version.outputs.version }}" + TAG="${{ steps.get_version.outputs.tag }}" + + # Wait for release assets to be available + sleep 30 + + # Download the deb package + curl -fLo pictopy.deb "https://github.com/AOSSIE-Org/PictoPy/releases/download/${TAG}/picto-py_${VERSION}_amd64.deb" || \ + curl -fLo pictopy.deb "https://github.com/AOSSIE-Org/PictoPy/releases/download/${TAG}/PictoPy_${VERSION}_amd64.deb" + + - name: Extract and repackage as tar.gz + run: | + VERSION="${{ steps.get_version.outputs.version }}" + + # Extract deb package + mkdir -p extract + dpkg-deb -x pictopy.deb extract/ + + # Create tar.gz with proper structure + cd extract + tar -czvf "../pictopy_${VERSION}_amd64.tar.gz" . + cd .. + + # Calculate checksum + sha256sum "pictopy_${VERSION}_amd64.tar.gz" > "pictopy_${VERSION}_amd64.tar.gz.sha256" + + - name: Upload tar.gz to release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.get_version.outputs.tag }} + files: | + pictopy_${{ steps.get_version.outputs.version }}_amd64.tar.gz + pictopy_${{ steps.get_version.outputs.version }}_amd64.tar.gz.sha256 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish-aur.yml b/.github/workflows/publish-aur.yml new file mode 100644 index 00000000..28516f34 --- /dev/null +++ b/.github/workflows/publish-aur.yml @@ -0,0 +1,162 @@ +name: Publish to AUR + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: "Tag name for the release (e.g., v1.1.0)" + required: true + type: string + +jobs: + publish-aur: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get version from tag + id: get_version + run: | + if [ "${{ github.event_name }}" = "release" ]; then + TAG="${{ github.event.release.tag_name }}" + else + TAG="${{ github.event.inputs.tag }}" + fi + # Remove 'v' prefix if present + VERSION="${TAG#v}" + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "tag=${TAG}" >> $GITHUB_OUTPUT + + - name: Wait for release assets + run: | + echo "Waiting for release assets to be available..." + sleep 60 + + - name: Calculate SHA256 checksums + id: checksums + run: | + VERSION="${{ steps.get_version.outputs.version }}" + BASE_URL="https://github.com/AOSSIE-Org/PictoPy/releases/download/v${VERSION}" + + # Download and calculate checksums for x86_64 + echo "Downloading x86_64 tarball..." + if curl -fLo pictopy_amd64.tar.gz "${BASE_URL}/pictopy_${VERSION}_amd64.tar.gz"; then + SHA256_X86_64=$(sha256sum pictopy_amd64.tar.gz | cut -d' ' -f1) + echo "sha256_x86_64=${SHA256_X86_64}" >> $GITHUB_OUTPUT + else + echo "sha256_x86_64=SKIP" >> $GITHUB_OUTPUT + fi + + # Download and calculate checksums for aarch64 + echo "Downloading aarch64 tarball..." + if curl -fLo pictopy_arm64.tar.gz "${BASE_URL}/pictopy_${VERSION}_arm64.tar.gz"; then + SHA256_AARCH64=$(sha256sum pictopy_arm64.tar.gz | cut -d' ' -f1) + echo "sha256_aarch64=${SHA256_AARCH64}" >> $GITHUB_OUTPUT + else + echo "sha256_aarch64=SKIP" >> $GITHUB_OUTPUT + fi + + - name: Update PKGBUILD + run: | + VERSION="${{ steps.get_version.outputs.version }}" + SHA256_X86_64="${{ steps.checksums.outputs.sha256_x86_64 }}" + SHA256_AARCH64="${{ steps.checksums.outputs.sha256_aarch64 }}" + + cd aur + + # Update version in PKGBUILD + sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD + sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD + + # Update source URLs + sed -i "s|pictopy_[0-9.]*_amd64|pictopy_${VERSION}_amd64|g" PKGBUILD + sed -i "s|pictopy_[0-9.]*_arm64|pictopy_${VERSION}_arm64|g" PKGBUILD + sed -i "s|/v[0-9.]*/|/v${VERSION}/|g" PKGBUILD + + # Update checksums + if [ "${SHA256_X86_64}" != "SKIP" ]; then + sed -i "s/^sha256sums_x86_64=.*/sha256sums_x86_64=('${SHA256_X86_64}')/" PKGBUILD + fi + if [ "${SHA256_AARCH64}" != "SKIP" ]; then + sed -i "s/^sha256sums_aarch64=.*/sha256sums_aarch64=('${SHA256_AARCH64}')/" PKGBUILD + fi + + cat PKGBUILD + + - name: Generate .SRCINFO + run: | + cd aur + + VERSION="${{ steps.get_version.outputs.version }}" + SHA256_X86_64="${{ steps.checksums.outputs.sha256_x86_64 }}" + SHA256_AARCH64="${{ steps.checksums.outputs.sha256_aarch64 }}" + + cat > .SRCINFO << EOF + pkgbase = pictopy + pkgdesc = A privacy-focused photo management application with AI-powered tagging and face recognition + pkgver = ${VERSION} + pkgrel = 1 + url = https://github.com/AOSSIE-Org/PictoPy + install = pictopy.install + arch = x86_64 + arch = aarch64 + license = MIT + makedepends = rust + makedepends = cargo + makedepends = nodejs + makedepends = npm + makedepends = python + makedepends = python-pip + makedepends = pyinstaller + makedepends = webkit2gtk-4.1 + makedepends = base-devel + makedepends = curl + makedepends = wget + makedepends = file + makedepends = openssl + makedepends = appmenu-gtk-module + makedepends = librsvg + depends = webkit2gtk-4.1 + depends = gtk3 + depends = glib2 + depends = cairo + depends = pango + depends = gdk-pixbuf2 + depends = libsoup3 + depends = openssl + depends = hicolor-icon-theme + optdepends = python-onnxruntime: For AI model inference + optdepends = python-opencv: For image processing + optdepends = python-numpy: For numerical operations + options = !strip + options = !emptydirs + source_x86_64 = pictopy-${VERSION}-x86_64.tar.gz::https://github.com/AOSSIE-Org/PictoPy/releases/download/v${VERSION}/pictopy_${VERSION}_amd64.tar.gz + sha256sums_x86_64 = ${SHA256_X86_64} + source_aarch64 = pictopy-${VERSION}-aarch64.tar.gz::https://github.com/AOSSIE-Org/PictoPy/releases/download/v${VERSION}/pictopy_${VERSION}_arm64.tar.gz + sha256sums_aarch64 = ${SHA256_AARCH64} + + pkgname = pictopy + EOF + + # Remove leading whitespace + sed -i 's/^ //' .SRCINFO + + cat .SRCINFO + + - name: Publish to AUR + uses: KSXGitHub/github-actions-deploy-aur@v3.0.1 + with: + pkgname: pictopy + pkgbuild: ./aur/PKGBUILD + commit_username: ${{ secrets.AUR_USERNAME }} + commit_email: ${{ secrets.AUR_EMAIL }} + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + commit_message: "Update to version ${{ steps.get_version.outputs.version }}" + ssh_keyscan_types: ed25519 + force_push: true + assets: | + ./aur/pictopy.install + ./aur/.SRCINFO diff --git a/README.md b/README.md index 59588948..dbf64316 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,36 @@ PictoPy is an advanced desktop gallery application that combines the power of Tauri, React, and Rust for the frontend with a Python backend for sophisticated image analysis and management. +## Installation + +### Arch Linux (AUR) + +PictoPy is available on the Arch User Repository (AUR) for Arch-based distributions (Arch, Manjaro, EndeavourOS, etc.): + +```bash +# Using yay +yay -S pictopy + +# Using paru +paru -S pictopy + +# Using pikaur +pikaur -S pictopy +``` + +For the development version built from source: +```bash +yay -S pictopy-git +``` + +### Other Linux Distributions + +Download the AppImage or .deb package from the [Releases](https://github.com/AOSSIE-Org/PictoPy/releases) page. + +### Windows & macOS + +Download the installer from the [Releases](https://github.com/AOSSIE-Org/PictoPy/releases) page. + # Want to Contribute? 😄     diff --git a/aur/.SRCINFO b/aur/.SRCINFO new file mode 100644 index 00000000..5ef354a1 --- /dev/null +++ b/aur/.SRCINFO @@ -0,0 +1,44 @@ +pkgbase = pictopy + pkgdesc = A privacy-focused photo management application with AI-powered tagging and face recognition + pkgver = 1.1.0 + pkgrel = 1 + url = https://github.com/AOSSIE-Org/PictoPy + install = pictopy.install + arch = x86_64 + arch = aarch64 + license = MIT + makedepends = rust + makedepends = cargo + makedepends = nodejs + makedepends = npm + makedepends = python + makedepends = python-pip + makedepends = pyinstaller + makedepends = webkit2gtk-4.1 + makedepends = base-devel + makedepends = curl + makedepends = wget + makedepends = file + makedepends = openssl + makedepends = appmenu-gtk-module + makedepends = librsvg + depends = webkit2gtk-4.1 + depends = gtk3 + depends = glib2 + depends = cairo + depends = pango + depends = gdk-pixbuf2 + depends = libsoup3 + depends = openssl + depends = hicolor-icon-theme + optdepends = python-onnxruntime: For AI model inference + optdepends = python-opencv: For image processing + optdepends = python-numpy: For numerical operations + options = !strip + options = !emptydirs + source_x86_64 = pictopy-1.1.0-x86_64.tar.gz::https://github.com/AOSSIE-Org/PictoPy/releases/download/v1.1.0/pictopy_1.1.0_amd64.tar.gz + sha256sums_x86_64 = SKIP + source_aarch64 = pictopy-1.1.0-aarch64.tar.gz::https://github.com/AOSSIE-Org/PictoPy/releases/download/v1.1.0/pictopy_1.1.0_arm64.tar.gz + sha256sums_aarch64 = SKIP + +pkgname = pictopy diff --git a/aur/PKGBUILD b/aur/PKGBUILD new file mode 100644 index 00000000..b1490565 --- /dev/null +++ b/aur/PKGBUILD @@ -0,0 +1,85 @@ +# Maintainer: AOSSIE +# Contributor: PictoPy Team + +pkgname=pictopy +pkgver=1.1.0 +pkgrel=1 +pkgdesc="A privacy-focused photo management application with AI-powered tagging and face recognition" +arch=('x86_64' 'aarch64') +url="https://github.com/AOSSIE-Org/PictoPy" +license=('MIT') +depends=( + 'webkit2gtk-4.1' + 'gtk3' + 'glib2' + 'cairo' + 'pango' + 'gdk-pixbuf2' + 'libsoup3' + 'openssl' + 'hicolor-icon-theme' +) +makedepends=( + 'rust' + 'cargo' + 'nodejs' + 'npm' + 'python' + 'python-pip' + 'pyinstaller' + 'webkit2gtk-4.1' + 'base-devel' + 'curl' + 'wget' + 'file' + 'openssl' + 'appmenu-gtk-module' + 'librsvg' +) +optdepends=( + 'python-onnxruntime: For AI model inference' + 'python-opencv: For image processing' + 'python-numpy: For numerical operations' +) +options=('!strip' '!emptydirs') +install=${pkgname}.install +source_x86_64=("${pkgname}-${pkgver}-x86_64.tar.gz::${url}/releases/download/v${pkgver}/pictopy_${pkgver}_amd64.tar.gz") +source_aarch64=("${pkgname}-${pkgver}-aarch64.tar.gz::${url}/releases/download/v${pkgver}/pictopy_${pkgver}_arm64.tar.gz") +sha256sums_x86_64=('SKIP') +sha256sums_aarch64=('SKIP') + +package() { + cd "${srcdir}" + + # Install the main application binary + install -Dm755 "usr/bin/picto-py" "${pkgdir}/usr/bin/pictopy" + + # Install libraries and resources + if [ -d "usr/lib" ]; then + cp -r usr/lib "${pkgdir}/usr/" + fi + + # Install desktop entry + install -Dm644 "usr/share/applications/picto-py.desktop" \ + "${pkgdir}/usr/share/applications/pictopy.desktop" + + # Update desktop entry to use correct binary name + sed -i 's/Exec=picto-py/Exec=pictopy/g' "${pkgdir}/usr/share/applications/pictopy.desktop" + + # Install icons + for size in 32x32 128x128 256x256; do + if [ -f "usr/share/icons/hicolor/${size}/apps/picto-py.png" ]; then + install -Dm644 "usr/share/icons/hicolor/${size}/apps/picto-py.png" \ + "${pkgdir}/usr/share/icons/hicolor/${size}/apps/pictopy.png" + fi + done + + # Install scalable icon if available + if [ -f "usr/share/icons/hicolor/scalable/apps/picto-py.svg" ]; then + install -Dm644 "usr/share/icons/hicolor/scalable/apps/picto-py.svg" \ + "${pkgdir}/usr/share/icons/hicolor/scalable/apps/pictopy.svg" + fi + + # Install license + install -Dm644 "${srcdir}/../LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" 2>/dev/null || true +} diff --git a/aur/PKGBUILD-git b/aur/PKGBUILD-git new file mode 100644 index 00000000..c52bebdb --- /dev/null +++ b/aur/PKGBUILD-git @@ -0,0 +1,164 @@ +# Maintainer: AOSSIE +# Contributor: PictoPy Team + +pkgname=pictopy-git +pkgver=1.1.0 +pkgrel=1 +pkgdesc="A privacy-focused photo management application with AI-powered tagging and face recognition (git version)" +arch=('x86_64' 'aarch64') +url="https://github.com/AOSSIE-Org/PictoPy" +license=('MIT') +depends=( + 'webkit2gtk-4.1' + 'gtk3' + 'glib2' + 'cairo' + 'pango' + 'gdk-pixbuf2' + 'libsoup3' + 'openssl' + 'hicolor-icon-theme' +) +makedepends=( + 'git' + 'rust' + 'cargo' + 'nodejs' + 'npm' + 'python' + 'python-pip' + 'python-virtualenv' + 'webkit2gtk-4.1' + 'base-devel' + 'curl' + 'wget' + 'file' + 'openssl' + 'appmenu-gtk-module' + 'librsvg' +) +optdepends=( + 'python-onnxruntime: For AI model inference' + 'python-opencv: For image processing' + 'python-numpy: For numerical operations' +) +provides=('pictopy') +conflicts=('pictopy') +options=('!strip' '!emptydirs') +install=pictopy.install +source=("${pkgname}::git+${url}.git") +sha256sums=('SKIP') + +pkgver() { + cd "${srcdir}/${pkgname}" + git describe --tags --long 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' || echo "1.1.0" +} + +build() { + cd "${srcdir}/${pkgname}" + + # Build backend server + echo "Building backend server..." + cd backend + python -m venv venv + source venv/bin/activate + pip install --upgrade pip + pip install -r requirements.txt + pip install pyinstaller + pyinstaller main.py --name PictoPy_Server --onedir --distpath dist + mkdir -p dist/PictoPy_Server/images + cp -r app dist/PictoPy_Server/ + deactivate + cd .. + + # Build sync microservice + echo "Building sync microservice..." + cd sync-microservice + python -m venv venv + source venv/bin/activate + pip install --upgrade pip + pip install -r requirements.txt + pip install pyinstaller + pyinstaller main.py --name PictoPy_Sync --onedir --distpath dist + cp -r app dist/PictoPy_Sync/ + deactivate + cd .. + + # Build frontend with Tauri + echo "Building frontend..." + cd frontend + npm install + npm run build + cd src-tauri + cargo build --release + cd ../.. +} + +package() { + cd "${srcdir}/${pkgname}" + + # Install the main application binary + install -Dm755 "frontend/src-tauri/target/release/picto-py" \ + "${pkgdir}/usr/bin/pictopy" + + # Install backend resources + install -dm755 "${pkgdir}/usr/lib/pictopy/resources/backend" + cp -r backend/dist/PictoPy_Server/* "${pkgdir}/usr/lib/pictopy/resources/backend/" + + # Install sync microservice resources + install -dm755 "${pkgdir}/usr/lib/pictopy/resources/sync-microservice" + cp -r sync-microservice/dist/PictoPy_Sync/* "${pkgdir}/usr/lib/pictopy/resources/sync-microservice/" + + # Set permissions for resources + chmod -R 755 "${pkgdir}/usr/lib/pictopy/resources" + + # Install desktop entry + install -Dm644 /dev/stdin "${pkgdir}/usr/share/applications/pictopy.desktop" << EOF +[Desktop Entry] +Name=PictoPy +Comment=Privacy-focused photo management with AI-powered tagging +Exec=pictopy +Icon=pictopy +Terminal=false +Type=Application +Categories=Graphics;Photography;Viewer; +Keywords=photo;image;gallery;ai;tagging;face;recognition; +StartupWMClass=PictoPy +EOF + + # Install icons + install -Dm644 "frontend/src-tauri/icons/32x32.png" \ + "${pkgdir}/usr/share/icons/hicolor/32x32/apps/pictopy.png" + install -Dm644 "frontend/src-tauri/icons/128x128.png" \ + "${pkgdir}/usr/share/icons/hicolor/128x128/apps/pictopy.png" + install -Dm644 "frontend/src-tauri/icons/128x128@2x.png" \ + "${pkgdir}/usr/share/icons/hicolor/256x256/apps/pictopy.png" + install -Dm644 "frontend/src-tauri/icons/icon.png" \ + "${pkgdir}/usr/share/icons/hicolor/512x512/apps/pictopy.png" + + # Install license + install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" 2>/dev/null || \ + install -Dm644 /dev/stdin "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" << 'EOF' +MIT License + +Copyright (c) AOSSIE + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +EOF +} diff --git a/aur/README.md b/aur/README.md new file mode 100644 index 00000000..a9a47e0d --- /dev/null +++ b/aur/README.md @@ -0,0 +1,126 @@ +# PictoPy AUR Package + +This directory contains the files needed to publish PictoPy to the [Arch User Repository (AUR)](https://aur.archlinux.org/). + +## Package Variants + +### `pictopy` (Binary Package) +The main package that installs pre-built binaries from GitHub releases. This is the recommended option for most users. + +### `pictopy-git` (Source Package) +Builds PictoPy from the latest git source. Use this if you want the bleeding-edge version or need to make modifications. + +## Installation + +### Using an AUR Helper (Recommended) + +```bash +# Using yay +yay -S pictopy + +# Using paru +paru -S pictopy + +# Using pikaur +pikaur -S pictopy +``` + +### Manual Installation + +```bash +# Clone the AUR repository +git clone https://aur.archlinux.org/pictopy.git +cd pictopy + +# Build and install +makepkg -si +``` + +### Installing from Git Source + +```bash +# Using yay +yay -S pictopy-git + +# Or manually +git clone https://aur.archlinux.org/pictopy-git.git +cd pictopy-git +makepkg -si +``` + +## Dependencies + +### Runtime Dependencies +- `webkit2gtk-4.1` - WebKit rendering engine +- `gtk3` - GTK+ 3 toolkit +- `glib2` - GLib library +- `cairo` - 2D graphics library +- `pango` - Text rendering +- `gdk-pixbuf2` - Image loading +- `libsoup3` - HTTP library +- `openssl` - Cryptography +- `hicolor-icon-theme` - Icon theme + +### Optional Dependencies +- `python-onnxruntime` - For AI model inference +- `python-opencv` - For image processing +- `python-numpy` - For numerical operations + +## Updating the AUR Package + +The package is automatically updated via GitHub Actions when a new release is published. To manually update: + +1. Update the `pkgver` in `PKGBUILD` +2. Update the source URLs if needed +3. Regenerate checksums: `updpkgsums` +4. Regenerate `.SRCINFO`: `makepkg --printsrcinfo > .SRCINFO` +5. Commit and push to AUR + +## GitHub Actions Setup + +To enable automatic AUR publishing, add these secrets to your GitHub repository: + +- `AUR_USERNAME` - Your AUR username +- `AUR_EMAIL` - Your AUR email +- `AUR_SSH_PRIVATE_KEY` - SSH private key registered with AUR + +### Generating SSH Key for AUR + +```bash +# Generate a new SSH key +ssh-keygen -t ed25519 -C "your-email@example.com" -f aur_key + +# Add the public key to your AUR account +cat aur_key.pub +# Copy this to: https://aur.archlinux.org/account/YOUR_USERNAME/edit + +# Add the private key as a GitHub secret (AUR_SSH_PRIVATE_KEY) +cat aur_key +``` + +## Troubleshooting + +### Build Fails with Missing Dependencies +```bash +# Install all build dependencies +sudo pacman -S --needed base-devel rust cargo nodejs npm python python-pip webkit2gtk-4.1 +``` + +### Application Won't Start +```bash +# Check for missing libraries +ldd /usr/bin/pictopy | grep "not found" + +# Install missing dependencies +sudo pacman -S webkit2gtk-4.1 gtk3 +``` + +### AI Features Not Working +```bash +# Install optional AI dependencies +sudo pacman -S python-onnxruntime python-opencv python-numpy +``` + +## License + +MIT License - See the main repository for details. diff --git a/aur/pictopy.install b/aur/pictopy.install new file mode 100644 index 00000000..b9f8a9f1 --- /dev/null +++ b/aur/pictopy.install @@ -0,0 +1,47 @@ +# PictoPy post-install hooks for Arch Linux + +post_install() { + echo "==> PictoPy has been installed successfully!" + echo "" + echo "==> To start PictoPy, run: pictopy" + echo "==> Or find it in your application menu." + echo "" + echo "==> Note: On first run, PictoPy will download required AI models." + echo "==> This may take a few minutes depending on your internet connection." + echo "" + + # Update icon cache + if [ -x /usr/bin/gtk-update-icon-cache ]; then + gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor + fi + + # Update desktop database + if [ -x /usr/bin/update-desktop-database ]; then + update-desktop-database -q /usr/share/applications + fi +} + +post_upgrade() { + post_install + echo "==> PictoPy has been upgraded to version $1" +} + +pre_remove() { + echo "==> Removing PictoPy..." +} + +post_remove() { + # Update icon cache + if [ -x /usr/bin/gtk-update-icon-cache ]; then + gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor + fi + + # Update desktop database + if [ -x /usr/bin/update-desktop-database ]; then + update-desktop-database -q /usr/share/applications + fi + + echo "==> PictoPy has been removed." + echo "==> User data in ~/.local/share/pictopy has been preserved." + echo "==> To remove all data, run: rm -rf ~/.local/share/pictopy" +} diff --git a/frontend/src-tauri/tauri.conf.json b/frontend/src-tauri/tauri.conf.json index 8ad815df..b5680160 100644 --- a/frontend/src-tauri/tauri.conf.json +++ b/frontend/src-tauri/tauri.conf.json @@ -7,11 +7,17 @@ }, "bundle": { "active": true, - "targets": ["nsis", "deb", "app"], + "targets": "all", "createUpdaterArtifacts": true, "linux": { "deb": { "postInstallScript": "./postinstall.sh" + }, + "appimage": { + "bundleMediaFramework": true + }, + "rpm": { + "release": "1" } }, "icon": [ diff --git a/frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx b/frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx index db4b029f..3d609a38 100644 --- a/frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx +++ b/frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx @@ -1,9 +1,17 @@ -import React from 'react'; -import { Folder, Trash2, Check } from 'lucide-react'; +import React, { useState } from 'react'; +import { Folder, Trash2, Check, AlertTriangle } from 'lucide-react'; import { Switch } from '@/components/ui/switch'; import { Button } from '@/components/ui/button'; import { Progress } from '@/components/ui/progress'; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; import { useSelector } from 'react-redux'; import { RootState } from '@/app/store'; import FolderPicker from '@/components/FolderPicker/FolderPicker'; @@ -29,6 +37,33 @@ const FolderManagementCard: React.FC = () => { (state: RootState) => state.folders.taggingStatus, ); + // State for delete confirmation dialog + const [folderToDelete, setFolderToDelete] = useState( + null, + ); + const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false); + + // Handle delete button click - show confirmation dialog + const handleDeleteClick = (folder: FolderDetails) => { + setFolderToDelete(folder); + setIsDeleteDialogOpen(true); + }; + + // Handle confirmed deletion + const handleConfirmDelete = () => { + if (folderToDelete) { + deleteFolder(folderToDelete.folder_id); + setIsDeleteDialogOpen(false); + setFolderToDelete(null); + } + }; + + // Handle cancel deletion + const handleCancelDelete = () => { + setIsDeleteDialogOpen(false); + setFolderToDelete(null); + }; + return ( { + + + + ); };