diff --git a/.github/workflows/app-build.yml b/.github/workflows/build-and-release.yml similarity index 92% rename from .github/workflows/app-build.yml rename to .github/workflows/build-and-release.yml index ed16cbb95..4a8e6e00e 100644 --- a/.github/workflows/app-build.yml +++ b/.github/workflows/build-and-release.yml @@ -1,5 +1,4 @@ -name: Build and Release - +name: Build and Release App on: workflow_dispatch: # Ability to manually trigger the workflow @@ -187,8 +186,8 @@ jobs: - uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TAURI_SIGNING_PRIVATE_KEY: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5YzZCUHNpNjQzalN3SllaeGI0TUU1Ky9VQjZOZjI0aklxdXJ6WVhrTEVVUUFBQkFBQUFBQUFBQUFBQUlBQUFBQWxRSUV5LzJkSXlMWUZrWE44MC9HQXFKQ1piYkhDUmJvTDlIVnlPQXpKeFJTWVBDdGZCcHp6RGpJMTlTWkp0RGhCNzRyT2lHc0JsYWFBTTdzcEN0ZnNuaE1EcjZxYWlEOHArbU9hcnFIUjUvQ1VpOERGeU55M2ttZE5xNnBvSE5ONllGOWN0YmkvS289Cg== - TAURI_SIGNING_PRIVATE_KEY_PASSWORD: 123456 + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY}} + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} with: projectPath: ./frontend tagName: app-v__VERSION__ diff --git a/.github/workflows/ci.yml b/.github/workflows/docs-deploy.yml similarity index 97% rename from .github/workflows/ci.yml rename to .github/workflows/docs-deploy.yml index 068eac79b..c3a0ee5bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/docs-deploy.yml @@ -1,4 +1,4 @@ -name: ci +name: Docs Deploy on: push: branches: diff --git a/.github/workflows/merge.yml b/.github/workflows/pr-check-build.yml similarity index 76% rename from .github/workflows/merge.yml rename to .github/workflows/pr-check-build.yml index d35a50569..79c8331be 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/pr-check-build.yml @@ -1,13 +1,12 @@ -name: "PR Check for PictoPy" +name: PR Check Build on: - pull_request_review: - types: [submitted] pull_request: paths: - "frontend/**" jobs: tauri-build-check: + name: Tauri Build Check strategy: fail-fast: false matrix: @@ -57,8 +56,9 @@ jobs: - uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TAURI_SIGNING_PRIVATE_KEY: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5NlF2SjE3cWNXOVlQQ0JBTlNITEpOUVoyQ3ZuNTdOSkwyNE1NN2RmVWQ1a0FBQkFBQUFBQUFBQUFBQUlBQUFBQU9XOGpTSFNRd0Q4SjNSbm5Oc1E0OThIUGx6SS9lWXI3ZjJxN3BESEh1QTRiQXlkR2E5aG1oK1g0Tk5kcmFzc0IvZFZScEpubnptRkxlbDlUR2R1d1Y5OGRSYUVmUGoxNTFBcHpQZ1dSS2lHWklZVHNkV1Byd1VQSnZCdTZFWlVGOUFNVENBRlgweUU9Cg== - TAURI_SIGNING_PRIVATE_KEY_PASSWORD: pass + # Don't worry, the below key is just a sample key for PR-Checks. Actual app build workflow uses a secret private key :) + TAURI_SIGNING_PRIVATE_KEY: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5TzhIVE9SbEtZZThpM2RvQWpvV09wZXlEOXR0cVRsVUs3NlR2NXhRTUJsSUFBQkFBQUFBQUFBQUFBQUlBQUFBQTBVZE5kNmR4ZHdScUtDWURsNWtweXQwem01WlJobXQzSmNtQUZydnNrb0UvSzJKQnM0b2ZRcSt6eElmaHFHZ3VzVkRrRkdtSC9jcGVRMDJzZlR3RDRta3V2UDBNdzRUSU1LQlo0dk43NHRHZGdaYTNPbndhYU14YmdqN1Y3VkNRb2l2bDF4NDQ5Tk09Cg== + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: abcd with: projectPath: ./frontend args: ${{ matrix.args }} diff --git a/.github/workflows/pr-tests.yml b/.github/workflows/pr-check-tests.yml similarity index 99% rename from .github/workflows/pr-tests.yml rename to .github/workflows/pr-check-tests.yml index fd5454a1f..86035076f 100644 --- a/.github/workflows/pr-tests.yml +++ b/.github/workflows/pr-check-tests.yml @@ -1,4 +1,4 @@ -name: CI for PictoPy +name: PR Check on: pull_request: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0a2778ffb..04850b46a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,9 +48,9 @@ Create Signing Keys for tauri using the command: npm run tauri signer generate ``` -Set the public key in tauri.conf.json as pubkey and private key and password in Environment Variables as TAURI_SIGNING_PRIVATE_KEY and TAURI_SIGNING_PRIVATE_KEY_PASSWORD +Set the public key in tauri.conf.json as pubkey and private key and password in Environment Variables(of your terminal) as TAURI_SIGNING_PRIVATE_KEY and TAURI_SIGNING_PRIVATE_KEY_PASSWORD -There is a preset pubkey in tauri.conf.json ; private key and password for it is: +As an **example** of the private key would look like this: ```bash TAURI_SIGNING_PRIVATE_KEY=dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5NlF2SjE3cWNXOVlQQ0JBTlNITEpOUVoyQ3ZuNTdOSkwyNE1NN2RmVWQ1a0FBQkFBQUFBQUFBQUFBQUlBQUFBQU9XOGpTSFNRd0Q4SjNSbm5Oc1E0OThIUGx6SS9lWXI3ZjJxN3BESEh1QTRiQXlkR2E5aG1oK1g0Tk5kcmFzc0IvZFZScEpubnptRkxlbDlUR2R1d1Y5OGRSYUVmUGoxNTFBcHpQZ1dSS2lHWklZVHNkV1Byd1VQSnZCdTZFWlVGOUFNVENBRlgweUU9Cg== diff --git a/README.md b/README.md index ec0991a2c..dbc3f2427 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,12 @@ PictoPy is an advanced desktop gallery application that combines the power of Ta --- -## 💡 **Want to contribute?** -For detailed setup instructions, coding guidelines, and the contribution process, please check out our [CONTRIBUTING.md](./CONTRIBUTING.md) file. +## 💡 **Want to contribute?** +For detailed setup instructions, coding guidelines, and the contribution process, please check out our [CONTRIBUTING.md](./CONTRIBUTING.md) file. --- + # Architecture ### Frontend diff --git a/docs/Manual_Setup_Guide.md b/docs/Manual_Setup_Guide.md new file mode 100644 index 000000000..dc3b5d917 --- /dev/null +++ b/docs/Manual_Setup_Guide.md @@ -0,0 +1,131 @@ +## Manual Setup Guide + +### Initial Steps: + +#### 1. Fork the PictoPy repository: https://github.com/AOSSIE-Org/PictoPy + +#### 2. Open your Terminal (Linux/MacOS) or Powershell (Windows) + +#### 3. Clone your forked repository: + +```bash +git clone https://github.com/yourUsername/PictoPy +``` + +#### 4. Change to the repository directory: + +```bash +cd PictoPy +``` + +#### 5. Add the main repository as "upstream": + +```bash +git remote add upstream https://github.com/AOSSIE-Org/PictoPy +``` + +### Tauri Frontend Setup: + +1. **Install Tauri prerequisites based on your OS using this** [guide](https://tauri.app/start/prerequisites/). + +2. **Navigate to the Frontend Directory:** Open your terminal and use `cd` to change directories: + ``` + cd frontend + ``` +3. **Install Dependencies**: + ``` + npm install + ``` +4. **Start the Tauri desktop app in development mode** + ``` + npm run tauri dev + ``` + +### Python (FastAPI) Backend Setup Steps: + +> **Note:** For backend setup make sure that you have **Python version 3.12**. Additionally, for Windows, make sure that you are using Powershell for the setup, not command prompt. + +1. **Navigate to the Backend Directory:** Open your terminal and use `cd` to change directories: + + Bash + + ``` + cd backend + ``` + +2. **Set Up a Virtual Environment (Highly Recommended):** Virtual environments isolate project dependencies. Create one using: + + Bash(Linux/MacOS) + + ``` + python3 -m venv .env + ``` + + Powershell(Windows) + + ``` + python -m venv .env + ``` + +3. **Activate the Virtual Environment:** + + Bash(Linux/MacOS) + + ``` + source .env/bin/activate + ``` + + Powershell(Windows) + + ``` + .env\Scripts\activate.ps1 + ``` + + After activating, you should be able to see the virtual environment's name before the current path. Something like this: + + ![alt text](/docs/assets/screenshots/virtualEnv.png) + +4. **Install Dependencies:** The `requirements.txt` file lists required packages. Install them using pip: + + Bash + + ``` + pip install -r requirements.txt + ``` + +5. **Running the backend:**: To start the backend in development mode, run this command while being in the backend folder and the virtual environment activated: + + Bash/Powershell + + ``` + fastapi dev + ``` + + The server will start on `http://localhost:8000` by default. In test mode, the server will automatically restart if any errors are detected or if source files are modified. + + ![alt text](/docs/assets/screenshots/serverRunning.png) + +6. **Missing System Dependencies:** Some dependencies might need system-level libraries like `libGL.so.1` (often needed by OpenCV). Install the appropriate packages based on your distribution: + + **Debian/Ubuntu:** + + Bash + + ``` + sudo apt update + sudo apt install -y libglib2.0-dev libgl1-mesa-glx + + ``` + + **Other Systems:** Consult your distribution's documentation for installation instructions. + +7. **`gobject-2.0` Not Found Error:** Resolve this error by installing `libglib2.0-dev` (Debian/Ubuntu): + + Bash + + ``` + sudo apt install -y libglib2.0-dev pkg-config + + ``` + + For other systems, consult your distribution's documentation. diff --git a/docs/Script_Setup_Guide.md b/docs/Script_Setup_Guide.md new file mode 100644 index 000000000..f2e08f73f --- /dev/null +++ b/docs/Script_Setup_Guide.md @@ -0,0 +1,80 @@ +## Setting Up using Script + +### Video Setup Guide: + +- [Windows](https://youtu.be/nNVAE4or280?si=j_y9Xn8Kra6tPHjw) +- [Ubuntu (Debian)](https://www.youtube.com/watch?v=a7I0ZRE-SHk) + +### Prerequisites: + +- [NodeJS](https://nodejs.org/en) (LTS Version Recommended) +- [Git](https://git-scm.com/downloads) version control system + +### Steps Performed in the Video: + +1. Fork the PictoPy repository: https://github.com/AOSSIE-Org/PictoPy + +2. Open your terminal (or Powershell with administrator privileges on Windows) + +3. Clone your forked repository: + + ```bash + git clone https://github.com/yourUsername/PictoPy + ``` + +4. Change to the repository directory: + + ```bash + cd PictoPy + ``` + +5. Add the main repository as "upstream": + + ```bash + git remote add upstream https://github.com/AOSSIE-Org/PictoPy + ``` + +6. Run the Automatic Setup + + ```bash + npm run setup + ``` + + > **Note:** This step can take a long time depending on your internet connection and system specifications. If the script seems to stop progressing after waiting for more than 10 minutes, press Enter in your terminal window to continue. + +7. Start the Backend Server + + #### Windows + + ```powershell + cd .\backend + .env\Scripts\activate.ps1 + fastapi dev + ``` + + #### Linux + + ```bash + cd ./backend + source .env/bin/activate + fastapi dev + ``` + +8. Start the Frontend Desktop App + + Open a new terminal window, navigate to the project directory, and run: + + ```bash + cd frontend + npm run tauri dev + ``` + +9. Pre-commit Setup + + Before running the `git commit` command, ensure you have the following Python packages installed globally: + + ```bash + pip install ruff black mypy pre-commit + ``` + + > **Note:** If you are committing from a virtual environment, these packages should already be installed as they are included in the requirements.txt file. diff --git a/docs/backend/docker-setup.md b/docs/backend/docker-setup.md new file mode 100644 index 000000000..d06cb7d46 --- /dev/null +++ b/docs/backend/docker-setup.md @@ -0,0 +1,107 @@ +# Backend Docker Setup for PictoPy + +This guide provides step-by-step instructions for building and running the PictoPy backend using Docker. + +## Table of Contents + +1. [Prerequisites](#prerequisites) +2. [Building the Docker Image](#building-the-docker-image) +3. [Running the Docker Container](#running-the-docker-container) +4. [Verifying the Container](#verifying-the-container) +5. [Accessing the Application](#accessing-the-application) +6. [Stopping the Container](#stopping-the-container) +7. [Troubleshooting](#troubleshooting) + +## Prerequisites + +Before you begin, ensure you have the Docker installed on your machine + +- Verify the installation by running: + ```bash + docker --version + ``` + +## Building the Docker Image + +1. Open a terminal and navigate to your project's root directory. + +2. Go to Backend directory + + ```bash + cd backend + ``` + +3. Run the following command to build the Docker image, replacing `` with your desired image name: + + ```bash + docker build -t . + ``` + +4. Wait for the build process to complete. This may take a few minutes depending on your internet speed and system performance. + +## Running the Docker Container + +Once the image is built, you can run a container using the following command: + +```bash +docker run -it --name backend-container -p 8000:8000 \ +-v images-data:/app/images \ +-v /:/host \ + +``` + +- `-it`: Runs the container interactively, attaching to the terminal for input/output. +- `-p 8000:8000`: Maps port 8000 on the host to port 8000 in the container. +- `-v`: Mounts a volume to share data between the host and container. +- ``: Specifies the image to use (the one we just built). + +## Verifying the Container + +To check if the container is running: + +```bash +docker ps +``` + +You should see an entry for `` with the status `Up`. + +## Accessing the Application + +Open a web browser or frontend to access the application at: + +``` +http://localhost:8000 +``` + +## Stopping the Container + +If you need to stop the container: + +```bash +docker kill +``` + +## Troubleshooting + +1. **Port already in use**: If you get an error saying the port is already in use, you can either: + + - Stop the process using port 8000, or + - Change the port mapping in the `docker run` command (e.g., `-p 8001:8000`) + +2. **Container exits immediately**: Check the container logs: + + ```bash + docker logs + ``` + +3. **Permission issues**: Ensure that `run.sh` has execute permissions(for linux only): + + ```bash + chmod +x run.sh + ``` + + Then rebuild the Docker image. + +Remember to rebuild your Docker image (`docker build -t .`) after making any changes to your application or Dockerfile. + +For more advanced Docker usage , view the [Docker documentation](https://docs.docker.com/get-started/). diff --git a/docs/frontend/docker-setup.md b/docs/frontend/docker-setup.md new file mode 100644 index 000000000..d1c9c23bb --- /dev/null +++ b/docs/frontend/docker-setup.md @@ -0,0 +1,129 @@ +# Docker Setup for PictoPy Frontend + +This guide provides instructions for building and running the PictoPy frontend using Docker. + +## Table of Contents + +1. [Prerequisites](#prerequisites) +2. [Building the Docker Image](#building-the-docker-image) +3. [Running the Container](#running-the-container) + - [Linux](#linux) + - [Windows](#windows) +4. [Accessing the GUI App](#accessing-the-gui-app) +5. [Common Troubleshooting](#common-troubleshooting) +6. [Notes on Cross-Platform Compatibility](#notes-on-cross-platform-compatibility) + +## Prerequisites + +- Docker installed on your system +- For Windows: An X Server (e.g., VcXsrv or Xming) +- For Linux : An X server also installed + ```bash + sudo apt install x + ``` + +## Building the Docker Image + +1. Open a terminal and navigate to your project's root directory. + +2. Go to Frontend directory + + ```bash + cd frontend + ``` + +3. Run the following command to build the Docker image, replacing `` with your desired image name: + + ```bash + docker build --build-arg TAURI_SIGNING_PRIVATE_KEY= --build-arg TAURI_SIGNING_PRIVATE_KEY_PASSWORD= -t . + ``` + + Replace and with your actual Tauri signing private key and password and with the image name. If you are using the default key, you can use the following command: + + ```bash + docker build --build-arg TAURI_SIGNING_PRIVATE_KEY=dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5NlF2SjE3cWNXOVlQQ0JBTlNITEpOUVoyQ3ZuNTdOSkwyNE1NN2RmVWQ1a0FBQkFBQUFBQUFBQUFBQUlBQUFBQU9XOGpTSFNRd0Q4SjNSbm5Oc1E0OThIUGx6SS9lWXI3ZjJxN3BESEh1QTRiQXlkR2E5aG1oK1g0Tk5kcmFzc0IvZFZScEpubnptRkxlbDlUR2R1d1Y5OGRSYUVmUGoxNTFBcHpQZ1dSS2lHWklZVHNkV1Byd1VQSnZCdTZFWlVGOUFNVENBRlgweUU9Cg== --build-arg TAURI_SIGNING_PRIVATE_KEY_PASSWORD=pass -t . + ``` + +## Running the Container + +### Linux + +1. Allow X11 forwarding: + + ```bash + xhost +local:docker + ``` + +2. Run the container: + + ```bash + docker run -it --name frontend-container --network host -p 1420:1420 -e DISPLAY=${DISPLAY} \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -v images-data:/app/images \ + -v /:/host \ + + ``` + +### Windows + +1. Start an X Server: + + - Launch VcXsrv or Xming. + - Configure it to allow connections from any host. + +2. Find your host machine's IP address: + + - Open Command Prompt and run `ipconfig`. + - Look for the IPv4 Address under your active network adapter. + +3. Run the container: + + ```bash + docker run -it -p 1420:1420 -e DISPLAY=:0.0 + ``` + +Replace `` with your actual IP address. + +4. Run the tauri application + ```bash + npm run tauri dev + ``` + +## Building the Tauri App + +### Linux + +```bash + npm run tauri build +``` + +### Windows + +```bash + npm run tauri build -- --runner cargo-xwin --target x86_64-pc-windows-msvc +``` + +## Accessing the GUI App + +If everything is configured correctly, the Tauri GUI app should display on your screen after running the container. + +## Common Troubleshooting + +### 1. GUI Not Displaying (X Server Issues) + +- **Windows**: + + - Ensure the X server (VcXsrv or Xming) is running. + - Check that it's configured to allow connections from any host. + +- **Linux**: + - Verify X11 forwarding is allowed: `xhost +local:docker` + +### 2. Network Issues + +If the container can't connect to the X server: + +1. Check your firewall settings and ensure it's not blocking the connection. +2. On Windows, try using the host's IP address instead of localhost. + +By following this guide and keeping these notes in mind, you should be able to successfully set up and run the PictoPy frontend using Docker across different platforms. If you encounter any persistent issues, please refer to the project's issue tracker or seek assistance from the development team. diff --git a/frontend/src-tauri/tauri.conf.json b/frontend/src-tauri/tauri.conf.json index 914cf3960..c74e6e165 100644 --- a/frontend/src-tauri/tauri.conf.json +++ b/frontend/src-tauri/tauri.conf.json @@ -7,7 +7,7 @@ }, "bundle": { "active": true, - "targets": ["nsis", "deb", "dmg", "app"], + "targets": ["nsis", "deb", "app"], "createUpdaterArtifacts": true, "linux": { "deb": { @@ -29,16 +29,16 @@ } }, "productName": "PictoPy", - "version": "0.0.1", + "version": "0.1.0", "identifier": "com.yourcompany.pictopy", "plugins": { "fs": { "requireLiteralLeadingDot": true }, "updater": { - "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEM5REMxNjMwRjgyRjM2OUIKUldTYk5pLzRNQmJjeWVWMTdLWkNxazNiQTY3YkNVKzZva1U3c2taM3lSOGZvTzJzdnJtNVRvakMK", + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDEzOTBGRjhEM0E3M0U0OUMKUldTYzVITTZqZitRRXdDVmhhMFVhaXkxa0tVUHluZzB6Y0dnRXg0cHMzZHZkMy85MnFKYmFuRzkK", "endpoints": [ - "https://github.com/rahulharpal1603/PictoPy/releases/latest/download/latest.json" + "https://github.com/AOSSIE-Org/PictoPy/releases/latest/download/latest.json" ] } },