removed supabase placeholder dependency completely for smooth startup and added macos scripts too. updated README.md for more info

main
greeneu 2 years ago
parent 036cca5881
commit 688eb2a5c8

@ -1,5 +1,23 @@
# Interview Coder - Unlocked Edition - Changes # Interview Coder - Unlocked Edition - Changes
## Major Architectural Changes
### Removal of Supabase Authentication System
1. **Complete Removal of Supabase Dependencies**:
- Removed all Supabase code, imports, and API calls
- Eliminated the authentication system completely
- Removed all subscription and payment-related code
2. **Replaced with Local Configuration**:
- Added `ConfigHelper.ts` for local storage of settings
- Implemented direct OpenAI API integration
- Created a simplified settings system with model selection
3. **User Interface Simplification**:
- Removed login/signup screens
- Added a welcome screen for new users
- Added comprehensive settings dialog for API key and model management
## Fixes and Improvements ## Fixes and Improvements
### UI Improvements ### UI Improvements

@ -17,7 +17,7 @@ The best coding interview tools are often behind expensive paywalls, making them
The codebase is designed to be adaptable: The codebase is designed to be adaptable:
- **AI Models**: Though currently using OpenAI's models, you can modify the code to integrate with other providers like Claude, Deepseek, Llama, or any model with an API - **AI Models**: Though currently using OpenAI's models, you can modify the code to integrate with other providers like Claude, Deepseek, Llama, or any model with an API. All integration code is in `electron/ProcessingHelper.ts` and UI settings are in `src/components/Settings/SettingsDialog.tsx`.
- **Languages**: Add support for additional programming languages - **Languages**: Add support for additional programming languages
- **Features**: Extend the functionality with new capabilities - **Features**: Extend the functionality with new capabilities
- **UI**: Customize the interface to your preferences - **UI**: Customize the interface to your preferences
@ -84,7 +84,7 @@ Note: The application is **NOT** invisible to:
## Running the Application ## Running the Application
### Initial Setup ### Quick Start
1. Clone the repository: 1. Clone the repository:
@ -99,59 +99,51 @@ cd interview-coder-unlocked
npm install npm install
``` ```
This will install all required npm packages including Electron, React, TypeScript, and other dependencies needed for the application. 3. **RECOMMENDED**: Clean any previous builds:
### Running in Stealth Mode
For the best experience, follow these steps to run the application:
1. First, clean any previous builds:
```bash ```bash
npm run clean npm run clean
``` ```
This command removes the `dist` and `dist-electron` directories to ensure a fresh build without any cached files or outdated components. 4. Run the appropriate script for your platform:
2. Then run the stealth-run batch file:
**For Windows:**
```bash ```bash
stealth-run.bat stealth-run.bat
``` ```
**What the stealth-run.bat does:** **For macOS/Linux:**
- Creates necessary directories in your AppData folder for storing screenshots and cache ```bash
- Builds the application in production mode # Make the script executable first
- Launches the application in stealth mode (invisible by default) chmod +x stealth-run.sh
- Provides a reminder of key shortcuts ./stealth-run.sh
```
**IMPORTANT**: When using stealth-run.bat, the application window will be invisible by default! Use Ctrl+B (or Cmd+B on Mac) to toggle visibility. **IMPORTANT**: The application window will be invisible by default! Use Ctrl+B (or Cmd+B on Mac) to toggle visibility.
### Troubleshooting **What the scripts do:**
- Create necessary directories for the application
- Clean previous builds to ensure a fresh start
- Build the application in production mode
- Launch the application in invisible mode
If you encounter any issues with the application: ### Notes & Troubleshooting
1. Always start with a clean build: - **Window Manager Compatibility**: Some window management tools (like Rectangle Pro on macOS) may interfere with the app's window movement. Consider disabling them temporarily.
```bash - **API Usage**: Be mindful of your OpenAI API key's rate limits and credit usage. Vision API calls are more expensive than text-only calls.
npm run clean
```
2. Make sure you have the latest dependencies: - **LLM Customization**: You can easily customize the app to include LLMs like Claude, Deepseek, or Grok by modifying the API calls in `ProcessingHelper.ts` and related UI components.
```bash - **Common Issues**:
npm install - Run `npm run clean` before starting the app for a fresh build
``` - Use Ctrl+B/Cmd+B multiple times if the window doesn't appear
- Adjust window opacity with Ctrl+[/]/Cmd+[/] if needed
3. If the window is invisible and keyboard shortcuts don't seem to work, try: - For macOS: ensure script has execute permissions (`chmod +x stealth-run.sh`)
- Pressing Ctrl+B (or Cmd+B on Mac) multiple times
- Checking Task Manager/Activity Monitor to verify the application is running
- Restarting the application
## Comparison with Paid Version of Interview Coder ## Comparison with Paid Version of Interview Coder
| Feature | Interview Coder (Paid) | Interview Coder Unlocked (This Project) | | Feature | Interview Coder (Paid) | Interview Coder Unlocked (This Project) |
|---------|------------------------|----------------------------------------|
| Price | $60/month subscription | Free (only pay for your API usage) | | Price | $60/month subscription | Free (only pay for your API usage) |
| Solution Generation | ✅ | ✅ | | Solution Generation | ✅ | ✅ |
| Debugging Assistance | ✅ | ✅ | | Debugging Assistance | ✅ | ✅ |
@ -206,30 +198,15 @@ npm install
- Window remains invisible to specified screen sharing applications - Window remains invisible to specified screen sharing applications
- Reset view using [Control or Cmd + R] - Reset view using [Control or Cmd + R]
## Using Custom AI Models ## Adding More AI Models
This application currently uses OpenAI's GPT models, but you can adapt it to work with other AI providers:
### Integration Points
The main integration point is in `electron/ProcessingHelper.ts`, which handles:
1. **Problem Extraction**: Converting screenshots to text and understanding the problem
2. **Solution Generation**: Creating optimized solutions with explanations
3. **Debugging**: Analyzing code errors and providing improvement suggestions
### Steps to Integrate Different Models This application is built with extensibility in mind. You can easily add support for additional LLMs alongside the existing OpenAI integration:
1. Replace the OpenAI client initialization with your preferred AI provider's SDK - You can add Claude, Deepseek, Grok, or any other AI model as alternative options
2. Modify the API calls in `processScreenshotsHelper`, `generateSolutionsHelper`, and `processExtraScreenshotsHelper` methods - The application architecture allows for multiple LLM backends to coexist
3. Adjust prompt formats based on your chosen model's capabilities - Users can have the freedom to choose their preferred AI provider
4. Update the UI components in `src/components/Settings/SettingsDialog.tsx` to reflect your model options
Common alternative AI providers to consider: To add new models, simply extend the API integration in `electron/ProcessingHelper.ts` and add the corresponding UI options in `src/components/Settings/SettingsDialog.tsx`. The modular design makes this straightforward without disrupting existing functionality.
- Anthropic's Claude (good vision capabilities)
- Deepseek (strong coding performance)
- Self-hosted open-source models (Llama, Mixtral)
- Azure OpenAI Service (same API but with Azure integration)
## Configuration ## Configuration

