Index

Variables

Const logger

logger: Logger = new Logger("profiles")

Functions

checkProfilesUsage

  • checkProfilesUsage(profiles: ProfileInfo[]): Promise<void>

createProfile

  • createProfile(profileName: string): Promise<void>

findProfilePath

  • findProfilePath(profileName: string): Promise<string | null>
  • Find profile path by name

    Parameters

    • profileName: string

    Returns Promise<string | null>

findProfileSectionRange

  • findProfileSectionRange(lines: string[], targetName: string): { end: number; nameLineIndex: number; start: number } | null
  • Find profile section range in profiles.ini

    Parameters

    • lines: string[]
    • targetName: string

    Returns { end: number; nameLineIndex: number; start: number } | null

generateProfileDir

  • generateProfileDir(profileName: string): string
  • Generate unique profile directory name

    Parameters

    • profileName: string

    Returns string

getFirefoxCmd

  • getFirefoxCmd(): Promise<string>
  • Get the Firefox executable command for the current platform

    Returns Promise<string>

getProfilesDir

  • getProfilesDir(): Promise<string>
  • Get the Firefox profiles directory for the current platform

    Returns Promise<string>

isProfileInUse

  • isProfileInUse(profilePath: string): Promise<boolean>
  • Check if profile is in use

    Parameters

    • profilePath: string

    Returns Promise<boolean>

launchProfile

  • launchProfile(profileName: string): Promise<void>
  • Launch Firefox with profile

    Parameters

    • profileName: string

    Returns Promise<void>

listProfiles

parseIniLine

  • parseIniLine(line: string): [string, string] | null
  • Parse profiles.ini line into key-value pair

    Parameters

    • line: string

    Returns [string, string] | null

parseIniSections

parseProfilesIni

  • parseProfilesIni(content: string, profilesDir: string): { defaultProfile: string | null; profiles: ProfileInfo[] }
  • Parse profiles.ini content

    Parameters

    • content: string
    • profilesDir: string

    Returns { defaultProfile: string | null; profiles: ProfileInfo[] }

    • defaultProfile: string | null
    • profiles: ProfileInfo[]

processProfileSection

  • processProfileSection(data: Record<string, string>, profilesDir: string, defaultProfile: string | null): ProfileInfo | null
  • Process profile section data into ProfileInfo

    Parameters

    • data: Record<string, string>
    • profilesDir: string
    • defaultProfile: string | null

    Returns ProfileInfo | null

renameProfile

  • renameProfile(oldName: string, newName: string): Promise<void>
  • Rename Firefox profile

    Parameters

    • oldName: string
    • newName: string

    Returns Promise<void>

updateProfileNameInIni

  • updateProfileNameInIni(content: string, oldName: string, newName: string): string
  • Update profile name in profiles.ini

    Parameters

    • content: string
    • oldName: string
    • newName: string

    Returns string

validateProfileRename

  • validateProfileRename(profiles: ProfileInfo[], oldName: string, newName: string): void