mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { createContext } from 'react';
|
|
|
|
export interface GitCredential {
|
|
username: string;
|
|
password: string;
|
|
}
|
|
|
|
export interface GitHostToken {
|
|
token: string;
|
|
username?: string;
|
|
scopes?: string[];
|
|
createdAt?: number;
|
|
}
|
|
|
|
export interface GitSettings {
|
|
credentials: Record<string, GitCredential>; // keyed by origin
|
|
hostTokens: Record<string, GitHostToken>; // keyed by host domain (e.g., 'github.com')
|
|
name?: string;
|
|
email?: string;
|
|
coAuthorEnabled?: boolean;
|
|
}
|
|
|
|
export interface GitSettingsContextType {
|
|
settings: GitSettings;
|
|
updateSettings: (settings: Partial<GitSettings>) => void;
|
|
addCredential: (origin: string, credential: GitCredential) => void;
|
|
removeCredential: (origin: string) => void;
|
|
updateCredential: (origin: string, credential: Partial<GitCredential>) => void;
|
|
addHostToken: (host: string, token: GitHostToken) => void;
|
|
removeHostToken: (host: string) => void;
|
|
updateHostToken: (host: string, token: Partial<GitHostToken>) => void;
|
|
isConfigured: boolean;
|
|
isInitialized: boolean;
|
|
}
|
|
|
|
export const GitSettingsContext = createContext<GitSettingsContextType | undefined>(undefined); |