@ -0,0 +1,26 @@
#!/bin/bash
echo "Cleaning up project for GitHub..."
echo "Removing node_modules directory..."
rm -rf node_modules
echo "Removing dist directory..."
rm -rf dist
echo "Removing dist-electron directory..."
rm -rf dist-electron
echo "Removing release directory..."
rm -rf release
echo "Removing package-lock.json..."
rm -f package-lock.json
echo "Removing any .env files..."
rm -f .env .env.local .env.development .env.production
echo "Cleanup complete!"
echo "Ready to commit to GitHub."
echo "Run 'npm install' after cloning to install dependencies."
echo "Press Enter to continue..."
read

@ -492,12 +492,7 @@ function loadEnvVariables() {
) )
dotenv.config({ path: path.join(process.resourcesPath, ".env") }) dotenv.config({ path: path.join(process.resourcesPath, ".env") })
} }
console.log("Loaded environment variables:", { console.log("Environment variables loaded for open-source version")
VITE_SUPABASE_URL: process.env.VITE_SUPABASE_URL ? "exists" : "missing",
VITE_SUPABASE_ANON_KEY: process.env.VITE_SUPABASE_ANON_KEY
? "exists"
: "missing"
})
} }
// Initialize application // Initialize application

@ -118,7 +118,6 @@
"@radix-ui/react-label": "^2.1.0", "@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-toast": "^1.2.2", "@radix-ui/react-toast": "^1.2.2",
"@supabase/supabase-js": "^2.39.0",
"@tanstack/react-query": "^5.64.0", "@tanstack/react-query": "^5.64.0",
"axios": "^1.7.7", "axios": "^1.7.7",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",

