Open source CapCut alternative.
TypeScript
Fix Mac auth onboarding and OAuth routing
David Le5ac6459e7da5
diff --git a/apps/Donkey/Package.swift b/apps/Donkey/Package.swiftindex a8c7cf4a..dba5b83e 100644--- a/apps/Donkey/Package.swift+++ b/apps/Donkey/Package.swift@@ -60,6 +60,8 @@ let package = Package("Resources/Donkey.iconset"],resources: [+ .copy("Resources/donkey-app-icon.png"),+ .copy("Resources/google-sign-up-dark-rounded.png"),.copy("Resources/theme.json")]),diff --git a/apps/Donkey/Sources/Donkey/DonkeyLoginWindowController.swift b/apps/Donkey/Sources/Donkey/DonkeyLoginWindowController.swiftindex 53b6f42e..93b7ca62 100644--- a/apps/Donkey/Sources/Donkey/DonkeyLoginWindowController.swift+++ b/apps/Donkey/Sources/Donkey/DonkeyLoginWindowController.swift@@ -39,75 +39,43 @@ final class DonkeyLoginWindowController: NSWindowController {private struct DonkeyLoginView: View {@ObservedObject var authCoordinator: DonkeyAuthCoordinator+ @State private var screen: DonkeyLoginScreen++ init(authCoordinator: DonkeyAuthCoordinator) {+ self.authCoordinator = authCoordinator+ _screen = State(initialValue: Self.initialScreen(for: authCoordinator.phase))+ }var body: some View {ZStack {Color(red: 0.13, green: 0.13, blue: 0.12).ignoresSafeArea()- VStack(spacing: 0) {- Spacer(minLength: 68)-- DonkeyBurstMark()- .frame(width: 86, height: 86)- .padding(.bottom, 58)-- Text("Donkey for Mac")- .font(.system(size: 48, weight: .bold, design: .serif))- .foregroundStyle(.white)- .padding(.bottom, 18)-- Text("Sign in to start using Donkey on this Mac.")- .font(.system(size: 22, weight: .regular))- .foregroundStyle(.white.opacity(0.58))-- Spacer(minLength: 76)-- VStack(spacing: 16) {- Button {- authCoordinator.beginGoogleSignIn()- } label: {- HStack(spacing: 14) {- GoogleLetterMark()- .frame(width: 25, height: 25)- Text(buttonTitle)- .font(.system(size: 23, weight: .semibold))- }- .foregroundStyle(.black.opacity(0.82))- .frame(maxWidth: .infinity)- .frame(height: 60)- .background(- RoundedRectangle(cornerRadius: 14, style: .continuous)- .fill(Color.white.opacity(buttonIsDisabled ? 0.68 : 0.96))- )+ switch screen {+ case .welcome:+ DonkeyWelcomeScreen {+ withAnimation(.easeInOut(duration: 0.22)) {+ screen = .googleSignIn}- .buttonStyle(.plain)- .disabled(buttonIsDisabled)- .accessibilityLabel("Continue with Google")-- statusText- .font(.system(size: 14, weight: .medium))- .foregroundStyle(statusColor)- .frame(height: 20)}- .frame(width: 560)- .padding(.bottom, 70)+ case .googleSignIn:+ DonkeyGoogleSignInScreen(+ authCoordinator: authCoordinator,+ buttonIsDisabled: buttonIsDisabled,+ statusColor: statusColor,+ statusText: { statusText }+ )+ }+ }+ .onChange(of: authCoordinator.phase) { _, phase in+ if phase.requiresGoogleSignInScreen {+ screen = .googleSignIn}- .padding(.horizontal, 52)}}- private var buttonTitle: String {- switch authCoordinator.phase {- case .openingBrowser:- return "Opening Google..."- case .waitingForCallback:- return "Waiting for Google..."- case .exchangingSession:- return "Signing in..."- default:- return "Continue with Google"- }+ private static func initialScreen(for phase: DonkeyAuthPhase) -> DonkeyLoginScreen {+ phase.requiresGoogleSignInScreen ? .googleSignIn : .welcome}private var buttonIsDisabled: Bool {@@ -142,41 +110,185 @@ private struct DonkeyLoginView: View {}}-private struct DonkeyBurstMark: View {- private let rayCount = 12+private enum DonkeyLoginScreen {+ case welcome+ case googleSignIn+}++private extension DonkeyAuthPhase {+ var requiresGoogleSignInScreen: Bool {+ switch self {+ case .openingBrowser, .waitingForCallback, .exchangingSession, .failed:+ return true+ case .signedOut, .signedIn:+ return false+ }+ }+}++private struct DonkeyWelcomeScreen: View {+ var getStarted: () -> Voidvar body: some View {- ZStack {- RoundedRectangle(cornerRadius: 18, style: .continuous)- .fill(Color(red: 0.87, green: 0.43, blue: 0.28))-- ForEach(0..<rayCount, id: \.self) { index in- Capsule(style: .continuous)- .fill(.white)- .frame(width: 6, height: 54)- .offset(y: -21)- .rotationEffect(.degrees(Double(index) * (360 / Double(rayCount))))+ VStack(spacing: 0) {+ Spacer(minLength: 118)++ DonkeyAppIconMark()+ .frame(width: 116, height: 116)+ .padding(.bottom, 44)++ Text("Donkey")+ .font(.system(size: 56, weight: .bold, design: .serif))+ .foregroundStyle(.white)+ .padding(.bottom, 18)++ Text("Get Donkey set up on this Mac.")+ .font(.system(size: 22, weight: .regular))+ .foregroundStyle(.white.opacity(0.58))++ Spacer(minLength: 102)++ Button(action: getStarted) {+ Text("Get started")+ .font(.system(size: 23, weight: .semibold))+ .foregroundStyle(.black.opacity(0.84))+ .frame(maxWidth: .infinity)+ .frame(height: 60)+ .background(+ RoundedRectangle(cornerRadius: 14, style: .continuous)+ .fill(Color.white.opacity(0.96))+ )}+ .buttonStyle(.plain)+ .frame(width: 420)+ .accessibilityLabel("Get started")+ .padding(.bottom, 70)}- .shadow(color: .black.opacity(0.24), radius: 20, y: 14)+ .padding(.horizontal, 52)}}-private struct GoogleLetterMark: View {+private struct DonkeyGoogleSignInScreen<StatusText: View>: View {+ @ObservedObject var authCoordinator: DonkeyAuthCoordinator+ var buttonIsDisabled: Bool+ var statusColor: Color+ var statusText: () -> StatusText+var body: some View {- Text("G")- .font(.system(size: 25, weight: .bold, design: .rounded))- .foregroundStyle(- LinearGradient(- colors: [- Color(red: 0.26, green: 0.52, blue: 0.96),- Color(red: 0.18, green: 0.66, blue: 0.32),- Color(red: 0.98, green: 0.76, blue: 0.18),- Color(red: 0.92, green: 0.26, blue: 0.21)- ],- startPoint: .topLeading,- endPoint: .bottomTrailing- )+ VStack(spacing: 0) {+ Spacer(minLength: 142)++ Text("Sign In")+ .font(.system(size: 48, weight: .bold, design: .serif))+ .foregroundStyle(.white)++ Spacer(minLength: 90)++ VStack(spacing: 18) {+ Button {+ authCoordinator.beginGoogleSignIn()+ } label: {+ GoogleSignUpAsset()+ .opacity(buttonIsDisabled ? 0.58 : 1)+ }+ .buttonStyle(.plain)+ .disabled(buttonIsDisabled)+ .accessibilityLabel("Sign up with Google")++ statusText()+ .font(.system(size: 14, weight: .medium))+ .foregroundStyle(statusColor)+ .frame(height: 20)+ }+ .frame(width: 360, height: 184)+ .background(+ RoundedRectangle(cornerRadius: 44, style: .continuous)+ .fill(Color(red: 0.06, green: 0.06, blue: 0.055)))++ Spacer(minLength: 170)+ }+ .padding(.horizontal, 52)+ }+}++private struct DonkeyAppIconMark: View {+ var body: some View {+ Image(nsImage: Self.image)+ .resizable()+ .interpolation(.high)+ .scaledToFit()+ .clipShape(RoundedRectangle(cornerRadius: 24, style: .continuous))+ .shadow(color: .black.opacity(0.24), radius: 24, y: 16)+ }++ private static let image: NSImage = {+ if let url = Bundle.module.url(forResource: "donkey-app-icon", withExtension: "png"),+ let image = NSImage(contentsOf: url) {+ return image+ }++ return NSApp.applicationIconImage+ }()+}++private struct GoogleSignUpAsset: View {+ var body: some View {+ Group {+ if let image = Self.image {+ Image(nsImage: image)+ .resizable()+ .interpolation(.high)+ .scaledToFit()+ } else {+ GoogleSignUpFallback()+ }+ }+ .frame(width: 179, height: 40)+ }++ private static let image: NSImage? = {+ guard let url = Bundle.module.url(+ forResource: "google-sign-up-dark-rounded",+ withExtension: "png"+ ) else {+ return nil+ }++ return NSImage(contentsOf: url)+ }()+}++private struct GoogleSignUpFallback: View {+ var body: some View {+ HStack(spacing: 12) {+ Text("G")+ .font(.system(size: 18, weight: .bold, design: .rounded))+ .foregroundStyle(+ LinearGradient(+ colors: [+ Color(red: 0.26, green: 0.52, blue: 0.96),+ Color(red: 0.18, green: 0.66, blue: 0.32),+ Color(red: 0.98, green: 0.76, blue: 0.18),+ Color(red: 0.92, green: 0.26, blue: 0.21)+ ],+ startPoint: .topLeading,+ endPoint: .bottomTrailing+ )+ )++ Text("Sign up with Google")+ .font(.system(size: 15, weight: .semibold))+ .foregroundStyle(.white)+ }+ .frame(maxWidth: .infinity, maxHeight: .infinity)+ .background(+ RoundedRectangle(cornerRadius: 20, style: .continuous)+ .fill(Color(red: 0.11, green: 0.12, blue: 0.12))+ )+ .overlay(+ RoundedRectangle(cornerRadius: 20, style: .continuous)+ .stroke(.white.opacity(0.54), lineWidth: 1)+ )}}diff --git a/apps/Donkey/Sources/Donkey/Resources/donkey-app-icon.png b/apps/Donkey/Sources/Donkey/Resources/donkey-app-icon.pngnew file mode 100644index 00000000..1635ef4cBinary files /dev/null and b/apps/Donkey/Sources/Donkey/Resources/donkey-app-icon.png differdiff --git a/apps/Donkey/Sources/Donkey/Resources/google-sign-up-dark-rounded.png b/apps/Donkey/Sources/Donkey/Resources/google-sign-up-dark-rounded.pngnew file mode 100644index 00000000..b29ddf84Binary files /dev/null and b/apps/Donkey/Sources/Donkey/Resources/google-sign-up-dark-rounded.png differdiff --git a/docs/guides/pointer-prompt-overlay.md b/docs/guides/pointer-prompt-overlay.mdindex ff772fbd..58994c48 100644--- a/docs/guides/pointer-prompt-overlay.md+++ b/docs/guides/pointer-prompt-overlay.md@@ -5,10 +5,11 @@Donkey supports a floating macOS overlay for conversational task threads andquick local-app actions:-- On first launch, Donkey shows a Google-only Mac sign-in window before starting- the overlay. Until the browser returns through the `donkey://auth/callback`- handoff and the app exchanges the returned code for a Better Auth cookie, the- notch surface is not shown and double-Command activation is not registered.+- On first launch, Donkey shows a native welcome screen, then a Google-only Mac+ sign-in screen before starting the overlay. Until the browser returns through+ the `donkey://auth/callback` handoff and the app exchanges the returned code+ for a Better Auth cookie, the notch surface is not shown and double-Command+ activation is not registered.- Double-tap Command and release to open a centered prompt with keyboard focus.- Double-tap Command and hold the second press to open the prompt in voice mode.- Show a top-center notch status surface for task progress, recent tasks, follow-up input, file drops, updates, and per-task pause/resume.diff --git a/site/next.config.ts b/site/next.config.tsindex c7714fa6..3a65376d 100644--- a/site/next.config.ts+++ b/site/next.config.ts@@ -3,7 +3,6 @@ import type { NextConfig } from "next";const nextConfig: NextConfig = {pageExtensions: ["js", "jsx", "ts", "tsx", "md", "mdx"],- trailingSlash: true,};const withMDX = createMDX({diff --git a/site/src/app/_components/landing/AuthScreen.tsx b/site/src/app/_components/landing/AuthScreen.tsxindex dae0e4b4..92325361 100644--- a/site/src/app/_components/landing/AuthScreen.tsx+++ b/site/src/app/_components/landing/AuthScreen.tsx@@ -198,14 +198,14 @@ export function AuthScreen({ mode }: Props) {>By continuing, you agree to the{" "}<a- href="/terms/"+ href="/terms"style={{ color: BLACK, fontWeight: 800 }}>Terms of Use</a>{" "}and{" "}<a- href="/privacy/"+ href="/privacy"style={{ color: BLACK, fontWeight: 800 }}>Privacy Policydiff --git a/site/src/app/_components/landing/Footer.tsx b/site/src/app/_components/landing/Footer.tsxindex 55ae07c4..4062daf6 100644--- a/site/src/app/_components/landing/Footer.tsx+++ b/site/src/app/_components/landing/Footer.tsx@@ -92,7 +92,7 @@ export function Footer() {}}><a- href="/privacy/"+ href="/privacy"style={{color: BLACK,fontWeight: 800,@@ -102,7 +102,7 @@ export function Footer() {Privacy Policy</a><a- href="/terms/"+ href="/terms"style={{color: BLACK,fontWeight: 800,diff --git a/site/src/app/legal/LegalPageShell.tsx b/site/src/app/legal/LegalPageShell.tsxindex 2ab791e5..c567ac16 100644--- a/site/src/app/legal/LegalPageShell.tsx+++ b/site/src/app/legal/LegalPageShell.tsx@@ -10,7 +10,7 @@ type Props = {export function LegalPageShell({ children }: Props) {return (<main className="min-h-screen bg-[#F5EFE0] text-[#0F0E0D] antialiased [font-family:-apple-system,BlinkMacSystemFont,'Segoe_UI',sans-serif]">- <TopNav ctaHref="/install/" ctaLabel="Download" />+ <TopNav ctaHref="/install" ctaLabel="Download" /><section className="mx-auto box-border w-full max-w-5xl px-6 py-12 md:px-10 md:py-20"><article className="prose prose-neutral max-w-none prose-headings:font-black prose-headings:tracking-normal prose-h1:text-5xl prose-h1:leading-none prose-h2:mt-12 prose-h2:border-t prose-h2:border-black/15 prose-h2:pt-8 prose-a:font-bold prose-a:text-black prose-strong:text-black md:prose-h1:text-7xl">{children}diff --git a/site/src/app/legal/TermsOfService.mdx b/site/src/app/legal/TermsOfService.mdxindex 66a0d2d2..ac6eae55 100644--- a/site/src/app/legal/TermsOfService.mdx+++ b/site/src/app/legal/TermsOfService.mdx@@ -260,7 +260,7 @@ We reserve the right, but not the obligation, to: (1) monitor the Services for v### 13. PRIVACY POLICY-We care about data privacy and security. Please review our Privacy Policy: https://donkeyuse.com/privacy/. By using the Services, you agree to be bound by our Privacy Policy, which is incorporated into these Legal Terms. Please be advised the Services are hosted in the United States. If you access the Services from another region of the world with laws or requirements governing personal data collection, use, or disclosure that differ from applicable laws in the United States, then through your continued use of the Services, your information may be transferred to and processed in the United States and other countries where we or our service providers operate.+We care about data privacy and security. Please review our Privacy Policy: https://donkeyuse.com/privacy. By using the Services, you agree to be bound by our Privacy Policy, which is incorporated into these Legal Terms. Please be advised the Services are hosted in the United States. If you access the Services from another region of the world with laws or requirements governing personal data collection, use, or disclosure that differ from applicable laws in the United States, then through your continued use of the Services, your information may be transferred to and processed in the United States and other countries where we or our service providers operate.### 14. COPYRIGHT INFRINGEMENTSdiff --git a/site/src/app/privacy/layout.tsx b/site/src/app/privacy/layout.tsxindex 8055e836..85c09e4a 100644--- a/site/src/app/privacy/layout.tsx+++ b/site/src/app/privacy/layout.tsx@@ -3,7 +3,7 @@ import type { ReactNode } from "react";export const metadata: Metadata = {alternates: {- canonical: "https://donkeyuse.com/privacy/",+ canonical: "https://donkeyuse.com/privacy",},description: "Read the Donkey privacy policy.",title: "Privacy Policy | Donkey",diff --git a/site/src/app/sitemap.ts b/site/src/app/sitemap.tsindex d12cff0c..4c41be8e 100644--- a/site/src/app/sitemap.ts+++ b/site/src/app/sitemap.ts@@ -16,25 +16,25 @@ export default function sitemap(): MetadataRoute.Sitemap {changeFrequency: "monthly",lastModified,priority: 0.8,- url: `${SITE_URL}/install/`,+ url: `${SITE_URL}/install`,},{changeFrequency: "monthly",lastModified,priority: 0.8,- url: `${SITE_URL}/pricing/`,+ url: `${SITE_URL}/pricing`,},{changeFrequency: "yearly",lastModified,priority: 0.5,- url: `${SITE_URL}/privacy/`,+ url: `${SITE_URL}/privacy`,},{changeFrequency: "yearly",lastModified,priority: 0.5,- url: `${SITE_URL}/terms/`,+ url: `${SITE_URL}/terms`,},];}diff --git a/site/src/app/terms/layout.tsx b/site/src/app/terms/layout.tsxindex 81d99f15..fc877421 100644--- a/site/src/app/terms/layout.tsx+++ b/site/src/app/terms/layout.tsx@@ -3,7 +3,7 @@ import type { ReactNode } from "react";export const metadata: Metadata = {alternates: {- canonical: "https://donkeyuse.com/terms/",+ canonical: "https://donkeyuse.com/terms",},description: "Read the Donkey terms of use.",title: "Terms of Use | Donkey",