Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send events to Sentry #171

Merged
merged 20 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Create .env file in root
run: |
echo "appVersion=debug" >> .env
echo "CAP_DESKTOP_SENTRY_URL=https://efd3156d9c0a8a49bee3ee675bec80d8@o4506859771527168.ingest.us.sentry.io/4506859844403200" >> .env
echo "CAP_DESKTOP_SENTRY_URL=https://6a3b6a09e6ae976c2ad6fff710e88748@o4506859771527168.ingest.us.sentry.io/4508330917101568" >> .env
echo "NEXT_PUBLIC_URL=${{ secrets.NEXT_PUBLIC_URL }}" >> .env
echo 'NEXTAUTH_URL=${NEXT_PUBLIC_URL}' >> .env
echo 'VITE_SERVER_URL=${NEXT_PUBLIC_URL}' >> .env
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
echo "appVersion=${{ steps.get_version.outputs.appVersion }}" >> .env
echo "NEXT_PUBLIC_ENVIRONMENT=production" >> .env
echo "NEXT_PUBLIC_LOCAL_MODE=false" >> .env
echo "CAP_DESKTOP_SENTRY_URL=https://efd3156d9c0a8a49bee3ee675bec80d8@o4506859771527168.ingest.us.sentry.io/4506859844403200" >> .env
echo "CAP_DESKTOP_SENTRY_URL=https://6a3b6a09e6ae976c2ad6fff710e88748@o4506859771527168.ingest.us.sentry.io/4508330917101568" >> .env

- name: Copy .env to apps/desktop
run: cp .env apps/desktop/.env
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
- name: Create .env file in root
run: |
echo "appVersion=${{ needs.draft.outputs.version }}" >> .env
echo "CAP_DESKTOP_SENTRY_URL=https://efd3156d9c0a8a49bee3ee675bec80d8@o4506859771527168.ingest.us.sentry.io/4506859844403200" >> .env
echo "CAP_DESKTOP_SENTRY_URL=https://6a3b6a09e6ae976c2ad6fff710e88748@o4506859771527168.ingest.us.sentry.io/4508330917101568" >> .env
echo "NEXT_PUBLIC_URL=${{ secrets.NEXT_PUBLIC_URL }}" >> .env
echo 'NEXTAUTH_URL=${NEXT_PUBLIC_URL}' >> .env
echo 'VITE_SERVER_URL=${NEXT_PUBLIC_URL}' >> .env
Expand Down
197 changes: 197 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ nokhwa-bindings-macos = { git = "https://github.com/CapSoftware/nokhwa", rev = "
wgpu = "22.1.0"
flume = "0.11.0"
thiserror = "1.0"
sentry = { version = "0.34.0", features = ["anyhow"] }

windows = "0.58.0"
windows-sys = "0.59.0"
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ global-hotkey = "0.6.3"
rand = "0.8.5"
cpal.workspace = true
keyed_priority_queue = "0.4.2"
sentry.workspace = true

cap-utils = { path = "../../../crates/utils" }
cap-project = { path = "../../../crates/project" }
Expand Down
15 changes: 15 additions & 0 deletions apps/desktop/src-tauri/src/auth.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::sync::Arc;

use serde::{Deserialize, Serialize};
use serde_json::json;
use specta::Type;
Expand All @@ -11,6 +13,7 @@ use crate::web_api;
#[derive(Serialize, Deserialize, Type, Debug)]
pub struct AuthStore {
pub token: String,
pub user_id: String,
pub expires: i32,
pub plan: Option<Plan>,
}
Expand All @@ -22,6 +25,18 @@ pub struct Plan {
}

impl AuthStore {
pub fn load<R: Runtime>(app: &AppHandle<R>) -> Result<Option<Self>, String> {
let Some(store) = app
.store("store")
.map(|s| s.get("auth"))
.map_err(|e| e.to_string())?
else {
return Ok(None);
};

serde_json::from_value(store).map_err(|e| e.to_string())
}

pub fn get<R: Runtime>(app: &AppHandle<R>) -> Result<Option<Self>, String> {
let Some(Some(store)) = app.get_store("store").map(|s| s.get("auth")) else {
return Ok(None);
Expand Down
Loading
Loading