diff --git a/.env.example b/.env.example index 49bebb75..be2f36cd 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ DATABASE_URL=sqlite://clippy.sqlite?mode=rwc -GOOGLE_CLIENT_ID= -GOOGLE_CLIENT_SECRET= \ No newline at end of file +TAURI_GOOGLE_CLIENT_ID= +TAURI_GOOGLE_CLIENT_SECRET= \ No newline at end of file diff --git a/.github/replace-config.js b/.github/replace-config.js new file mode 100644 index 00000000..ec40494b --- /dev/null +++ b/.github/replace-config.js @@ -0,0 +1,12 @@ +import { readFileSync, writeFileSync } from "fs"; +import { join, resolve } from "path"; + +const configPath = join(resolve(), "src-tauri/tauri.conf.json"); +const config = JSON.parse(readFileSync(configPath, "utf8")); + +// Replace the secret +config.plugins.oauth.google.clientId = process.env.TAURI_GOOGLE_CLIENT_ID; +config.plugins.oauth.google.clientSecret = process.env.TAURI_GOOGLE_CLIENT_SECRET; + +// Write back to file +writeFileSync(configPath, JSON.stringify(config, null, 2)); diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 26f55988..60ce0073 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -20,8 +20,8 @@ jobs: - name: Create env file run: | touch .env - echo GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }} > .env - echo GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }} >> .env + echo TAURI_GOOGLE_CLIENT_ID=${{ secrets.TAURI_GOOGLE_CLIENT_ID }} > .env + echo TAURI_GOOGLE_CLIENT_SECRET=${{ secrets.TAURI_GOOGLE_CLIENT_SECRET }} >> .env cat .env diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 86ba3648..6c66d589 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: "publish" on: workflow_dispatch: push: - branches: [mastera] + branches: [master] concurrency: group: ${{ github.ref }} cancel-in-progress: true @@ -63,6 +63,12 @@ jobs: with: node-version: lts/* + - name: Replace environment variables in config + env: + TAURI_GOOGLE_CLIENT_ID: ${{ secrets.TAURI_GOOGLE_CLIENT_ID }} + TAURI_GOOGLE_CLIENT_SECRET: ${{ secrets.TAURI_GOOGLE_CLIENT_SECRET }} + run: node ./.github/replace-config.js + - name: install rust stable uses: dtolnay/rust-toolchain@stable with: @@ -84,8 +90,6 @@ jobs: - uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} - GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} with: tagName: ${{ needs.setup.outputs.tag_name }} releaseName: ${{ needs.setup.outputs.tag_name }} diff --git a/README.md b/README.md index cbc266dd..ed3368b4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@


- Clipboard Manager made with Tauri, Solid & Sea-Orm + clipboard manager with sync & encryption
Try it out · @@ -18,20 +18,75 @@

