Tea cli version tracking (#608)

* bump 0.2.7

* #595 track tea version in sentry

* #595 add teaVersion to sesssion

* bump v0.2.13

---------

Co-authored-by: neil molina <neil@neils-MacBook-Pro.local>
This commit is contained in:
Neil 2023-05-15 08:03:08 +08:00 committed by GitHub
parent 34cd8324ea
commit 24ff5f23ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 6 deletions

View file

@ -14,7 +14,7 @@ import initializePushNotification, {
syncPackageTopicSubscriptions syncPackageTopicSubscriptions
} from "./libs/push-notification"; } from "./libs/push-notification";
import init from "./libs/initialize"; import init, { initializeTeaCli } from "./libs/initialize";
import { readSessionData } from "./libs/auth"; import { readSessionData } from "./libs/auth";
import { isDev } from "./libs/auto-updater"; import { isDev } from "./libs/auto-updater";
@ -38,10 +38,11 @@ if (app.isPackaged) {
} }
}); });
Sentry.configureScope(async (scope) => { Sentry.configureScope(async (scope) => {
const session = await readSessionData(); const [session, cliVersion] = await Promise.all([readSessionData(), initializeTeaCli()]);
scope.setUser({ scope.setUser({
id: session.device_id, // device_id this should exist in our pg db: developer_id is to many device_id id: session.device_id, // device_id this should exist in our pg db: developer_id is to many device_id
username: session?.user?.login || "" // github username or handler username: session?.user?.login || "", // github username or handler
tea: cliVersion
}); });
}); });
setSentryLogging(Sentry); setSentryLogging(Sentry);

View file

@ -18,6 +18,7 @@ export interface Session {
key?: string; key?: string;
user?: any; user?: any;
locale?: string; locale?: string;
teaVersion?: string;
} }
let sessionMemory: Session = { device_id: "", locale: "en" }; let sessionMemory: Session = { device_id: "", locale: "en" };

View file

@ -40,7 +40,8 @@ export default function initializeHandlers({ notifyMainWindow }: HandlerOptions)
ipcMain.handle("get-session", async () => { ipcMain.handle("get-session", async () => {
try { try {
log.info("getting session"); log.info("getting session");
const session = await readSessionData(); const [session, cliVersion] = await Promise.all([readSessionData(), initializeTeaCli()]);
session.teaVersion = cliVersion;
log.debug(session ? "found session data" : "no session data found"); log.debug(session ? "found session data" : "no session data found");
return session; return session;
} catch (error) { } catch (error) {

View file

@ -1,6 +1,6 @@
{ {
"name": "tea", "name": "tea",
"version": "0.2.12", "version": "0.2.13",
"private": true, "private": true,
"description": "tea gui app", "description": "tea gui app",
"author": "tea.xyz", "author": "tea.xyz",

View file

@ -15,7 +15,8 @@ export async function initSentry(session?: Session) {
Sentry.configureScope(async (scope) => { Sentry.configureScope(async (scope) => {
scope.setUser({ scope.setUser({
id: session.device_id, // device_id this should exist in our pg db: developer_id is to many device_id id: session.device_id, // device_id this should exist in our pg db: developer_id is to many device_id
username: session?.user?.login || "" // github username or handler username: session?.user?.login || "", // github username or handler
tea: session?.teaVersion || "unknown"
}); });
}); });
} }

View file

@ -57,6 +57,7 @@ export interface Session {
key?: string; key?: string;
user?: Developer; user?: Developer;
locale?: string; locale?: string;
teaVersion?: string;
} }
export enum SideMenuOptions { export enum SideMenuOptions {