@ -1,122 +1,40 @@
import { createClient } from "@supabase/supabase-js" // This file has been emptied to remove Supabase dependencies.
// The open-source version uses local configuration instead.
console.log("Supabase URL:", import.meta.env.VITE_SUPABASE_URL) // Export empty objects to prevent import errors in case any components still reference this file
console.log( export const supabase = {
"Supabase Anon Key:",
import.meta.env.VITE_SUPABASE_ANON_KEY?.slice(0, 10) + "..."
)
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY
if (!supabaseUrl || !supabaseAnonKey) {
throw new Error("Missing Supabase environment variables")
}
export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
auth: { auth: {
flowType: "pkce", getUser: async () => ({ data: { user: null } }),
detectSessionInUrl: true, onAuthStateChange: () => ({ data: { subscription: { unsubscribe: () => {} } } }),
persistSession: true, signOut: async () => ({ error: null }),
autoRefreshToken: true, exchangeCodeForSession: async () => ({ error: null }),
debug: true, signInWithOAuth: async () => ({ data: null, error: null })
storage: {
getItem: (key) => {
const item = localStorage.getItem(key)
console.log("Auth storage - Getting key:", key, "Value exists:", !!item)
return item
},
setItem: (key, value) => {
console.log("Auth storage - Setting key:", key)
localStorage.setItem(key, value)
},
removeItem: (key) => {
console.log("Auth storage - Removing key:", key)
localStorage.removeItem(key)
}
}
}, },
realtime: { from: () => ({
params: { select: () => ({
eventsPerSecond: 10 eq: () => ({
}, single: async () => null,
headers: { maybeSingle: async () => null
apikey: supabaseAnonKey
}
}
})
export const signInWithGoogle = async () => {
try {
console.log("Initiating Google sign in...")
const { data, error } = await supabase.auth.signInWithOAuth({
provider: "google",
options: {
redirectTo: window.location.origin
}
})
if (error) {
console.error("Google sign in error:", error)
throw error
}
console.log("Google sign in response:", data)
return data
} catch (error) {
console.error("Unexpected error during Google sign in:", error)
throw error
}
}
let channel: ReturnType<typeof supabase.channel> | null = null
// Monitor auth state changes and manage realtime connection
supabase.auth.onAuthStateChange((event, session) => {
console.log("Auth state changed:", event, session?.user?.id)
console.log("Full session data:", session)
if (event === "SIGNED_IN" && session) {
// Only establish realtime connection after successful sign in
console.log("Establishing realtime connection...")
// Clean up existing channel if any
if (channel) {
channel.unsubscribe()
}
channel = supabase.channel("system", {
config: {
presence: {
key: session.user.id
}
}
})
channel
.on("system", { event: "*" }, (payload) => {
console.log("System event:", payload)
}) })
.subscribe((status) => { }),
console.log("Realtime subscription status:", status) update: () => ({
if (status === "SUBSCRIBED") { eq: () => ({
console.log("Successfully connected to realtime system") select: () => ({
} single: async () => null
if (status === "CHANNEL_ERROR") { })
console.error("Realtime connection error - will retry in 5s")
setTimeout(() => {
channel?.subscribe()
}, 5000)
}
}) })
} })
}),
channel: () => ({
on: () => ({
subscribe: () => ({
unsubscribe: () => {}
})
})
})
};
if (event === "SIGNED_OUT") { export const signInWithGoogle = async () => {
// Clean up realtime connection on sign out console.log("Sign in with Google not available in open-source version");
if (channel) { return { data: null };
console.log("Cleaning up realtime connection") };
channel.unsubscribe()
channel = null
}
}
})