-successor of [the electron clippy](https://github.com/0-don/clippy-ts) +
+ + + Windows (x64) + +• + + Windows (arm64) + +
+ + Linux (deb) + +• + + Linux (rpm) + +• + + Linux (zst) + +• + + Linux (AppImage) + +
+ + macOS (Silicon) + +• + + macOS (Intel) + +
+
+ +
### Features -- display/hide **ctrl+y** or **ctrl+d** (change in settings) -- type out clipboard **ctrl+b** (where pasting isn't allowed) -- text, html, rtf, image, file support -- keybinds for everything & custom keybinds -- add favorite clipboards -- smart search, for links, colors, images, hex, etc. -- change/sync database location -- dark mode / white mode -- multilanguage support -- display scale +- **Multi-content support:** + - Text, HTML, RTF support + - Image support with thumbnails + - File support with metadata +- **Smart clipboard features:** + - Type out clipboard content (where pasting isn't allowed) **ctrl+b** + - Smart search for links, colors, images, hex codes etc. + - Add favorite clipboards + - Clear history by type +- **Security & Privacy:** + - End-to-end encryption support + - Password protection + - Configurable size limits for different content types +- **Cloud sync:** + - Google Drive integration + - Sync favorites and history + - Configurable sync limits +- **Customization:** + - Global hotkeys for all functions + - Custom keybinds + - Adjustable display scale + - Dark/Light mode + - Multiple languages support + - Configurable window positions + - Database location customization +- **System Integration:** + - Autostart option + - System tray support + - Display toggle with **ctrl+y** or **ctrl+d** ### Prerequisites Development diff --git a/docs/src/assets/app-icon.png b/docs/src/assets/app-icon.png new file mode 100644 index 00000000..fdafe2e3 Binary files /dev/null and b/docs/src/assets/app-icon.png differ diff --git a/docs/src/content/docs/index.mdx b/docs/src/content/docs/index.mdx index 548e4cde..9de25512 100644 --- a/docs/src/content/docs/index.mdx +++ b/docs/src/content/docs/index.mdx @@ -1,11 +1,11 @@ --- title: Welcome to Clippy -description: Get started building your docs site with Starlight. +description: Get started with Clippy, modern clipboard mana template: splash hero: tagline: Well done! Your Clippy project is up and running! image: - file: ../../assets/Clippy.webp + file: ../../assets/app-icon.png actions: - text: Quick Start link: /guides/installation/ diff --git a/public/apple.png b/public/apple.png new file mode 100644 index 00000000..f9bd6d9f Binary files /dev/null and b/public/apple.png differ diff --git a/public/linux.png b/public/linux.png new file mode 100644 index 00000000..1d0b10a8 Binary files /dev/null and b/public/linux.png differ diff --git a/public/windows.png b/public/windows.png new file mode 100644 index 00000000..534b69f6 Binary files /dev/null and b/public/windows.png differ diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 79bdffd8..0b2cf4fc 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -3,7 +3,8 @@ #[tokio::main] async fn main() -> Result<(), Box> { - dotenvy::dotenv()?; + #[cfg(debug_assertions)] + dotenvy::dotenv().ok(); #[cfg(target_os = "linux")] { diff --git a/src-tauri/src/utils/providers/google_drive.rs b/src-tauri/src/utils/providers/google_drive.rs index 130f09d8..de45b31c 100644 --- a/src-tauri/src/utils/providers/google_drive.rs +++ b/src-tauri/src/utils/providers/google_drive.rs @@ -58,9 +58,39 @@ pub struct GoogleDriveProviderImpl(GoogleDriveProvider); impl GoogleDriveProviderImpl { pub async fn new() -> Result { + let config = get_app().config(); + + let (client_id, client_secret) = match ( + std::env::var("TAURI_GOOGLE_CLIENT_ID"), + std::env::var("TAURI_GOOGLE_CLIENT_SECRET"), + ) { + (Ok(id), Ok(secret)) => (id, secret), + _ => { + let plugins = config + .plugins + .0 + .get("oauth") + .and_then(|o| o.get("google")) + .ok_or_else(|| CommandError::new("Missing Google OAuth configuration"))?; + + ( + plugins + .get("clientId") + .and_then(|v| v.as_str()) + .ok_or_else(|| CommandError::new("Missing Google client ID"))? + .to_string(), + plugins + .get("clientSecret") + .and_then(|v| v.as_str()) + .ok_or_else(|| CommandError::new("Missing Google client secret"))? + .to_string(), + ) + } + }; + let secret = yup_oauth2::ApplicationSecret { - client_id: std::env::var("GOOGLE_CLIENT_ID")?, - client_secret: std::env::var("GOOGLE_CLIENT_SECRET")?, + client_id, + client_secret, auth_uri: "https://accounts.google.com/o/oauth2/auth".into(), token_uri: "https://accounts.google.com/o/oauth2/token".into(), ..Default::default() diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 000c549b..26fb08fa 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -66,5 +66,13 @@ ] } } + }, + "plugins": { + "oauth": { + "google": { + "clientId": "%TAURI_GOOGLE_CLIENT_ID%", + "clientSecret": "%TAURI_GOOGLE_CLIENT_SECRET%" + } + } } }