From 6fc649d8897680f8f1bbfe625aee11afcdd64c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sat, 9 May 2026 02:46:07 -0400 Subject: [PATCH] Add protocol brand contract --- crates/ely_app/src/brand.rs | 11 ++++++++++- crates/ely_app/src/main.rs | 10 +++++----- crates/ely_app/src/shell/internal_pages/about.rs | 11 ++++++++++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/crates/ely_app/src/brand.rs b/crates/ely_app/src/brand.rs index fbbfcbc..89db77c 100644 --- a/crates/ely_app/src/brand.rs +++ b/crates/ely_app/src/brand.rs @@ -2,10 +2,16 @@ pub(crate) const PRODUCT_NAME: &str = "ELY Browser"; pub(crate) const FORMAL_PRODUCT_NAME: &str = "ELY Browser by Elydora"; pub(crate) const COMPANY_NAME: &str = "Elydora"; pub(crate) const SYNC_SERVICE_NAME: &str = "Elydora Cloud"; +pub(crate) const DEEP_LINK_SCHEME: &str = "ely"; +pub(crate) const DEEP_LINK_PREFIX: &str = "ely://"; +pub(crate) const AUTH_CALLBACK_URL: &str = "ely://auth/callback"; #[cfg(test)] mod tests { - use super::{COMPANY_NAME, FORMAL_PRODUCT_NAME, PRODUCT_NAME, SYNC_SERVICE_NAME}; + use super::{ + AUTH_CALLBACK_URL, COMPANY_NAME, DEEP_LINK_PREFIX, DEEP_LINK_SCHEME, FORMAL_PRODUCT_NAME, + PRODUCT_NAME, SYNC_SERVICE_NAME, + }; #[test] fn brand_identity_matches_prd_names() { @@ -13,5 +19,8 @@ mod tests { assert_eq!(FORMAL_PRODUCT_NAME, "ELY Browser by Elydora"); assert_eq!(COMPANY_NAME, "Elydora"); assert_eq!(SYNC_SERVICE_NAME, "Elydora Cloud"); + assert_eq!(DEEP_LINK_SCHEME, "ely"); + assert_eq!(DEEP_LINK_PREFIX, "ely://"); + assert_eq!(AUTH_CALLBACK_URL, "ely://auth/callback"); } } diff --git a/crates/ely_app/src/main.rs b/crates/ely_app/src/main.rs index 0bb6a33..d6e3efb 100644 --- a/crates/ely_app/src/main.rs +++ b/crates/ely_app/src/main.rs @@ -19,7 +19,7 @@ use gpui_component_assets::Assets; use shell::ElyShell; use shortcuts::bind_shortcuts; -use crate::brand::PRODUCT_NAME; +use crate::brand::{DEEP_LINK_PREFIX, PRODUCT_NAME}; actions!( ely_app, @@ -275,12 +275,12 @@ fn open_deep_link(target: &BrowserWindowTarget, url: UrlText, cx: &mut App) -> b fn parse_ely_deep_link(value: &str) -> Option { let trimmed = value.trim(); - let scheme = trimmed.get(..6)?; - let route = trimmed.get(6..)?; + let scheme = trimmed.get(..DEEP_LINK_PREFIX.len())?; + let route = trimmed.get(DEEP_LINK_PREFIX.len()..)?; scheme - .eq_ignore_ascii_case("ely://") - .then(|| UrlText::parse(format!("ely://{route}")).ok()) + .eq_ignore_ascii_case(DEEP_LINK_PREFIX) + .then(|| UrlText::parse(format!("{DEEP_LINK_PREFIX}{route}")).ok()) .flatten() } diff --git a/crates/ely_app/src/shell/internal_pages/about.rs b/crates/ely_app/src/shell/internal_pages/about.rs index 6a54208..adc80e0 100644 --- a/crates/ely_app/src/shell/internal_pages/about.rs +++ b/crates/ely_app/src/shell/internal_pages/about.rs @@ -3,7 +3,10 @@ use ely_design_system::colors; use gpui::{AnyElement, IntoElement, ParentElement, Styled, div, px, rgb}; use gpui_component::{IconName, StyledExt, scroll::ScrollableElement}; -use crate::brand::{COMPANY_NAME, FORMAL_PRODUCT_NAME, PRODUCT_NAME, SYNC_SERVICE_NAME}; +use crate::brand::{ + AUTH_CALLBACK_URL, COMPANY_NAME, DEEP_LINK_PREFIX, DEEP_LINK_SCHEME, FORMAL_PRODUCT_NAME, + PRODUCT_NAME, SYNC_SERVICE_NAME, +}; use super::{ElyShell, render_canvas_surface}; @@ -79,6 +82,12 @@ fn render_about_rows(snapshot: &BrowserSnapshot) -> AnyElement { )) .child(about_row(IconName::Building2, "Publisher", COMPANY_NAME, "Brand owner")) .child(about_row(IconName::Globe, "Service", SYNC_SERVICE_NAME, "Sync and release service")) + .child(about_row( + IconName::ExternalLink, + "Protocol", + DEEP_LINK_PREFIX, + format!("scheme: {DEEP_LINK_SCHEME}; auth: {AUTH_CALLBACK_URL}"), + )) .child(about_row(IconName::Info, "Version", APP_VERSION, "Cargo package version")) .child(about_row(IconName::GitHub, "Build", BUILD_REVISION, "Git revision")) .child(about_row(