Safe Haskell | None |
---|
A module for working with Firefox profiles. Firefox profiles are manipulated in pure code and then "prepared" for network transmission.
- data Firefox
- data Profile b = Profile {}
- data PreparedProfile b
- data ProfilePref
- = PrefInteger !Integer
- | PrefDouble !Double
- | PrefString !Text
- | PrefBool !Bool
- class ToPref a where
- toPref :: a -> ProfilePref
- addPref :: ToPref a => Text -> a -> Profile b -> Profile b
- getPref :: Text -> Profile b -> Maybe ProfilePref
- deletePref :: Text -> Profile b -> Profile b
- addExtension :: FilePath -> Profile b -> Profile b
- deleteExtension :: FilePath -> Profile b -> Profile b
- loadProfile :: MonadBaseControl IO m => FilePath -> m (Profile Firefox)
- prepareProfile :: MonadBase IO m => Profile Firefox -> m (PreparedProfile Firefox)
- prepareTempProfile :: MonadBase IO m => (Profile Firefox -> Profile Firefox) -> m (PreparedProfile Firefox)
- prepareLoadedProfile :: MonadBaseControl IO m => FilePath -> (Profile Firefox -> Profile Firefox) -> m (PreparedProfile Firefox)
Profiles
Phantom type used in the parameters of Profile
and PreparedProfile
This structure allows you to construct and manipulate profiles in pure code, deferring execution of IO operations until the profile is "prepared". This type is shared by both Firefox and Opera profile code; when a distinction must be made, the phantom type parameter is used to differentiate.
Profile | |
|
data PreparedProfile b Source
Represents a profile that has been prepared for network transmission. The profile cannot be modified in this form.
Eq (PreparedProfile b) | |
Show (PreparedProfile b) | |
ToJSON (PreparedProfile s) | |
FromJSON (PreparedProfile s) |
Preferences
data ProfilePref Source
A profile preference value. This is the subset of JSON values that excludes arrays, objects, and null.
A typeclass to convert types to profile preference values
toPref :: a -> ProfilePrefSource
addPref :: ToPref a => Text -> a -> Profile b -> Profile bSource
Add a new preference entry to a profile, overwriting any existing entry with the same key.
getPref :: Text -> Profile b -> Maybe ProfilePrefSource
Retrieve a preference from a profile by key name.
deletePref :: Text -> Profile b -> Profile bSource
Delete an existing preference entry from a profile. This operation is silent if the preference wasn't found.
Extensions
addExtension :: FilePath -> Profile b -> Profile bSource
Add a new extension to the profile. The file path should refer to an .xpi file or an extension directory. This operation has no effect if the same extension has already been added to this profile.
deleteExtension :: FilePath -> Profile b -> Profile bSource
Delete an existing extension from the profile. The file path should refer to an .xpi file or an extension directory. This operation has no effect if the extension was never added to the profile.
Loading and preparing profiles
loadProfile :: MonadBaseControl IO m => FilePath -> m (Profile Firefox)Source
Load an existing profile from the file system. Any prepared changes made to
the Profile
will have no effect to the profile on disk.
prepareProfile :: MonadBase IO m => Profile Firefox -> m (PreparedProfile Firefox)Source
Prepare a firefox profile for network transmission. Internally, this function constructs a Firefox profile within a temp directory, archives it as a zip file, and then base64 encodes the zipped data. The temporary directory is deleted afterwards
prepareTempProfile :: MonadBase IO m => (Profile Firefox -> Profile Firefox) -> m (PreparedProfile Firefox)Source
Apply a function on an automatically generated default profile, and prepare the result. The Profile passed to the handler function is the default profile used by sessions when Nothing is specified
prepareLoadedProfile :: MonadBaseControl IO m => FilePath -> (Profile Firefox -> Profile Firefox) -> m (PreparedProfile Firefox)Source
Convenience function to load an existing Firefox profile from disk, apply a handler function, and then prepare the result for network transmission.