@ -18,16 +18,22 @@ echo.
cd /D "%~dp0" cd /D "%~dp0"
echo 1. Creating required directories... echo === Step 1: Creating required directories... ===
mkdir "%APPDATA%\interview-coder-v1\temp" 2>nul mkdir "%APPDATA%\interview-coder-v1\temp" 2>nul
mkdir "%APPDATA%\interview-coder-v1\cache" 2>nul mkdir "%APPDATA%\interview-coder-v1\cache" 2>nul
mkdir "%APPDATA%\interview-coder-v1\screenshots" 2>nul mkdir "%APPDATA%\interview-coder-v1\screenshots" 2>nul
mkdir "%APPDATA%\interview-coder-v1\extra_screenshots" 2>nul mkdir "%APPDATA%\interview-coder-v1\extra_screenshots" 2>nul
echo 2. Building application... echo === Step 2: Cleaning previous builds... ===
echo Removing old build files to ensure a fresh start...
rmdir /s /q dist dist-electron 2>nul
del /q .env 2>nul
echo === Step 3: Building application... ===
echo This may take a moment...
call npm run build call npm run build
echo 3. Launching in stealth mode... echo === Step 4: Launching in stealth mode... ===
echo Remember: Press Ctrl+B to make it visible, Ctrl+[ and Ctrl+] to adjust opacity! echo Remember: Press Ctrl+B to make it visible, Ctrl+[ and Ctrl+] to adjust opacity!
echo. echo.
set NODE_ENV=production set NODE_ENV=production
@ -35,3 +41,7 @@ start /B cmd /c "npx electron ./dist-electron/main.js"
echo App is now running invisibly! Press Ctrl+B to make it visible. echo App is now running invisibly! Press Ctrl+B to make it visible.
echo. echo.
echo If you encounter any issues:
echo 1. Make sure you've installed dependencies with 'npm install'
echo 2. Press Ctrl+B multiple times to toggle visibility
echo 3. Check Task Manager to verify the app is running

@ -0,0 +1,49 @@
#!/bin/bash
echo "=== Interview Coder - Invisible Edition (No Paywall) ==="
echo
echo "IMPORTANT: This app is designed to be INVISIBLE by default!"
echo "Use the keyboard shortcuts to control it:"
echo
echo "- Toggle Visibility: Cmd+B"
echo "- Take Screenshot: Cmd+H"
echo "- Process Screenshots: Cmd+Enter"
echo "- Move Window: Cmd+Arrows (Left/Right/Up/Down)"
echo "- Adjust Opacity: Cmd+[ (decrease) / Cmd+] (increase)"
echo "- Reset View: Cmd+R"
echo "- Quit App: Cmd+Q"
echo
echo "When you press Cmd+B, the window will toggle between visible and invisible."
echo "If movement shortcuts aren't working, try making the window visible first with Cmd+B."
echo
# Navigate to script directory
cd "$(dirname "$0")"
echo "=== Step 1: Creating required directories... ==="
mkdir -p ~/Library/Application\ Support/interview-coder-v1/temp
mkdir -p ~/Library/Application\ Support/interview-coder-v1/cache
mkdir -p ~/Library/Application\ Support/interview-coder-v1/screenshots
mkdir -p ~/Library/Application\ Support/interview-coder-v1/extra_screenshots
echo "=== Step 2: Cleaning previous builds... ==="
echo "Removing old build files to ensure a fresh start..."
rm -rf dist dist-electron
rm -f .env
echo "=== Step 3: Building application... ==="
echo "This may take a moment..."
npm run build
echo "=== Step 4: Launching in stealth mode... ==="
echo "Remember: Cmd+B to make it visible, Cmd+[ and Cmd+] to adjust opacity!"
echo
export NODE_ENV=production
npx electron ./dist-electron/main.js &
echo "App is now running invisibly! Press Cmd+B to make it visible."
echo
echo "If you encounter any issues:"
echo "1. Make sure you've installed dependencies with 'npm install'"
echo "2. Make sure this script has execute permissions (chmod +x stealth-run.sh)"
echo "3. Press Cmd+B multiple times to toggle visibility"
echo "4. Check Activity Monitor to verify the app is running"
Loading…
Cancel
Save