chrome

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2025 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Chrome browser module.

Chrome bookmarks are stored in a json file normally called Bookmarks. The bookmarks file is updated atomically by chrome for each change to the bookmark entries by the user.

Changes are detected by watching the parent directory for fsnotify.Create events on the bookmark file. On linux this is done by using fsnotify.

Chrome browser module.

Chrome bookmarks are stored in a json file normally called Bookmarks. The bookmarks file is updated atomically by chrome for each change to the bookmark entries by the user.

Changes are detected by watching the parent directory for fsnotify.Create events on the bookmark file. On linux this is done by using fsnotify.

Copyright (c) 2023 Chakib Ben Ziane <contact@blob42.xyz> and [`gosuki` contributors](https://github.com/blob42/gosuki/graphs/contributors). All rights reserved.

SPDX-License-Identifier: AGPL-3.0-or-later

This file is part of GoSuki.

GoSuki is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

GoSuki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with gosuki. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	BrowserName    = "chrome" // Default flavour to use
	DefaultProfile = "Default"
	RootNodeName   = "ROOT"
)
View Source
const StateFile = "Local State"

Chrome state file. The state file is a json file containing the last used profile and the list of profiles. Equivalent to the profiles.ini file for mozilla browsers.

Variables

View Source
var (
	ProfileManager = &ChromeProfileManager{}

	ChromeCfg = NewChromeConfig()
)

Functions

This section is empty.

Types

type Chrome

type Chrome struct {
	// holds browsers.BrowserConfig
	*ChromeConfig

	parsing.Counter
	// contains filtered or unexported fields
}

Chrome browser module

func NewChrome

func NewChrome() *Chrome

func (Chrome) Config

func (ch Chrome) Config() *modules.BrowserConfig

Returns a pointer to an initialized browser config

func (*Chrome) GetCurFlavour

func (c *Chrome) GetCurFlavour() *browsers.BrowserDef

get current active flavour

func (*Chrome) GetProfile

func (c *Chrome) GetProfile() *profiles.Profile

func (*Chrome) GetProfiles

func (*Chrome) GetProfiles(flavour string) ([]*profiles.Profile, error)

func (*Chrome) Init

func (ch *Chrome) Init(ctx *modules.Context, p *profiles.Profile) error

func (*Chrome) ListFlavours

func (*Chrome) ListFlavours() []browsers.BrowserDef

Returns all flavours supported by this browser

func (Chrome) ModInfo

func (ch Chrome) ModInfo() modules.ModInfo

func (*Chrome) PreLoad

func (ch *Chrome) PreLoad(_ *modules.Context) error

PreLoad() will be called right after a browser is initialized

func (*Chrome) ResetWatcher

func (ch *Chrome) ResetWatcher() error

func (*Chrome) Run

func (ch *Chrome) Run()

func (*Chrome) Shutdown

func (ch *Chrome) Shutdown() error

Implement modules.Shutdowner

func (*Chrome) UseProfile

func (c *Chrome) UseProfile(p *profiles.Profile, flv *browsers.BrowserDef) error

Notifies the module to use a custom profile NOTE: this is implemented at the browser Level

func (*Chrome) Watch

func (ch *Chrome) Watch() *watch.WatchDescriptor

func (*Chrome) WatchAllProfiles

func (chrome *Chrome) WatchAllProfiles() bool

If should watch all profiles

type ChromeConfig

type ChromeConfig struct {
	*modules.BrowserConfig `toml:"-"`
	modules.ProfilePrefs   `toml:"profile-options" mapstructure:"profile-options"`
	CustomProfiles         []profiles.CustomProfile `toml:"custom-profiles" mapstructure:"custom-profiles"`
}

func NewChromeConfig

func NewChromeConfig() *ChromeConfig

type ChromeProfileManager

type ChromeProfileManager struct{}

Helper struct to manage chrome profiles profiles.ProfileManager is implemented at the browser level

func (*ChromeProfileManager) GetProfileByID

func (cpm *ChromeProfileManager) GetProfileByID(flavour string, id string) (*profiles.Profile, error)

chrome uses ID to identify the profile path

func (*ChromeProfileManager) GetProfiles

func (*ChromeProfileManager) GetProfiles(flavour string) ([]*profiles.Profile, error)

Returns all profiles for a given flavour

type ParseChildJSONFunc

type ParseChildJSONFunc func([]byte, jsonparser.ValueType, int, error)

Type of the func used recursively on each json node entry by jsonparser.ArrayEach

type RawNode

type RawNode struct {
	// contains filtered or unexported fields
}

type used to store json nodes in memory for parsing.

type RecursiveParseJSONFunc

type RecursiveParseJSONFunc func([]byte, []byte, jsonparser.ValueType, int) error

type StateData

type StateData struct {
	LastUsed string
	Profile  struct {
		InfoCache map[string]profiles.Profile `json:"info_cache"`
	}
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL