-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Rename app to H3Code and harden process execution #1935
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,5 +26,5 @@ | |
| "typescript": "catalog:", | ||
| "vitest": "catalog:" | ||
| }, | ||
| "productName": "T3 Code (Alpha)" | ||
| "productName": "H3Code" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,20 +91,26 @@ const SET_SAVED_ENVIRONMENT_SECRET_CHANNEL = "desktop:set-saved-environment-secr | |
| const REMOVE_SAVED_ENVIRONMENT_SECRET_CHANNEL = "desktop:remove-saved-environment-secret"; | ||
| const GET_SERVER_EXPOSURE_STATE_CHANNEL = "desktop:get-server-exposure-state"; | ||
| const SET_SERVER_EXPOSURE_MODE_CHANNEL = "desktop:set-server-exposure-mode"; | ||
| const BASE_DIR = process.env.T3CODE_HOME?.trim() || Path.join(OS.homedir(), ".t3"); | ||
| const BASE_DIR = | ||
| process.env.H3CODE_HOME?.trim() || | ||
| process.env.T3CODE_HOME?.trim() || | ||
| Path.join(OS.homedir(), ".h3code"); | ||
| const STATE_DIR = Path.join(BASE_DIR, "userdata"); | ||
| const DESKTOP_SETTINGS_PATH = Path.join(STATE_DIR, "desktop-settings.json"); | ||
| const CLIENT_SETTINGS_PATH = Path.join(STATE_DIR, "client-settings.json"); | ||
| const SAVED_ENVIRONMENT_REGISTRY_PATH = Path.join(STATE_DIR, "saved-environments.json"); | ||
| const DESKTOP_SCHEME = "t3"; | ||
| const ROOT_DIR = Path.resolve(__dirname, "../../.."); | ||
| const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL); | ||
| const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)"; | ||
| const APP_USER_MODEL_ID = "com.t3tools.t3code"; | ||
| const LINUX_DESKTOP_ENTRY_NAME = isDevelopment ? "t3code-dev.desktop" : "t3code.desktop"; | ||
| const LINUX_WM_CLASS = isDevelopment ? "t3code-dev" : "t3code"; | ||
| const USER_DATA_DIR_NAME = isDevelopment ? "t3code-dev" : "t3code"; | ||
| const LEGACY_USER_DATA_DIR_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)"; | ||
| const APP_DISPLAY_NAME = isDevelopment ? "H3Code (Dev)" : "H3Code"; | ||
| const APP_USER_MODEL_ID = "com.h3tools.h3code"; | ||
| const LINUX_DESKTOP_ENTRY_NAME = isDevelopment ? "h3code-dev.desktop" : "h3code.desktop"; | ||
| const LINUX_WM_CLASS = isDevelopment ? "h3code-dev" : "h3code"; | ||
| const USER_DATA_DIR_NAME = isDevelopment ? "h3code-dev" : "h3code"; | ||
| const LEGACY_PRE_REBRAND_APP_NAME = ["T3", "Code"].join(" "); | ||
| const LEGACY_PRE_REBRAND_USER_DATA_DIR_NAME = isDevelopment | ||
| ? `${LEGACY_PRE_REBRAND_APP_NAME} (Dev)` | ||
| : `${LEGACY_PRE_REBRAND_APP_NAME} (Alpha)`; | ||
| const COMMIT_HASH_PATTERN = /^[0-9a-f]{7,40}$/i; | ||
| const COMMIT_HASH_DISPLAY_LENGTH = 12; | ||
| const LOG_DIR = Path.join(STATE_DIR, "logs"); | ||
|
|
@@ -659,7 +665,7 @@ function handleFatalStartupError(stage: string, error: unknown): void { | |
| console.error(`[desktop] fatal startup error (${stage})`, error); | ||
| if (!isQuitting) { | ||
| isQuitting = true; | ||
| dialog.showErrorBox("T3 Code failed to start", `Stage: ${stage}\n${message}${detail}`); | ||
| dialog.showErrorBox("H3Code failed to start", `Stage: ${stage}\n${message}${detail}`); | ||
| } | ||
| stopBackend(); | ||
| restoreStdIoCapture?.(); | ||
|
|
@@ -764,7 +770,7 @@ async function checkForUpdatesFromMenu(): Promise<void> { | |
| void dialog.showMessageBox({ | ||
| type: "info", | ||
| title: "You're up to date!", | ||
| message: `T3 Code ${updateState.currentVersion} is currently the newest version available.`, | ||
| message: `H3Code ${updateState.currentVersion} is currently the newest version available.`, | ||
| buttons: ["OK"], | ||
| }); | ||
| } else if (updateState.status === "error") { | ||
|
|
@@ -881,13 +887,10 @@ function resolveIconPath(ext: "ico" | "icns" | "png"): string | null { | |
| * Resolve the Electron userData directory path. | ||
| * | ||
| * Electron derives the default userData path from `productName` in | ||
| * package.json, which currently produces directories with spaces and | ||
| * parentheses (e.g. `~/.config/T3 Code (Alpha)` on Linux). This is | ||
| * unfriendly for shell usage and violates Linux naming conventions. | ||
| * | ||
| * We override it to a clean lowercase name (`t3code`). If the legacy | ||
| * directory already exists we keep using it so existing users don't | ||
| * lose their Chromium profile data (localStorage, cookies, sessions). | ||
| * package.json. Override it to a clean lowercase name so packaged and local | ||
| * builds keep stable paths across platforms. If the pre-rebrand path already | ||
| * exists we keep using it so existing users don't lose their Chromium profile | ||
| * data (localStorage, cookies, sessions). | ||
| */ | ||
| function resolveUserDataPath(): string { | ||
| const appDataBase = | ||
|
|
@@ -897,7 +900,7 @@ function resolveUserDataPath(): string { | |
| ? Path.join(OS.homedir(), "Library", "Application Support") | ||
| : process.env.XDG_CONFIG_HOME || Path.join(OS.homedir(), ".config"); | ||
|
|
||
| const legacyPath = Path.join(appDataBase, LEGACY_USER_DATA_DIR_NAME); | ||
| const legacyPath = Path.join(appDataBase, LEGACY_PRE_REBRAND_USER_DATA_DIR_NAME); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Electron userdata path missing intermediate legacy fallbackHigh Severity
Additional Locations (1)Reviewed by Cursor Bugbot for commit 752f261. Configure here. |
||
| if (FS.existsSync(legacyPath)) { | ||
| return legacyPath; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| export const APP_BASE_NAME = "T3 Code"; | ||
| export const APP_STAGE_LABEL = import.meta.env.DEV ? "Dev" : "Alpha"; | ||
| export const APP_BASE_NAME = "H3Code"; | ||
| export const APP_STAGE_LABEL = import.meta.env.APP_STAGE_LABEL; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 Low
-export const APP_STAGE_LABEL = import.meta.env.APP_STAGE_LABEL;
+export const APP_STAGE_LABEL = import.meta.env.APP_STAGE_LABEL || (import.meta.env.DEV ? "Dev" : "Alpha");🤖 Copy this AI Prompt to have your agent fix this: |
||
| export const APP_DISPLAY_NAME = `${APP_BASE_NAME} (${APP_STAGE_LABEL})`; | ||
| export const APP_VERSION = import.meta.env.APP_VERSION || "0.0.0"; | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing legacy fallback for home directory path change
High Severity
BASE_DIRdefaults changed from~/.t3to~/.h3codewith no fallback check for the old~/.t3path. UnlikeresolveUserDataPath()which checks if the legacy Electron userdata directory exists before switching to the new name,BASE_DIRunconditionally uses~/.h3code. Existing users with settings, saved environments, server state (state.sqlite), and logs stored under~/.t3/userdata/will silently lose access to all of that data on upgrade.Reviewed by Cursor Bugbot for commit 752f261. Configure here.