Compare commits
No commits in common. "main" and "v0.1.1" have entirely different histories.
3
.github/FUNDING.yml
vendored
|
@ -1,3 +0,0 @@
|
|||
github: 0pandadev
|
||||
buy_me_a_coffee: pandadev_
|
||||
ko_fi: pandadev_
|
3
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -1,5 +1,5 @@
|
|||
name: "\U0001F41E Bug report"
|
||||
description: Create a report to help me improve Qopy
|
||||
description: Create a report to help us improve
|
||||
labels: [Bug]
|
||||
assignees:
|
||||
- 0PandaDEV
|
||||
|
@ -54,7 +54,6 @@ body:
|
|||
options:
|
||||
- Windows
|
||||
- Linux
|
||||
- macOS
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
|
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
@ -1,5 +1,5 @@
|
|||
name: "\U0001F4A1 Feature request"
|
||||
description: Suggest an idea for Qopy
|
||||
description: Suggest an idea for this project
|
||||
labels: [Feature]
|
||||
assignees:
|
||||
- 0PandaDEV
|
||||
|
|
40
.github/scripts/macOS.sh
vendored
|
@ -1,40 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -f .env ]; then
|
||||
export $(cat .env | grep -v '^#' | xargs)
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
required_vars=("APPLE_CERTIFICATE" "APPLE_CERTIFICATE_PASSWORD" "APPLE_ID" "APPLE_ID_PASSWORD" "KEYCHAIN_PASSWORD" "APP_BUNDLE_ID")
|
||||
for var in "${required_vars[@]}"; do
|
||||
if [ -z "${!var}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
bun run tauri build
|
||||
|
||||
rm -f certificate.p12
|
||||
echo "$APPLE_CERTIFICATE" | base64 --decode > certificate.p12 2>/dev/null
|
||||
security import certificate.p12 -P "$APPLE_CERTIFICATE_PASSWORD" -A 2>/dev/null
|
||||
|
||||
SIGNING_IDENTITY=$(security find-identity -v -p codesigning | grep "Apple Development" | head -1 | awk -F '"' '{print $2}')
|
||||
|
||||
if [ -z "$SIGNING_IDENTITY" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
codesign --force --options runtime --sign "$SIGNING_IDENTITY" src-tauri/target/release/bundle/macos/*.app 2>/dev/null
|
||||
|
||||
rm -f certificate.p12
|
||||
|
||||
hdiutil create -volname "Qopy" -srcfolder src-tauri/target/release/bundle/dmg -ov -format UDZO Qopy.dmg
|
||||
|
||||
codesign --force --sign "$APPLE_CERTIFICATE" Qopy.dmg 2>/dev/null
|
||||
|
||||
xcrun notarytool submit Qopy.dmg --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_CERTIFICATE" --wait
|
||||
|
||||
xcrun stapler staple Qopy.dmg
|
||||
|
||||
exit 0
|
281
.github/workflows/build.yml
vendored
|
@ -20,230 +20,109 @@ jobs:
|
|||
id: get_version
|
||||
run: echo "VERSION=$(node -p "require('./src-tauri/tauri.conf.json').version")" >> $GITHUB_OUTPUT
|
||||
|
||||
build-macos:
|
||||
needs: prepare
|
||||
runs-on: macos-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- args: "--target aarch64-apple-darwin"
|
||||
arch: "arm64"
|
||||
- args: "--target x86_64-apple-darwin"
|
||||
arch: "x64"
|
||||
env:
|
||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Redact Sensitive Information
|
||||
run: |
|
||||
function redact_output {
|
||||
sed -e "s/${{ secrets.APPLE_ID }}/REDACTED/g;s/${{ secrets.APPLE_ID_PASSWORD }}/REDACTED/g;s/${{ secrets.APPLE_CERTIFICATE }}/REDACTED/g;s/${{ secrets.APPLE_CERTIFICATE_PASSWORD }}/REDACTED/g;s/${{ secrets.KEYCHAIN_PASSWORD }}/REDACTED/g;s/${{ secrets.PAT }}/REDACTED/g;s/${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}/REDACTED/g"
|
||||
}
|
||||
exec > >(redact_output) 2>&1
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-apple-darwin,x86_64-apple-darwin
|
||||
- uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: "src-tauri -> target"
|
||||
cache-directories: "~/.cargo/registry/index/,~/.cargo/registry/cache/,~/.cargo/git/db/"
|
||||
shared-key: "macos-rust-cache"
|
||||
save-if: "true"
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-
|
||||
- run: npm install -g pnpm && pnpm install
|
||||
- name: Import Apple Developer Certificate
|
||||
env:
|
||||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
||||
run: |
|
||||
echo $APPLE_CERTIFICATE | base64 --decode > certificate.p12
|
||||
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
|
||||
security default-keychain -s build.keychain
|
||||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
|
||||
security set-keychain-settings -lut 7200 build.keychain
|
||||
security import certificate.p12 -k build.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
|
||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain
|
||||
security find-identity -v -p codesigning build.keychain
|
||||
- name: Verify Certificate
|
||||
run: |
|
||||
CERT_INFO=$(security find-identity -v -p codesigning build.keychain | grep "Apple Development")
|
||||
CERT_ID=$(echo "$CERT_INFO" | awk -F'"' '{print $2}')
|
||||
echo "CERT_ID=$CERT_ID" >> $GITHUB_ENV
|
||||
echo "Certificate imported."
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
||||
APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }}
|
||||
with:
|
||||
args: ${{ matrix.args }}
|
||||
- name: Debug Signing Process
|
||||
if: failure()
|
||||
run: |
|
||||
echo "Attempting manual signing:"
|
||||
timeout 300 codesign --force --options runtime --sign "$CERT_ID" --entitlements src-tauri/entitlements.plist src-tauri/target/${{ matrix.args == '--target aarch64-apple-darwin' && 'aarch64-apple-darwin' || 'x86_64-apple-darwin' }}/release/bundle/macos/Qopy.app
|
||||
echo "Verifying signature:"
|
||||
codesign -dv --verbose=4 "src-tauri/target/${{ matrix.args == '--target aarch64-apple-darwin' && 'aarch64-apple-darwin' || 'x86_64-apple-darwin' }}/release/bundle/macos/Qopy.app" | sed 's/.*Authority=.*/Authority=REDACTED/'
|
||||
- name: Set architecture label
|
||||
run: |
|
||||
if [[ "${{ matrix.args }}" == "--target aarch64-apple-darwin" ]]; then
|
||||
echo "ARCH_LABEL=aarch64-apple-darwin" >> $GITHUB_ENV
|
||||
else
|
||||
echo "ARCH_LABEL=x86_64-apple-darwin" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Rename and Publish macOS Artifacts
|
||||
run: |
|
||||
mv src-tauri/target/${{ env.ARCH_LABEL }}/release/bundle/dmg/*.dmg src-tauri/target/${{ env.ARCH_LABEL }}/release/bundle/dmg/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.dmg
|
||||
mv src-tauri/target/${{ env.ARCH_LABEL }}/release/bundle/macos/*.app.tar.gz src-tauri/target/${{ env.ARCH_LABEL }}/release/bundle/macos/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.app.tar.gz
|
||||
mv src-tauri/target/${{ env.ARCH_LABEL }}/release/bundle/macos/*.app.tar.gz.sig src-tauri/target/${{ env.ARCH_LABEL }}/release/bundle/macos/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.app.tar.gz.sig
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macos-dmg-${{ matrix.arch }}
|
||||
path: "src-tauri/target/${{ env.ARCH_LABEL }}/release/bundle/dmg/*.dmg"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: updater-macos-${{ matrix.arch }}
|
||||
path: |
|
||||
src-tauri/target/${{ env.ARCH_LABEL }}/release/bundle/macos/*.app.tar.gz
|
||||
src-tauri/target/${{ env.ARCH_LABEL }}/release/bundle/macos/*.app.tar.gz.sig
|
||||
|
||||
build-windows:
|
||||
build:
|
||||
needs: prepare
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- args: "--target x86_64-pc-windows-msvc"
|
||||
arch: "x64"
|
||||
target: "x86_64-pc-windows-msvc"
|
||||
- args: "--target aarch64-pc-windows-msvc"
|
||||
arch: "arm64"
|
||||
target: "aarch64-pc-windows-msvc"
|
||||
runs-on: windows-latest
|
||||
platform: [ubuntu-latest, windows-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
env:
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
|
||||
- uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: "src-tauri -> target"
|
||||
cache-directories: "~/.cargo/registry/index/,~/.cargo/registry/cache/,~/.cargo/git/db/"
|
||||
shared-key: "windows-rust-cache"
|
||||
save-if: "true"
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-
|
||||
- run: npm install -g pnpm && pnpm install
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
args: ${{ matrix.args }}
|
||||
- name: List Bundle Directory
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Output "Checking build directories..."
|
||||
Get-ChildItem -Path "src-tauri/target" -Recurse -Directory | Where-Object { $_.Name -eq "msi" } | ForEach-Object {
|
||||
Write-Output "Found MSI directory: $($_.FullName)"
|
||||
Get-ChildItem -Path $_.FullName -Filter "*.msi" | ForEach-Object {
|
||||
Write-Output "Found MSI file: $($_.FullName)"
|
||||
}
|
||||
}
|
||||
- name: Rename and Publish Windows Artifacts
|
||||
run: |
|
||||
mv src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi src-tauri/target/${{ matrix.target }}/release/bundle/msi/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.msi
|
||||
mv src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi.sig src-tauri/target/${{ matrix.target }}/release/bundle/msi/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.msi.sig
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows-${{ matrix.arch }}
|
||||
path: src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: updater-windows-${{ matrix.arch }}
|
||||
path: |
|
||||
src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi
|
||||
src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi.sig
|
||||
|
||||
build-ubuntu:
|
||||
needs: prepare
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: install Rust stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Rust cache
|
||||
uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
targets: x86_64-unknown-linux-gnu
|
||||
- uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: "src-tauri -> target"
|
||||
cache-directories: "~/.cargo/registry/index/,~/.cargo/registry/cache/,~/.cargo/git/db/"
|
||||
shared-key: "ubuntu-rust-cache"
|
||||
save-if: "true"
|
||||
- uses: actions/cache@v4
|
||||
workspaces: "./src-tauri -> target"
|
||||
|
||||
- name: pnpm cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-
|
||||
- name: Install dependencies
|
||||
|
||||
- name: install dependencies (ubuntu only)
|
||||
if: matrix.platform == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libayatana-appindicator3-dev librsvg2-dev libasound2-dev rpm
|
||||
sudo apt install libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libayatana-appindicator3-dev librsvg2-dev libasound2-dev
|
||||
echo "PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig" >> $GITHUB_ENV
|
||||
- run: npm install -g pnpm && pnpm install
|
||||
|
||||
- name: install frontend dependencies
|
||||
run: npm install -g pnpm && pnpm install
|
||||
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
args: --target x86_64-unknown-linux-gnu
|
||||
- name: Rename Linux Artifacts
|
||||
|
||||
- name: Rename and Publish Windows Artifacts
|
||||
if: matrix.platform == 'windows-latest'
|
||||
run: |
|
||||
mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/Qopy-${{ needs.prepare.outputs.version }}.deb
|
||||
mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/Qopy-${{ needs.prepare.outputs.version }}.AppImage
|
||||
mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage.sig src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/Qopy-${{ needs.prepare.outputs.version }}.AppImage.sig
|
||||
mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/rpm/Qopy-${{ needs.prepare.outputs.version }}.rpm
|
||||
- uses: actions/upload-artifact@v4
|
||||
mv src-tauri/target/release/bundle/msi/*.msi src-tauri/target/release/bundle/msi/Qopy-${{ needs.prepare.outputs.version }}.msi
|
||||
mv src-tauri/target/release/bundle/msi/*.msi.sig src-tauri/target/release/bundle/msi/Qopy-${{ needs.prepare.outputs.version }}.msi.sig
|
||||
|
||||
- name: Publish Windows Artifacts
|
||||
if: matrix.platform == 'windows-latest'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ubuntu-deb
|
||||
path: src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb
|
||||
- uses: actions/upload-artifact@v4
|
||||
name: build-windows-msi
|
||||
path: src-tauri/target/release/bundle/msi/*.msi
|
||||
|
||||
- name: Publish Windows Updater Files
|
||||
if: matrix.platform == 'windows-latest'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ubuntu-appimage
|
||||
path: src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ubuntu-rpm
|
||||
path: src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: updater-ubuntu
|
||||
name: updater-files-windows
|
||||
path: |
|
||||
src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage
|
||||
src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage.sig
|
||||
src-tauri/target/release/bundle/msi/*.msi
|
||||
src-tauri/target/release/bundle/msi/*.msi.sig
|
||||
|
||||
- name: Rename and Publish Ubuntu Artifacts
|
||||
if: matrix.platform == 'ubuntu-latest'
|
||||
run: |
|
||||
mv src-tauri/target/release/bundle/deb/*.deb src-tauri/target/release/bundle/deb/Qopy-${{ needs.prepare.outputs.version }}.deb
|
||||
mv src-tauri/target/release/bundle/appimage/*.AppImage src-tauri/target/release/bundle/appimage/Qopy-${{ needs.prepare.outputs.version }}.AppImage
|
||||
mv src-tauri/target/release/bundle/appimage/*.AppImage.sig src-tauri/target/release/bundle/appimage/Qopy-${{ needs.prepare.outputs.version }}.AppImage.sig
|
||||
mv src-tauri/target/release/bundle/rpm/*.rpm src-tauri/target/release/bundle/rpm/Qopy-${{ needs.prepare.outputs.version }}.rpm
|
||||
|
||||
- name: Publish Ubuntu Artifacts
|
||||
if: matrix.platform == 'ubuntu-latest'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-ubuntu-deb
|
||||
path: src-tauri/target/release/bundle/deb/*.deb
|
||||
|
||||
- name: Publish Ubuntu AppImage
|
||||
if: matrix.platform == 'ubuntu-latest'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-ubuntu-appimage
|
||||
path: src-tauri/target/release/bundle/appimage/*.AppImage
|
||||
|
||||
- name: Publish Ubuntu RPM
|
||||
if: matrix.platform == 'ubuntu-latest'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-ubuntu-rpm
|
||||
path: src-tauri/target/release/bundle/rpm/*.rpm
|
||||
|
||||
- name: Publish Ubuntu Updater Files
|
||||
if: matrix.platform == 'ubuntu-latest'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: updater-files-ubuntu
|
||||
path: |
|
||||
src-tauri/target/release/bundle/appimage/*.AppImage
|
||||
src-tauri/target/release/bundle/appimage/*.AppImage.sig
|
325
.github/workflows/release.yml
vendored
|
@ -1,325 +0,0 @@
|
|||
name: "Release"
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.get_version.outputs.VERSION }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Get version
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=$(node -p 'require("./src-tauri/tauri.conf.json").version')
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
build-macos:
|
||||
permissions: write-all
|
||||
needs: prepare
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- args: "--target aarch64-apple-darwin"
|
||||
arch: "silicon"
|
||||
- args: "--target x86_64-apple-darwin"
|
||||
arch: "intel"
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Redact Sensitive Information
|
||||
run: |
|
||||
function redact_output {
|
||||
sed -e "s/${{ secrets.REDACT_PATTERN }}/REDACTED/g"
|
||||
}
|
||||
exec > >(redact_output) 2>&1
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-apple-darwin,x86_64-apple-darwin
|
||||
- uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: "src-tauri -> target"
|
||||
cache-directories: "~/.cargo/registry/index/,~/.cargo/registry/cache/,~/.cargo/git/db/"
|
||||
shared-key: "macos-rust-cache"
|
||||
save-if: "true"
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-
|
||||
- run: npm install -g pnpm && pnpm install
|
||||
- name: Import Apple Developer Certificate
|
||||
env:
|
||||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
||||
run: |
|
||||
echo $APPLE_CERTIFICATE | base64 --decode > certificate.p12
|
||||
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
|
||||
security default-keychain -s build.keychain
|
||||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
|
||||
security import certificate.p12 -k build.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
|
||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
||||
with:
|
||||
args: ${{ matrix.args }}
|
||||
|
||||
- name: Rename macOS Artifacts
|
||||
run: |
|
||||
mv src-tauri/target/${{ matrix.args == '--target aarch64-apple-darwin' && 'aarch64-apple-darwin' || 'x86_64-apple-darwin' }}/release/bundle/dmg/*.dmg src-tauri/target/${{ matrix.args == '--target aarch64-apple-darwin' && 'aarch64-apple-darwin' || 'x86_64-apple-darwin' }}/release/bundle/dmg/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.dmg
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macos-${{ matrix.arch }}-binaries
|
||||
path: |
|
||||
src-tauri/target/**/release/bundle/dmg/*.dmg
|
||||
|
||||
build-windows:
|
||||
permissions: write-all
|
||||
needs: prepare
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- args: "--target x86_64-pc-windows-msvc"
|
||||
arch: "x64"
|
||||
target: "x86_64-pc-windows-msvc"
|
||||
- args: "--target aarch64-pc-windows-msvc"
|
||||
arch: "arm64"
|
||||
target: "aarch64-pc-windows-msvc"
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
|
||||
- uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: "src-tauri -> target"
|
||||
cache-directories: "~/.cargo/registry/index/,~/.cargo/registry/cache/,~/.cargo/git/db/"
|
||||
shared-key: "windows-rust-cache"
|
||||
save-if: "true"
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-
|
||||
- run: npm install -g pnpm && pnpm install
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
args: ${{ matrix.args }}
|
||||
- name: List Bundle Directory
|
||||
shell: pwsh
|
||||
run: |
|
||||
$bundlePath = "src-tauri/target/${{ matrix.target }}/release/bundle/msi"
|
||||
if (Test-Path $bundlePath) {
|
||||
Write-Output "Contents of ${bundlePath}:"
|
||||
Get-ChildItem -Path $bundlePath
|
||||
} else {
|
||||
Write-Output "Path ${bundlePath} does not exist."
|
||||
}
|
||||
- name: Rename Windows Artifacts
|
||||
shell: pwsh
|
||||
run: |
|
||||
$bundlePath = "src-tauri/target/${{ matrix.target }}/release/bundle/msi"
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
$arch = "${{ matrix.arch }}"
|
||||
if (Test-Path $bundlePath) {
|
||||
$msiFiles = Get-ChildItem -Path "$bundlePath/*.msi"
|
||||
foreach ($file in $msiFiles) {
|
||||
$newName = "Qopy-$version`_$arch.msi"
|
||||
Rename-Item -Path $file.FullName -NewName $newName
|
||||
}
|
||||
} else {
|
||||
Write-Error "Path ${bundlePath} does not exist."
|
||||
exit 1
|
||||
}
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows-${{ matrix.arch }}-binaries
|
||||
path: src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi
|
||||
|
||||
build-linux:
|
||||
permissions: write-all
|
||||
needs: prepare
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: "src-tauri -> target"
|
||||
cache-directories: "~/.cargo/registry/index/,~/.cargo/registry/cache/,~/.cargo/git/db/"
|
||||
shared-key: "linux-rust-cache"
|
||||
save-if: "true"
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libayatana-appindicator3-dev librsvg2-dev libasound2-dev rpm
|
||||
echo "PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig" >> $GITHUB_ENV
|
||||
- run: npm install -g pnpm && pnpm install
|
||||
- name: Generate Changelog
|
||||
id: changelog
|
||||
run: |
|
||||
CHANGELOG=$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"- %s")
|
||||
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
|
||||
echo "$CHANGELOG" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
args: --target x86_64-unknown-linux-gnu
|
||||
- name: Rename Linux Artifacts
|
||||
run: |
|
||||
mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/Qopy-${{ needs.prepare.outputs.version }}.deb
|
||||
mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/Qopy-${{ needs.prepare.outputs.version }}.AppImage
|
||||
mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/rpm/Qopy-${{ needs.prepare.outputs.version }}.rpm
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-binaries
|
||||
path: |
|
||||
src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb
|
||||
src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage
|
||||
src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm
|
||||
|
||||
create-release:
|
||||
permissions: write-all
|
||||
needs: [prepare, build-macos, build-windows, build-linux]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.PAT }}
|
||||
|
||||
- name: Check if release already exists
|
||||
id: check_release
|
||||
run: |
|
||||
VERSION="${{ needs.prepare.outputs.version }}"
|
||||
RELEASE_EXISTS=$(gh release view v$VERSION --json id --jq '.id' 2>/dev/null || echo "")
|
||||
if [ -n "$RELEASE_EXISTS" ]; then
|
||||
echo "SKIP_RELEASE=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "SKIP_RELEASE=false" >> $GITHUB_ENV
|
||||
fi
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PAT }}
|
||||
|
||||
- name: Download all artifacts
|
||||
if: env.SKIP_RELEASE == 'false'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Update CHANGELOG
|
||||
if: env.SKIP_RELEASE == 'false'
|
||||
id: changelog
|
||||
uses: requarks/changelog-action@v1
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
tag: ${{ github.ref_name }}
|
||||
|
||||
- name: Generate Release Body
|
||||
if: env.SKIP_RELEASE == 'false'
|
||||
id: release_body
|
||||
run: |
|
||||
VERSION="${{ needs.prepare.outputs.version }}"
|
||||
|
||||
# Calculate hashes with corrected paths
|
||||
WINDOWS_ARM_HASH=$(sha256sum "artifacts/windows-arm64-binaries/Qopy-${VERSION}_arm64.msi" | awk '{ print $1 }')
|
||||
WINDOWS_64_HASH=$(sha256sum "artifacts/windows-x64-binaries/Qopy-${VERSION}_x64.msi" | awk '{ print $1 }')
|
||||
MAC_SILICON_HASH=$(sha256sum "artifacts/macos-silicon-binaries/aarch64-apple-darwin/release/bundle/dmg/Qopy-${VERSION}_silicon.dmg" | awk '{ print $1 }')
|
||||
MAC_INTEL_HASH=$(sha256sum "artifacts/macos-intel-binaries/x86_64-apple-darwin/release/bundle/dmg/Qopy-${VERSION}_intel.dmg" | awk '{ print $1 }')
|
||||
DEBIAN_HASH=$(sha256sum "artifacts/linux-binaries/deb/Qopy-${VERSION}.deb" | awk '{ print $1 }')
|
||||
APPIMAGE_HASH=$(sha256sum "artifacts/linux-binaries/appimage/Qopy-${VERSION}.AppImage" | awk '{ print $1 }')
|
||||
REDHAT_HASH=$(sha256sum "artifacts/linux-binaries/rpm/Qopy-${VERSION}.rpm" | awk '{ print $1 }')
|
||||
|
||||
# Debug output
|
||||
echo "Calculated hashes:"
|
||||
echo "Windows ARM: $WINDOWS_ARM_HASH"
|
||||
echo "Windows x64: $WINDOWS_64_HASH"
|
||||
echo "Mac Silicon: $MAC_SILICON_HASH"
|
||||
echo "Mac Intel: $MAC_INTEL_HASH"
|
||||
echo "Debian: $DEBIAN_HASH"
|
||||
echo "AppImage: $APPIMAGE_HASH"
|
||||
echo "Red Hat: $REDHAT_HASH"
|
||||
|
||||
RELEASE_BODY=$(cat <<-EOF
|
||||
|
||||
${{ needs.create-release.outputs.changelog }}
|
||||
|
||||
## ⬇️ Downloads
|
||||
|
||||
- [Windows (x64)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_x64.msi) - ${WINDOWS_64_HASH}
|
||||
- [Windows (ARM64)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_arm64.msi) - ${WINDOWS_ARM_HASH}
|
||||
- [macOS (Silicon)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_silicon.dmg) - ${MAC_SILICON_HASH}
|
||||
- [macOS (Intel)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_intel.dmg) - ${MAC_INTEL_HASH}
|
||||
- [Debian](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}.deb) - ${DEBIAN_HASH}
|
||||
- [AppImage](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}.AppImage) - ${APPIMAGE_HASH}
|
||||
- [Red Hat](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}.rpm) - ${REDHAT_HASH}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV
|
||||
echo "$RELEASE_BODY" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: Create Release
|
||||
if: env.SKIP_RELEASE == 'false'
|
||||
uses: softprops/action-gh-release@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PAT }}
|
||||
with:
|
||||
draft: true
|
||||
tag_name: v${{ needs.prepare.outputs.version }}
|
||||
name: v${{ needs.prepare.outputs.version }}
|
||||
files: |
|
||||
artifacts/**/*.dmg
|
||||
artifacts/**/*.msi
|
||||
artifacts/**/*.deb
|
||||
artifacts/**/*.AppImage
|
||||
artifacts/**/*.rpm
|
||||
body: ${{ env.RELEASE_BODY }}
|
1
.gitignore
vendored
|
@ -25,4 +25,3 @@ logs
|
|||
bun.lockb
|
||||
.gitignore
|
||||
.vscode
|
||||
bun.lock
|
|
@ -1,21 +1,19 @@
|
|||
# Get Started
|
||||
|
||||
The default hotkey for Qopy is Windows+V which is also the hotkey for the default clipboard manager to turn that off follow [this guide](https://github.com/0PandaDEV/Qopy/blob/main/GET_STARTED.md#disable-windowsv-for-default-clipboard-manager).
|
||||
The hotkey for Qopy is Windows+V which is also the hotkey for the default clipboard manager to turn that off follow [this guide](https://github.com/0PandaDEV/Qopy/blob/main/GET_STARTED.md#disable-windowsv-for-default-clipboard-manager).
|
||||
|
||||
All the data of Qopy is stored inside of a SQLite database.
|
||||
All the data of Qopy is stored inside of a SQLite database. The location for the file differs for windows and linux.
|
||||
|
||||
| Operating System | Path |
|
||||
|------------------|-----------------------------------------------------------------|
|
||||
|------------------|-------------------------------------------------------|
|
||||
| Windows | `C:\Users\USERNAME\AppData\Roaming\net.pandadev.qopy` |
|
||||
| macOS | `/Users/USERNAME/Library/Application Support/net.pandadev.qopy` |
|
||||
| Linux | `/home/USERNAME/.local/share/net.pandadev.qopy` |
|
||||
| Linux | `` |
|
||||
|
||||
## Disable Windows+V for default clipboard manager
|
||||
|
||||
<video src="https://github.com/user-attachments/assets/723f9e07-3190-46ec-9bb7-15dfc112f620" controls title="Disable Windows+V for default clipboard manager"></video>
|
||||
https://github.com/user-attachments/assets/723f9e07-3190-46ec-9bb7-15dfc112f620
|
||||
|
||||
To disable the default clipboard manager popup from windows open Command prompt and run this command
|
||||
|
||||
```cmd
|
||||
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System" /v AllowClipboardHistory /t REG_DWORD /d 0 /f
|
||||
```
|
||||
|
|
662
LICENSE
|
@ -1,661 +1,9 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
Creative Commons Attribution-NonCommercial-ShareAlike (CC BY-NC-SA) License with Additional Clause:
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
|
||||
|
||||
Preamble
|
||||
In addition to the CC BY-NC-SA license terms, any derivative works based on this project must be contributed back to the original project and cannot be distributed as separate projects. All contributors must agree to this condition when making modifications to the original work.
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
Appropriate credit — If supplied, you must provide the name of the creator and attribution parties, a copyright notice, a license notice, a disclaimer notice, and a link to the material. CC licenses prior to Version 4.0 also require you to provide the title of the material if supplied, and may have other slight differences.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
For more details about the CC BY-NC-SA license, please visit: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
|
|
100
README.md
|
@ -3,84 +3,64 @@
|
|||
<img align="center" width="128px" src="src-tauri/icons/icon.png" />
|
||||
<h1 align="center"><b>Qopy</b></h1>
|
||||
|
||||
The fixed and simple clipboard manager for both Windows and Linux.
|
||||
The fixed, simple and reliable clipboard manager for both Windows and Linux.
|
||||
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1_x64.msi">
|
||||
<img src="./public/windows.png"> Windows (x64)
|
||||
<ins>**This project is not yet stable!**</ins>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Download for</td>
|
||||
<td>
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.1.0/Qopy_0.1.0_x64_en-US.msi">
|
||||
<img src="./public/windows.png"> Windows
|
||||
</a>
|
||||
•
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1_arm64.msi">
|
||||
Windows (arm64)
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.1.0/Qopy_0.1.0_amd64.AppImage">
|
||||
<img src="./public/linux.png"> Linux
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1.deb">
|
||||
<img src="./public/linux.png"> Linux (deb)
|
||||
</a>
|
||||
•
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1.rpm">
|
||||
Linux (rpm)
|
||||
</a>
|
||||
•
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1.AppImage">
|
||||
Linux (AppImage)
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1_silicon.dmg">
|
||||
<img src="./public/apple.png"> macOS (Silicon)
|
||||
</a>
|
||||
•
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1_intel.dmg">
|
||||
macOS (Intel)
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
<sup>Nightly releases can be found <a href="https://github.com/0PandaDEV/qopy/actions/workflows/build.yml">here</a> </sup>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<sup>Unstable Nightly releases can be found <a href="https://github.com/0PandaDEV/qopy/actions/workflows/build.yml">here</a> </sup>
|
||||
|
||||
</div>
|
||||
|
||||
[discord »](https://discord.gg/invite/Y7SbYphVw9)
|
||||
|
||||
> \[!IMPORTANT]
|
||||
>
|
||||
> **Star this project**, You will receive all release notifications from GitHub without any delay \~ ⭐️
|
||||
|
||||
<details>
|
||||
<summary><kbd>Star History</kbd></summary>
|
||||
<a href="https://starchart.cc/0PandaDEV/Qopy">
|
||||
<picture>
|
||||
<img width="100%" src="https://starchart.cc/0PandaDEV/Qopy.svg?variant=adaptive">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=0pandadev/qopy&theme=dark&type=Date">
|
||||
<img width="100%" src="https://api.star-history.com/svg?repos=0pandadev/qopy&type=Date">
|
||||
</picture>
|
||||
</a>
|
||||
</details>
|
||||
|
||||
[](https://wakatime.com/badge/user/018ce503-097f-4057-9599-db20b190920c/project/fe76359d-56c2-4a13-8413-55207b6ad298)
|
||||
|
||||
## 📋 What is Qopy
|
||||
|
||||
Qopy is a fixed clipboard manager designed as a simple alternative to the standard clipboard on Windows. It aims to provide a faster, more reliable experience while providing an extensive set of features compared to its Windows counterpart.
|
||||
Qopy is a fixed clipboard manager designed as a simple alternative to the standard clipboard in Windows. It aims to provide a smoother, more reliable experience. Plus, it's compatible with Linux, so you can enjoy the same great features on both operating systems.
|
||||
|
||||
❌ macOS will probably be not supported if you want something similar on macOS take a look at [Raycast](https://www.raycast.com/) and their clipboard history extension.
|
||||
|
||||
## 🚧 Roadmap
|
||||
- [x] [Setup guide](https://github.com/0PandaDEV/Qopy/blob/main/GET_STARTED.md)
|
||||
- [ ] Sync Clipboard across devices https://github.com/0PandaDEV/Qopy/issues/8
|
||||
- [x] Settings https://github.com/0PandaDEV/Qopy/issues/2
|
||||
- [x] Metadata for copied items https://github.com/0PandaDEV/Qopy/issues/5
|
||||
- [ ] [Setup guide](https://github.com/0PandaDEV/Qopy/blob/main/GET_STARTED.md)
|
||||
- [ ] Settings https://github.com/0PandaDEV/Qopy/issues/2
|
||||
- [ ] Option for custom keybind https://github.com/0PandaDEV/Qopy/issues/3
|
||||
- [ ] Metadata for copied items https://github.com/0PandaDEV/Qopy/issues/5
|
||||
- [ ] Code highlighting https://github.com/0PandaDEV/Qopy/issues/7
|
||||
- [ ] Streamshare integration https://github.com/0PandaDEV/Qopy/issues/4
|
||||
- [ ] Content type filter https://github.com/0PandaDEV/Qopy/issues/16
|
||||
- [ ] Preview for copied files https://github.com/0PandaDEV/Qopy/issues/15
|
||||
- [ ] Convert files to other formats https://github.com/0PandaDEV/Qopy/issues/17
|
||||
- [x] Option for custom keybind https://github.com/0PandaDEV/Qopy/issues/3
|
||||
- [x] macOS Support https://github.com/0PandaDEV/Qopy/issues/13
|
||||
- [ ] Cross-device clipboard sharing https://github.com/0PandaDEV/Qopy/issues/8
|
||||
|
||||
<sup>If you have ideas for features to include, please write a feature request [here](https://github.com/0pandadev/Qopy/issues).</sup>
|
||||
|
||||
## 📦 Concepts
|
||||
|
||||
Here you can see a few concepts these might not be implemented:
|
||||
|
||||

|
||||

|
||||
|
||||
## 📦 Preview
|
||||
<img width="800px" src="https://github.com/user-attachments/assets/18e1f9e3-414c-46e2-9c51-61c6e63a06d2"/>
|
||||
<img width="800px" src="https://github.com/user-attachments/assets/46ec4672-f156-4426-a2cb-3a40d00dbcd6"/>
|
||||
|
||||
## ❤️ Donations & Support
|
||||
|
||||
|
@ -88,31 +68,33 @@ Qopy is open-source and free to use. I appreciate donations to support ongoing d
|
|||
|
||||
<a href="https://buymeacoffee.com/pandadev_"><img src="https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black"/></a>
|
||||
|
||||
More options available via the Sponsor ❤️ button above.
|
||||
|
||||
## ⌨️ Local development
|
||||
|
||||
You can use GitHub Codespaces for online development:
|
||||
|
||||
[![][codespaces-shield]][codespaces-link]
|
||||
|
||||
Or to get Qopy set up on your machine, you'll need to have Rust and bun installed. Then, follow these steps:
|
||||
Or to get Qopy set up on your machine, you'll need to have Rust and pnpm installed. Then, follow these steps:
|
||||
|
||||
```zsh
|
||||
git clone https://github.com/0pandadev/Qopy.git
|
||||
cd Qopy
|
||||
bun i
|
||||
bun dev
|
||||
pnpm i
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
> \[!TIP]
|
||||
>
|
||||
> If you are interested in contributing code, feel free to check out the [Issues](https://github.com/0pandadev/Qopy/issues) section.
|
||||
> If you are interested in contributing code, feel free to check out our GitHub [Issues](https://github.com/0pandadev/Qopy/issues).
|
||||
|
||||
## 🔨 Building for production
|
||||
|
||||
To build for production simply execute:
|
||||
|
||||
```zsh
|
||||
bun build
|
||||
pnpm build
|
||||
```
|
||||
|
||||
> \[!NOTE]
|
||||
|
@ -123,7 +105,7 @@ bun build
|
|||
|
||||
## 📝 License
|
||||
|
||||
Qopy is licensed under AGPL-3. See the [LICENSE file](./LICENCE) for more information.
|
||||
Qopy is licensed under the Creative Commons Attribution-Noncommercial-Share Alike. See the [LICENSE file](./LICENCE) for more information.
|
||||
|
||||
[codespaces-link]: https://codespaces.new/0pandadev/Qopy
|
||||
[codespaces-shield]: https://github.com/codespaces/badge.svg
|
||||
|
|
130
README_ru.md
|
@ -1,130 +0,0 @@
|
|||
<div align="center">
|
||||
|
||||
<img align="center" width="128px" src="src-tauri/icons/icon.png" />
|
||||
<h1 align="center"><b>Qopy</b></h1>
|
||||
|
||||
Простой и исправленный менеджер буфера обмена как для Windows, так и для Linux.
|
||||
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1_x64.msi">
|
||||
<img src="./public/windows.png"> Windows (x64)
|
||||
</a>
|
||||
•
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1_arm64.msi">
|
||||
Windows (arm64)
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1.deb">
|
||||
<img src="./public/linux.png"> Linux (deb)
|
||||
</a>
|
||||
•
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1.rpm">
|
||||
Linux (rpm)
|
||||
</a>
|
||||
•
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1.AppImage">
|
||||
Linux (AppImage)
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1_silicon.dmg">
|
||||
<img src="./public/apple.png"> macOS (Silicon)
|
||||
</a>
|
||||
•
|
||||
<a href="https://github.com/0PandaDEV/Qopy/releases/download/v0.3.1/Qopy-0.3.1_intel.dmg">
|
||||
macOS (Intel)
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
<sup>Тестовые версии можно найти <a href="https://github.com/0PandaDEV/qopy/actions/workflows/build.yml">тут</a> </sup>
|
||||
|
||||
</div>
|
||||
|
||||
[discord »](https://discord.gg/invite/Y7SbYphVw9)
|
||||
|
||||
> \[!IMPORTANT]
|
||||
>
|
||||
> **Нажав на звезду**, Вы будете получать все уведомления от Github о новых версиях без задержек \~ ⭐️
|
||||
|
||||
<details>
|
||||
<summary><kbd>Star History</kbd></summary>
|
||||
<a href="https://star-history.com/#0pandadev/qopy&Date">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=0pandadev/qopy&theme=dark&type=Date">
|
||||
<img width="100%" src="https://api.star-history.com/svg?repos=0pandadev/qopy&type=Date">
|
||||
</picture>
|
||||
</a>
|
||||
</details>
|
||||
|
||||
[](https://wakatime.com/badge/user/018ce503-097f-4057-9599-db20b190920c/project/fe76359d-56c2-4a13-8413-55207b6ad298)
|
||||
|
||||
## 📋 Что такое Qopy
|
||||
|
||||
Qopy представляет собой исправленный менеджер буфера обмена, разработанный как простая альтернатива стандартному буферу обмена в Windows. Его цель - обеспечить более быструю и надежную работу, предоставляя при этом обширный набор функций по сравнению со своим аналогом в Windows.
|
||||
|
||||
## 🚧 Дорожная карта
|
||||
- [ ] [Руководство по установке](https://github.com/0PandaDEV/Qopy/blob/main/GET_STARTED.md)
|
||||
- [ ] Синхронизация буфера обмена между устройствами https://github.com/0PandaDEV/Qopy/issues/8
|
||||
- [ ] Настройки https://github.com/0PandaDEV/Qopy/issues/2
|
||||
- [x] Метаданные для скопированных элементов https://github.com/0PandaDEV/Qopy/issues/5
|
||||
- [ ] Выделение кода https://github.com/0PandaDEV/Qopy/issues/7
|
||||
- [ ] Интеграция Streamshare https://github.com/0PandaDEV/Qopy/issues/4
|
||||
- [ ] Фильтр типов контента https://github.com/0PandaDEV/Qopy/issues/16
|
||||
- [ ] Превью для скопированных файлов https://github.com/0PandaDEV/Qopy/issues/15
|
||||
- [ ] Конвертация файлов в другие форматы https://github.com/0PandaDEV/Qopy/issues/17
|
||||
- [x] Опция для пользовательской привязки клавиш https://github.com/0PandaDEV/Qopy/issues/3
|
||||
- [x] Поддержка macOS https://github.com/0PandaDEV/Qopy/issues/13
|
||||
|
||||
<sup>Если у вас есть идеи для функций, которые можно добавить в будущем, пожалуйста, напишите об этом [здесь](https://github.com/0pandadev/Qopy/issues).</sup>
|
||||
|
||||
## 📦 Концепты
|
||||
|
||||
Здесь вы можете увидеть несколько концепцов, которые могут быть не реализованы:
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
## ❤️ Пожертвования и Поддержка
|
||||
|
||||
Qopy имеет открытый исходный код и бесплатен для использования. Я ценю пожертвования в поддержку постоянной разработки и улучшений. Ваши взносы являются добровольными и помогают мне улучшить приложение для всех.
|
||||
|
||||
<a href="https://buymeacoffee.com/pandadev_"><img src="https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black"/></a>
|
||||
|
||||
## ⌨️ Локальная разработка
|
||||
|
||||
Вы можете использовать GitHub Codespaces для онлайн-разработки:
|
||||
|
||||
[![][codespaces-shield]][codespaces-link]
|
||||
|
||||
Или, чтобы настроить Qopy на вашем компьютере, вам необходимо установить Rust и bun. Затем выполните следующие действия:
|
||||
|
||||
```zsh
|
||||
git clone https://github.com/0pandadev/Qopy.git
|
||||
cd Qopy
|
||||
bun i
|
||||
bun dev
|
||||
```
|
||||
|
||||
> \[!Tip]
|
||||
>
|
||||
> Если вы заинтересованы во внесении кода, не стесняйтесь смотреть здесь [Issues](https://github.com/0pandadev/Qopy/issues).
|
||||
|
||||
## 🔨 Сборка для продакшена
|
||||
|
||||
Чтобы собрать для продакшена,просто выполните:
|
||||
|
||||
```zsh
|
||||
bun build
|
||||
```
|
||||
|
||||
> \[!NOTE]
|
||||
>
|
||||
> Не волнуйтесь, в конце произойдет сбой, потому что он не сможет обнаружить Приватный ключ, но установочные файлы будут сгенерированы независимо от этого.
|
||||
>
|
||||
> Вы можете найти его в `src-tauri/target/release/bundle`.
|
||||
|
||||
## 📝 Лицензия
|
||||
|
||||
Qopy лицензирован под GPL-3. Смотрите [LICENSE file](./LICENCE) для дополнительной информации.
|
||||
|
||||
[codespaces-link]: https://codespaces.new/0pandadev/Qopy
|
||||
[codespaces-shield]: https://github.com/codespaces/badge.svg
|
72
app.vue
|
@ -1,104 +1,72 @@
|
|||
<template>
|
||||
<div>
|
||||
<Noise />
|
||||
<NuxtPage />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { app, window } from "@tauri-apps/api";
|
||||
import { disable, enable } from "@tauri-apps/plugin-autostart";
|
||||
import { onMounted } from "vue";
|
||||
import { keyboard } from "wrdu-keyboard";
|
||||
|
||||
const { $settings } = useNuxtApp();
|
||||
keyboard.init();
|
||||
import { listen } from '@tauri-apps/api/event'
|
||||
import { app, window } from '@tauri-apps/api';
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
onMounted(async () => {
|
||||
await listen("settings", async () => {
|
||||
await navigateTo("/settings");
|
||||
await listen('change_keybind', async () => {
|
||||
await navigateTo('/keybind')
|
||||
await app.show();
|
||||
await window.getCurrentWindow().show();
|
||||
});
|
||||
})
|
||||
|
||||
if ((await $settings.getSetting("autostart")) === "true") {
|
||||
await enable();
|
||||
} else {
|
||||
await disable();
|
||||
}
|
||||
|
||||
await listen("main_route", async () => {
|
||||
await navigateTo("/");
|
||||
});
|
||||
});
|
||||
await listen('main_route', async () => {
|
||||
await navigateTo('/')
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@font-face {
|
||||
font-family: SFRoundedRegular;
|
||||
font-display: swap;
|
||||
src: url("/fonts/SFRoundedRegular.otf") format("opentype");
|
||||
src: url("~/assets/fonts/SFRoundedRegular.otf") format("opentype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: SFRoundedMedium;
|
||||
font-display: swap;
|
||||
src: url("/fonts/SFRoundedMedium.otf") format("opentype");
|
||||
src: url("~/assets/fonts/SFRoundedMedium.otf") format("opentype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: SFRoundedSemiBold;
|
||||
font-display: swap;
|
||||
src: url("/fonts/SFRoundedSemiBold.otf") format("opentype");
|
||||
src: url("~/assets/fonts/SFRoundedSemiBold.otf") format("opentype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: CommitMono;
|
||||
font-display: swap;
|
||||
src: url("/fonts/CommitMono.woff2") format("woff2");
|
||||
}
|
||||
|
||||
:root {
|
||||
--background: #2e2d2b;
|
||||
--accent: #feb453;
|
||||
--border: #ffffff0d;
|
||||
|
||||
--text: #e5dfd5;
|
||||
--text-secondary: #ada9a1;
|
||||
--text-muted: #78756f;
|
||||
|
||||
--sidebar-width: 286px;
|
||||
--bottom-bar-height: 39px;
|
||||
--info-panel-height: 160px;
|
||||
--content-view-height: calc(
|
||||
100% - var(--search-height) - var(--info-panel-height) -
|
||||
var(--bottom-bar-height)
|
||||
);
|
||||
src: url("~/assets/fonts/CommitMono.woff2") format("woff2");
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
color: #E5DFD5;
|
||||
text-decoration: none;
|
||||
font-family: SFRoundedRegular;
|
||||
scroll-behavior: smooth;
|
||||
scrollbar-width: thin;
|
||||
user-select: none;
|
||||
|
||||
--os-handle-bg: #ada9a1;
|
||||
--os-handle-bg-hover: #78756f;
|
||||
--os-handle-bg-active: #78756f;
|
||||
--os-handle-bg: #ADA9A1;
|
||||
--os-handle-bg-hover: #78756F;
|
||||
--os-handle-bg-active: #78756F;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
body,
|
||||
#__nuxt {
|
||||
background-color: transparent;
|
||||
width: 750px;
|
||||
height: 474px;
|
||||
z-index: -1;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.os-scrollbar-horizontal {
|
||||
|
|
300
assets/css/index.scss
Normal file
|
@ -0,0 +1,300 @@
|
|||
$primary: #2E2D2B;
|
||||
$accent: #FEB453;
|
||||
$divider: #ffffff0d;
|
||||
|
||||
$text: #E5DFD5;
|
||||
$text2: #ADA9A1;
|
||||
$mutedtext: #78756F;
|
||||
|
||||
.bg {
|
||||
width: 750px;
|
||||
height: 474px;
|
||||
background-color: $primary;
|
||||
border: 1px solid $divider;
|
||||
border-radius: 12px;
|
||||
z-index: -1;
|
||||
position: fixed;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.search {
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 54px;
|
||||
background-color: transparent;
|
||||
outline: none;
|
||||
border: none;
|
||||
font-size: 18px;
|
||||
color: $mutedtext;
|
||||
padding-inline: 16px;
|
||||
border-bottom: 1px solid $divider;
|
||||
font-family: SFRoundedMedium;
|
||||
}
|
||||
|
||||
.results {
|
||||
position: absolute;
|
||||
width: 284px;
|
||||
top: 53px;
|
||||
left: 0;
|
||||
height: calc(100vh - 95px);
|
||||
border-right: 1px solid $divider;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-inline: 8px;
|
||||
padding-bottom: 8px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
|
||||
.result {
|
||||
height: 40px;
|
||||
font-size: 14px;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
padding: 10px;
|
||||
padding-inline: 10px;
|
||||
letter-spacing: 0.5px;
|
||||
gap: 10px;
|
||||
overflow: hidden;
|
||||
text-overflow: clip;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.result {
|
||||
cursor: pointer;
|
||||
|
||||
&.selected {
|
||||
background-color: $divider;
|
||||
}
|
||||
}
|
||||
|
||||
.time-separator {
|
||||
font-size: 12px;
|
||||
color: $text2;
|
||||
font-family: SFRoundedSemiBold;
|
||||
padding-left: 8px;
|
||||
padding-bottom: 8px;
|
||||
padding-top: 14px;
|
||||
}
|
||||
|
||||
.favicon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 20px;
|
||||
height: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
position: absolute;
|
||||
top: 53px;
|
||||
left: 284px;
|
||||
padding: 8px;
|
||||
height: calc(100vh - 96px);
|
||||
font-family: CommitMono !important;
|
||||
font-size: 14px;
|
||||
letter-spacing: 1;
|
||||
border-radius: 10px;
|
||||
width: calc(100vw - 286px);
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
|
||||
div {
|
||||
border-radius: 10px;
|
||||
font-family: CommitMono !important;
|
||||
}
|
||||
|
||||
.full-image {
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
}
|
||||
|
||||
.image {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
object-fit: contain;
|
||||
object-position: top left;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-bar {
|
||||
height: 40px;
|
||||
width: calc(100vw - 2px);
|
||||
backdrop-filter: blur(18px);
|
||||
background-color: hsla(40, 3%, 16%, 0.8);
|
||||
position: fixed;
|
||||
bottom: 1px;
|
||||
left: 1px;
|
||||
z-index: 100;
|
||||
border-radius: 0 0 12px 12px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
padding-inline: 12px;
|
||||
padding-right: 6px;
|
||||
padding-top: 1px;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
border-top: 1px solid $divider;
|
||||
|
||||
p {
|
||||
color: $text2;
|
||||
}
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.logo {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.paste p {
|
||||
color: $text;
|
||||
}
|
||||
|
||||
.actions div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
width: 2px;
|
||||
height: 12px;
|
||||
background-color: $divider;
|
||||
margin-left: 8px;
|
||||
margin-right: 4px;
|
||||
transition: all .2s;
|
||||
}
|
||||
|
||||
.paste,
|
||||
.actions {
|
||||
padding: 4px;
|
||||
padding-left: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
border-radius: 7px;
|
||||
background-color: transparent;
|
||||
transition: all .2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.paste:hover,
|
||||
.actions:hover {
|
||||
background-color: $divider;
|
||||
}
|
||||
|
||||
&:hover .paste:hover~.divider,
|
||||
&:hover .actions:hover~.divider {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.clothoid-corner {
|
||||
clip-path: polygon(13.890123px 0px,
|
||||
calc(100% - 13.890123px) 0px,
|
||||
calc(100% - 12.723414px) 0.004211px,
|
||||
calc(100% - 11.556933px) 0.025635px,
|
||||
calc(100% - 10.391895px) 0.085062px,
|
||||
calc(100% - 9.231074px) 0.199291px,
|
||||
calc(100% - 8.079275px) 0.382298px,
|
||||
calc(100% - 6.947448px) 0.662609px,
|
||||
calc(100% - 5.844179px) 1.039291px,
|
||||
calc(100% - 4.793324px) 1.542842px,
|
||||
calc(100% - 3.811369px) 2.169728px,
|
||||
calc(100% - 2.926417px) 2.926417px,
|
||||
calc(100% - 2.169728px) 3.811369px,
|
||||
calc(100% - 1.542842px) 4.793324px,
|
||||
calc(100% - 1.039291px) 5.844179px,
|
||||
calc(100% - 0.662609px) 6.947448px,
|
||||
calc(100% - 0.382298px) 8.079275px,
|
||||
calc(100% - 0.199291px) 9.231074px,
|
||||
calc(100% - 0.085062px) 10.391895px,
|
||||
calc(100% - 0.025635px) 11.556933px,
|
||||
calc(100% - 0.004211px) 12.723414px,
|
||||
100% 13.890123px,
|
||||
100% calc(100% - 13.890123px),
|
||||
calc(100% - 0.004211px) calc(100% - 12.723414px),
|
||||
calc(100% - 0.025635px) calc(100% - 11.556933px),
|
||||
calc(100% - 0.085062px) calc(100% - 10.391895px),
|
||||
calc(100% - 0.199291px) calc(100% - 9.231074px),
|
||||
calc(100% - 0.382298px) calc(100% - 8.079275px),
|
||||
calc(100% - 0.662609px) calc(100% - 6.947448px),
|
||||
calc(100% - 1.039291px) calc(100% - 5.844179px),
|
||||
calc(100% - 1.542842px) calc(100% - 4.793324px),
|
||||
calc(100% - 2.169728px) calc(100% - 3.811369px),
|
||||
calc(100% - 2.926417px) calc(100% - 2.926417px),
|
||||
calc(100% - 3.811369px) calc(100% - 2.169728px),
|
||||
calc(100% - 4.793324px) calc(100% - 1.542842px),
|
||||
calc(100% - 5.844179px) calc(100% - 1.039291px),
|
||||
calc(100% - 6.947448px) calc(100% - 0.662609px),
|
||||
calc(100% - 8.079275px) calc(100% - 0.382298px),
|
||||
calc(100% - 9.231074px) calc(100% - 0.199291px),
|
||||
calc(100% - 10.391895px) calc(100% - 0.085062px),
|
||||
calc(100% - 11.556933px) calc(100% - 0.025635px),
|
||||
calc(100% - 12.723414px) calc(100% - 0.004211px),
|
||||
calc(100% - 13.890123px) 100%,
|
||||
13.890123px 100%,
|
||||
12.723414px calc(100% - 0.004211px),
|
||||
11.556933px calc(100% - 0.025635px),
|
||||
10.391895px calc(100% - 0.085062px),
|
||||
9.231074px calc(100% - 0.199291px),
|
||||
8.079275px calc(100% - 0.382298px),
|
||||
6.947448px calc(100% - 0.662609px),
|
||||
5.844179px calc(100% - 1.039291px),
|
||||
4.793324px calc(100% - 1.542842px),
|
||||
3.811369px calc(100% - 2.169728px),
|
||||
2.926417px calc(100% - 2.926417px),
|
||||
2.169728px calc(100% - 3.811369px),
|
||||
1.542842px calc(100% - 4.793324px),
|
||||
1.039291px calc(100% - 5.844179px),
|
||||
0.662609px calc(100% - 6.947448px),
|
||||
0.382298px calc(100% - 8.079275px),
|
||||
0.199291px calc(100% - 9.231074px),
|
||||
0.085062px calc(100% - 10.391895px),
|
||||
0.025635px calc(100% - 11.556933px),
|
||||
0.004211px calc(100% - 12.723414px),
|
||||
0px calc(100% - 13.890123px),
|
||||
0px 13.890123px,
|
||||
0.004211px 12.723414px,
|
||||
0.025635px 11.556933px,
|
||||
0.085062px 10.391895px,
|
||||
0.199291px 9.231074px,
|
||||
0.382298px 8.079275px,
|
||||
0.662609px 6.947448px,
|
||||
1.039291px 5.844179px,
|
||||
1.542842px 4.793324px,
|
||||
2.169728px 3.811369px,
|
||||
2.926417px 2.926417px,
|
||||
3.811369px 2.169728px,
|
||||
4.793324px 1.542842px,
|
||||
5.844179px 1.039291px,
|
||||
6.947448px 0.662609px,
|
||||
8.079275px 0.382298px,
|
||||
9.231074px 0.199291px,
|
||||
10.391895px 0.085062px,
|
||||
11.556933px 0.025635px,
|
||||
12.723414px 0.004211px,
|
||||
13.890123px 0px);
|
||||
}
|
66
assets/css/keybind.scss
Normal file
|
@ -0,0 +1,66 @@
|
|||
$primary: #2E2D2B;
|
||||
$accent: #FEB453;
|
||||
$divider: #ffffff0d;
|
||||
|
||||
$text: #E5DFD5;
|
||||
$text2: #ADA9A1;
|
||||
$mutedtext: #78756F;
|
||||
|
||||
.bg {
|
||||
width: 750px;
|
||||
height: 474px;
|
||||
background-color: $primary;
|
||||
border: 1px solid $divider;
|
||||
border-radius: 12px;
|
||||
z-index: -1;
|
||||
position: fixed;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.keybind-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.keybind-input {
|
||||
width: 300px;
|
||||
height: 50px;
|
||||
border: 2px solid $accent;
|
||||
border-radius: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
margin-bottom: 20px;
|
||||
background-color: rgba($accent, 0.1);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.keybind-input:focus {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px rgba($accent, 0.5);
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 10px 20px;
|
||||
background-color: $accent;
|
||||
color: $primary;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
<template>
|
||||
<div class="bottombar">
|
||||
<div class="branding">
|
||||
<img src="/logo.png" alt="logo" class="logo" />
|
||||
<p class="name">Qopy</p>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<div v-if="primaryAction" class="paste" @click="primaryAction.onClick">
|
||||
<p class="text">{{ primaryAction.text }}</p>
|
||||
<component :is="primaryAction.icon" />
|
||||
</div>
|
||||
<div v-if="secondaryAction" class="divider"></div>
|
||||
<div v-if="secondaryAction" class="actions" @click="secondaryAction.onClick">
|
||||
<p class="text">{{ secondaryAction.text }}</p>
|
||||
<div>
|
||||
<IconsCtrl v-if="(os === 'windows' || os === 'linux') && secondaryAction.showModifier" />
|
||||
<IconsCmd v-if="os === 'macos' && secondaryAction.showModifier" />
|
||||
<component :is="secondaryAction.icon" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { platform } from "@tauri-apps/plugin-os";
|
||||
|
||||
interface Action {
|
||||
text: string;
|
||||
icon: any;
|
||||
onClick?: () => void;
|
||||
showModifier?: boolean;
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
primaryAction?: Action;
|
||||
secondaryAction?: Action;
|
||||
}>();
|
||||
|
||||
const os = ref<string>("");
|
||||
|
||||
onMounted(() => {
|
||||
os.value = platform();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bottombar {
|
||||
min-height: 40px;
|
||||
width: 100%;
|
||||
border-top: 1px solid var(--border);
|
||||
backdrop-filter: blur(18px);
|
||||
border-radius: 0 0 11px 11px;
|
||||
background-color: rgba(46, 45, 43, 0.051);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 11px;
|
||||
padding-right: 6px;
|
||||
justify-content: space-between;
|
||||
|
||||
.branding {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
color: var(--text-secondary);
|
||||
|
||||
.logo {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.text {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.actions div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
width: 2px;
|
||||
height: 12px;
|
||||
background-color: var(--border);
|
||||
margin-left: 8px;
|
||||
margin-right: 4px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.paste,
|
||||
.actions {
|
||||
padding: 4px;
|
||||
padding-left: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
border-radius: 7px;
|
||||
background-color: transparent;
|
||||
transition: all 0.2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.paste:hover,
|
||||
.actions:hover {
|
||||
background-color: var(--border);
|
||||
}
|
||||
|
||||
&:hover .paste:hover ~ .divider,
|
||||
&:hover .divider:has(+ .actions:hover) {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: SFRoundedMedium;
|
||||
}
|
||||
</style>
|
|
@ -1,39 +0,0 @@
|
|||
<template>
|
||||
<svg
|
||||
width="24px"
|
||||
height="20px"
|
||||
viewBox="0 0 24 20"
|
||||
version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<path d="M0 0L24 0L24 20L0 20L0 0Z" id="path_1" />
|
||||
<clipPath id="clip_1">
|
||||
<use
|
||||
xlink:href="#path_1"
|
||||
clip-rule="evenodd"
|
||||
fill-rule="evenodd"
|
||||
transform="translate(0, -2.133523)" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<g id="cmd">
|
||||
<path
|
||||
d="M-751 -2016L-751 -2016L-751 -1996L-775 -1996L-775 -2016L-751 -2016Z"
|
||||
id="cmd"
|
||||
fill="none"
|
||||
stroke="none" />
|
||||
<path
|
||||
d="M12 0L17.6 0C19.8402 0 20.9603 0 21.816 0.435974Q22.3804 0.723593 22.8284 1.17157Q23.2764 1.61955 23.564 2.18404C24 3.03969 24 4.15979 24 6.4L24 13.6C24 15.8402 24 16.9603 23.564 17.816Q23.2764 18.3804 22.8284 18.8284Q22.3804 19.2764 21.816 19.564C20.9603 20 19.8402 20 17.6 20L6.4 20C4.15979 20 3.03969 20 2.18404 19.564Q1.61955 19.2764 1.17157 18.8284Q0.723594 18.3804 0.435974 17.816C0 16.9603 0 15.8402 0 13.6L0 6.4C0 4.15979 0 3.03969 0.435974 2.18404Q0.723594 1.61955 1.17157 1.17157Q1.61955 0.723594 2.18404 0.435974C3.03969 0 4.15979 0 6.4 0L12 0Z"
|
||||
id="Rectangle"
|
||||
fill="#FFFFFF"
|
||||
fill-opacity="0.050980393"
|
||||
stroke="none" />
|
||||
<g id="⌘" clip-path="url(#clip_1)" transform="translate(0 2.133523)">
|
||||
<g transform="translate(5.5692472, 0)" id="⌘" fill="#E5DFD5">
|
||||
<path
|
||||
d="M3.55007 12.8061Q2.98224 12.8061 2.51598 12.5268Q2.04972 12.2475 1.77042 11.7789Q1.49112 11.3104 1.49112 10.7472Q1.49112 10.1747 1.77042 9.70614Q2.04972 9.23757 2.51598 8.95827Q2.98224 8.67898 3.55007 8.67898L4.5657 8.67898L4.5657 7.04474L3.55007 7.04474Q2.98224 7.04474 2.51598 6.76775Q2.04972 6.49077 1.77042 6.02219Q1.49112 5.55362 1.49112 4.98579Q1.49112 4.41797 1.77042 3.9494Q2.04972 3.48082 2.51598 3.20383Q2.98224 2.92685 3.55007 2.92684Q4.1179 2.92684 4.58647 3.20383Q5.05504 3.48082 5.33434 3.9494Q5.61364 4.41797 5.61364 4.98579L5.61364 5.99219L7.25249 5.99219L7.25249 4.98579Q7.25249 4.41797 7.52947 3.9494Q7.80646 3.48082 8.27504 3.20383Q8.74361 2.92685 9.31144 2.92684Q9.87926 2.92684 10.3455 3.20383Q10.8118 3.48082 11.0888 3.9494Q11.3658 4.41797 11.3658 4.98579Q11.3658 5.55362 11.0888 6.02219Q10.8118 6.49077 10.3455 6.76775Q9.87926 7.04474 9.31144 7.04474L8.30043 7.04474L8.30043 8.67898L9.31144 8.67898Q9.87926 8.67898 10.3455 8.95827Q10.8118 9.23757 11.0888 9.70614Q11.3658 10.1747 11.3658 10.7472Q11.3658 11.3104 11.0888 11.7789Q10.8118 12.2475 10.3455 12.5268Q9.87926 12.8061 9.31144 12.8061Q8.74361 12.8061 8.27504 12.5268Q7.80646 12.2475 7.52947 11.7789Q7.25249 11.3104 7.25249 10.7472L7.25249 9.73153L5.61364 9.73153L5.61364 10.7472Q5.61364 11.3104 5.33434 11.7789Q5.05504 12.2475 4.58647 12.5268Q4.1179 12.8061 3.55007 12.8061ZM3.55007 11.7536Q3.97017 11.7536 4.26563 11.4604Q4.56108 11.1673 4.5657 10.7472L4.5657 9.73153L3.55007 9.73153Q3.12997 9.73615 2.83452 10.0293Q2.53906 10.3224 2.53906 10.7472Q2.53906 11.1673 2.83452 11.4604Q3.12997 11.7536 3.55007 11.7536ZM9.31144 11.7536Q9.72692 11.7536 10.0224 11.4604Q10.3178 11.1673 10.3178 10.7472Q10.3178 10.3224 10.0224 10.0293Q9.72692 9.73615 9.31144 9.73153L8.30043 9.73153L8.30043 10.7472Q8.29581 11.1673 8.59357 11.4604Q8.89133 11.7536 9.31144 11.7536ZM3.55007 5.99219L4.5657 5.99219L4.5657 4.98579Q4.56108 4.56569 4.26563 4.27255Q3.97017 3.9794 3.55007 3.9794Q3.12997 3.9794 2.83452 4.27255Q2.53906 4.56569 2.53906 4.98579Q2.53906 5.40589 2.83452 5.70135Q3.12997 5.9968 3.55007 5.99219ZM8.30043 5.99219L9.31144 5.99219Q9.72692 5.9968 10.0224 5.70135Q10.3178 5.40589 10.3178 4.98579Q10.3178 4.56569 10.0224 4.27255Q9.72692 3.9794 9.31144 3.9794Q8.89133 3.9794 8.59357 4.27255Q8.29581 4.56569 8.30043 4.98579L8.30043 5.99219ZM5.61364 8.67898L7.25249 8.67898L7.25249 7.04474L5.61364 7.04474L5.61364 8.67898Z" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</template>
|
|
@ -1,16 +1,11 @@
|
|||
<template>
|
||||
<svg
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 18 18"
|
||||
fill="none"
|
||||
<svg width="15px" height="18px" viewBox="0 0 15 18" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<g id="Code" fill-opacity="1">
|
||||
<path d="M15 0L15 0L15 18L0 18L0 0L15 0Z" id="Code" fill="none" stroke="none" />
|
||||
<path
|
||||
d="M3.75 16.0714L11.25 16.0714C12.2855 16.0714 13.125 15.208 13.125 14.1429L13.125 8.02672C13.1248 7.5147 12.9269 7.02399 12.5748 6.66239L8.52375 2.493C8.17225 2.13169 7.69568 1.92868 7.19875 1.92857L3.75 1.92857C2.71447 1.92857 1.875 2.79202 1.875 3.85715L1.875 14.1429C1.875 15.208 2.71447 16.0714 3.75 16.0714M15 8.02672C15.0003 7.00424 14.6053 6.02271 13.9018 5.29904L9.85 1.13143C9.1465 0.406921 8.19178 -0.000123228 7.19625 0L3.75 0C1.67893 0 0 1.7269 0 3.85714L0 14.1429C2.38419e-07 16.2731 1.67893 18 3.75 18L11.25 18C13.3211 18 15 16.2731 15 14.1429L15 8.02672ZM8.40003 12.2529C8.03446 11.8764 8.03446 11.2665 8.40003 10.89L9.61253 9.64286L8.40003 8.39571C8.05583 8.01577 8.06598 7.4237 8.423 7.05648C8.78002 6.68926 9.35564 6.67882 9.72503 7.03286L11.6 8.96143C11.9656 9.33791 11.9656 9.94781 11.6 10.3243L9.72503 12.2529C9.35901 12.6289 8.76605 12.6289 8.40003 12.2529M6.60003 8.39571C6.94423 8.01577 6.93407 7.4237 6.57706 7.05649C6.22004 6.68927 5.64442 6.67882 5.27503 7.03286L3.40003 8.96143C3.03446 9.33791 3.03446 9.94781 3.40003 10.3243L5.27503 12.2529C5.50874 12.5108 5.86072 12.617 6.19289 12.5298C6.52505 12.4425 6.78443 12.1757 6.86926 11.8341C6.95409 11.4924 6.85084 11.1304 6.60003 10.89L5.38753 9.64286L6.60003 8.39571Z"
|
||||
fill="#E5DFD5"
|
||||
fill-rule="evenodd"
|
||||
transform="translate(1.5 0)" />
|
||||
d="M3.75 16.0714L11.25 16.0714C12.2855 16.0714 13.125 15.208 13.125 14.1429L13.125 8.02672C13.1248 7.5147 12.9269 7.02399 12.5748 6.66239L8.52375 2.493C8.17225 2.13169 7.69568 1.92868 7.19875 1.92857L3.75 1.92857C2.71447 1.92857 1.875 2.79202 1.875 3.85714L1.875 14.1429C1.875 15.208 2.71447 16.0714 3.75 16.0714M15 8.02672C15.0003 7.00424 14.6053 6.02271 13.9018 5.29904L9.85 1.13143C9.1465 0.406921 8.19178 -0.000123228 7.19625 0L3.75 0C1.67893 0 0 1.7269 0 3.85714L0 14.1429C2.98023e-07 16.2731 1.67893 18 3.75 18L11.25 18C13.3211 18 15 16.2731 15 14.1429L15 8.02672ZM8.4 12.2529C8.03443 11.8764 8.03443 11.2665 8.4 10.89L9.6125 9.64286L8.4 8.39571C8.0558 8.01577 8.06595 7.4237 8.42297 7.05648C8.77999 6.68927 9.35561 6.67882 9.725 7.03286L11.6 8.96143C11.9656 9.33791 11.9656 9.94781 11.6 10.3243L9.725 12.2529C9.35898 12.6289 8.76602 12.6289 8.4 12.2529M6.6 8.39571C6.9442 8.01577 6.93404 7.4237 6.57703 7.05649C6.22001 6.68927 5.64439 6.67882 5.275 7.03286L3.4 8.96143C3.03443 9.33791 3.03443 9.94781 3.4 10.3243L5.275 12.2529C5.50871 12.5108 5.86069 12.617 6.19286 12.5298C6.52502 12.4425 6.7844 12.1757 6.86923 11.8341C6.95406 11.4924 6.85081 11.1304 6.6 10.89L5.3875 9.64286L6.6 8.39571Z"
|
||||
id="Shape" fill="#E5DFD5" fill-rule="evenodd" stroke="none" />
|
||||
</g>
|
||||
</svg>
|
||||
</template>
|
|
@ -1,32 +0,0 @@
|
|||
<template>
|
||||
<svg
|
||||
width="24px"
|
||||
height="20px"
|
||||
viewBox="0 0 24 20"
|
||||
version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Ctrl" fill-opacity="1">
|
||||
<path
|
||||
d="M-751 -2016L-751 -2016L-751 -1996L-775 -1996L-775 -2016L-751 -2016Z"
|
||||
id="Ctrl"
|
||||
fill="none"
|
||||
stroke="none" />
|
||||
<path
|
||||
d="M12 0L17.6 0C19.8402 0 20.9603 0 21.816 0.435974Q22.3804 0.723593 22.8284 1.17157Q23.2764 1.61955 23.564 2.18404C24 3.03969 24 4.15979 24 6.4L24 13.6C24 15.8402 24 16.9603 23.564 17.816Q23.2764 18.3804 22.8284 18.8284Q22.3804 19.2764 21.816 19.564C20.9603 20 19.8402 20 17.6 20L6.4 20C4.15979 20 3.03969 20 2.18404 19.564Q1.61955 19.2764 1.17157 18.8284Q0.723594 18.3804 0.435974 17.816C0 16.9603 0 15.8402 0 13.6L0 6.4C0 4.15979 0 3.03969 0.435974 2.18404Q0.723594 1.61955 1.17157 1.17157Q1.61955 0.723594 2.18404 0.435974C3.03969 0 4.15979 0 6.4 0L12 0Z"
|
||||
id="Rectangle"
|
||||
fill="#FFFFFF"
|
||||
fill-opacity="0.050980393"
|
||||
stroke="none" />
|
||||
<path
|
||||
d="M7.97095 9.00977L12 5L16 9.00977"
|
||||
id="Vector"
|
||||
fill="none"
|
||||
fill-rule="evenodd"
|
||||
stroke="#E5E0D5"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
</g>
|
||||
</svg>
|
||||
</template>
|
|
@ -1,41 +0,0 @@
|
|||
<template>
|
||||
<svg
|
||||
width="24px"
|
||||
height="20px"
|
||||
viewBox="0 0 24 20"
|
||||
version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Enter" fill-opacity="1">
|
||||
<path
|
||||
d="M-659 -2016L-659 -2016L-659 -1996L-683 -1996L-683 -2016L-659 -2016Z"
|
||||
id="Enter"
|
||||
fill="none"
|
||||
stroke="none" />
|
||||
<path
|
||||
d="M12 0L17.6 0C19.8402 0 20.9603 0 21.816 0.435974Q22.3804 0.723593 22.8284 1.17157Q23.2764 1.61955 23.564 2.18404C24 3.03969 24 4.15979 24 6.4L24 13.6C24 15.8402 24 16.9603 23.564 17.816Q23.2764 18.3804 22.8284 18.8284Q22.3804 19.2764 21.816 19.564C20.9603 20 19.8402 20 17.6 20L6.4 20C4.15979 20 3.03969 20 2.18404 19.564Q1.61955 19.2764 1.17157 18.8284Q0.723594 18.3804 0.435974 17.816C0 16.9603 0 15.8402 0 13.6L0 6.4C0 4.15979 0 3.03969 0.435974 2.18404Q0.723594 1.61955 1.17157 1.17157Q1.61955 0.723594 2.18404 0.435974C3.03969 0 4.15979 0 6.4 0L12 0Z"
|
||||
id="Rectangle"
|
||||
fill="#FFFFFF"
|
||||
fill-opacity="0.050980393"
|
||||
stroke="none" />
|
||||
<path
|
||||
d="M16.0597 5.48914L16.0597 10.5L7.5 10.5"
|
||||
id="Vector"
|
||||
fill="none"
|
||||
fill-rule="evenodd"
|
||||
stroke="#E5DFD5"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
<path
|
||||
d="M9.5 8.5L9.5 12.5035L7 10.5L9.5 8.5Z"
|
||||
id="Vector"
|
||||
fill="#E5DFD5"
|
||||
fill-rule="evenodd"
|
||||
stroke="#E5DFD5"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
</g>
|
||||
</svg>
|
||||
</template>
|
|
@ -1,16 +1,11 @@
|
|||
<template>
|
||||
<svg
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 18 18"
|
||||
fill="none"
|
||||
<svg width="15px" height="18px" viewBox="0 0 15 18" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<g id="File" fill-opacity="1">
|
||||
<path d="M15 0L15 0L15 18L0 18L0 0L15 0Z" id="File" fill="none" stroke="none" />
|
||||
<path
|
||||
d="M11.25 16.0714L3.75 16.0714C2.71447 16.0714 1.875 15.208 1.875 14.1429L1.875 3.85714C1.875 2.79202 2.71447 1.92857 3.75 1.92857L6.25 1.92857L6.25 5.14286C6.25 7.2731 7.92893 9 10 9L13.125 9L13.125 14.1429C13.125 15.208 12.2855 16.0714 11.25 16.0714M12.8788 7.07143C12.7961 6.92188 12.6944 6.78437 12.5763 6.66257L8.5225 2.493C8.40408 2.37151 8.2704 2.26687 8.125 2.18186L8.125 5.14286C8.125 6.20798 8.96447 7.07143 10 7.07143L12.8788 7.07143ZM13.9013 5.29843C14.6049 6.02193 15.0001 7.00338 15 8.02672L15 14.1429C15 16.2731 13.3211 18 11.25 18L3.75 18C1.67893 18 0 16.2731 0 14.1429L0 3.85714C-5.96046e-07 1.7269 1.67893 0 3.75 0L7.19625 0C8.19116 -0.000122309 9.14535 0.406423 9.84875 1.13014L13.9013 5.29843Z"
|
||||
fill="#E5DFD5"
|
||||
fill-rule="evenodd"
|
||||
transform="translate(1.5 0)" />
|
||||
id="Shape" fill="#E5DFD5" fill-rule="evenodd" stroke="none" />
|
||||
</g>
|
||||
</svg>
|
||||
</template>
|
|
@ -1,15 +1,11 @@
|
|||
<template>
|
||||
<svg
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 18 18"
|
||||
fill="none"
|
||||
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<g id="Image" fill-opacity="1">
|
||||
<path d="M18 0L18 0L18 18L0 18L0 0L18 0Z" id="Image" fill="none" stroke="none" />
|
||||
<path
|
||||
d="M13.8462 2.07692L4.15385 2.07692C3.00679 2.07692 2.07692 3.00679 2.07692 4.15385L2.07692 11.1143L3.40892 10.1451C4.26934 9.51991 5.43685 9.5289 6.28754 10.1672L7.57246 11.1309L10.8512 8.32016C11.7843 7.52111 13.1676 7.54669 14.0705 8.37969L15.9231 10.0897L15.9231 4.15385C15.9231 3.00679 14.9932 2.07692 13.8462 2.07692M18 12.4588L18 4.15385C18 1.85974 16.1403 0 13.8462 0L4.15385 0C1.85974 0 0 1.85974 0 4.15385L0 13.8462C3.30118e-07 16.1403 1.85974 18 4.15385 18L13.8462 18C16.1403 18 18 16.1403 18 13.8462L18 12.4588ZM15.9231 12.9157L12.6623 9.90554C12.5333 9.78671 12.3358 9.78314 12.2026 9.89723L8.29108 13.2508L7.65831 13.7935L6.99231 13.2937L5.04 11.8302C4.91867 11.7398 4.75269 11.7386 4.63015 11.8274L2.07692 13.6814L2.07692 13.8462C2.07692 14.9932 3.00679 15.9231 4.15385 15.9231L13.8462 15.9231C14.9932 15.9231 15.9231 14.9932 15.9231 13.8462L15.9231 12.9157ZM8.30769 6.23077C8.30769 7.37782 7.37782 8.30769 6.23077 8.30769C5.08372 8.30769 4.15385 7.37782 4.15385 6.23077C4.15385 5.08372 5.08372 4.15385 6.23077 4.15385C7.37782 4.15385 8.30769 5.08372 8.30769 6.23077"
|
||||
fill="#E5DFD5"
|
||||
fill-rule="evenodd" />
|
||||
id="Shape" fill="#E5DFD5" fill-rule="evenodd" stroke="none" />
|
||||
</g>
|
||||
</svg>
|
||||
</template>
|
|
@ -1,29 +0,0 @@
|
|||
<template>
|
||||
<svg
|
||||
width="24px"
|
||||
height="20px"
|
||||
viewBox="0 0 24 20"
|
||||
version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="K" fill-opacity="1">
|
||||
<path
|
||||
d="M-751 -2016L-751 -2016L-751 -1996L-775 -1996L-775 -2016L-751 -2016Z"
|
||||
id="K"
|
||||
fill="none"
|
||||
stroke="none" />
|
||||
<path
|
||||
d="M12 0L17.6 0C19.8402 0 20.9603 0 21.816 0.435974Q22.3804 0.723593 22.8284 1.17157Q23.2764 1.61955 23.564 2.18404C24 3.03969 24 4.15979 24 6.4L24 13.6C24 15.8402 24 16.9603 23.564 17.816Q23.2764 18.3804 22.8284 18.8284Q22.3804 19.2764 21.816 19.564C20.9603 20 19.8402 20 17.6 20L6.4 20C4.15979 20 3.03969 20 2.18404 19.564Q1.61955 19.2764 1.17157 18.8284Q0.723594 18.3804 0.435974 17.816C0 16.9603 0 15.8402 0 13.6L0 6.4C0 4.15979 0 3.03969 0.435974 2.18404Q0.723594 1.61955 1.17157 1.17157Q1.61955 0.723594 2.18404 0.435974C3.03969 0 4.15979 0 6.4 0L12 0Z"
|
||||
id="Rectangle"
|
||||
fill="#FFFFFF"
|
||||
fill-opacity="0.050980393"
|
||||
stroke="none" />
|
||||
<g id="K" transform="translate(8 0)">
|
||||
<g transform="translate(0, 2.8945312)" id="K" fill="#E5E0D5">
|
||||
<path
|
||||
d="M1.5 11.5254C1.97461 11.5254 2.25586 11.2383 2.25586 10.7402L2.25586 8.70703L3.13477 7.77539L5.87695 11.127C6.11133 11.4199 6.31641 11.5313 6.61523 11.5313C7.02539 11.5313 7.3418 11.2148 7.3418 10.8047C7.3418 10.6055 7.25391 10.3945 7.04883 10.1426L4.25391 6.76172L6.79688 4.10742C6.97266 3.91992 7.04297 3.76172 7.04297 3.55664C7.04297 3.16992 6.74414 2.86523 6.33984 2.86523C6.09375 2.86523 5.91211 2.95898 5.70703 3.18164L2.30859 6.84961L2.25586 6.84961L2.25586 3.65625C2.25586 3.1582 1.97461 2.87109 1.5 2.87109C1.03125 2.87109 0.744141 3.1582 0.744141 3.65625L0.744141 10.7402C0.744141 11.2383 1.03125 11.5254 1.5 11.5254Z" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</template>
|
|
@ -1,15 +0,0 @@
|
|||
<template>
|
||||
<svg
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 18 18"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<path
|
||||
d="M2.68978 6.95235C3.0999 6.55662 3.75151 6.56259 4.1543 6.96577C4.5571 7.36895 4.56246 8.02056 4.16634 8.43031C4.16634 8.43031 3.15364 9.443 3.15364 9.443C1.68651 10.9393 1.69832 13.3381 3.18012 14.8199C4.66192 16.3017 7.06072 16.3135 8.55703 14.8464C8.55703 14.8464 9.56973 13.8337 9.56973 13.8337C9.98137 13.4501 10.6228 13.4614 11.0207 13.8593C11.4185 14.2571 11.4299 14.8986 11.0463 15.3102C11.0463 15.3102 10.035 16.3229 10.035 16.3229C7.71847 18.5799 4.01808 18.5559 1.73113 16.2689C-0.555826 13.982 -0.579909 10.2816 1.67708 7.96504C1.67708 7.96504 2.68978 6.95235 2.68978 6.95235ZM13.8337 9.56973C13.4501 9.98138 13.4614 10.6228 13.8593 11.0207C14.2571 11.4185 14.8986 11.4299 15.3103 11.0463C15.3103 11.0463 16.323 10.035 16.323 10.035C18.58 7.71847 18.5559 4.01808 16.2689 1.73113C13.982 -0.555826 10.2816 -0.579908 7.96505 1.67708C7.96505 1.67708 6.95235 2.68978 6.95235 2.68978C6.55662 3.0999 6.56259 3.75151 6.96577 4.15431C7.36895 4.55711 8.02056 4.56247 8.43031 4.16635C8.43031 4.16635 9.44301 3.15365 9.44301 3.15365C10.9393 1.68652 13.3381 1.69833 14.8199 3.18013C16.3017 4.66192 16.3135 7.06073 14.8464 8.55704C14.8464 8.55704 13.8337 9.56973 13.8337 9.56973ZM12.5242 6.9523C12.8038 6.69186 12.9188 6.29961 12.8243 5.92945C12.7297 5.55928 12.4407 5.27024 12.0705 5.1757C11.7004 5.08117 11.3081 5.19623 11.0477 5.47574C11.0477 5.47574 5.47574 11.0477 5.47574 11.0477C5.19623 11.3081 5.08117 11.7004 5.1757 12.0705C5.27024 12.4407 5.55928 12.7297 5.92945 12.8243C6.29961 12.9188 6.69186 12.8037 6.9523 12.5242C6.9523 12.5242 12.5242 6.9523 12.5242 6.9523Z"
|
||||
fill="#E5DFD5"
|
||||
fill-rule="evenodd" />
|
||||
</g>
|
||||
</svg>
|
||||
</template>
|
|
@ -1,16 +1,11 @@
|
|||
<template>
|
||||
<svg
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 18 18"
|
||||
fill="none"
|
||||
<svg width="15px" height="18px" viewBox="0 0 15 18" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<g id="Text" fill-opacity="1">
|
||||
<path d="M15 0L15 0L15 18L0 18L0 0L15 0Z" id="Text" fill="none" stroke="none" />
|
||||
<path
|
||||
d="M3.75 16.0714L11.25 16.0714C12.2855 16.0714 13.125 15.208 13.125 14.1429L13.125 8.02672C13.1248 7.5147 12.9269 7.02399 12.5748 6.66239L8.52375 2.493C8.17225 2.13169 7.69568 1.92868 7.19875 1.92857L3.75 1.92857C2.71447 1.92857 1.875 2.79202 1.875 3.85714L1.875 14.1429C1.875 15.208 2.71447 16.0714 3.75 16.0714M15 8.02672C15.0003 7.00424 14.6053 6.02271 13.9018 5.29904L9.85 1.13143C9.1465 0.406921 8.19178 -0.000123228 7.19625 0L3.75 0C1.67893 0 0 1.7269 0 3.85714L0 14.1429C2.38419e-07 16.2731 1.67893 18 3.75 18L11.25 18C13.3211 18 15 16.2731 15 14.1429L15 8.02672ZM3.75 9.32143C3.75 8.78887 4.16973 8.35714 4.6875 8.35714L10.3125 8.35714C10.8303 8.35714 11.25 8.78887 11.25 9.32143C11.25 9.85399 10.8303 10.2857 10.3125 10.2857L4.6875 10.2857C4.16973 10.2857 3.75 9.85399 3.75 9.32143M4.6875 12.2143C4.35256 12.2143 4.04307 12.3981 3.8756 12.6964C3.70813 12.9948 3.70813 13.3624 3.8756 13.6607C4.04307 13.9591 4.35256 14.1429 4.6875 14.1429L7.8125 14.1429C8.14744 14.1429 8.45693 13.9591 8.6244 13.6607C8.79187 13.3624 8.79187 12.9948 8.6244 12.6964C8.45693 12.3981 8.14744 12.2143 7.8125 12.2143L4.6875 12.2143Z"
|
||||
fill="#E5DFD5"
|
||||
fill-rule="evenodd"
|
||||
transform="translate(1.5 0)" />
|
||||
d="M3.75 16.0714L11.25 16.0714C12.2855 16.0714 13.125 15.208 13.125 14.1429L13.125 8.02672C13.1248 7.5147 12.9269 7.02399 12.5748 6.66239L8.52375 2.493C8.17225 2.13169 7.69568 1.92868 7.19875 1.92857L3.75 1.92857C2.71447 1.92857 1.875 2.79202 1.875 3.85714L1.875 14.1429C1.875 15.208 2.71447 16.0714 3.75 16.0714M15 8.02672C15.0003 7.00424 14.6053 6.02271 13.9018 5.29904L9.85 1.13143C9.1465 0.406921 8.19178 -0.000123228 7.19625 0L3.75 0C1.67893 0 0 1.7269 0 3.85714L0 14.1429C2.98023e-07 16.2731 1.67893 18 3.75 18L11.25 18C13.3211 18 15 16.2731 15 14.1429L15 8.02672ZM3.75 9.32143C3.75 8.78887 4.16973 8.35714 4.6875 8.35714L10.3125 8.35714C10.8303 8.35714 11.25 8.78887 11.25 9.32143C11.25 9.85399 10.8303 10.2857 10.3125 10.2857L4.6875 10.2857C4.16973 10.2857 3.75 9.85399 3.75 9.32143M4.6875 12.2143C4.35256 12.2143 4.04307 12.3981 3.8756 12.6964C3.70813 12.9948 3.70813 13.3624 3.8756 13.6607C4.04307 13.9591 4.35256 14.1429 4.6875 14.1429L7.8125 14.1429C8.14744 14.1429 8.45693 13.9591 8.6244 13.6607C8.79187 13.3624 8.79187 12.9948 8.6244 12.6964C8.45693 12.3981 8.14744 12.2143 7.8125 12.2143L4.6875 12.2143Z"
|
||||
id="Shape" fill="#E5DFD5" fill-rule="evenodd" stroke="none" />
|
||||
</g>
|
||||
</svg>
|
||||
</template>
|
|
@ -6,18 +6,16 @@
|
|||
.noise {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
top: 1px;
|
||||
left: 1px;
|
||||
width: calc(100vw - 2px);
|
||||
height: calc(100vh - 2px);
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
background-image: url("/noise.webp");
|
||||
z-index: 0;
|
||||
background-image: url('/noise.png');
|
||||
background-repeat: repeat;
|
||||
image-rendering: pixelated;
|
||||
overflow: hidden;
|
||||
mix-blend-mode: multiply;
|
||||
opacity: .5;
|
||||
border-radius: 12px;
|
||||
}
|
||||
</style>
|
|
@ -1,122 +0,0 @@
|
|||
<template>
|
||||
<div
|
||||
:class="['result', { selected }]"
|
||||
@click="$emit('select')"
|
||||
:ref="el => { if (selected && el) $emit('setRef', el as HTMLElement) }">
|
||||
<template v-if="item.content_type === 'image'">
|
||||
<img
|
||||
v-if="imageUrl"
|
||||
:src="imageUrl"
|
||||
alt="Image"
|
||||
class="image"
|
||||
@error="$emit('imageError')" />
|
||||
<IconsImage v-else class="icon" />
|
||||
</template>
|
||||
<template v-else-if="hasFavicon(item.favicon ?? '')">
|
||||
<img
|
||||
v-if="item.favicon"
|
||||
:src="getFaviconFromDb(item.favicon)"
|
||||
alt="Favicon"
|
||||
class="favicon"
|
||||
@error="
|
||||
($event.target as HTMLImageElement).src = '/public/icons/Link.svg'
|
||||
" />
|
||||
<IconsLink v-else class="icon" />
|
||||
</template>
|
||||
<IconsFile
|
||||
class="icon"
|
||||
v-else-if="item.content_type === ContentType.File" />
|
||||
<IconsText
|
||||
class="icon"
|
||||
v-else-if="item.content_type === ContentType.Text" />
|
||||
<svg
|
||||
v-else-if="item.content_type === ContentType.Color"
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 18 18"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<rect width="18" height="18" />
|
||||
<path
|
||||
d="M9 18C12.2154 18 15.1865 16.2846 16.7942 13.5C18.4019 10.7154 18.4019 7.28461 16.7942 4.5C15.1865 1.71539 12.2154 -1.22615e-06 9 0C5.78461 0 2.81347 1.71539 1.20577 4.5C-0.401925 7.28461 -0.401923 10.7154 1.20577 13.5C2.81347 16.2846 5.78461 18 9 18Z"
|
||||
fill="#E5DFD5" />
|
||||
<path
|
||||
d="M9 16C7.14348 16 5.36301 15.2625 4.05025 13.9497C2.7375 12.637 2 10.8565 2 9C2 7.14348 2.7375 5.36301 4.05025 4.05025C5.36301 2.7375 7.14348 2 9 2C10.8565 2 12.637 2.7375 13.9497 4.05025C15.2625 5.36301 16 7.14348 16 9C16 10.8565 15.2625 12.637 13.9497 13.9497C12.637 15.2625 10.8565 16 9 16Z"
|
||||
:fill="item.content" />
|
||||
</g>
|
||||
</svg>
|
||||
<IconsCode
|
||||
class="icon"
|
||||
v-else-if="item.content_type === ContentType.Code" />
|
||||
<span v-if="item.content_type === ContentType.Image">
|
||||
Image ({{ dimensions || "Loading..." }})
|
||||
</span>
|
||||
<span v-else>{{ truncateContent(item.content) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ContentType } from "~/types/types";
|
||||
import type { HistoryItem } from "~/types/types";
|
||||
|
||||
defineProps<{
|
||||
item: HistoryItem;
|
||||
selected: boolean;
|
||||
imageUrl?: string;
|
||||
dimensions?: string;
|
||||
}>();
|
||||
|
||||
defineEmits<{
|
||||
(e: "select"): void;
|
||||
(e: "imageError"): void;
|
||||
(e: "setRef", el: HTMLElement): void;
|
||||
}>();
|
||||
|
||||
const hasFavicon = (str: string): boolean => {
|
||||
return str.trim() !== "";
|
||||
};
|
||||
|
||||
const getFaviconFromDb = (favicon: string): string => {
|
||||
return `data:image/png;base64,${favicon}`;
|
||||
};
|
||||
|
||||
const truncateContent = (content: string): string => {
|
||||
const maxWidth = 284;
|
||||
const charWidth = 9;
|
||||
const maxChars = Math.floor(maxWidth / charWidth);
|
||||
return content.length > maxChars
|
||||
? content.slice(0, maxChars - 3) + "..."
|
||||
: content;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.result {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 11px;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
align-items: center;
|
||||
|
||||
&.selected {
|
||||
background-color: var(--border);
|
||||
}
|
||||
|
||||
.favicon,
|
||||
.image,
|
||||
.icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
span {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: var(--text);
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,57 +0,0 @@
|
|||
<template>
|
||||
<div class="topbar">
|
||||
<input
|
||||
ref="searchInput"
|
||||
v-model="searchQuery"
|
||||
@input="onInputChange"
|
||||
class="search"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
type="text"
|
||||
placeholder="Type to filter entries..." />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
|
||||
const searchQuery = ref("");
|
||||
const searchInput = ref<HTMLInputElement | null>(null);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "search", query: string): void;
|
||||
(e: "searchStarted"): void;
|
||||
(e: "focus"): void;
|
||||
}>();
|
||||
|
||||
const onInputChange = () => {
|
||||
emit("searchStarted");
|
||||
emit("search", searchQuery.value);
|
||||
};
|
||||
|
||||
defineExpose({ searchInput });
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.topbar {
|
||||
width: 100%;
|
||||
min-height: 56px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-inline: 16px;
|
||||
z-index: 100;
|
||||
|
||||
.search {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 18px;
|
||||
color: var(--text);
|
||||
background-color: transparent;
|
||||
outline: none;
|
||||
border: none;
|
||||
font-family: SFRoundedMedium;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,54 +0,0 @@
|
|||
import type { HistoryItem } from '~/types/types'
|
||||
|
||||
interface GroupedHistory {
|
||||
label: string
|
||||
items: HistoryItem[]
|
||||
}
|
||||
|
||||
export const selectedGroupIndex = ref(0)
|
||||
export const selectedItemIndex = ref(0)
|
||||
export const selectedElement = ref<HTMLElement | null>(null)
|
||||
|
||||
export const useSelectedResult = (groupedHistory: Ref<GroupedHistory[]>) => {
|
||||
const selectedItem = computed<HistoryItem | null>(() => {
|
||||
const group = groupedHistory.value[selectedGroupIndex.value]
|
||||
return group?.items[selectedItemIndex.value] ?? null
|
||||
})
|
||||
|
||||
const isSelected = (groupIndex: number, itemIndex: number): boolean => {
|
||||
return selectedGroupIndex.value === groupIndex && selectedItemIndex.value === itemIndex
|
||||
}
|
||||
|
||||
const selectNext = (): void => {
|
||||
const currentGroup = groupedHistory.value[selectedGroupIndex.value]
|
||||
if (selectedItemIndex.value < currentGroup.items.length - 1) {
|
||||
selectedItemIndex.value++
|
||||
} else if (selectedGroupIndex.value < groupedHistory.value.length - 1) {
|
||||
selectedGroupIndex.value++
|
||||
selectedItemIndex.value = 0
|
||||
}
|
||||
}
|
||||
|
||||
const selectPrevious = (): void => {
|
||||
if (selectedItemIndex.value > 0) {
|
||||
selectedItemIndex.value--
|
||||
} else if (selectedGroupIndex.value > 0) {
|
||||
selectedGroupIndex.value--
|
||||
selectedItemIndex.value = groupedHistory.value[selectedGroupIndex.value].items.length - 1
|
||||
}
|
||||
}
|
||||
|
||||
const selectItem = (groupIndex: number, itemIndex: number): void => {
|
||||
selectedGroupIndex.value = groupIndex
|
||||
selectedItemIndex.value = itemIndex
|
||||
}
|
||||
|
||||
return {
|
||||
selectedItem,
|
||||
isSelected,
|
||||
selectNext,
|
||||
selectPrevious,
|
||||
selectItem,
|
||||
selectedElement
|
||||
}
|
||||
}
|
|
@ -2,21 +2,5 @@
|
|||
export default defineNuxtConfig({
|
||||
devtools: { enabled: false },
|
||||
compatibilityDate: "2024-07-04",
|
||||
ssr: false,
|
||||
app: {
|
||||
head: {
|
||||
charset: "utf-8",
|
||||
viewport:
|
||||
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0",
|
||||
},
|
||||
},
|
||||
vite: {
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
api: "modern-compiler",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
ssr: false
|
||||
})
|
26
package.json
|
@ -10,19 +10,17 @@
|
|||
"postinstall": "nuxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.3.0",
|
||||
"@tauri-apps/cli": "2.3.1",
|
||||
"@tauri-apps/plugin-autostart": "2.2.0",
|
||||
"@tauri-apps/plugin-os": "2.2.1",
|
||||
"nuxt": "3.16.0",
|
||||
"overlayscrollbars": "2.11.1",
|
||||
"overlayscrollbars-vue": "0.5.9",
|
||||
"sass-embedded": "1.85.1",
|
||||
"uuid": "11.1.0",
|
||||
"vue": "3.5.13",
|
||||
"wrdu-keyboard": "github:0PandaDEV/keyboard"
|
||||
},
|
||||
"overrides": {
|
||||
"chokidar": "^3.6.0"
|
||||
"@tauri-apps/api": "^2.0.0-rc.3",
|
||||
"@tauri-apps/cli": "^2.0.0-rc.7",
|
||||
"@tauri-apps/plugin-autostart": "^2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-fs": "^2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-os": "^2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-sql": "^2.0.0-rc.0",
|
||||
"nuxt": "^3.13.0",
|
||||
"nuxt-build-cache": "^0.1.1",
|
||||
"overlayscrollbars": "^2.10.0",
|
||||
"overlayscrollbars-vue": "^0.5.9",
|
||||
"sass": "^1.77.8",
|
||||
"vue": "3.4.38"
|
||||
}
|
||||
}
|
||||
|
|
1057
pages/index.vue
53
pages/keybind.vue
Normal file
|
@ -0,0 +1,53 @@
|
|||
<template>
|
||||
<div class="bg">
|
||||
<div class="keybind-container">
|
||||
<h2>Set New Keybind</h2>
|
||||
<div
|
||||
class="keybind-input"
|
||||
tabindex="0"
|
||||
@focus="startCapture"
|
||||
@blur="stopCapture"
|
||||
ref="keybindInput"
|
||||
>
|
||||
{{ currentKeybind || 'Click here, then press your desired key combination' }}
|
||||
</div>
|
||||
<button @click="saveKeybind" :disabled="!currentKeybind">Save Keybind</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
|
||||
const currentKeybind = ref('');
|
||||
const keybindInput = ref<HTMLElement | null>(null);
|
||||
|
||||
const startCapture = async () => {
|
||||
await invoke('start_keybind_capture');
|
||||
};
|
||||
|
||||
const stopCapture = async () => {
|
||||
await invoke('stop_keybind_capture');
|
||||
};
|
||||
|
||||
const saveKeybind = () => {
|
||||
console.log('Saving keybind:', currentKeybind.value);
|
||||
// Implement saving logic here
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
const unlisten = await listen('keybind_captured', (event: any) => {
|
||||
currentKeybind.value = event.payload as string;
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
unlisten();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '~/assets/css/keybind.scss';
|
||||
</style>
|
|
@ -1,232 +0,0 @@
|
|||
<template>
|
||||
<main>
|
||||
<div class="top-bar">
|
||||
<NuxtLink to="/" class="back">
|
||||
<img src="../public/back_arrow.svg" />
|
||||
<p>Back</p>
|
||||
</NuxtLink>
|
||||
</div>
|
||||
<div class="settings-container">
|
||||
<div class="settings">
|
||||
<div class="names">
|
||||
<p style="line-height: 14px">Startup</p>
|
||||
<p style="line-height: 34px">Qopy Hotkey</p>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="launch">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="launch"
|
||||
v-model="autostart"
|
||||
@change="toggleAutostart" />
|
||||
<label for="launch" class="checkmark">
|
||||
<svg
|
||||
width="14"
|
||||
height="14"
|
||||
viewBox="0 0 14 14"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<rect width="14" height="14" />
|
||||
<path
|
||||
id="Path"
|
||||
d="M0 2.00696L2.25015 4.25L6 0"
|
||||
fill="none"
|
||||
stroke-width="1.5"
|
||||
stroke="#E5DFD5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
transform="translate(4 5)" />
|
||||
</g>
|
||||
</svg>
|
||||
</label>
|
||||
<p for="launch">Launch Qopy at login</p>
|
||||
</div>
|
||||
<div
|
||||
@blur="onBlur"
|
||||
@focus="onFocus"
|
||||
class="keybind-input"
|
||||
ref="keybindInput"
|
||||
tabindex="0"
|
||||
:class="{ 'empty-keybind': showEmptyKeybindError }">
|
||||
<span class="key" v-if="keybind.length === 0">Click here</span>
|
||||
<template v-else>
|
||||
<span
|
||||
:key="index"
|
||||
class="key"
|
||||
:class="{ modifier: isModifier(key) }"
|
||||
v-for="(key, index) in keybind">
|
||||
{{ keyToLabel(key) }}
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<BottomBar
|
||||
:primary-action="{
|
||||
text: 'Save',
|
||||
icon: IconsEnter,
|
||||
onClick: saveKeybind,
|
||||
showModifier: true,
|
||||
}" />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, reactive, ref } from "vue";
|
||||
import { platform } from "@tauri-apps/plugin-os";
|
||||
import { useRouter } from "vue-router";
|
||||
import { KeyValues, KeyLabels } from "../types/keys";
|
||||
import { disable, enable } from "@tauri-apps/plugin-autostart";
|
||||
import { Key, keyboard } from "wrdu-keyboard";
|
||||
import BottomBar from "../components/BottomBar.vue";
|
||||
import IconsEnter from "~/components/Icons/Enter.vue";
|
||||
|
||||
const activeModifiers = reactive<Set<KeyValues>>(new Set());
|
||||
const isKeybindInputFocused = ref(false);
|
||||
const keybind = ref<KeyValues[]>([]);
|
||||
const keybindInput = ref<HTMLElement | null>(null);
|
||||
const lastBlurTime = ref(0);
|
||||
const os = ref("");
|
||||
const router = useRouter();
|
||||
const showEmptyKeybindError = ref(false);
|
||||
const autostart = ref(false);
|
||||
const { $settings } = useNuxtApp();
|
||||
|
||||
const modifierKeySet = new Set([
|
||||
KeyValues.AltLeft,
|
||||
KeyValues.AltRight,
|
||||
KeyValues.ControlLeft,
|
||||
KeyValues.ControlRight,
|
||||
KeyValues.MetaLeft,
|
||||
KeyValues.MetaRight,
|
||||
KeyValues.ShiftLeft,
|
||||
KeyValues.ShiftRight,
|
||||
]);
|
||||
|
||||
const isModifier = (key: KeyValues): boolean => {
|
||||
return modifierKeySet.has(key);
|
||||
};
|
||||
|
||||
const keyToLabel = (key: KeyValues): string => {
|
||||
return KeyLabels[key] || key;
|
||||
};
|
||||
|
||||
const updateKeybind = () => {
|
||||
const modifiers = Array.from(activeModifiers);
|
||||
const nonModifiers = keybind.value.filter((key) => !isModifier(key));
|
||||
keybind.value = [...modifiers, ...nonModifiers];
|
||||
};
|
||||
|
||||
const onBlur = () => {
|
||||
isKeybindInputFocused.value = false;
|
||||
lastBlurTime.value = Date.now();
|
||||
showEmptyKeybindError.value = false;
|
||||
};
|
||||
|
||||
const onFocus = () => {
|
||||
isKeybindInputFocused.value = true;
|
||||
activeModifiers.clear();
|
||||
keybind.value = [];
|
||||
showEmptyKeybindError.value = false;
|
||||
};
|
||||
|
||||
const onKeyDown = (event: KeyboardEvent) => {
|
||||
const key = event.code as KeyValues;
|
||||
|
||||
if (key === KeyValues.Escape) {
|
||||
if (keybindInput.value) {
|
||||
keybindInput.value.blur();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (isModifier(key)) {
|
||||
activeModifiers.add(key);
|
||||
} else if (!keybind.value.includes(key)) {
|
||||
keybind.value = keybind.value.filter((k) => isModifier(k));
|
||||
keybind.value.push(key);
|
||||
}
|
||||
|
||||
updateKeybind();
|
||||
showEmptyKeybindError.value = false;
|
||||
};
|
||||
|
||||
const saveKeybind = async () => {
|
||||
if (keybind.value.length > 0) {
|
||||
await $settings.saveSetting("keybind", JSON.stringify(keybind.value));
|
||||
router.push("/");
|
||||
} else {
|
||||
showEmptyKeybindError.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const toggleAutostart = async () => {
|
||||
if (autostart.value === true) {
|
||||
await enable();
|
||||
} else {
|
||||
await disable();
|
||||
}
|
||||
await $settings.saveSetting("autostart", autostart.value ? "true" : "false");
|
||||
};
|
||||
|
||||
os.value = platform();
|
||||
|
||||
onMounted(async () => {
|
||||
keyboard.prevent.down([Key.All], (event: KeyboardEvent) => {
|
||||
if (isKeybindInputFocused.value) {
|
||||
onKeyDown(event);
|
||||
}
|
||||
});
|
||||
|
||||
keyboard.prevent.down([Key.Escape], () => {
|
||||
if (isKeybindInputFocused.value) {
|
||||
keybindInput.value?.blur();
|
||||
} else {
|
||||
router.push("/");
|
||||
}
|
||||
});
|
||||
|
||||
switch (os.value) {
|
||||
case "macos":
|
||||
keyboard.prevent.down([Key.LeftMeta, Key.Enter], () => {
|
||||
if (!isKeybindInputFocused.value) {
|
||||
saveKeybind();
|
||||
}
|
||||
});
|
||||
|
||||
keyboard.prevent.down([Key.RightMeta, Key.Enter], () => {
|
||||
if (!isKeybindInputFocused.value) {
|
||||
saveKeybind();
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case "linux":
|
||||
case "windows":
|
||||
keyboard.prevent.down([Key.LeftControl, Key.Enter], () => {
|
||||
if (!isKeybindInputFocused.value) {
|
||||
saveKeybind();
|
||||
}
|
||||
});
|
||||
|
||||
keyboard.prevent.down([Key.RightControl, Key.Enter], () => {
|
||||
if (!isKeybindInputFocused.value) {
|
||||
saveKeybind();
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
autostart.value = (await $settings.getSetting("autostart")) === "true";
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
keyboard.clear();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "/styles/settings.scss";
|
||||
</style>
|
|
@ -1,61 +0,0 @@
|
|||
import { invoke } from "@tauri-apps/api/core";
|
||||
import type { HistoryItem } from "~/types/types";
|
||||
|
||||
export default defineNuxtPlugin(() => {
|
||||
return {
|
||||
provide: {
|
||||
history: {
|
||||
async getHistory(): Promise<HistoryItem[]> {
|
||||
return await invoke<HistoryItem[]>("get_history");
|
||||
},
|
||||
|
||||
async addHistoryItem(item: HistoryItem): Promise<void> {
|
||||
await invoke<void>("add_history_item", { item });
|
||||
},
|
||||
|
||||
async searchHistory(query: string): Promise<HistoryItem[]> {
|
||||
try {
|
||||
return await invoke<HistoryItem[]>("search_history", { query });
|
||||
} catch (error) {
|
||||
console.error("Error searching history:", error);
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
async loadHistoryChunk(
|
||||
offset: number,
|
||||
limit: number
|
||||
): Promise<HistoryItem[]> {
|
||||
try {
|
||||
return await invoke<HistoryItem[]>("load_history_chunk", {
|
||||
offset,
|
||||
limit,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error loading history chunk:", error);
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
async deleteHistoryItem(id: string): Promise<void> {
|
||||
await invoke<void>("delete_history_item", { id });
|
||||
},
|
||||
|
||||
async clearHistory(): Promise<void> {
|
||||
await invoke<void>("clear_history");
|
||||
},
|
||||
|
||||
async writeAndPaste(data: {
|
||||
content: string;
|
||||
contentType: string;
|
||||
}): Promise<void> {
|
||||
await invoke<void>("write_and_paste", data);
|
||||
},
|
||||
|
||||
async readImage(data: { filename: string }): Promise<string> {
|
||||
return await invoke<string>("read_image", data);
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
export default defineNuxtPlugin(() => {
|
||||
return {
|
||||
provide: {
|
||||
settings: {
|
||||
async getSetting(key: string): Promise<string> {
|
||||
return await invoke<string>("get_setting", { key });
|
||||
},
|
||||
|
||||
async saveSetting(key: string, value: string): Promise<void> {
|
||||
await invoke<void>("save_setting", { key, value });
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
BIN
public/apple.png
Before Width: | Height: | Size: 260 B |
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg width="12" height="8" viewBox="0 0 12 8" fill="none" stroke="none" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Arrow" transform="translate(0 0)">
|
||||
<rect id="Rectangle" width="12" height="8" style="mix-blend-mode:normal;" transform="translate(0 0)" />
|
||||
<path id="Path" d="M3.10928 8.76192C3.10928 8.76192 3.10928 0.952386 3.10928 0.952386C3.10928 0.682544 3.1892 0.456512 3.34903 0.274291C3.50887 0.0920672 3.70643 0.000639439 3.94173 3.33786e-06C4.17706 -0.000631809 4.37489 0.0907969 4.53526 0.274291C4.69566 0.457782 4.77529 0.683815 4.77418 0.952386C4.77418 0.952386 4.77418 8.76192 4.77418 8.76192C4.77418 8.76192 6.60566 7 6.60566 7C6.75827 6.8254 6.95253 6.73811 7.18839 6.73811C7.42426 6.73811 7.61849 6.8254 7.77111 7C7.92373 7.1746 8 7.39683 8 7.66667C8 7.93651 7.92373 8.15874 7.77111 8.33334C7.77111 8.33334 4.52444 11.7143 4.52444 11.7143C4.35797 11.9048 4.16372 12 3.94173 12C3.71975 12 3.52551 11.9048 3.35902 11.7143C3.35902 11.7143 0.228926 8.33334 0.228926 8.33334C0.076309 8.15874 0 7.93652 0 7.66668C0 7.39683 0.076309 7.1746 0.228926 7C0.381543 6.8254 0.575782 6.73811 0.811648 6.73811C1.04751 6.73811 1.24175 6.8254 1.39437 7C1.39437 7 3.10928 8.76192 3.10928 8.76192Z" style="fill:#ADA9A1;fill-rule:evenodd;mix-blend-mode:normal;" transform="matrix(0 1 -1 0 12 0)" />
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.4 KiB |
18
public/cmd.svg
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg width="24px" height="20px" viewBox="0 0 24 20" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<path d="M0 0L24 0L24 20L0 20L0 0Z" id="path_1" />
|
||||
<clipPath id="clip_1">
|
||||
<use xlink:href="#path_1" clip-rule="evenodd" fill-rule="evenodd" transform="translate(0, -2.133523)" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<g id="cmd">
|
||||
<path d="M-751 -2016L-751 -2016L-751 -1996L-775 -1996L-775 -2016L-751 -2016Z" id="cmd" fill="none" stroke="none" />
|
||||
<path d="M12 0L17.6 0C19.8402 0 20.9603 0 21.816 0.435974Q22.3804 0.723593 22.8284 1.17157Q23.2764 1.61955 23.564 2.18404C24 3.03969 24 4.15979 24 6.4L24 13.6C24 15.8402 24 16.9603 23.564 17.816Q23.2764 18.3804 22.8284 18.8284Q22.3804 19.2764 21.816 19.564C20.9603 20 19.8402 20 17.6 20L6.4 20C4.15979 20 3.03969 20 2.18404 19.564Q1.61955 19.2764 1.17157 18.8284Q0.723594 18.3804 0.435974 17.816C0 16.9603 0 15.8402 0 13.6L0 6.4C0 4.15979 0 3.03969 0.435974 2.18404Q0.723594 1.61955 1.17157 1.17157Q1.61955 0.723594 2.18404 0.435974C3.03969 0 4.15979 0 6.4 0L12 0Z" id="Rectangle" fill="#FFFFFF" fill-opacity="0.050980393" stroke="none" />
|
||||
<g id="⌘" clip-path="url(#clip_1)" transform="translate(0 2.133523)">
|
||||
<g transform="translate(5.5692472, 0)" id="⌘" fill="#E5DFD5">
|
||||
<path d="M3.55007 12.8061Q2.98224 12.8061 2.51598 12.5268Q2.04972 12.2475 1.77042 11.7789Q1.49112 11.3104 1.49112 10.7472Q1.49112 10.1747 1.77042 9.70614Q2.04972 9.23757 2.51598 8.95827Q2.98224 8.67898 3.55007 8.67898L4.5657 8.67898L4.5657 7.04474L3.55007 7.04474Q2.98224 7.04474 2.51598 6.76775Q2.04972 6.49077 1.77042 6.02219Q1.49112 5.55362 1.49112 4.98579Q1.49112 4.41797 1.77042 3.9494Q2.04972 3.48082 2.51598 3.20383Q2.98224 2.92685 3.55007 2.92684Q4.1179 2.92684 4.58647 3.20383Q5.05504 3.48082 5.33434 3.9494Q5.61364 4.41797 5.61364 4.98579L5.61364 5.99219L7.25249 5.99219L7.25249 4.98579Q7.25249 4.41797 7.52947 3.9494Q7.80646 3.48082 8.27504 3.20383Q8.74361 2.92685 9.31144 2.92684Q9.87926 2.92684 10.3455 3.20383Q10.8118 3.48082 11.0888 3.9494Q11.3658 4.41797 11.3658 4.98579Q11.3658 5.55362 11.0888 6.02219Q10.8118 6.49077 10.3455 6.76775Q9.87926 7.04474 9.31144 7.04474L8.30043 7.04474L8.30043 8.67898L9.31144 8.67898Q9.87926 8.67898 10.3455 8.95827Q10.8118 9.23757 11.0888 9.70614Q11.3658 10.1747 11.3658 10.7472Q11.3658 11.3104 11.0888 11.7789Q10.8118 12.2475 10.3455 12.5268Q9.87926 12.8061 9.31144 12.8061Q8.74361 12.8061 8.27504 12.5268Q7.80646 12.2475 7.52947 11.7789Q7.25249 11.3104 7.25249 10.7472L7.25249 9.73153L5.61364 9.73153L5.61364 10.7472Q5.61364 11.3104 5.33434 11.7789Q5.05504 12.2475 4.58647 12.5268Q4.1179 12.8061 3.55007 12.8061ZM3.55007 11.7536Q3.97017 11.7536 4.26563 11.4604Q4.56108 11.1673 4.5657 10.7472L4.5657 9.73153L3.55007 9.73153Q3.12997 9.73615 2.83452 10.0293Q2.53906 10.3224 2.53906 10.7472Q2.53906 11.1673 2.83452 11.4604Q3.12997 11.7536 3.55007 11.7536ZM9.31144 11.7536Q9.72692 11.7536 10.0224 11.4604Q10.3178 11.1673 10.3178 10.7472Q10.3178 10.3224 10.0224 10.0293Q9.72692 9.73615 9.31144 9.73153L8.30043 9.73153L8.30043 10.7472Q8.29581 11.1673 8.59357 11.4604Q8.89133 11.7536 9.31144 11.7536ZM3.55007 5.99219L4.5657 5.99219L4.5657 4.98579Q4.56108 4.56569 4.26563 4.27255Q3.97017 3.9794 3.55007 3.9794Q3.12997 3.9794 2.83452 4.27255Q2.53906 4.56569 2.53906 4.98579Q2.53906 5.40589 2.83452 5.70135Q3.12997 5.9968 3.55007 5.99219ZM8.30043 5.99219L9.31144 5.99219Q9.72692 5.9968 10.0224 5.70135Q10.3178 5.40589 10.3178 4.98579Q10.3178 4.56569 10.0224 4.27255Q9.72692 3.9794 9.31144 3.9794Q8.89133 3.9794 8.59357 4.27255Q8.29581 4.56569 8.30043 4.98579L8.30043 5.99219ZM5.61364 8.67898L7.25249 8.67898L7.25249 7.04474L5.61364 7.04474L5.61364 8.67898Z" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.7 KiB |
8
public/ctrl.svg
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg width="24px" height="20px" viewBox="0 0 24 20" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Ctrl" fill-opacity="1">
|
||||
<path d="M-751 -2016L-751 -2016L-751 -1996L-775 -1996L-775 -2016L-751 -2016Z" id="Ctrl" fill="none" stroke="none" />
|
||||
<path d="M12 0L17.6 0C19.8402 0 20.9603 0 21.816 0.435974Q22.3804 0.723593 22.8284 1.17157Q23.2764 1.61955 23.564 2.18404C24 3.03969 24 4.15979 24 6.4L24 13.6C24 15.8402 24 16.9603 23.564 17.816Q23.2764 18.3804 22.8284 18.8284Q22.3804 19.2764 21.816 19.564C20.9603 20 19.8402 20 17.6 20L6.4 20C4.15979 20 3.03969 20 2.18404 19.564Q1.61955 19.2764 1.17157 18.8284Q0.723594 18.3804 0.435974 17.816C0 16.9603 0 15.8402 0 13.6L0 6.4C0 4.15979 0 3.03969 0.435974 2.18404Q0.723594 1.61955 1.17157 1.17157Q1.61955 0.723594 2.18404 0.435974C3.03969 0 4.15979 0 6.4 0L12 0Z" id="Rectangle" fill="#FFFFFF" fill-opacity="0.050980393" stroke="none" />
|
||||
<path d="M7.97095 9.00977L12 5L16 9.00977" id="Vector" fill="none" fill-rule="evenodd" stroke="#E5E0D5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
9
public/enter.svg
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg width="24px" height="20px" viewBox="0 0 24 20" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Enter" fill-opacity="1">
|
||||
<path d="M-659 -2016L-659 -2016L-659 -1996L-683 -1996L-683 -2016L-659 -2016Z" id="Enter" fill="none" stroke="none" />
|
||||
<path d="M12 0L17.6 0C19.8402 0 20.9603 0 21.816 0.435974Q22.3804 0.723593 22.8284 1.17157Q23.2764 1.61955 23.564 2.18404C24 3.03969 24 4.15979 24 6.4L24 13.6C24 15.8402 24 16.9603 23.564 17.816Q23.2764 18.3804 22.8284 18.8284Q22.3804 19.2764 21.816 19.564C20.9603 20 19.8402 20 17.6 20L6.4 20C4.15979 20 3.03969 20 2.18404 19.564Q1.61955 19.2764 1.17157 18.8284Q0.723594 18.3804 0.435974 17.816C0 16.9603 0 15.8402 0 13.6L0 6.4C0 4.15979 0 3.03969 0.435974 2.18404Q0.723594 1.61955 1.17157 1.17157Q1.61955 0.723594 2.18404 0.435974C3.03969 0 4.15979 0 6.4 0L12 0Z" id="Rectangle" fill="#FFFFFF" fill-opacity="0.050980393" stroke="none" />
|
||||
<path d="M16.0597 5.48914L16.0597 10.5L7.5 10.5" id="Vector" fill="none" fill-rule="evenodd" stroke="#E5DFD5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
||||
<path d="M9.5 8.5L9.5 12.5035L7 10.5L9.5 8.5Z" id="Vector" fill="#E5DFD5" fill-rule="evenodd" stroke="#E5DFD5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
12
public/k.svg
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg width="24px" height="20px" viewBox="0 0 24 20" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="K" fill-opacity="1">
|
||||
<path d="M-751 -2016L-751 -2016L-751 -1996L-775 -1996L-775 -2016L-751 -2016Z" id="K" fill="none" stroke="none" />
|
||||
<path d="M12 0L17.6 0C19.8402 0 20.9603 0 21.816 0.435974Q22.3804 0.723593 22.8284 1.17157Q23.2764 1.61955 23.564 2.18404C24 3.03969 24 4.15979 24 6.4L24 13.6C24 15.8402 24 16.9603 23.564 17.816Q23.2764 18.3804 22.8284 18.8284Q22.3804 19.2764 21.816 19.564C20.9603 20 19.8402 20 17.6 20L6.4 20C4.15979 20 3.03969 20 2.18404 19.564Q1.61955 19.2764 1.17157 18.8284Q0.723594 18.3804 0.435974 17.816C0 16.9603 0 15.8402 0 13.6L0 6.4C0 4.15979 0 3.03969 0.435974 2.18404Q0.723594 1.61955 1.17157 1.17157Q1.61955 0.723594 2.18404 0.435974C3.03969 0 4.15979 0 6.4 0L12 0Z" id="Rectangle" fill="#FFFFFF" fill-opacity="0.050980393" stroke="none" />
|
||||
<g id="K" transform="translate(8 0)">
|
||||
<g transform="translate(0, 2.8945312)" id="K" fill="#E5E0D5">
|
||||
<path d="M1.5 11.5254C1.97461 11.5254 2.25586 11.2383 2.25586 10.7402L2.25586 8.70703L3.13477 7.77539L5.87695 11.127C6.11133 11.4199 6.31641 11.5313 6.61523 11.5313C7.02539 11.5313 7.3418 11.2148 7.3418 10.8047C7.3418 10.6055 7.25391 10.3945 7.04883 10.1426L4.25391 6.76172L6.79688 4.10742C6.97266 3.91992 7.04297 3.76172 7.04297 3.55664C7.04297 3.16992 6.74414 2.86523 6.33984 2.86523C6.09375 2.86523 5.91211 2.95898 5.70703 3.18164L2.30859 6.84961L2.25586 6.84961L2.25586 3.65625C2.25586 3.1582 1.97461 2.87109 1.5 2.87109C1.03125 2.87109 0.744141 3.1582 0.744141 3.65625L0.744141 10.7402C0.744141 11.2383 1.03125 11.5254 1.5 11.5254Z" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
BIN
public/noise.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 374 KiB |
2411
src-tauri/Cargo.lock
generated
|
@ -1,58 +1,42 @@
|
|||
[package]
|
||||
name = "qopy"
|
||||
version = "0.4.0"
|
||||
version = "0.1.1"
|
||||
description = "Qopy"
|
||||
authors = ["pandadev"]
|
||||
edition = "2021"
|
||||
rust-version = "1.70"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2.0.6", features = [] }
|
||||
tauri-build = { version = "2.0.0-rc.6", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2.3.1", features = [
|
||||
tauri = { version = "2.0.0-rc.6", features = [
|
||||
"macos-private-api",
|
||||
"tray-icon",
|
||||
"image-png",
|
||||
] }
|
||||
tauri-plugin-sql = { version = "2.2.0", features = ["sqlite"] }
|
||||
tauri-plugin-autostart = "2.2.0"
|
||||
tauri-plugin-os = "2.2.1"
|
||||
tauri-plugin-updater = "2.6.0"
|
||||
tauri-plugin-dialog = "2.2.0"
|
||||
tauri-plugin-fs = "2.2.0"
|
||||
tauri-plugin-clipboard = "2.1.11"
|
||||
tauri-plugin-prevent-default = "1.2.1"
|
||||
tauri-plugin-global-shortcut = "2.2.0"
|
||||
tauri-plugin-aptabase = { git = "https://github.com/aptabase/tauri-plugin-aptabase", branch = "v2" }
|
||||
sqlx = { version = "0.8.3", features = [
|
||||
"runtime-tokio-native-tls",
|
||||
"sqlite",
|
||||
"chrono",
|
||||
] }
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
tokio = { version = "1.44.1", features = ["full"] }
|
||||
serde_json = "1.0.140"
|
||||
tauri-plugin-sql = { version = "2.0.0-rc.0", features = ["sqlite"] }
|
||||
tauri-plugin-autostart = "2.0.0-rc.0"
|
||||
tauri-plugin-os = "2.0.0-rc.0"
|
||||
tauri-plugin-updater = "2.0.0-rc.1"
|
||||
tauri-plugin-dialog = "2.0.0-rc.0"
|
||||
tauri-plugin-fs = "2.0.0-rc.0"
|
||||
tauri-plugin-clipboard = "2.1.6"
|
||||
tauri-plugin-prevent-default = "0.4.0"
|
||||
sqlx = { version = "0.8.0", features = ["runtime-tokio-native-tls", "sqlite"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
serde_json = "1.0"
|
||||
rdev = "0.5.3"
|
||||
rand = "0.9.0"
|
||||
rand = "0.8"
|
||||
base64 = "0.22.1"
|
||||
image = "0.25.5"
|
||||
reqwest = { version = "0.12.14", features = ["json", "blocking"] }
|
||||
url = "2.5.4"
|
||||
regex = "1.11.1"
|
||||
sha2 = "0.10.8"
|
||||
lazy_static = "1.5.0"
|
||||
time = "0.3.39"
|
||||
global-hotkey = "0.6.4"
|
||||
chrono = { version = "0.4.40", features = ["serde"] }
|
||||
log = { version = "0.4.26", features = ["std"] }
|
||||
uuid = "1.16.0"
|
||||
include_dir = "0.7.4"
|
||||
# hyperpolyglot = { git = "https://github.com/0pandadev/hyperpolyglot" }
|
||||
applications = { git = "https://github.com/HuakunShen/applications-rs", branch = "fix/win-app-detection" }
|
||||
glob = "0.3.2"
|
||||
meta_fetcher = "0.1.1"
|
||||
parking_lot = "0.12.3"
|
||||
image = "0.25.1"
|
||||
reqwest = { version = "0.12.5", features = ["blocking"] }
|
||||
url = "2.5.2"
|
||||
regex = "1"
|
||||
sha2 = "0.10.6"
|
||||
lazy_static = "1.4.0"
|
||||
time = "0.3"
|
||||
|
||||
[features]
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
||||
|
|
|
@ -1,42 +1,51 @@
|
|||
use tauri_plugin_aptabase::EventTracker;
|
||||
use base64::{ engine::general_purpose::STANDARD, Engine };
|
||||
// use hyperpolyglot;
|
||||
use base64::engine::general_purpose::STANDARD;
|
||||
use base64::Engine;
|
||||
use image::ImageFormat;
|
||||
use lazy_static::lazy_static;
|
||||
use rand::Rng;
|
||||
use rdev::{simulate, EventType, Key};
|
||||
use regex::Regex;
|
||||
use sha2::{Digest, Sha256};
|
||||
use sqlx::SqlitePool;
|
||||
use std::fs;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::{ thread, time::Duration };
|
||||
use tauri::{ AppHandle, Emitter, Listener, Manager };
|
||||
use std::{fs, sync::Mutex, thread, time::Duration};
|
||||
use tauri::{AppHandle, Emitter, Listener, Manager, Runtime};
|
||||
use tauri_plugin_clipboard::Clipboard;
|
||||
use tokio::runtime::Runtime as TokioRuntime;
|
||||
use url::Url;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::db;
|
||||
use crate::utils::commands::get_app_info;
|
||||
use crate::utils::favicon::fetch_favicon_as_base64;
|
||||
use crate::utils::types::{ ContentType, HistoryItem };
|
||||
|
||||
lazy_static! {
|
||||
static ref APP_DATA_DIR: Mutex<Option<std::path::PathBuf>> = Mutex::new(None);
|
||||
static ref IS_PROGRAMMATIC_PASTE: AtomicBool = AtomicBool::new(false);
|
||||
}
|
||||
|
||||
pub fn set_app_data_dir(path: std::path::PathBuf) {
|
||||
let mut dir = APP_DATA_DIR.lock().unwrap();
|
||||
*dir = Some(path);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn write_and_paste(
|
||||
app_handle: AppHandle,
|
||||
pub fn read_image(filename: String) -> Result<String, String> {
|
||||
let app_data_dir = APP_DATA_DIR.lock().unwrap();
|
||||
let app_data_dir = app_data_dir.as_ref().expect("App data directory not set");
|
||||
let image_path = app_data_dir.join("images").join(filename);
|
||||
let image_data = fs::read(image_path).map_err(|e| e.to_string())?;
|
||||
Ok(STANDARD.encode(image_data))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn write_and_paste<R: Runtime>(
|
||||
app_handle: tauri::AppHandle<R>,
|
||||
content: String,
|
||||
content_type: String
|
||||
content_type: String,
|
||||
) -> Result<(), String> {
|
||||
let clipboard = app_handle.state::<Clipboard>();
|
||||
|
||||
match content_type.as_str() {
|
||||
"text" => clipboard.write_text(content).map_err(|e| e.to_string())?,
|
||||
"link" => clipboard.write_text(content).map_err(|e| e.to_string())?,
|
||||
"color" => clipboard.write_text(content).map_err(|e| e.to_string())?,
|
||||
"image" => {
|
||||
clipboard.write_image_base64(content).map_err(|e| e.to_string())?;
|
||||
clipboard
|
||||
.write_image_base64(content)
|
||||
.map_err(|e| e.to_string())?;
|
||||
}
|
||||
"files" => {
|
||||
clipboard
|
||||
|
@ -44,183 +53,106 @@ pub async fn write_and_paste(
|
|||
content
|
||||
.split(", ")
|
||||
.map(|file| file.to_string())
|
||||
.collect::<Vec<String>>()
|
||||
.collect::<Vec<String>>(),
|
||||
)
|
||||
.map_err(|e| e.to_string())?;
|
||||
}
|
||||
_ => {
|
||||
return Err("Unsupported content type".to_string());
|
||||
}
|
||||
_ => return Err("Unsupported content type".to_string()),
|
||||
}
|
||||
|
||||
IS_PROGRAMMATIC_PASTE.store(true, Ordering::SeqCst);
|
||||
|
||||
thread::spawn(|| {
|
||||
thread::sleep(Duration::from_millis(100));
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
let modifier_key = Key::MetaLeft;
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let modifier_key = Key::ControlLeft;
|
||||
|
||||
let events = vec![
|
||||
EventType::KeyPress(modifier_key),
|
||||
EventType::KeyPress(Key::KeyV),
|
||||
EventType::KeyRelease(Key::KeyV),
|
||||
EventType::KeyRelease(modifier_key)
|
||||
];
|
||||
|
||||
for event in events {
|
||||
if let Err(e) = simulate(&event) {
|
||||
println!("Simulation error: {:?}", e);
|
||||
}
|
||||
thread::sleep(Duration::from_millis(20));
|
||||
}
|
||||
});
|
||||
simulate_paste();
|
||||
|
||||
tokio::spawn(async {
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(500)).await;
|
||||
IS_PROGRAMMATIC_PASTE.store(false, Ordering::SeqCst);
|
||||
});
|
||||
|
||||
let _ = app_handle.track_event(
|
||||
"clipboard_paste",
|
||||
Some(serde_json::json!({
|
||||
"content_type": content_type
|
||||
}))
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn setup(app: &AppHandle) {
|
||||
let app_handle = app.clone();
|
||||
fn simulate_paste() {
|
||||
let mut events = vec![
|
||||
EventType::KeyPress(Key::ControlLeft),
|
||||
EventType::KeyPress(Key::KeyV),
|
||||
EventType::KeyRelease(Key::KeyV),
|
||||
EventType::KeyRelease(Key::ControlLeft),
|
||||
];
|
||||
|
||||
thread::sleep(Duration::from_millis(100));
|
||||
|
||||
for event in events.drain(..) {
|
||||
simulate(&event).unwrap();
|
||||
thread::sleep(Duration::from_millis(20));
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_image_path(app_handle: tauri::AppHandle, filename: String) -> String {
|
||||
let app_data_dir = app_handle
|
||||
.path()
|
||||
.app_data_dir()
|
||||
.expect("Failed to get app data directory");
|
||||
let image_path = app_data_dir.join("images").join(filename);
|
||||
image_path.to_str().unwrap_or("").to_string()
|
||||
}
|
||||
|
||||
pub fn setup<R: Runtime>(app: &AppHandle<R>) {
|
||||
let app = app.clone();
|
||||
let runtime = TokioRuntime::new().expect("Failed to create Tokio runtime");
|
||||
|
||||
app_handle.clone().listen("plugin:clipboard://clipboard-monitor/update", move |_event| {
|
||||
let app_handle = app_handle.clone();
|
||||
app.clone().listen(
|
||||
"plugin:clipboard://clipboard-monitor/update",
|
||||
move |_event| {
|
||||
let app = app.clone();
|
||||
runtime.block_on(async move {
|
||||
if IS_PROGRAMMATIC_PASTE.load(Ordering::SeqCst) {
|
||||
return;
|
||||
}
|
||||
|
||||
let clipboard = app_handle.state::<Clipboard>();
|
||||
let clipboard = app.state::<Clipboard>();
|
||||
let available_types = clipboard.available_types().unwrap();
|
||||
|
||||
let (app_name, app_icon) = get_app_info();
|
||||
|
||||
match get_pool(&app_handle).await {
|
||||
match get_pool(&app).await {
|
||||
Ok(pool) => {
|
||||
if available_types.image {
|
||||
println!("Handling image change");
|
||||
if let Ok(image_data) = clipboard.read_image_base64() {
|
||||
let file_path = save_image_to_file(&app_handle, &image_data).await
|
||||
.map_err(|e| e.to_string())
|
||||
.unwrap_or_else(|e| e);
|
||||
let _ = db::history::add_history_item(
|
||||
app_handle.clone(),
|
||||
pool,
|
||||
HistoryItem::new(
|
||||
app_name,
|
||||
ContentType::Image,
|
||||
file_path,
|
||||
None,
|
||||
app_icon,
|
||||
None
|
||||
insert_content_if_not_exists(
|
||||
app.clone(),
|
||||
pool.clone(),
|
||||
"image",
|
||||
image_data,
|
||||
)
|
||||
).await;
|
||||
.await;
|
||||
}
|
||||
let _ = app.emit("plugin:clipboard://image-changed", ());
|
||||
} else if available_types.files {
|
||||
println!("Handling files change");
|
||||
if let Ok(files) = clipboard.read_files() {
|
||||
for file in files {
|
||||
let _ = db::history::add_history_item(
|
||||
app_handle.clone(),
|
||||
let files_str = files.join(", ");
|
||||
insert_content_if_not_exists(
|
||||
app.clone(),
|
||||
pool.clone(),
|
||||
HistoryItem::new(
|
||||
app_name.clone(),
|
||||
ContentType::File,
|
||||
file,
|
||||
None,
|
||||
app_icon.clone(),
|
||||
None
|
||||
"files",
|
||||
files_str,
|
||||
)
|
||||
).await;
|
||||
}
|
||||
.await;
|
||||
}
|
||||
let _ = app.emit("plugin:clipboard://files-changed", ());
|
||||
} else if available_types.text {
|
||||
println!("Handling text change");
|
||||
if let Ok(text) = clipboard.read_text() {
|
||||
let text = text.to_string();
|
||||
let url_regex = Regex::new(
|
||||
r"^https?://(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)$"
|
||||
).unwrap();
|
||||
|
||||
if url_regex.is_match(&text) {
|
||||
if let Ok(url) = Url::parse(&text) {
|
||||
let favicon = match fetch_favicon_as_base64(url).await {
|
||||
Ok(Some(f)) => Some(f),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let _ = db::history::add_history_item(
|
||||
app_handle.clone(),
|
||||
pool,
|
||||
HistoryItem::new(
|
||||
app_name,
|
||||
ContentType::Link,
|
||||
insert_content_if_not_exists(
|
||||
app.clone(),
|
||||
pool.clone(),
|
||||
"text",
|
||||
text,
|
||||
favicon,
|
||||
app_icon,
|
||||
None
|
||||
)
|
||||
).await;
|
||||
}
|
||||
} else {
|
||||
if text.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Temporarily disabled code detection
|
||||
/*if let Some(detection) = hyperpolyglot::detect_from_text(&text) {
|
||||
let language = match detection {
|
||||
hyperpolyglot::Detection::Heuristics(lang) => lang.to_string(),
|
||||
_ => detection.language().to_string(),
|
||||
};
|
||||
|
||||
let _ = db::history::add_history_item(
|
||||
pool,
|
||||
HistoryItem::new(app_name, ContentType::Code, text, None, app_icon, Some(language))
|
||||
).await;
|
||||
} else*/ if crate::utils::commands::detect_color(&text) {
|
||||
let _ = db::history::add_history_item(
|
||||
app_handle.clone(),
|
||||
pool,
|
||||
HistoryItem::new(
|
||||
app_name,
|
||||
ContentType::Color,
|
||||
text,
|
||||
None,
|
||||
app_icon,
|
||||
None
|
||||
)
|
||||
).await;
|
||||
} else {
|
||||
let _ = db::history::add_history_item(
|
||||
app_handle.clone(),
|
||||
pool,
|
||||
HistoryItem::new(
|
||||
app_name,
|
||||
ContentType::Text,
|
||||
text.clone(),
|
||||
None,
|
||||
app_icon,
|
||||
None
|
||||
)
|
||||
).await;
|
||||
}
|
||||
}
|
||||
.await;
|
||||
}
|
||||
let _ = app.emit("plugin:clipboard://text-changed", ());
|
||||
} else {
|
||||
println!("Unknown clipboard content type");
|
||||
}
|
||||
|
@ -229,52 +161,145 @@ pub fn setup(app: &AppHandle) {
|
|||
println!("Failed to get database pool: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
let _ = app_handle.emit("clipboard-content-updated", ());
|
||||
let _ = app_handle.track_event(
|
||||
"clipboard_copied",
|
||||
Some(
|
||||
serde_json::json!({
|
||||
"content_type": if available_types.image { "image" }
|
||||
else if available_types.files { "files" }
|
||||
else if available_types.text { "text" }
|
||||
else { "unknown" }
|
||||
})
|
||||
)
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async fn get_pool(
|
||||
app_handle: &AppHandle
|
||||
) -> Result<tauri::State<'_, SqlitePool>, Box<dyn std::error::Error + Send + Sync>> {
|
||||
Ok(app_handle.state::<SqlitePool>())
|
||||
async fn get_pool<R: Runtime>(
|
||||
app_handle: &AppHandle<R>,
|
||||
) -> Result<SqlitePool, Box<dyn std::error::Error + Send + Sync>> {
|
||||
let app_data_dir = app_handle
|
||||
.path()
|
||||
.app_data_dir()
|
||||
.expect("Failed to get app data directory");
|
||||
let db_path = app_data_dir.join("data.db");
|
||||
let database_url = format!("sqlite:{}", db_path.to_str().unwrap());
|
||||
SqlitePool::connect(&database_url)
|
||||
.await
|
||||
.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Send + Sync>)
|
||||
}
|
||||
|
||||
async fn insert_content_if_not_exists<R: Runtime>(
|
||||
app_handle: AppHandle<R>,
|
||||
pool: SqlitePool,
|
||||
content_type: &str,
|
||||
content: String,
|
||||
) {
|
||||
let last_content: Option<String> = sqlx::query_scalar(
|
||||
"SELECT content FROM history WHERE content_type = ? ORDER BY timestamp DESC LIMIT 1",
|
||||
)
|
||||
.bind(content_type)
|
||||
.fetch_one(&pool)
|
||||
.await
|
||||
.unwrap_or(None);
|
||||
|
||||
let content = if content_type == "image" {
|
||||
match save_image(&app_handle, &content).await {
|
||||
Ok(path) => path,
|
||||
Err(e) => {
|
||||
println!("Failed to save image: {}", e);
|
||||
content
|
||||
}
|
||||
}
|
||||
} else {
|
||||
content
|
||||
};
|
||||
|
||||
if last_content.as_deref() != Some(&content) {
|
||||
let id: String = rand::thread_rng()
|
||||
.sample_iter(&rand::distributions::Alphanumeric)
|
||||
.take(16)
|
||||
.map(char::from)
|
||||
.collect();
|
||||
|
||||
let favicon_base64 = if content_type == "text" {
|
||||
let url_regex = Regex::new(r"^https?://(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)$").unwrap();
|
||||
if url_regex.is_match(&content) {
|
||||
match url::Url::parse(&content) {
|
||||
Ok(url) => match fetch_favicon_as_base64(url).await {
|
||||
Ok(Some(favicon)) => Some(favicon),
|
||||
Ok(None) => None,
|
||||
Err(e) => {
|
||||
println!("Failed to fetch favicon: {}", e);
|
||||
None
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
println!("Failed to parse URL: {}", e);
|
||||
None
|
||||
}
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let _ = sqlx::query(
|
||||
"INSERT INTO history (id, content_type, content, favicon) VALUES (?, ?, ?, ?)",
|
||||
)
|
||||
.bind(id)
|
||||
.bind(content_type)
|
||||
.bind(&content)
|
||||
.bind(favicon_base64)
|
||||
.execute(&pool)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn save_image<R: Runtime>(
|
||||
app_handle: &AppHandle<R>,
|
||||
base64_image: &str,
|
||||
) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let image_data = STANDARD.decode(base64_image)?;
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update(&image_data);
|
||||
let hash = hasher.finalize();
|
||||
let filename = format!("{:x}.png", hash);
|
||||
|
||||
let app_data_dir = app_handle
|
||||
.path()
|
||||
.app_data_dir()
|
||||
.expect("Failed to get app data directory");
|
||||
let images_dir = app_data_dir.join("images");
|
||||
let path = images_dir.join(&filename);
|
||||
|
||||
if !path.exists() {
|
||||
fs::create_dir_all(&images_dir)?;
|
||||
fs::write(&path, &image_data)?;
|
||||
}
|
||||
|
||||
Ok(path.to_str().unwrap().to_string())
|
||||
}
|
||||
|
||||
async fn fetch_favicon_as_base64(
|
||||
url: url::Url,
|
||||
) -> Result<Option<String>, Box<dyn std::error::Error>> {
|
||||
let client = reqwest::Client::new();
|
||||
let favicon_url = format!("https://favicone.com/{}", url.host_str().unwrap());
|
||||
let response = client.get(&favicon_url).send().await?;
|
||||
|
||||
if response.status().is_success() {
|
||||
let bytes = response.bytes().await?;
|
||||
let img = image::load_from_memory(&bytes)?;
|
||||
let mut png_bytes: Vec<u8> = Vec::new();
|
||||
img.write_to(&mut std::io::Cursor::new(&mut png_bytes), ImageFormat::Png)?;
|
||||
Ok(Some(STANDARD.encode(&png_bytes)))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn start_monitor(app_handle: AppHandle) -> Result<(), String> {
|
||||
let clipboard = app_handle.state::<Clipboard>();
|
||||
clipboard.start_monitor(app_handle.clone()).map_err(|e| e.to_string())?;
|
||||
clipboard
|
||||
.start_monitor(app_handle.clone())
|
||||
.map_err(|e| e.to_string())?;
|
||||
app_handle
|
||||
.emit("plugin:clipboard://clipboard-monitor/status", true)
|
||||
.map_err(|e| e.to_string())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn save_image_to_file(
|
||||
app_handle: &AppHandle,
|
||||
base64_data: &str
|
||||
) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let app_data_dir = app_handle.path().app_data_dir().unwrap();
|
||||
let images_dir = app_data_dir.join("images");
|
||||
fs::create_dir_all(&images_dir)?;
|
||||
|
||||
let file_name = format!("{}.png", Uuid::new_v4());
|
||||
let file_path = images_dir.join(&file_name);
|
||||
|
||||
let bytes = STANDARD.decode(base64_data)?;
|
||||
fs::write(&file_path, bytes)?;
|
||||
|
||||
Ok(file_path.to_string_lossy().into_owned())
|
||||
}
|
||||
|
|
70
src-tauri/src/api/database.rs
Normal file
|
@ -0,0 +1,70 @@
|
|||
use sqlx::sqlite::SqlitePoolOptions;
|
||||
use std::fs;
|
||||
use tokio::runtime::Runtime;
|
||||
use tauri::Manager;
|
||||
use rand::{thread_rng, Rng};
|
||||
use rand::distributions::Alphanumeric;
|
||||
|
||||
pub fn setup(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let rt = Runtime::new().expect("Failed to create Tokio runtime");
|
||||
|
||||
let app_data_dir = app.path().app_data_dir().unwrap();
|
||||
fs::create_dir_all(&app_data_dir).expect("Failed to create app data directory");
|
||||
|
||||
let db_path = app_data_dir.join("data.db");
|
||||
let is_new_db = !db_path.exists();
|
||||
if is_new_db {
|
||||
fs::File::create(&db_path).expect("Failed to create database file");
|
||||
}
|
||||
|
||||
let db_url = format!("sqlite:{}", db_path.to_str().unwrap());
|
||||
let pool = rt.block_on(async {
|
||||
SqlitePoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect(&db_url)
|
||||
.await
|
||||
.expect("Failed to create pool")
|
||||
});
|
||||
|
||||
rt.block_on(async {
|
||||
sqlx::query(
|
||||
"CREATE TABLE IF NOT EXISTS history (
|
||||
id TEXT PRIMARY KEY,
|
||||
content_type TEXT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
favicon TEXT,
|
||||
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
)"
|
||||
)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.expect("Failed to create table");
|
||||
|
||||
sqlx::query(
|
||||
"CREATE INDEX IF NOT EXISTS idx_timestamp ON history (timestamp)"
|
||||
)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.expect("Failed to create index");
|
||||
|
||||
if is_new_db {
|
||||
let id: String = thread_rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
.take(16)
|
||||
.map(char::from)
|
||||
.collect();
|
||||
sqlx::query("INSERT INTO history (id, content_type, content, timestamp) VALUES (?, ?, ?, CURRENT_TIMESTAMP)")
|
||||
.bind(id)
|
||||
.bind("text")
|
||||
.bind("Welcome to your clipboard history!")
|
||||
.execute(&pool)
|
||||
.await
|
||||
.expect("Failed to insert welcome message");
|
||||
}
|
||||
});
|
||||
|
||||
app.manage(pool);
|
||||
app.manage(rt);
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -1,155 +1,136 @@
|
|||
use crate::utils::commands::center_window_on_current_monitor;
|
||||
use crate::utils::keys::KeyCode;
|
||||
use global_hotkey::{
|
||||
hotkey::{ Code, HotKey, Modifiers },
|
||||
GlobalHotKeyEvent,
|
||||
GlobalHotKeyManager,
|
||||
HotKeyState,
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use tauri::{ AppHandle, Manager, Listener };
|
||||
use tauri_plugin_aptabase::EventTracker;
|
||||
use rdev::{listen, Event, EventType, Key};
|
||||
use tauri::{Manager, Emitter};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::collections::HashSet;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Default)]
|
||||
struct HotkeyState {
|
||||
manager: Option<GlobalHotKeyManager>,
|
||||
registered_hotkey: Option<HotKey>,
|
||||
use crate::utils::commands::center_window_on_current_monitor;
|
||||
|
||||
static IS_CAPTURING_KEYBIND: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
struct CapturedKeybind {
|
||||
modifiers: Vec<String>,
|
||||
key: String,
|
||||
}
|
||||
|
||||
unsafe impl Send for HotkeyState {}
|
||||
struct KeybindState {
|
||||
pressed_keys: HashSet<Key>,
|
||||
}
|
||||
|
||||
impl KeybindState {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
pressed_keys: HashSet::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn setup(app_handle: tauri::AppHandle) {
|
||||
let state = Arc::new(Mutex::new(HotkeyState::default()));
|
||||
let manager = match GlobalHotKeyManager::new() {
|
||||
Ok(manager) => manager,
|
||||
Err(err) => {
|
||||
eprintln!("Failed to initialize hotkey manager: {:?}", err);
|
||||
return;
|
||||
}
|
||||
};
|
||||
let app_handle_clone = app_handle.clone();
|
||||
let keybind_state = Arc::new(Mutex::new(KeybindState::new()));
|
||||
|
||||
{
|
||||
let mut hotkey_state = state.lock();
|
||||
hotkey_state.manager = Some(manager);
|
||||
}
|
||||
|
||||
let rt = app_handle.state::<tokio::runtime::Runtime>();
|
||||
let initial_keybind = rt
|
||||
.block_on(crate::db::settings::get_keybind(app_handle.clone()))
|
||||
.expect("Failed to get initial keybind");
|
||||
|
||||
if let Err(e) = register_shortcut(&state, &initial_keybind) {
|
||||
eprintln!("Error registering initial shortcut: {:?}", e);
|
||||
}
|
||||
|
||||
let state_clone = Arc::clone(&state);
|
||||
app_handle.listen("update-shortcut", move |event| {
|
||||
let payload_str = event.payload().replace("\\\"", "\"");
|
||||
let trimmed_str = payload_str.trim_matches('"');
|
||||
unregister_current_hotkey(&state_clone);
|
||||
|
||||
let payload: Vec<String> = serde_json::from_str(trimmed_str).unwrap_or_default();
|
||||
if let Err(e) = register_shortcut(&state_clone, &payload) {
|
||||
eprintln!("Error re-registering shortcut: {:?}", e);
|
||||
}
|
||||
});
|
||||
|
||||
let state_clone = Arc::clone(&state);
|
||||
app_handle.listen("save_keybind", move |event| {
|
||||
let payload_str = event.payload().to_string();
|
||||
unregister_current_hotkey(&state_clone);
|
||||
|
||||
let payload: Vec<String> = serde_json::from_str(&payload_str).unwrap_or_default();
|
||||
if let Err(e) = register_shortcut(&state_clone, &payload) {
|
||||
eprintln!("Error registering saved shortcut: {:?}", e);
|
||||
}
|
||||
});
|
||||
|
||||
setup_hotkey_receiver(app_handle);
|
||||
}
|
||||
|
||||
fn setup_hotkey_receiver(app_handle: AppHandle) {
|
||||
std::thread::spawn(move || {
|
||||
loop {
|
||||
match GlobalHotKeyEvent::receiver().recv() {
|
||||
Ok(event) => {
|
||||
if event.state == HotKeyState::Released {
|
||||
continue;
|
||||
}
|
||||
handle_hotkey_event(&app_handle);
|
||||
}
|
||||
Err(e) => eprintln!("Error receiving hotkey event: {:?}", e),
|
||||
if let Err(e) = listen(move |event| {
|
||||
let mut state = keybind_state.lock().unwrap();
|
||||
if IS_CAPTURING_KEYBIND.load(Ordering::SeqCst) {
|
||||
handle_keybind_capture(&app_handle_clone, event, &mut state);
|
||||
} else {
|
||||
handle_normal_hotkey(&app_handle_clone, event, &mut state);
|
||||
}
|
||||
}) {
|
||||
eprintln!("Error setting up event listener: {:?}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn unregister_current_hotkey(state: &Arc<Mutex<HotkeyState>>) {
|
||||
let mut hotkey_state = state.lock();
|
||||
if let Some(old_hotkey) = hotkey_state.registered_hotkey.take() {
|
||||
if let Some(manager) = &hotkey_state.manager {
|
||||
let _ = manager.unregister(old_hotkey);
|
||||
fn handle_normal_hotkey(app_handle: &tauri::AppHandle, event: Event, state: &mut KeybindState) {
|
||||
match event.event_type {
|
||||
EventType::KeyPress(Key::MetaLeft) | EventType::KeyPress(Key::MetaRight) => {
|
||||
state.pressed_keys.insert(Key::MetaLeft);
|
||||
}
|
||||
EventType::KeyRelease(Key::MetaLeft) | EventType::KeyRelease(Key::MetaRight) => {
|
||||
state.pressed_keys.remove(&Key::MetaLeft);
|
||||
}
|
||||
}
|
||||
|
||||
fn register_shortcut(state: &Arc<Mutex<HotkeyState>>, shortcut: &[String]) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let hotkey = parse_hotkey(shortcut)?;
|
||||
let mut hotkey_state = state.lock();
|
||||
|
||||
if let Some(manager) = &hotkey_state.manager {
|
||||
manager.register(hotkey.clone())?;
|
||||
hotkey_state.registered_hotkey = Some(hotkey);
|
||||
Ok(())
|
||||
} else {
|
||||
Err("Hotkey manager not initialized".into())
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_hotkey(shortcut: &[String]) -> Result<HotKey, Box<dyn std::error::Error>> {
|
||||
let mut modifiers = Modifiers::empty();
|
||||
let mut code = None;
|
||||
|
||||
for part in shortcut {
|
||||
match part.as_str() {
|
||||
"ControlLeft" => modifiers |= Modifiers::CONTROL,
|
||||
"AltLeft" => modifiers |= Modifiers::ALT,
|
||||
"ShiftLeft" => modifiers |= Modifiers::SHIFT,
|
||||
"MetaLeft" => modifiers |= Modifiers::META,
|
||||
key => code = Some(Code::from(KeyCode::from_str(key)?)),
|
||||
}
|
||||
}
|
||||
|
||||
let key_code = code.ok_or_else(|| "No valid key code found".to_string())?;
|
||||
Ok(HotKey::new(Some(modifiers), key_code))
|
||||
}
|
||||
|
||||
fn handle_hotkey_event(app_handle: &AppHandle) {
|
||||
let window = app_handle.get_webview_window("main").unwrap();
|
||||
if window.is_visible().unwrap() {
|
||||
window.hide().unwrap();
|
||||
} else {
|
||||
window.set_always_on_top(true).unwrap();
|
||||
window.show().unwrap();
|
||||
window.set_focus().unwrap();
|
||||
|
||||
let window_clone = window.clone();
|
||||
std::thread::spawn(move || {
|
||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||
window_clone.set_always_on_top(false).unwrap();
|
||||
});
|
||||
|
||||
EventType::KeyPress(Key::KeyV) => {
|
||||
if state.pressed_keys.contains(&Key::MetaLeft) {
|
||||
state.pressed_keys.clear();
|
||||
if let Some(window) = app_handle.get_webview_window("main") {
|
||||
let _ = window.show();
|
||||
let _ = window.set_focus();
|
||||
center_window_on_current_monitor(&window);
|
||||
}
|
||||
|
||||
let _ = app_handle.track_event(
|
||||
"hotkey_triggered",
|
||||
Some(
|
||||
serde_json::json!({
|
||||
"action": if window.is_visible().unwrap() { "hide" } else { "show" }
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_keybind_capture(app_handle: &tauri::AppHandle, event: Event, state: &mut KeybindState) {
|
||||
match event.event_type {
|
||||
EventType::KeyPress(key) => {
|
||||
state.pressed_keys.insert(key);
|
||||
update_captured_keybind(app_handle, &state.pressed_keys);
|
||||
}
|
||||
EventType::KeyRelease(key) => {
|
||||
state.pressed_keys.remove(&key);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn update_captured_keybind(app_handle: &tauri::AppHandle, pressed_keys: &HashSet<Key>) {
|
||||
let modifiers: Vec<String> = vec![Key::ControlLeft, Key::ShiftLeft, Key::Alt, Key::MetaLeft]
|
||||
.into_iter()
|
||||
.filter(|key| pressed_keys.contains(key))
|
||||
.map(|key| key_to_string(key))
|
||||
.collect();
|
||||
|
||||
let key = pressed_keys.iter()
|
||||
.find(|&&key| !vec![Key::ControlLeft, Key::ShiftLeft, Key::Alt, Key::MetaLeft].contains(&key))
|
||||
.map(|&key| key_to_string(key));
|
||||
|
||||
if let Some(key) = key {
|
||||
let captured_keybind = CapturedKeybind {
|
||||
modifiers,
|
||||
key,
|
||||
};
|
||||
if let Err(e) = app_handle.emit("keybind_captured", captured_keybind) {
|
||||
eprintln!("Error emitting keybind_captured event: {:?}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn key_to_string(key: Key) -> String {
|
||||
match key {
|
||||
Key::ControlLeft | Key::ControlRight => "Ctrl".to_string(),
|
||||
Key::ShiftLeft | Key::ShiftRight => "Shift".to_string(),
|
||||
Key::Alt => "Alt".to_string(),
|
||||
Key::MetaLeft | Key::MetaRight => "Meta".to_string(),
|
||||
_ => format!("{:?}", key),
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn start_keybind_capture() {
|
||||
IS_CAPTURING_KEYBIND.store(true, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn stop_keybind_capture() {
|
||||
IS_CAPTURING_KEYBIND.store(false, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_current_keybind() -> String {
|
||||
// Implement logic to retrieve the current keybind from your configuration
|
||||
"Meta+V".to_string() // Placeholder
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn save_keybind(keybind: String) -> Result<(), String> {
|
||||
// Implement logic to save the new keybind to your configuration
|
||||
println!("Saving keybind: {}", keybind);
|
||||
Ok(())
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
pub mod clipboard;
|
||||
pub mod hotkeys;
|
||||
pub mod tray;
|
||||
pub mod updater;
|
||||
pub mod clipboard;
|
||||
pub mod database;
|
||||
pub mod tray;
|
||||
pub mod hotkeys;
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
use tauri::{ menu::{ MenuBuilder, MenuItemBuilder }, tray::TrayIconBuilder, Emitter, Manager };
|
||||
use tauri_plugin_aptabase::EventTracker;
|
||||
use tauri::{
|
||||
menu::{MenuBuilder, MenuItemBuilder}, tray::TrayIconBuilder, Emitter, Manager
|
||||
};
|
||||
|
||||
pub fn setup(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let window = app.get_webview_window("main").unwrap();
|
||||
let is_visible = window.is_visible().unwrap();
|
||||
let _ = app.track_event(
|
||||
"tray_toggle",
|
||||
Some(serde_json::json!({
|
||||
"action": if is_visible { "hide" } else { "show" }
|
||||
}))
|
||||
);
|
||||
let window_clone_for_tray = window.clone();
|
||||
|
||||
let icon_bytes = include_bytes!("../../icons/Square71x71Logo.png");
|
||||
let icon = tauri::image::Image::from_bytes(icon_bytes).unwrap();
|
||||
|
@ -17,42 +12,32 @@ pub fn setup(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
|
|||
let _tray = TrayIconBuilder::new()
|
||||
.menu(
|
||||
&MenuBuilder::new(app)
|
||||
.items(&[&MenuItemBuilder::with_id("app_name", "Qopy").enabled(false).build(app)?])
|
||||
.items(&[&MenuItemBuilder::with_id("app_name", "Qopy")
|
||||
.enabled(false)
|
||||
.build(app)?])
|
||||
.items(&[&MenuItemBuilder::with_id("show", "Show/Hide").build(app)?])
|
||||
.items(&[&MenuItemBuilder::with_id("settings", "Settings").build(app)?])
|
||||
.items(&[&MenuItemBuilder::with_id("keybind", "Change keybind").build(app)?])
|
||||
.items(&[&MenuItemBuilder::with_id("quit", "Quit").build(app)?])
|
||||
.build()?
|
||||
.build()?,
|
||||
)
|
||||
.on_menu_event(move |_app, event| {
|
||||
match event.id().as_ref() {
|
||||
.on_menu_event(move |_app, event| match event.id().as_ref() {
|
||||
"quit" => {
|
||||
let _ = _app.track_event("app_quit", None);
|
||||
std::process::exit(0);
|
||||
}
|
||||
"show" => {
|
||||
let _ = _app.track_event(
|
||||
"tray_toggle",
|
||||
Some(
|
||||
serde_json::json!({
|
||||
"action": if is_visible { "hide" } else { "show" }
|
||||
})
|
||||
)
|
||||
);
|
||||
let is_visible = window.is_visible().unwrap();
|
||||
let is_visible = window_clone_for_tray.is_visible().unwrap();
|
||||
if is_visible {
|
||||
window.hide().unwrap();
|
||||
window_clone_for_tray.hide().unwrap();
|
||||
} else {
|
||||
window.show().unwrap();
|
||||
window.set_focus().unwrap();
|
||||
window_clone_for_tray.show().unwrap();
|
||||
window_clone_for_tray.set_focus().unwrap();
|
||||
}
|
||||
window.emit("main_route", ()).unwrap();
|
||||
window_clone_for_tray.emit("main_route", ()).unwrap();
|
||||
}
|
||||
"settings" => {
|
||||
let _ = _app.track_event("tray_settings", None);
|
||||
window.emit("settings", ()).unwrap();
|
||||
"keybind" => {
|
||||
window_clone_for_tray.emit("change_keybind", ()).unwrap();
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
})
|
||||
.icon(icon)
|
||||
.build(app)?;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use tauri::{ async_runtime, AppHandle, Manager };
|
||||
use tauri_plugin_dialog::{ DialogExt, MessageDialogButtons, MessageDialogKind };
|
||||
use tauri::{AppHandle, async_runtime};
|
||||
use tauri_plugin_dialog::{DialogExt, MessageDialogKind};
|
||||
use tauri_plugin_updater::UpdaterExt;
|
||||
|
||||
pub async fn check_for_updates(app: AppHandle, prompted: bool) {
|
||||
|
||||
pub async fn check_for_updates(app: AppHandle) {
|
||||
println!("Checking for updates...");
|
||||
|
||||
let updater = app.updater().unwrap();
|
||||
|
@ -18,77 +19,28 @@ pub async fn check_for_updates(app: AppHandle, prompted: bool) {
|
|||
"Would you like to install it now?",
|
||||
]);
|
||||
|
||||
let window = app.get_webview_window("main").unwrap();
|
||||
window.show().unwrap();
|
||||
window.set_focus().unwrap();
|
||||
|
||||
app.dialog()
|
||||
.message(msg)
|
||||
.title("Qopy Update Available")
|
||||
.buttons(
|
||||
MessageDialogButtons::OkCancelCustom(
|
||||
String::from("Install"),
|
||||
String::from("Cancel")
|
||||
)
|
||||
)
|
||||
.title("Update Available")
|
||||
.ok_button_label("Install")
|
||||
.cancel_button_label("Cancel")
|
||||
.show(move |response| {
|
||||
if !response {
|
||||
return;
|
||||
}
|
||||
async_runtime::spawn(async move {
|
||||
match
|
||||
update.download_and_install(
|
||||
|_, _| {},
|
||||
|| {}
|
||||
).await
|
||||
{
|
||||
Ok(_) => {
|
||||
app.dialog()
|
||||
.message(
|
||||
"Update installed successfully. The application needs to restart to apply the changes."
|
||||
)
|
||||
.title("Qopy Update Installed")
|
||||
.buttons(
|
||||
MessageDialogButtons::OkCancelCustom(
|
||||
String::from("Restart"),
|
||||
String::from("Cancel")
|
||||
)
|
||||
)
|
||||
.show(move |response| {
|
||||
if response {
|
||||
app.restart();
|
||||
}
|
||||
});
|
||||
}
|
||||
Err(e) => {
|
||||
if let Err(e) = update.download_and_install(|_, _| {}, || {}).await {
|
||||
println!("Error installing new update: {:?}", e);
|
||||
app.dialog()
|
||||
.message(
|
||||
app.dialog().message(
|
||||
"Failed to install new update. The new update can be downloaded from Github"
|
||||
)
|
||||
.kind(MessageDialogKind::Error)
|
||||
.show(|_| {});
|
||||
}
|
||||
).kind(MessageDialogKind::Error).show(|_| {});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
Ok(None) => {
|
||||
println!("No updates available.");
|
||||
}
|
||||
Ok(None) => println!("No updates available."),
|
||||
Err(e) => {
|
||||
if prompted {
|
||||
let window = app.get_webview_window("main").unwrap();
|
||||
window.show().unwrap();
|
||||
window.set_focus().unwrap();
|
||||
|
||||
app.dialog()
|
||||
.message("No updates available.")
|
||||
.title("Qopy Update Check")
|
||||
.show(|_| {});
|
||||
}
|
||||
|
||||
println!("No updates available. {}", e.to_string());
|
||||
println!("Failed to check for updates: {:?}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,107 +0,0 @@
|
|||
use include_dir::{ include_dir, Dir };
|
||||
use sqlx::sqlite::{ SqlitePool, SqlitePoolOptions };
|
||||
use std::fs;
|
||||
use tauri::Manager;
|
||||
use tokio::runtime::Runtime as TokioRuntime;
|
||||
|
||||
static MIGRATIONS_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/src/db/migrations");
|
||||
|
||||
pub fn setup(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let rt = TokioRuntime::new().expect("Failed to create Tokio runtime");
|
||||
app.manage(rt);
|
||||
|
||||
let rt = app.state::<TokioRuntime>();
|
||||
|
||||
let app_data_dir = app.path().app_data_dir().unwrap();
|
||||
fs::create_dir_all(&app_data_dir).expect("Failed to create app data directory");
|
||||
|
||||
let db_path = app_data_dir.join("data.db");
|
||||
let is_new_db = !db_path.exists();
|
||||
if is_new_db {
|
||||
fs::File::create(&db_path).expect("Failed to create database file");
|
||||
}
|
||||
|
||||
let db_url = format!("sqlite:{}", db_path.to_str().unwrap());
|
||||
let pool = rt.block_on(async {
|
||||
SqlitePoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect(&db_url).await
|
||||
.expect("Failed to create pool")
|
||||
});
|
||||
|
||||
app.manage(pool.clone());
|
||||
|
||||
rt.block_on(async {
|
||||
apply_migrations(&pool).await?;
|
||||
if is_new_db {
|
||||
if let Err(e) = super::history::initialize_history(&pool).await {
|
||||
eprintln!("Failed to initialize history: {}", e);
|
||||
}
|
||||
if let Err(e) = super::settings::initialize_settings(&pool).await {
|
||||
eprintln!("Failed to initialize settings: {}", e);
|
||||
}
|
||||
}
|
||||
Ok::<(), Box<dyn std::error::Error>>(())
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn apply_migrations(pool: &SqlitePool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
sqlx
|
||||
::query(
|
||||
"CREATE TABLE IF NOT EXISTS schema_version (
|
||||
version INTEGER PRIMARY KEY,
|
||||
applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);"
|
||||
)
|
||||
.execute(pool).await?;
|
||||
|
||||
let current_version: Option<i64> = sqlx
|
||||
::query_scalar("SELECT MAX(version) FROM schema_version")
|
||||
.fetch_one(pool).await?;
|
||||
|
||||
let current_version = current_version.unwrap_or(0);
|
||||
|
||||
let mut migration_files: Vec<(i64, &str)> = MIGRATIONS_DIR.files()
|
||||
.filter_map(|file| {
|
||||
let file_name = file.path().file_name()?.to_str()?;
|
||||
if file_name.ends_with(".sql") && file_name.starts_with("v") {
|
||||
let version: i64 = file_name
|
||||
.trim_start_matches("v")
|
||||
.trim_end_matches(".sql")
|
||||
.parse()
|
||||
.ok()?;
|
||||
Some((version, file.contents_utf8()?))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
migration_files.sort_by_key(|(version, _)| *version);
|
||||
|
||||
for (version, content) in migration_files {
|
||||
if version > current_version {
|
||||
let statements: Vec<&str> = content
|
||||
.split(';')
|
||||
.map(|s| s.trim())
|
||||
.filter(|s| !s.is_empty())
|
||||
.collect();
|
||||
|
||||
for statement in statements {
|
||||
sqlx
|
||||
::query(statement)
|
||||
.execute(pool).await
|
||||
.map_err(|e| format!("Failed to execute migration {}: {}", version, e))?;
|
||||
}
|
||||
|
||||
sqlx
|
||||
::query("INSERT INTO schema_version (version) VALUES (?)")
|
||||
.bind(version)
|
||||
.execute(pool).await?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -1,217 +0,0 @@
|
|||
use crate::utils::types::{ ContentType, HistoryItem };
|
||||
use base64::{ engine::general_purpose::STANDARD, Engine };
|
||||
use rand::{ rng, Rng };
|
||||
use rand::distr::Alphanumeric;
|
||||
use sqlx::{ Row, SqlitePool };
|
||||
use std::fs;
|
||||
use tauri_plugin_aptabase::EventTracker;
|
||||
|
||||
pub async fn initialize_history(pool: &SqlitePool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let id: String = rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
.take(16)
|
||||
.map(char::from)
|
||||
.collect();
|
||||
|
||||
sqlx::query(
|
||||
"INSERT INTO history (id, source, content_type, content, timestamp) VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP)"
|
||||
)
|
||||
.bind(id)
|
||||
.bind("System")
|
||||
.bind("text")
|
||||
.bind("Welcome to your clipboard history!")
|
||||
.execute(pool).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_history(pool: tauri::State<'_, SqlitePool>) -> Result<Vec<HistoryItem>, String> {
|
||||
let rows = sqlx
|
||||
::query(
|
||||
"SELECT id, source, source_icon, content_type, content, favicon, timestamp, language FROM history ORDER BY timestamp DESC"
|
||||
)
|
||||
.fetch_all(&*pool).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let items = rows
|
||||
.iter()
|
||||
.map(|row| HistoryItem {
|
||||
id: row.get("id"),
|
||||
source: row.get("source"),
|
||||
source_icon: row.get("source_icon"),
|
||||
content_type: ContentType::from(row.get::<String, _>("content_type")),
|
||||
content: row.get("content"),
|
||||
favicon: row.get("favicon"),
|
||||
timestamp: row.get("timestamp"),
|
||||
language: row.get("language"),
|
||||
})
|
||||
.collect();
|
||||
|
||||
Ok(items)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn add_history_item(
|
||||
app_handle: tauri::AppHandle,
|
||||
pool: tauri::State<'_, SqlitePool>,
|
||||
item: HistoryItem
|
||||
) -> Result<(), String> {
|
||||
let (id, source, source_icon, content_type, content, favicon, timestamp, language) =
|
||||
item.to_row();
|
||||
|
||||
let existing = sqlx
|
||||
::query("SELECT id FROM history WHERE content = ? AND content_type = ?")
|
||||
.bind(&content)
|
||||
.bind(&content_type)
|
||||
.fetch_optional(&*pool).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
match existing {
|
||||
Some(_) => {
|
||||
sqlx
|
||||
::query(
|
||||
"UPDATE history SET timestamp = strftime('%Y-%m-%dT%H:%M:%f+00:00', 'now') WHERE content = ? AND content_type = ?"
|
||||
)
|
||||
.bind(&content)
|
||||
.bind(&content_type)
|
||||
.execute(&*pool).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
}
|
||||
None => {
|
||||
sqlx
|
||||
::query(
|
||||
"INSERT INTO history (id, source, source_icon, content_type, content, favicon, timestamp, language) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
)
|
||||
.bind(id)
|
||||
.bind(source)
|
||||
.bind(source_icon)
|
||||
.bind(content_type)
|
||||
.bind(content)
|
||||
.bind(favicon)
|
||||
.bind(timestamp)
|
||||
.bind(language)
|
||||
.execute(&*pool).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
}
|
||||
}
|
||||
|
||||
let _ = app_handle.track_event(
|
||||
"history_item_added",
|
||||
Some(serde_json::json!({
|
||||
"content_type": item.content_type.to_string()
|
||||
}))
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn search_history(
|
||||
pool: tauri::State<'_, SqlitePool>,
|
||||
query: String
|
||||
) -> Result<Vec<HistoryItem>, String> {
|
||||
if query.trim().is_empty() {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
|
||||
let query = format!("%{}%", query);
|
||||
|
||||
let rows = sqlx
|
||||
::query(
|
||||
"SELECT id, source, source_icon, content_type, content, favicon, timestamp, language
|
||||
FROM history
|
||||
WHERE content LIKE ?
|
||||
ORDER BY timestamp DESC
|
||||
LIMIT 100"
|
||||
)
|
||||
.bind(query)
|
||||
.fetch_all(&*pool).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let mut items = Vec::with_capacity(rows.len());
|
||||
for row in rows.iter() {
|
||||
items.push(HistoryItem {
|
||||
id: row.get("id"),
|
||||
source: row.get("source"),
|
||||
source_icon: row.get("source_icon"),
|
||||
content_type: ContentType::from(row.get::<String, _>("content_type")),
|
||||
content: row.get("content"),
|
||||
favicon: row.get("favicon"),
|
||||
timestamp: row.get("timestamp"),
|
||||
language: row.get("language"),
|
||||
});
|
||||
}
|
||||
|
||||
Ok(items)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn load_history_chunk(
|
||||
pool: tauri::State<'_, SqlitePool>,
|
||||
offset: i64,
|
||||
limit: i64
|
||||
) -> Result<Vec<HistoryItem>, String> {
|
||||
let rows = sqlx
|
||||
::query(
|
||||
"SELECT id, source, source_icon, content_type, content, favicon, timestamp, language FROM history ORDER BY timestamp DESC LIMIT ? OFFSET ?"
|
||||
)
|
||||
.bind(limit)
|
||||
.bind(offset)
|
||||
.fetch_all(&*pool).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let items = rows
|
||||
.iter()
|
||||
.map(|row| HistoryItem {
|
||||
id: row.get("id"),
|
||||
source: row.get("source"),
|
||||
source_icon: row.get("source_icon"),
|
||||
content_type: ContentType::from(row.get::<String, _>("content_type")),
|
||||
content: row.get("content"),
|
||||
favicon: row.get("favicon"),
|
||||
timestamp: row.get("timestamp"),
|
||||
language: row.get("language"),
|
||||
})
|
||||
.collect();
|
||||
|
||||
Ok(items)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn delete_history_item(
|
||||
app_handle: tauri::AppHandle,
|
||||
pool: tauri::State<'_, SqlitePool>,
|
||||
id: String
|
||||
) -> Result<(), String> {
|
||||
sqlx
|
||||
::query("DELETE FROM history WHERE id = ?")
|
||||
.bind(id)
|
||||
.execute(&*pool).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let _ = app_handle.track_event("history_item_deleted", None);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn clear_history(
|
||||
app_handle: tauri::AppHandle,
|
||||
pool: tauri::State<'_, SqlitePool>
|
||||
) -> Result<(), String> {
|
||||
sqlx
|
||||
::query("DELETE FROM history")
|
||||
.execute(&*pool).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let _ = app_handle.track_event("history_cleared", None);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn read_image(filename: String) -> Result<String, String> {
|
||||
let bytes = fs::read(filename).map_err(|e| e.to_string())?;
|
||||
Ok(STANDARD.encode(bytes))
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
CREATE TABLE IF NOT EXISTS settings (
|
||||
key TEXT PRIMARY KEY,
|
||||
value TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS history (
|
||||
id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(16)))),
|
||||
content_type TEXT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
favicon TEXT,
|
||||
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
|
@ -1,3 +0,0 @@
|
|||
ALTER TABLE history ADD COLUMN source TEXT DEFAULT 'System' NOT NULL;
|
||||
ALTER TABLE history ADD COLUMN source_icon TEXT;
|
||||
ALTER TABLE history ADD COLUMN language TEXT;
|
|
@ -1 +0,0 @@
|
|||
INSERT INTO settings (key, value) VALUES ('autostart', 'true');
|
|
@ -1,3 +0,0 @@
|
|||
pub mod database;
|
||||
pub mod history;
|
||||
pub mod settings;
|
|
@ -1,87 +0,0 @@
|
|||
use serde::{ Deserialize, Serialize };
|
||||
use serde_json;
|
||||
use sqlx::Row;
|
||||
use sqlx::SqlitePool;
|
||||
use tauri::{ Emitter, Manager };
|
||||
use tauri_plugin_aptabase::EventTracker;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
struct KeybindSetting {
|
||||
keybind: Vec<String>,
|
||||
}
|
||||
|
||||
pub async fn initialize_settings(pool: &SqlitePool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let default_keybind = KeybindSetting {
|
||||
keybind: vec!["Meta".to_string(), "V".to_string()],
|
||||
};
|
||||
let json = serde_json::to_string(&default_keybind)?;
|
||||
|
||||
sqlx
|
||||
::query("INSERT INTO settings (key, value) VALUES ('keybind', ?)")
|
||||
.bind(json)
|
||||
.execute(pool).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_setting(
|
||||
pool: tauri::State<'_, SqlitePool>,
|
||||
key: String
|
||||
) -> Result<String, String> {
|
||||
let row = sqlx
|
||||
::query("SELECT value FROM settings WHERE key = ?")
|
||||
.bind(key)
|
||||
.fetch_optional(&*pool).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
Ok(row.map(|r| r.get("value")).unwrap_or_default())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn save_setting(
|
||||
app_handle: tauri::AppHandle,
|
||||
pool: tauri::State<'_, SqlitePool>,
|
||||
key: String,
|
||||
value: String
|
||||
) -> Result<(), String> {
|
||||
sqlx
|
||||
::query("INSERT OR REPLACE INTO settings (key, value) VALUES (?, ?)")
|
||||
.bind(key.clone())
|
||||
.bind(value.clone())
|
||||
.execute(&*pool).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let _ = app_handle.track_event(
|
||||
"setting_saved",
|
||||
Some(serde_json::json!({
|
||||
"key": key
|
||||
}))
|
||||
);
|
||||
|
||||
if key == "keybind" {
|
||||
let _ = app_handle.emit("update-shortcut", &value).map_err(|e| e.to_string())?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_keybind(app_handle: tauri::AppHandle) -> Result<Vec<String>, String> {
|
||||
let pool = app_handle.state::<SqlitePool>();
|
||||
|
||||
let row = sqlx
|
||||
::query("SELECT value FROM settings WHERE key = 'keybind'")
|
||||
.fetch_optional(&*pool).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let json = row
|
||||
.map(|r| r.get::<String, _>("value"))
|
||||
.unwrap_or_else(|| {
|
||||
serde_json
|
||||
::to_string(&vec!["MetaLeft".to_string(), "KeyV".to_string()])
|
||||
.expect("Failed to serialize default keybind")
|
||||
});
|
||||
|
||||
serde_json::from_str::<Vec<String>>(&json).map_err(|e| e.to_string())
|
||||
}
|
|
@ -1,135 +1,84 @@
|
|||
#![cfg_attr(all(not(debug_assertions), target_os = "windows"), windows_subsystem = "windows")]
|
||||
#![cfg_attr(
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
mod api;
|
||||
mod db;
|
||||
mod utils;
|
||||
|
||||
use sqlx::sqlite::SqlitePoolOptions;
|
||||
use std::fs;
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_aptabase::{ EventTracker, InitOptions };
|
||||
use tauri_plugin_autostart::MacosLauncher;
|
||||
use tauri_plugin_prevent_default::Flags;
|
||||
|
||||
fn main() {
|
||||
let runtime = tokio::runtime::Runtime::new().expect("Failed to create Tokio runtime");
|
||||
let _guard = runtime.enter();
|
||||
|
||||
tauri::Builder
|
||||
::default()
|
||||
#[allow(unused_variables)]
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_clipboard::init())
|
||||
.plugin(tauri_plugin_os::init())
|
||||
.plugin(tauri_plugin_sql::Builder::default().build())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_updater::Builder::default().build())
|
||||
.plugin(tauri_plugin_autostart::init(
|
||||
MacosLauncher::LaunchAgent,
|
||||
Some(vec![]),
|
||||
))
|
||||
.plugin(
|
||||
tauri_plugin_aptabase::Builder
|
||||
::new("A-SH-8937252746")
|
||||
.with_options(InitOptions {
|
||||
host: Some("https://aptabase.pandadev.net".to_string()),
|
||||
flush_interval: None,
|
||||
})
|
||||
.with_panic_hook(
|
||||
Box::new(|client, info, msg| {
|
||||
let location = info
|
||||
.location()
|
||||
.map(|loc| format!("{}:{}:{}", loc.file(), loc.line(), loc.column()))
|
||||
.unwrap_or_else(|| "".to_string());
|
||||
|
||||
let _ = client.track_event(
|
||||
"panic",
|
||||
Some(
|
||||
serde_json::json!({
|
||||
"info": format!("{} ({})", msg, location),
|
||||
})
|
||||
)
|
||||
);
|
||||
})
|
||||
)
|
||||
.build()
|
||||
)
|
||||
.plugin(tauri_plugin_autostart::init(MacosLauncher::LaunchAgent, Some(vec![])))
|
||||
.plugin(
|
||||
tauri_plugin_prevent_default::Builder
|
||||
::new()
|
||||
tauri_plugin_prevent_default::Builder::new()
|
||||
.with_flags(Flags::all().difference(Flags::CONTEXT_MENU))
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.setup(|app| {
|
||||
#[cfg(target_os = "macos")]
|
||||
app.set_activation_policy(tauri::ActivationPolicy::Accessory);
|
||||
|
||||
let app_data_dir = app.path().app_data_dir().unwrap();
|
||||
utils::logger::init_logger(&app_data_dir).expect("Failed to initialize logger");
|
||||
|
||||
fs::create_dir_all(&app_data_dir).expect("Failed to create app data directory");
|
||||
|
||||
let db_path = app_data_dir.join("data.db");
|
||||
let is_new_db = !db_path.exists();
|
||||
if is_new_db {
|
||||
fs::File::create(&db_path).expect("Failed to create database file");
|
||||
}
|
||||
|
||||
let db_url = format!("sqlite:{}", db_path.to_str().unwrap());
|
||||
|
||||
let app_handle = app.handle().clone();
|
||||
|
||||
let app_handle_clone = app_handle.clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let pool = SqlitePoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect(&db_url).await
|
||||
.expect("Failed to create pool");
|
||||
|
||||
app_handle_clone.manage(pool);
|
||||
});
|
||||
|
||||
let main_window = app.get_webview_window("main");
|
||||
|
||||
let _ = db::database::setup(app);
|
||||
// #[cfg(not(target_os = "macos"))]
|
||||
api::hotkeys::setup(app_handle.clone());
|
||||
api::tray::setup(app)?;
|
||||
api::database::setup(app)?;
|
||||
api::clipboard::setup(app.handle());
|
||||
let _ = api::clipboard::start_monitor(app_handle.clone());
|
||||
|
||||
utils::commands::center_window_on_current_monitor(main_window.as_ref().unwrap());
|
||||
main_window
|
||||
.as_ref()
|
||||
.map(|w| w.hide())
|
||||
.unwrap_or(Ok(()))?;
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
utils::commands::center_window_on_current_monitor(&window);
|
||||
window.hide().unwrap();
|
||||
}
|
||||
|
||||
let _ = app.track_event("app_started", None);
|
||||
// #[cfg(dev)]
|
||||
// {
|
||||
// let window = app.get_webview_window("main").unwrap();
|
||||
// window.open_devtools();
|
||||
// window.close_devtools();
|
||||
// }
|
||||
|
||||
let app_data_dir = app
|
||||
.path()
|
||||
.app_data_dir()
|
||||
.expect("Failed to get app data directory");
|
||||
api::clipboard::set_app_data_dir(app_data_dir);
|
||||
|
||||
tauri::async_runtime::spawn(async move {
|
||||
api::updater::check_for_updates(app_handle, false).await;
|
||||
api::updater::check_for_updates(app_handle).await;
|
||||
});
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.on_window_event(|_app, _event| {
|
||||
.on_window_event(|app, event| {
|
||||
#[cfg(not(dev))]
|
||||
if let tauri::WindowEvent::Focused(false) = _event {
|
||||
if let Some(window) = _app.get_webview_window("main") {
|
||||
if let tauri::WindowEvent::Focused(false) = event {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.hide();
|
||||
}
|
||||
}
|
||||
})
|
||||
.invoke_handler(
|
||||
tauri::generate_handler![
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
api::clipboard::get_image_path,
|
||||
api::clipboard::write_and_paste,
|
||||
db::history::get_history,
|
||||
db::history::add_history_item,
|
||||
db::history::search_history,
|
||||
db::history::load_history_chunk,
|
||||
db::history::delete_history_item,
|
||||
db::history::clear_history,
|
||||
db::history::read_image,
|
||||
db::settings::get_setting,
|
||||
db::settings::save_setting,
|
||||
utils::commands::fetch_page_meta
|
||||
]
|
||||
)
|
||||
api::clipboard::read_image,
|
||||
api::hotkeys::start_keybind_capture,
|
||||
api::hotkeys::stop_keybind_capture,
|
||||
api::hotkeys::get_current_keybind,
|
||||
api::hotkeys::save_keybind,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
|
@ -1,16 +1,7 @@
|
|||
use applications::{AppInfoContext, AppInfo, AppTrait, utils::image::RustImage};
|
||||
use base64::{ engine::general_purpose::STANDARD, Engine };
|
||||
use image::codecs::png::PngEncoder;
|
||||
use tauri::PhysicalPosition;
|
||||
use meta_fetcher;
|
||||
|
||||
pub fn center_window_on_current_monitor(window: &tauri::WebviewWindow) {
|
||||
if
|
||||
let Some(monitor) = window
|
||||
.available_monitors()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.find(|m| {
|
||||
if let Some(monitor) = window.available_monitors().unwrap().iter().find(|m| {
|
||||
let primary_monitor = window
|
||||
.primary_monitor()
|
||||
.unwrap()
|
||||
|
@ -18,120 +9,22 @@ pub fn center_window_on_current_monitor(window: &tauri::WebviewWindow) {
|
|||
let mouse_position = primary_monitor.position();
|
||||
let monitor_position = m.position();
|
||||
let monitor_size = m.size();
|
||||
mouse_position.x >= monitor_position.x &&
|
||||
mouse_position.x < monitor_position.x + (monitor_size.width as i32) &&
|
||||
mouse_position.y >= monitor_position.y &&
|
||||
mouse_position.y < monitor_position.y + (monitor_size.height as i32)
|
||||
})
|
||||
{
|
||||
mouse_position.x >= monitor_position.x
|
||||
&& mouse_position.x < monitor_position.x + monitor_size.width as i32
|
||||
&& mouse_position.y >= monitor_position.y
|
||||
&& mouse_position.y < monitor_position.y + monitor_size.height as i32
|
||||
}) {
|
||||
let monitor_size = monitor.size();
|
||||
let window_size = window.outer_size().unwrap();
|
||||
|
||||
let x = ((monitor_size.width as i32) - (window_size.width as i32)) / 2;
|
||||
let y = ((monitor_size.height as i32) - (window_size.height as i32)) / 2;
|
||||
let x = (monitor_size.width as i32 - window_size.width as i32) / 2;
|
||||
let y = (monitor_size.height as i32 - window_size.height as i32) / 2;
|
||||
|
||||
window
|
||||
.set_position(PhysicalPosition::new(monitor.position().x + x, monitor.position().y + y))
|
||||
.set_position(PhysicalPosition::new(
|
||||
monitor.position().x + x,
|
||||
monitor.position().y + y,
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_app_info() -> (String, Option<String>) {
|
||||
println!("Getting app info");
|
||||
let mut ctx = AppInfoContext::new(vec![]);
|
||||
println!("Created AppInfoContext");
|
||||
ctx.refresh_apps().unwrap();
|
||||
println!("Refreshed apps");
|
||||
match ctx.get_frontmost_application() {
|
||||
Ok(window) => {
|
||||
println!("Found frontmost application: {}", window.name);
|
||||
let name = window.name.clone();
|
||||
let icon = window
|
||||
.load_icon()
|
||||
.ok()
|
||||
.map(|i| {
|
||||
println!("Loading icon for {}", name);
|
||||
let png = i.to_png().unwrap();
|
||||
let encoded = STANDARD.encode(png.get_bytes());
|
||||
println!("Icon encoded successfully");
|
||||
encoded
|
||||
});
|
||||
println!("Returning app info: {} with icon: {}", name, icon.is_some());
|
||||
(name, icon)
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Failed to get frontmost application: {:?}", e);
|
||||
("System".to_string(), None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn _process_icon_to_base64(path: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let img = image::open(path)?;
|
||||
let resized = img.resize(128, 128, image::imageops::FilterType::Lanczos3);
|
||||
let mut png_buffer = Vec::new();
|
||||
resized.write_with_encoder(PngEncoder::new(&mut png_buffer))?;
|
||||
Ok(STANDARD.encode(png_buffer))
|
||||
}
|
||||
|
||||
pub fn detect_color(color: &str) -> bool {
|
||||
let color = color.trim().to_lowercase();
|
||||
|
||||
// hex
|
||||
if color.starts_with('#') && color.len() == color.trim_end_matches(char::is_whitespace).len() {
|
||||
let hex = &color[1..];
|
||||
return match hex.len() {
|
||||
3 | 6 | 8 => hex.chars().all(|c| c.is_ascii_hexdigit()),
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
// rgb/rgba
|
||||
if
|
||||
(color.starts_with("rgb(") || color.starts_with("rgba(")) &&
|
||||
color.ends_with(")") &&
|
||||
!color[..color.len() - 1].contains(")")
|
||||
{
|
||||
let values = color
|
||||
.trim_start_matches("rgba(")
|
||||
.trim_start_matches("rgb(")
|
||||
.trim_end_matches(')')
|
||||
.split(',')
|
||||
.collect::<Vec<&str>>();
|
||||
|
||||
return match values.len() {
|
||||
3 | 4 => values.iter().all(|v| v.trim().parse::<f32>().is_ok()),
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
// hsl/hsla
|
||||
if
|
||||
(color.starts_with("hsl(") || color.starts_with("hsla(")) &&
|
||||
color.ends_with(")") &&
|
||||
!color[..color.len() - 1].contains(")")
|
||||
{
|
||||
let values = color
|
||||
.trim_start_matches("hsla(")
|
||||
.trim_start_matches("hsl(")
|
||||
.trim_end_matches(')')
|
||||
.split(',')
|
||||
.collect::<Vec<&str>>();
|
||||
|
||||
return match values.len() {
|
||||
3 | 4 => values.iter().all(|v| v.trim().parse::<f32>().is_ok()),
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn fetch_page_meta(url: String) -> Result<(String, Option<String>), String> {
|
||||
let metadata = meta_fetcher
|
||||
::fetch_metadata(&url)
|
||||
.map_err(|e| format!("Failed to fetch metadata: {}", e))?;
|
||||
|
||||
Ok((metadata.title.unwrap_or_else(|| "No title found".to_string()), metadata.image))
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
use base64::engine::general_purpose::STANDARD;
|
||||
use base64::Engine;
|
||||
use image::ImageFormat;
|
||||
use reqwest;
|
||||
use url::Url;
|
||||
|
||||
pub async fn fetch_favicon_as_base64(
|
||||
url: Url
|
||||
) -> Result<Option<String>, Box<dyn std::error::Error>> {
|
||||
let client = reqwest::Client::new();
|
||||
let favicon_url = format!("https://favicone.com/{}", url.host_str().unwrap());
|
||||
let response = client.get(&favicon_url).send().await?;
|
||||
|
||||
if response.status().is_success() {
|
||||
let bytes = response.bytes().await?;
|
||||
let img = image::load_from_memory(&bytes)?;
|
||||
let mut png_bytes: Vec<u8> = Vec::new();
|
||||
img.write_to(&mut std::io::Cursor::new(&mut png_bytes), ImageFormat::Png)?;
|
||||
Ok(Some(STANDARD.encode(&png_bytes)))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
use global_hotkey::hotkey::Code;
|
||||
use std::str::FromStr;
|
||||
|
||||
pub struct KeyCode(Code);
|
||||
|
||||
impl FromStr for KeyCode {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let code = match s {
|
||||
"Backquote" => Code::Backquote,
|
||||
"Backslash" => Code::Backslash,
|
||||
"BracketLeft" => Code::BracketLeft,
|
||||
"BracketRight" => Code::BracketRight,
|
||||
"Comma" => Code::Comma,
|
||||
"Digit0" => Code::Digit0,
|
||||
"Digit1" => Code::Digit1,
|
||||
"Digit2" => Code::Digit2,
|
||||
"Digit3" => Code::Digit3,
|
||||
"Digit4" => Code::Digit4,
|
||||
"Digit5" => Code::Digit5,
|
||||
"Digit6" => Code::Digit6,
|
||||
"Digit7" => Code::Digit7,
|
||||
"Digit8" => Code::Digit8,
|
||||
"Digit9" => Code::Digit9,
|
||||
"Equal" => Code::Equal,
|
||||
"KeyA" => Code::KeyA,
|
||||
"KeyB" => Code::KeyB,
|
||||
"KeyC" => Code::KeyC,
|
||||
"KeyD" => Code::KeyD,
|
||||
"KeyE" => Code::KeyE,
|
||||
"KeyF" => Code::KeyF,
|
||||
"KeyG" => Code::KeyG,
|
||||
"KeyH" => Code::KeyH,
|
||||
"KeyI" => Code::KeyI,
|
||||
"KeyJ" => Code::KeyJ,
|
||||
"KeyK" => Code::KeyK,
|
||||
"KeyL" => Code::KeyL,
|
||||
"KeyM" => Code::KeyM,
|
||||
"KeyN" => Code::KeyN,
|
||||
"KeyO" => Code::KeyO,
|
||||
"KeyP" => Code::KeyP,
|
||||
"KeyQ" => Code::KeyQ,
|
||||
"KeyR" => Code::KeyR,
|
||||
"KeyS" => Code::KeyS,
|
||||
"KeyT" => Code::KeyT,
|
||||
"KeyU" => Code::KeyU,
|
||||
"KeyV" => Code::KeyV,
|
||||
"KeyW" => Code::KeyW,
|
||||
"KeyX" => Code::KeyX,
|
||||
"KeyY" => Code::KeyY,
|
||||
"KeyZ" => Code::KeyZ,
|
||||
"Minus" => Code::Minus,
|
||||
"Period" => Code::Period,
|
||||
"Quote" => Code::Quote,
|
||||
"Semicolon" => Code::Semicolon,
|
||||
"Slash" => Code::Slash,
|
||||
"Backspace" => Code::Backspace,
|
||||
"CapsLock" => Code::CapsLock,
|
||||
"Delete" => Code::Delete,
|
||||
"Enter" => Code::Enter,
|
||||
"Space" => Code::Space,
|
||||
"Tab" => Code::Tab,
|
||||
"End" => Code::End,
|
||||
"Home" => Code::Home,
|
||||
"Insert" => Code::Insert,
|
||||
"PageDown" => Code::PageDown,
|
||||
"PageUp" => Code::PageUp,
|
||||
"ArrowDown" => Code::ArrowDown,
|
||||
"ArrowLeft" => Code::ArrowLeft,
|
||||
"ArrowRight" => Code::ArrowRight,
|
||||
"ArrowUp" => Code::ArrowUp,
|
||||
"NumLock" => Code::NumLock,
|
||||
"Numpad0" => Code::Numpad0,
|
||||
"Numpad1" => Code::Numpad1,
|
||||
"Numpad2" => Code::Numpad2,
|
||||
"Numpad3" => Code::Numpad3,
|
||||
"Numpad4" => Code::Numpad4,
|
||||
"Numpad5" => Code::Numpad5,
|
||||
"Numpad6" => Code::Numpad6,
|
||||
"Numpad7" => Code::Numpad7,
|
||||
"Numpad8" => Code::Numpad8,
|
||||
"Numpad9" => Code::Numpad9,
|
||||
"NumpadAdd" => Code::NumpadAdd,
|
||||
"NumpadDecimal" => Code::NumpadDecimal,
|
||||
"NumpadDivide" => Code::NumpadDivide,
|
||||
"NumpadMultiply" => Code::NumpadMultiply,
|
||||
"NumpadSubtract" => Code::NumpadSubtract,
|
||||
"Escape" => Code::Escape,
|
||||
"PrintScreen" => Code::PrintScreen,
|
||||
"ScrollLock" => Code::ScrollLock,
|
||||
"Pause" => Code::Pause,
|
||||
"AudioVolumeDown" => Code::AudioVolumeDown,
|
||||
"AudioVolumeMute" => Code::AudioVolumeMute,
|
||||
"AudioVolumeUp" => Code::AudioVolumeUp,
|
||||
"F1" => Code::F1,
|
||||
"F2" => Code::F2,
|
||||
"F3" => Code::F3,
|
||||
"F4" => Code::F4,
|
||||
"F5" => Code::F5,
|
||||
"F6" => Code::F6,
|
||||
"F7" => Code::F7,
|
||||
"F8" => Code::F8,
|
||||
"F9" => Code::F9,
|
||||
"F10" => Code::F10,
|
||||
"F11" => Code::F11,
|
||||
"F12" => Code::F12,
|
||||
_ => {
|
||||
return Err(format!("Unknown key code: {}", s));
|
||||
}
|
||||
};
|
||||
Ok(KeyCode(code))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<KeyCode> for Code {
|
||||
fn from(key_code: KeyCode) -> Self {
|
||||
key_code.0
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
use chrono;
|
||||
use log::{ LevelFilter, SetLoggerError };
|
||||
use std::fs::{ File, OpenOptions };
|
||||
use std::io::Write;
|
||||
use std::panic;
|
||||
|
||||
pub struct FileLogger {
|
||||
file: File,
|
||||
}
|
||||
|
||||
impl log::Log for FileLogger {
|
||||
fn enabled(&self, _metadata: &log::Metadata) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn log(&self, record: &log::Record) {
|
||||
if self.enabled(record.metadata()) {
|
||||
let mut file = self.file.try_clone().expect("Failed to clone file handle");
|
||||
|
||||
writeln!(
|
||||
file,
|
||||
"{} [{:<5}] {}: {} ({}:{})",
|
||||
chrono::Local::now().format("%Y-%m-%d %H:%M:%S"),
|
||||
record.level(),
|
||||
record.target(),
|
||||
record.args(),
|
||||
record.file().unwrap_or("unknown"),
|
||||
record.line().unwrap_or(0)
|
||||
).expect("Failed to write to log file");
|
||||
}
|
||||
}
|
||||
|
||||
fn flush(&self) {
|
||||
self.file.sync_all().expect("Failed to flush log file");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init_logger(app_data_dir: &std::path::Path) -> Result<(), SetLoggerError> {
|
||||
let logs_dir = app_data_dir.join("logs");
|
||||
std::fs::create_dir_all(&logs_dir).expect("Failed to create logs directory");
|
||||
|
||||
let log_path = logs_dir.join("app.log");
|
||||
let file = OpenOptions::new()
|
||||
.create(true)
|
||||
.append(true)
|
||||
.open(&log_path)
|
||||
.expect("Failed to open log file");
|
||||
|
||||
let panic_file = file.try_clone().expect("Failed to clone file handle");
|
||||
panic::set_hook(
|
||||
Box::new(move |panic_info| {
|
||||
let mut file = panic_file.try_clone().expect("Failed to clone file handle");
|
||||
|
||||
let location = panic_info
|
||||
.location()
|
||||
.map(|loc| format!("{}:{}:{}", loc.file(), loc.line(), loc.column()))
|
||||
.unwrap_or_else(|| "unknown location".to_string());
|
||||
|
||||
let message = match panic_info.payload().downcast_ref::<&str>() {
|
||||
Some(s) => *s,
|
||||
None =>
|
||||
match panic_info.payload().downcast_ref::<String>() {
|
||||
Some(s) => s.as_str(),
|
||||
None => "Unknown panic message",
|
||||
}
|
||||
};
|
||||
|
||||
let _ = writeln!(
|
||||
file,
|
||||
"{} [PANIC] rust_panic: {} ({})",
|
||||
chrono::Local::now().format("%Y-%m-%d %H:%M:%S"),
|
||||
message,
|
||||
location
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
let logger = Box::new(FileLogger { file });
|
||||
unsafe {
|
||||
log::set_logger_racy(Box::leak(logger))?;
|
||||
}
|
||||
log::set_max_level(LevelFilter::Debug);
|
||||
Ok(())
|
||||
}
|
|
@ -1,5 +1 @@
|
|||
pub mod commands;
|
||||
pub mod favicon;
|
||||
pub mod types;
|
||||
pub mod logger;
|
||||
pub mod keys;
|
||||
|
|
|
@ -1,155 +0,0 @@
|
|||
use chrono::{ DateTime, Utc };
|
||||
use serde::{ Deserialize, Serialize };
|
||||
use std::fmt;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
|
||||
pub struct HistoryItem {
|
||||
pub id: String,
|
||||
pub source: String,
|
||||
pub source_icon: Option<String>,
|
||||
pub content_type: ContentType,
|
||||
pub content: String,
|
||||
pub favicon: Option<String>,
|
||||
pub timestamp: DateTime<Utc>,
|
||||
pub language: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ContentType {
|
||||
Text,
|
||||
Image,
|
||||
File,
|
||||
Link,
|
||||
Color,
|
||||
Code,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct InfoText {
|
||||
pub source: String,
|
||||
pub content_type: ContentType,
|
||||
pub characters: i32,
|
||||
pub words: i32,
|
||||
pub copied: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct InfoImage {
|
||||
pub source: String,
|
||||
pub content_type: ContentType,
|
||||
pub dimensions: String,
|
||||
pub size: i64,
|
||||
pub copied: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct InfoFile {
|
||||
pub source: String,
|
||||
pub content_type: ContentType,
|
||||
pub path: String,
|
||||
pub filesize: i64,
|
||||
pub copied: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct InfoLink {
|
||||
pub source: String,
|
||||
pub content_type: ContentType,
|
||||
pub title: Option<String>,
|
||||
pub url: String,
|
||||
pub characters: i32,
|
||||
pub copied: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct InfoColor {
|
||||
pub source: String,
|
||||
pub content_type: ContentType,
|
||||
pub hex: String,
|
||||
pub rgb: String,
|
||||
pub copied: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct InfoCode {
|
||||
pub source: String,
|
||||
pub content_type: ContentType,
|
||||
pub language: String,
|
||||
pub lines: i32,
|
||||
pub copied: DateTime<Utc>,
|
||||
}
|
||||
|
||||
impl fmt::Display for ContentType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
ContentType::Text => write!(f, "text"),
|
||||
ContentType::Image => write!(f, "image"),
|
||||
ContentType::File => write!(f, "file"),
|
||||
ContentType::Link => write!(f, "link"),
|
||||
ContentType::Color => write!(f, "color"),
|
||||
ContentType::Code => write!(f, "code"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for ContentType {
|
||||
fn from(s: String) -> Self {
|
||||
match s.to_lowercase().as_str() {
|
||||
"text" => ContentType::Text,
|
||||
"image" => ContentType::Image,
|
||||
"file" => ContentType::File,
|
||||
"link" => ContentType::Link,
|
||||
"color" => ContentType::Color,
|
||||
"code" => ContentType::Code,
|
||||
_ => ContentType::Text,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl HistoryItem {
|
||||
pub fn new(
|
||||
source: String,
|
||||
content_type: ContentType,
|
||||
content: String,
|
||||
favicon: Option<String>,
|
||||
source_icon: Option<String>,
|
||||
language: Option<String>
|
||||
) -> Self {
|
||||
Self {
|
||||
id: Uuid::new_v4().to_string(),
|
||||
source,
|
||||
source_icon,
|
||||
content_type,
|
||||
content,
|
||||
favicon,
|
||||
timestamp: Utc::now(),
|
||||
language,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_row(
|
||||
&self
|
||||
) -> (
|
||||
String,
|
||||
String,
|
||||
Option<String>,
|
||||
String,
|
||||
String,
|
||||
Option<String>,
|
||||
DateTime<Utc>,
|
||||
Option<String>,
|
||||
) {
|
||||
(
|
||||
self.id.clone(),
|
||||
self.source.clone(),
|
||||
self.source_icon.clone(),
|
||||
self.content_type.to_string(),
|
||||
self.content.clone(),
|
||||
self.favicon.clone(),
|
||||
self.timestamp,
|
||||
self.language.clone(),
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"productName": "Qopy",
|
||||
"version": "0.4.0",
|
||||
"version": "0.1.1",
|
||||
"identifier": "net.pandadev.qopy",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
@ -25,8 +25,7 @@
|
|||
"center": true,
|
||||
"shadow": false,
|
||||
"transparent": true,
|
||||
"skipTaskbar": true,
|
||||
"alwaysOnTop": true
|
||||
"skipTaskbar": true
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
|
@ -45,13 +44,14 @@
|
|||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"category": "DeveloperTool"
|
||||
]
|
||||
},
|
||||
"plugins": {
|
||||
"updater": {
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDExNDIzNjA1QjE0NjU1OTkKUldTWlZVYXhCVFpDRWNvNmt0UE5lQmZkblEyZGZiZ2tHelJvT2YvNVpLU1RIM1RKZFQrb2tzWWwK",
|
||||
"endpoints": ["https://qopy.pandadev.net/"]
|
||||
"endpoints": [
|
||||
"https://qopy.pandadev.net/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"$schema": "../node_modules/@tauri-apps/cli/schema.json"
|
||||
|
|
|
@ -1,186 +0,0 @@
|
|||
$primary: #2e2d2b;
|
||||
$accent: #feb453;
|
||||
$divider: #ffffff0d;
|
||||
|
||||
$text: #e5dfd5;
|
||||
$text2: #ada9a1;
|
||||
$mutedtext: #78756f;
|
||||
|
||||
$search-height: 56px;
|
||||
$sidebar-width: 286px;
|
||||
$bottom-bar-height: 39px;
|
||||
$info-panel-height: 160px;
|
||||
$content-view-height: calc(
|
||||
100% - $search-height - $info-panel-height - $bottom-bar-height
|
||||
);
|
||||
|
||||
main {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: $primary;
|
||||
border: 1px solid $divider;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 12px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.container {
|
||||
height: 376px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.results {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 14px 8px;
|
||||
gap: 8px;
|
||||
min-width: 286px;
|
||||
border-right: 1px solid var(--border);
|
||||
|
||||
.time-separator {
|
||||
font-size: 12px;
|
||||
color: $text2;
|
||||
font-family: SFRoundedSemiBold;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.group {
|
||||
& + .group {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.time-separator {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.results-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.favicon,
|
||||
.image,
|
||||
.icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
height: 100%;
|
||||
font-family: CommitMono !important;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1;
|
||||
border-radius: 10px;
|
||||
width: 462px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
overflow: hidden;
|
||||
z-index: 2;
|
||||
color: $text;
|
||||
|
||||
&:not(:has(.image)) {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
span.content-text {
|
||||
font-family: CommitMono !important;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
}
|
||||
}
|
||||
|
||||
.information {
|
||||
min-height: 160px;
|
||||
width: 462px;
|
||||
border-top: 1px solid $divider;
|
||||
padding: 14px;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
|
||||
.title {
|
||||
font-family: SFRoundedSemiBold;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.6px;
|
||||
color: $text;
|
||||
}
|
||||
|
||||
.info-content {
|
||||
display: flex;
|
||||
gap: 0;
|
||||
flex-direction: column;
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
font-size: 12px;
|
||||
justify-content: space-between;
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid $divider;
|
||||
line-height: 1;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
padding-top: 22px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: SFRoundedMedium;
|
||||
color: $text2;
|
||||
font-weight: 500;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
span {
|
||||
font-family: CommitMono;
|
||||
color: $text;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
margin-left: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
|
||||
img {
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.search-loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
font-size: 16px;
|
||||
color: var(--text-secondary);
|
||||
}
|
|
@ -1,235 +0,0 @@
|
|||
$primary: #2e2d2b;
|
||||
$accent: #feb453;
|
||||
$divider: #ffffff0d;
|
||||
|
||||
$text: #e5dfd5;
|
||||
$text2: #ada9a1;
|
||||
$mutedtext: #78756f;
|
||||
|
||||
main {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: $primary;
|
||||
border: 1px solid $divider;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 12px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.back {
|
||||
position: absolute;
|
||||
top: 16px;
|
||||
left: 16px;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
|
||||
img {
|
||||
background-color: $divider;
|
||||
border-radius: 6px;
|
||||
padding: 8px 6px;
|
||||
}
|
||||
|
||||
p {
|
||||
color: $text2;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: SFRoundedMedium;
|
||||
}
|
||||
|
||||
.settings-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-top: 26px;
|
||||
position: relative;
|
||||
font-size: 12px;
|
||||
font-family: SFRoundedMedium;
|
||||
|
||||
.settings {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
margin-left: -26px;
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
|
||||
.names {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
|
||||
p {
|
||||
font-family: SFRoundedSemiBold;
|
||||
color: $text2;
|
||||
display: flex;
|
||||
justify-content: right;
|
||||
}
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
color: $mutedtext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.launch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
input[type="checkbox"] {
|
||||
appearance: none;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
background-color: transparent;
|
||||
border-radius: 5px;
|
||||
border: 1px solid $mutedtext;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
|
||||
&:checked {
|
||||
~ .checkmark {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.checkmark {
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
p {
|
||||
color: $text2;
|
||||
}
|
||||
}
|
||||
|
||||
.keybind-input {
|
||||
width: min-content;
|
||||
white-space: nowrap;
|
||||
padding: 6px;
|
||||
border: 1px solid $divider;
|
||||
color: $text2;
|
||||
display: flex;
|
||||
border-radius: 10px;
|
||||
outline: none;
|
||||
gap: 4px;
|
||||
|
||||
.key {
|
||||
color: $text2;
|
||||
font-family: SFRoundedMedium;
|
||||
background-color: $divider;
|
||||
padding: 2px 6px;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.keybind-input:focus {
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.empty-keybind {
|
||||
border-color: rgba(255, 82, 82, 0.298);
|
||||
}
|
||||
|
||||
.top-bar {
|
||||
width: 100%;
|
||||
min-height: 56px;
|
||||
border-bottom: 1px solid $divider;
|
||||
}
|
||||
|
||||
.bottom-bar {
|
||||
height: 40px;
|
||||
width: calc(100vw - 2px);
|
||||
backdrop-filter: blur(18px);
|
||||
background-color: hsla(40, 3%, 16%, 0.8);
|
||||
position: fixed;
|
||||
bottom: 1px;
|
||||
left: 1px;
|
||||
z-index: 100;
|
||||
border-radius: 0 0 12px 12px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
padding-inline: 12px;
|
||||
padding-right: 6px;
|
||||
padding-top: 1px;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
border-top: 1px solid $divider;
|
||||
|
||||
p {
|
||||
color: $text2;
|
||||
}
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.logo {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.actions div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
width: 2px;
|
||||
height: 12px;
|
||||
background-color: $divider;
|
||||
margin-left: 8px;
|
||||
margin-right: 4px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.actions {
|
||||
padding: 4px;
|
||||
padding-left: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
border-radius: 7px;
|
||||
background-color: transparent;
|
||||
transition: all 0.2s;
|
||||
cursor: pointer;
|
||||
|
||||
p {
|
||||
color: $text;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
pointer-events: none;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
.actions:hover {
|
||||
background-color: $divider;
|
||||
}
|
||||
|
||||
&:hover .actions:hover ~ .divider {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
217
types/keys.ts
|
@ -1,217 +0,0 @@
|
|||
export enum KeyValues {
|
||||
Backquote = 'Backquote',
|
||||
Backslash = 'Backslash',
|
||||
BracketLeft = 'BracketLeft',
|
||||
BracketRight = 'BracketRight',
|
||||
Comma = 'Comma',
|
||||
Digit0 = 'Digit0',
|
||||
Digit1 = 'Digit1',
|
||||
Digit2 = 'Digit2',
|
||||
Digit3 = 'Digit3',
|
||||
Digit4 = 'Digit4',
|
||||
Digit5 = 'Digit5',
|
||||
Digit6 = 'Digit6',
|
||||
Digit7 = 'Digit7',
|
||||
Digit8 = 'Digit8',
|
||||
Digit9 = 'Digit9',
|
||||
Equal = 'Equal',
|
||||
KeyA = 'KeyA',
|
||||
KeyB = 'KeyB',
|
||||
KeyC = 'KeyC',
|
||||
KeyD = 'KeyD',
|
||||
KeyE = 'KeyE',
|
||||
KeyF = 'KeyF',
|
||||
KeyG = 'KeyG',
|
||||
KeyH = 'KeyH',
|
||||
KeyI = 'KeyI',
|
||||
KeyJ = 'KeyJ',
|
||||
KeyK = 'KeyK',
|
||||
KeyL = 'KeyL',
|
||||
KeyM = 'KeyM',
|
||||
KeyN = 'KeyN',
|
||||
KeyO = 'KeyO',
|
||||
KeyP = 'KeyP',
|
||||
KeyQ = 'KeyQ',
|
||||
KeyR = 'KeyR',
|
||||
KeyS = 'KeyS',
|
||||
KeyT = 'KeyT',
|
||||
KeyU = 'KeyU',
|
||||
KeyV = 'KeyV',
|
||||
KeyW = 'KeyW',
|
||||
KeyX = 'KeyX',
|
||||
KeyY = 'KeyY',
|
||||
KeyZ = 'KeyZ',
|
||||
Minus = 'Minus',
|
||||
Period = 'Period',
|
||||
Quote = 'Quote',
|
||||
Semicolon = 'Semicolon',
|
||||
Slash = 'Slash',
|
||||
AltLeft = 'AltLeft',
|
||||
AltRight = 'AltRight',
|
||||
Backspace = 'Backspace',
|
||||
CapsLock = 'CapsLock',
|
||||
ContextMenu = 'ContextMenu',
|
||||
ControlLeft = 'ControlLeft',
|
||||
ControlRight = 'ControlRight',
|
||||
Enter = 'Enter',
|
||||
MetaLeft = 'MetaLeft',
|
||||
MetaRight = 'MetaRight',
|
||||
ShiftLeft = 'ShiftLeft',
|
||||
ShiftRight = 'ShiftRight',
|
||||
Space = 'Space',
|
||||
Tab = 'Tab',
|
||||
Delete = 'Delete',
|
||||
End = 'End',
|
||||
Home = 'Home',
|
||||
Insert = 'Insert',
|
||||
PageDown = 'PageDown',
|
||||
PageUp = 'PageUp',
|
||||
ArrowDown = 'ArrowDown',
|
||||
ArrowLeft = 'ArrowLeft',
|
||||
ArrowRight = 'ArrowRight',
|
||||
ArrowUp = 'ArrowUp',
|
||||
NumLock = 'NumLock',
|
||||
Numpad0 = 'Numpad0',
|
||||
Numpad1 = 'Numpad1',
|
||||
Numpad2 = 'Numpad2',
|
||||
Numpad3 = 'Numpad3',
|
||||
Numpad4 = 'Numpad4',
|
||||
Numpad5 = 'Numpad5',
|
||||
Numpad6 = 'Numpad6',
|
||||
Numpad7 = 'Numpad7',
|
||||
Numpad8 = 'Numpad8',
|
||||
Numpad9 = 'Numpad9',
|
||||
NumpadAdd = 'NumpadAdd',
|
||||
NumpadDecimal = 'NumpadDecimal',
|
||||
NumpadDivide = 'NumpadDivide',
|
||||
NumpadMultiply = 'NumpadMultiply',
|
||||
NumpadSubtract = 'NumpadSubtract',
|
||||
Escape = 'Escape',
|
||||
PrintScreen = 'PrintScreen',
|
||||
ScrollLock = 'ScrollLock',
|
||||
Pause = 'Pause',
|
||||
AudioVolumeDown = 'AudioVolumeDown',
|
||||
AudioVolumeMute = 'AudioVolumeMute',
|
||||
AudioVolumeUp = 'AudioVolumeUp',
|
||||
F1 = 'F1',
|
||||
F2 = 'F2',
|
||||
F3 = 'F3',
|
||||
F4 = 'F4',
|
||||
F5 = 'F5',
|
||||
F6 = 'F6',
|
||||
F7 = 'F7',
|
||||
F8 = 'F8',
|
||||
F9 = 'F9',
|
||||
F10 = 'F10',
|
||||
F11 = 'F11',
|
||||
F12 = 'F12',
|
||||
}
|
||||
|
||||
export enum KeyLabels {
|
||||
Backquote = '`',
|
||||
Backslash = '\\',
|
||||
BracketLeft = '[',
|
||||
BracketRight = ']',
|
||||
Comma = ',',
|
||||
Digit0 = '0',
|
||||
Digit1 = '1',
|
||||
Digit2 = '2',
|
||||
Digit3 = '3',
|
||||
Digit4 = '4',
|
||||
Digit5 = '5',
|
||||
Digit6 = '6',
|
||||
Digit7 = '7',
|
||||
Digit8 = '8',
|
||||
Digit9 = '9',
|
||||
Equal = '=',
|
||||
KeyA = 'A',
|
||||
KeyB = 'B',
|
||||
KeyC = 'C',
|
||||
KeyD = 'D',
|
||||
KeyE = 'E',
|
||||
KeyF = 'F',
|
||||
KeyG = 'G',
|
||||
KeyH = 'H',
|
||||
KeyI = 'I',
|
||||
KeyJ = 'J',
|
||||
KeyK = 'K',
|
||||
KeyL = 'L',
|
||||
KeyM = 'M',
|
||||
KeyN = 'N',
|
||||
KeyO = 'O',
|
||||
KeyP = 'P',
|
||||
KeyQ = 'Q',
|
||||
KeyR = 'R',
|
||||
KeyS = 'S',
|
||||
KeyT = 'T',
|
||||
KeyU = 'U',
|
||||
KeyV = 'V',
|
||||
KeyW = 'W',
|
||||
KeyX = 'X',
|
||||
KeyY = 'Y',
|
||||
KeyZ = 'Z',
|
||||
Minus = '-',
|
||||
Period = '.',
|
||||
Quote = "'",
|
||||
Semicolon = ';',
|
||||
Slash = '/',
|
||||
AltLeft = 'Alt',
|
||||
AltRight = 'Alt (Right)',
|
||||
Backspace = 'Backspace',
|
||||
CapsLock = 'Caps Lock',
|
||||
ContextMenu = 'Context Menu',
|
||||
ControlLeft = 'Ctrl',
|
||||
ControlRight = 'Ctrl (Right)',
|
||||
Enter = 'Enter',
|
||||
MetaLeft = 'Meta',
|
||||
MetaRight = 'Meta (Right)',
|
||||
ShiftLeft = 'Shift',
|
||||
ShiftRight = 'Shift (Right)',
|
||||
Space = 'Space',
|
||||
Tab = 'Tab',
|
||||
Delete = 'Delete',
|
||||
End = 'End',
|
||||
Home = 'Home',
|
||||
Insert = 'Insert',
|
||||
PageDown = 'Page Down',
|
||||
PageUp = 'Page Up',
|
||||
ArrowDown = '↓',
|
||||
ArrowLeft = '←',
|
||||
ArrowRight = '→',
|
||||
ArrowUp = '↑',
|
||||
NumLock = 'Num Lock',
|
||||
Numpad0 = 'Numpad 0',
|
||||
Numpad1 = 'Numpad 1',
|
||||
Numpad2 = 'Numpad 2',
|
||||
Numpad3 = 'Numpad 3',
|
||||
Numpad4 = 'Numpad 4',
|
||||
Numpad5 = 'Numpad 5',
|
||||
Numpad6 = 'Numpad 6',
|
||||
Numpad7 = 'Numpad 7',
|
||||
Numpad8 = 'Numpad 8',
|
||||
Numpad9 = 'Numpad 9',
|
||||
NumpadAdd = 'Numpad +',
|
||||
NumpadDecimal = 'Numpad .',
|
||||
NumpadDivide = 'Numpad /',
|
||||
NumpadMultiply = 'Numpad *',
|
||||
NumpadSubtract = 'Numpad -',
|
||||
Escape = 'Esc',
|
||||
PrintScreen = 'Print Screen',
|
||||
ScrollLock = 'Scroll Lock',
|
||||
Pause = 'Pause',
|
||||
AudioVolumeDown = 'Volume Down',
|
||||
AudioVolumeMute = 'Volume Mute',
|
||||
AudioVolumeUp = 'Volume Up',
|
||||
F1 = 'F1',
|
||||
F2 = 'F2',
|
||||
F3 = 'F3',
|
||||
F4 = 'F4',
|
||||
F5 = 'F5',
|
||||
F6 = 'F6',
|
||||
F7 = 'F7',
|
||||
F8 = 'F8',
|
||||
F9 = 'F9',
|
||||
F10 = 'F10',
|
||||
F11 = 'F11',
|
||||
F12 = 'F12',
|
||||
}
|
116
types/types.ts
|
@ -1,116 +0,0 @@
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
export enum ContentType {
|
||||
Text = "text",
|
||||
Image = "image",
|
||||
File = "file",
|
||||
Link = "link",
|
||||
Color = "color",
|
||||
Code = "code",
|
||||
}
|
||||
|
||||
export class HistoryItem {
|
||||
id: string;
|
||||
source: string;
|
||||
source_icon?: string;
|
||||
content_type: ContentType;
|
||||
content: string;
|
||||
favicon?: string;
|
||||
timestamp: Date;
|
||||
language?: string;
|
||||
|
||||
constructor(
|
||||
source: string,
|
||||
content_type: ContentType,
|
||||
content: string,
|
||||
favicon?: string,
|
||||
source_icon?: string,
|
||||
language?: string
|
||||
) {
|
||||
this.id = uuidv4();
|
||||
this.source = source;
|
||||
this.source_icon = source_icon;
|
||||
this.content_type = content_type;
|
||||
this.content = content;
|
||||
this.favicon = favicon;
|
||||
this.timestamp = new Date();
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
toRow(): [
|
||||
string,
|
||||
string,
|
||||
string | undefined,
|
||||
string,
|
||||
string,
|
||||
string | undefined,
|
||||
Date,
|
||||
string | undefined
|
||||
] {
|
||||
return [
|
||||
this.id,
|
||||
this.source,
|
||||
this.source_icon,
|
||||
this.content_type,
|
||||
this.content,
|
||||
this.favicon,
|
||||
this.timestamp,
|
||||
this.language,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
export interface Settings {
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface InfoText {
|
||||
source: string;
|
||||
content_type: ContentType.Text;
|
||||
characters: number;
|
||||
words: number;
|
||||
copied: Date;
|
||||
}
|
||||
|
||||
export interface InfoImage {
|
||||
source: string;
|
||||
content_type: ContentType.Image;
|
||||
dimensions: string;
|
||||
size: number;
|
||||
copied: Date;
|
||||
}
|
||||
|
||||
export interface InfoFile {
|
||||
source: string;
|
||||
content_type: ContentType.File;
|
||||
path: string;
|
||||
filesize: number;
|
||||
copied: Date;
|
||||
}
|
||||
|
||||
export interface InfoLink {
|
||||
source: string;
|
||||
content_type: ContentType.Link;
|
||||
title?: string;
|
||||
url: string;
|
||||
characters: number;
|
||||
copied: Date;
|
||||
}
|
||||
|
||||
export interface InfoColor {
|
||||
source: string;
|
||||
content_type: ContentType.Color;
|
||||
hex: string;
|
||||
rgb: string;
|
||||
hsl: string;
|
||||
copied: Date;
|
||||
}
|
||||
|
||||
export interface InfoCode {
|
||||
source: string;
|
||||
content_type: ContentType.Code;
|
||||
language: string;
|
||||
lines: number;
|
||||
copied: Date;
|
||||
}
|