Add OAuth login support and streamline authentication flows
- Introduced `oauthLogin` method in `electron/preload.ts` and backend IPC handlers for OAuth via `BrowserWindow`. - Replaced web-based OAuth redirection with Electron-specific implementation for Google, Facebook, and Apple. - Refactored `SocialForm.tsx` to handle OAuth login success and token management via Electron. - Updated `User`, `QuillSense`, and context methods to include `quill-trial` subscriptions and extended login logic. - Cleaned up code, removed unused imports, and improved error handling for authentication scenarios.
This commit is contained in:
@@ -19,7 +19,8 @@ export interface Conversation {
|
||||
type?: ConversationType;
|
||||
messages: Message[];
|
||||
status: number;
|
||||
totalPrice?: number;
|
||||
totalPrice?: number
|
||||
useYourKey?: boolean;
|
||||
}
|
||||
|
||||
export interface AIGeneratedText {
|
||||
@@ -34,21 +35,25 @@ export interface AIResponseWithCredits<T> {
|
||||
data: T;
|
||||
}
|
||||
|
||||
export interface AIDictionary extends AIResponseWithCredits<DictionaryAIResponse> {}
|
||||
export interface AIDictionary extends AIResponseWithCredits<DictionaryAIResponse> {
|
||||
}
|
||||
|
||||
export interface AIGeneratedTextData {
|
||||
totalCost: number;
|
||||
response: string;
|
||||
}
|
||||
export interface AIGeneratedText extends AIResponseWithCredits<AIGeneratedTextData> {}
|
||||
|
||||
export interface AIInspire extends AIResponseWithCredits<InspireAIResponse> {}
|
||||
export interface AIGeneratedText extends AIResponseWithCredits<AIGeneratedTextData> {
|
||||
}
|
||||
|
||||
export interface AISynonyms extends AIResponseWithCredits<SynonymsAIResponse> {}
|
||||
export interface AIInspire extends AIResponseWithCredits<InspireAIResponse> {
|
||||
}
|
||||
|
||||
export interface AIVerbConjugation extends AIResponseWithCredits<unknown> {}
|
||||
export interface AISynonyms extends AIResponseWithCredits<SynonymsAIResponse> {
|
||||
}
|
||||
|
||||
export interface AISimpleText extends AIResponseWithCredits<string> {}
|
||||
export interface AIVerbConjugation extends AIResponseWithCredits<unknown> {
|
||||
}
|
||||
|
||||
interface InspireAIResponse {
|
||||
ideas: {
|
||||
@@ -80,10 +85,6 @@ export interface InspirationAIIdea {
|
||||
relatedTo: string;
|
||||
}
|
||||
|
||||
export interface InspiredAIResponse {
|
||||
ideas: InspirationAIIdea[];
|
||||
}
|
||||
|
||||
export interface ConversationProps {
|
||||
id: string;
|
||||
mode: string;
|
||||
@@ -94,8 +95,13 @@ export interface ConversationProps {
|
||||
|
||||
export default class QuillSense {
|
||||
static getSubLevel(session: SessionProps): number {
|
||||
const currentSub: Subscription | null = User.getCurrentSubscription(session?.user, 'quill-sense');
|
||||
if (!currentSub) return 0;
|
||||
let currentSub: Subscription | null = User.getCurrentSubscription(session?.user, 'quill-sense');
|
||||
if (!currentSub) {
|
||||
currentSub = User.getCurrentSubscription(session?.user, 'quill-trial');
|
||||
if (!currentSub) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
switch (currentSub?.subTier) {
|
||||
case 1:
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user