Documentation
¶
Overview ¶
Package firefox parses many formats of Firefox data.
Index ¶
- func ParseExtensionPreferences(filename string) (map[string]ExtensionPermissions, error)
- func ProfilesDir() (string, error)
- type Addon
- type AddonInfo
- type Addons
- type BookmarkBackup
- type BookmarkBackupEntry
- type Command
- type ContainerIdentity
- type Containers
- type ExtensionPermissions
- type ExtensionSetting
- type ExtensionSettings
- type Extensions
- type Handlers
- type Install
- type InstallTelemetryInfo
- type L10nRegistrySources
- type Locale
- type MimeType
- type Person
- type Pref
- type Profile
- type ProfileInfo
- type RecommendationState
- type Scheme
- type SchemeHandler
- type Screenshot
- type StartupData
- type TargetApplication
- type Times
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseExtensionPreferences ¶
func ParseExtensionPreferences(filename string) (map[string]ExtensionPermissions, error)
ParseExtensionPreferences parses extension-preferences.json in a Firefox profile.
func ProfilesDir ¶
ProfilesDir returns the path for the Firefox Profiles directory.
Types ¶
type Addon ¶
type Addon struct { ID *uuid.Firefox `json:"id"` SyncGUID *uuid.UUID `json:"syncGUID"` // "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" Version string `json:"version"` // addon version Type string `json:"type"` // "extension", "theme", "locale", "dictionary" Loader jsonutil.UnknownType `json:"loader"` UpdateURL string `json:"updateURL"` OptionsURL string `json:"optionsURL"` OptionsType int `json:"optionsType"` OptionsBrowserStyle bool `json:"optionsBrowserStyle"` AboutURL string `json:"aboutURL"` DefaultLocale Locale `json:"defaultLocale"` Visible bool `json:"visible"` Active bool `json:"active"` UserDisabled bool `json:"userDisabled"` AppDisabled bool `json:"appDisabled"` EmbedderDisabled bool `json:"embedderDisabled"` InstallDate int64 `json:"installDate"` UpdateDate timefmt.UnixMilli `json:"updateDate,omitempty"` ApplyBackgroundUpdates interface{} `json:"applyBackgroundUpdates"` // e.g. 1 or "1" Path string `json:"path"` Skinnable bool `json:"skinnable"` SourceURI string `json:"sourceURI"` ReleaseNotesURI string `json:"releaseNotesURI"` SoftDisabled bool `json:"softDisabled"` ForeignInstall bool `json:"foreignInstall"` StrictCompatibility bool `json:"strictCompatibility"` Locales []Locale `json:"locales"` TargetApplications []TargetApplication `json:"targetApplications"` TargetPlatforms []jsonutil.UnknownType `json:"targetPlatforms"` SignedState int `json:"signedState,omitempty"` // e.g. 2 SignedDate timefmt.UnixMilli `json:"signedDate"` Seen bool `json:"seen"` Dependencies []interface{} `json:"dependencies"` Incognito string `json:"incognito,omitempty"` // e.g. "not_allowed", "spanning" UserPermissions *ExtensionPermissions `json:"userPermissions"` OptionalPermissions *ExtensionPermissions `json:"optionalPermissions"` Icons map[int]string `json:"icons"` // key: icon size, value: path IconURL string `json:"iconURL"` BlocklistState int `json:"blocklistState"` // e.g. 2 BlocklistURL string `json:"blocklistURL"` StartupData *StartupData `json:"startupData"` Hidden bool `json:"hidden"` InstallTelemetryInfo *InstallTelemetryInfo `json:"installTelemetryInfo"` RecommendationState *RecommendationState `json:"recommendationState"` RootURI string `json:"rootURI"` Location string `json:"location"` // e.g. "app-builtin", "app-profile", "app-system-addons", "app-system-defaults", "app-system-local" }
type AddonInfo ¶
type AddonInfo struct { ID *uuid.Firefox `json:"id"` Icons map[int]string `json:"icons"` // key: icon size, value: path Type string `json:"type"` // e.g. "extension", "locale", "dictionary" Name string `json:"name"` Version string `json:"version"` Creator Person `json:"creator"` Developers []Person `json:"developers"` Description string `json:"description"` FullDescription string `json:"fullDescription"` Screenshots []Screenshot `json:"screenshots"` HomepageURL string `json:"homepageURL"` SupportURL string `json:"supportURL"` ContributionURL string `json:"contributionURL"` AverageRating float64 `json:"averageRating"` // out of 5 ReviewCount int `json:"reviewCount"` ReviewURL string `json:"reviewURL"` WeeklyDownloads int `json:"weeklyDownloads"` SourceURI string `json:"sourceURI"` // URI to .xpi UpdateDate timefmt.UnixMilli `json:"updateDate"` }
AddonInfo contains addon information from addons.mozilla.org.
type Addons ¶
Addons contains information from addons.mozilla.org for installed addons.
func ParseAddons ¶
ParseAddons parses addons.json in a Firefox profile.
type BookmarkBackup ¶
type BookmarkBackup struct { Date time.Time // date of backup Count int // number of entries Hash []byte // hash of json contents Compressed bool // true when mozLz4-compressed Bookmarks *BookmarkBackupEntry }
BookmarkBackup is a backup of Firefox bookmarks.
func GetBookmarkBackupMetadata ¶
func GetBookmarkBackupMetadata(filename string) (*BookmarkBackup, error)
GetBookmarkBackupMetadata reads the metadata from a bookmark backup filename. The returned BookmarkBackup has nil Bookmarks.
func ParseBookmarkBackup ¶
func ParseBookmarkBackup(filename string) (*BookmarkBackup, error)
ParseBookmarkBackup parses a bookmarks file within bookmarkbackups in a Firefox profile.
type BookmarkBackupEntry ¶
type BookmarkBackupEntry struct { GUID string `json:"guid"` // e.g. "xQxadA7g1y_x", "root________", "menu________", "toolbar_____", "unfiled_____", "mobile______" Title string `json:"title"` Index int `json:"index"` // index of child DateAdded timefmt.UnixMicro `json:"dateAdded"` LastModified timefmt.UnixMicro `json:"lastModified"` ID int `json:"id"` // sequential (e.g. 0, 1, 2) TypeCode int `json:"typeCode"` // place: 1, place-container: 2 Type string `json:"type"` // "text/x-moz-place", "text/x-moz-place-container" Root string `json:"root,omitempty"` Children []BookmarkBackupEntry `json:"children,omitempty"` IconURI string `json:"iconuri,omitempty"` URI string `json:"uri,omitempty"` }
BookmarkBackupEntry is an entry in a bookmark backup.
type Command ¶
type Command struct {
PrecedenceList []ExtensionSetting `json:"precedenceList"`
}
Command is a command with values set by extensions.
type ContainerIdentity ¶
type ContainerIdentity struct { UserContextID int64 `json:"userContextId"` Public bool `json:"public"` Icon string `json:"icon"` // e.g. "circle" Color string `json:"color"` // e.g. "blue" L10nID string `json:"l10nID,omitempty"` AccessKey string `json:"accessKey,omitempty"` TelemetryID int64 `json:"telemetryId,omitempty"` Name string `json:"name,omitempty"` }
ContainerIdentity is a container definition.
type Containers ¶
type Containers struct { Version int64 `json:"version"` // e.g. 4 LastUserContextID int64 `json:"lastUserContextId"` Identities []ContainerIdentity `json:"identities"` }
Containers contains containers contained in containers.json.
func ParseContainers ¶
func ParseContainers(filename string) (*Containers, error)
ParseContainers parses containers.json in a Firefox profile.
type ExtensionPermissions ¶
type ExtensionPermissions struct { Permissions []string `json:"permissions"` // e.g. "clipboardWrite" or "internal:privateBrowsingAllowed" Origins []string `json:"origins"` // origins given access to }
ExtensionPermissions lists additional permissions granted to an extension in extension-preferences.json.
type ExtensionSetting ¶
type ExtensionSetting struct { ID string `json:"id"` InstallDate timefmt.UnixMilli `json:"installDate"` Value interface{} `json:"value"` Enabled bool `json:"enabled"` }
ExtensionSetting is a value set by an extension.
type ExtensionSettings ¶
type ExtensionSettings struct { Version int `json:"version"` // e.g. 2 Commands map[string]Command `json:"commands"` URLOverrides jsonutil.UnknownObj `json:"url_overrides"` Prefs map[string]Pref `json:"prefs"` DefaultSearch jsonutil.UnknownObj `json:"default_search"` HomepageNotification jsonutil.UnknownObj `json:"homepageNotification"` TabHideNotification jsonutil.UnknownObj `json:"tabHideNotification"` NewTabNotification jsonutil.UnknownObj `json:"newTabNotification"` }
ExtensionSettings contains preferences and commands set by extensions in extension-settings.json.
func ParseExtensionSettings ¶
func ParseExtensionSettings(filename string) (*ExtensionSettings, error)
ParseExtensionSettings parses extension-settings.json in a Firefox profile.
type Extensions ¶
type Extensions struct { SchemaVersion int `json:"schemaVersion"` // e.g. 33 Addons []Addon `json:"addons"` }
func ParseExtensions ¶
func ParseExtensions(filename string) (*Extensions, error)
ParseExtensions parses extensions.json in a Firefox profile.
type Handlers ¶
type Handlers struct { DefaultHandlersVersion map[string]int `json:"defaultHandlersVersion"` // key: locale (e.g. "en-US") MIMETypes map[string]MimeType `json:"mimeTypes"` // key: MIME type (e.g. "image/jpeg") Schemes map[string]Scheme `json:"schemes"` // key: URI scheme (e.g. "mailto") }
Handlers registers handlers for MIME types and URI schemes.
func ParseHandlers ¶
ParseHandlers parses handlers.json in a Firefox profile.
type Install ¶
type Install struct { ID uint64 `ini:"-"` // displayed in uppercase hex Default string // default profile path Locked bool }
Install is a Firefox installation.
func ParseInstalls ¶
ParseInstalls parses installs.ini in the Firefox root.
type InstallTelemetryInfo ¶
type L10nRegistrySources ¶
type Locale ¶
type Locale struct { Name string `json:"name"` // Addon name Description string `json:"description,omitempty"` Creator string `json:"creator,omitempty"` HomepageURL string `json:"homepageURL,omitempty"` Developers jsonutil.UnknownType `json:"developers"` Translators jsonutil.UnknownType `json:"translators"` Contributors jsonutil.UnknownType `json:"contributors"` Locales []string `json:"locales"` }
Locale contains addon information in a locale.
type MimeType ¶
type MimeType struct { Action int `json:"action"` // e.g. 0, 3 Ask bool `json:"ask,omitempty"` Extensions []string `json:"extensions,omitempty"` // e.g. "jpg", "jpeg" }
MimeType registers an action to perform for a MIME type and assigns file extensions to that MIME type.
type Pref ¶
type Pref struct { InitialValue interface{} `json:"initialValue"` PrecedenceList []ExtensionSetting `json:"precedenceList"` }
Pref is a preference with values set by extensions and an initial value.
type Profile ¶
type Profile struct { ID int `ini:"-"` // sequential (e.g. 0, 1, 2) Name string // e.g. "default", "default-release", "dev-edition-default" IsRelative bool Path string Default bool }
Profile is a Firefox profile.
type ProfileInfo ¶
type ProfileInfo struct { StartWithLastProfile bool Version int // e.g. 2 Profiles []Profile `ini:"-"` Installs []Install `ini:"-"` }
ProfileInfo contains Firefox profiles and installs.
func ParseProfiles ¶
func ParseProfiles(firefoxDir string) (*ProfileInfo, error)
ParseProfiles parses profiles.ini in the Firefox root.
type RecommendationState ¶
type Scheme ¶
type Scheme struct { Action int `json:"action"` // e.g. 2, 4 Ask bool `json:"ask,omitempty"` StubEntry bool `json:"stubEntry,omitempty"` // true when handler unchanged from default Handlers []*SchemeHandler `json:"handlers,omitempty"` }
Scheme registers an action to perform for a URI scheme and a list of handler applications.
type SchemeHandler ¶
type SchemeHandler struct { Name string `json:"name"` Path string `json:"path,omitempty"` // for local apps URITemplate string `json:"uriTemplate,omitempty"` // for web apps }
SchemeHandler is an application that can handle a URI scheme.
type Screenshot ¶
type Screenshot struct { URL string `json:"url"` Width int `json:"width"` Height int `json:"height"` ThumbnailURL string `json:"thumbnailURL"` ThumbnailWidth int `json:"thumbnailWidth"` ThumbnailHeight int `json:"thumbnailHeight"` Caption string `json:"caption,omitempty"` }
Screenshot is an image of an addon displayed on addons.mozilla.org.
type StartupData ¶
type StartupData struct { Dictionaries map[string]string `json:"dictionaries,omitempty"` // key: locale, value: path to .dic // PersistentListeners key1: module name (e.g. "webRequest"), key2: name of event within module (e.g. "onBeforeRequest"), value: multiple listeners PersistentListeners map[string]map[string][][]interface{} `json:"persistentListeners,omitempty"` ChromeEntries [][]string `json:"chromeEntries"` LangpackID string `json:"langpackId,omitempty"` L10nRegistrySources *L10nRegistrySources `json:"l10nRegistrySources,omitempty"` Languages []string `json:"languages"` }