Socket
Socket
Sign inDemoInstall

@beaker/core

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@beaker/core

Beaker browser's core software


Version published
Weekly downloads
169
increased by134.72%
Maintainers
3
Weekly downloads
 
Created
Source

Beaker Core

Beaker browser's core software. Factored out so that we can build extensions from the same codebase.

Work in progress! Not ready to use.

Here's how we use it in electron (the browser):

import {app, protocol} from 'electron'
import beakerCore from '@beaker/core'

const DISALLOWED_SAVE_PATH_NAMES = [
  'home',
  'desktop',
  'documents',
  'downloads',
  'music',
  'pictures',
  'videos'
]

// setup beaker-core
await beakerCore.setup({
  // config
  userDataPath: app.getPath('userData'),
  homePath: app.getPath('home'),
  templatesPath: path.join(__dirname, 'assets', 'templates'),
  disallowedSavePaths: DISALLOWED_SAVE_PATH_NAMES.map(path => app.getPath(path)),

  // APIs
  permsAPI: {
    async checkLabsPerm({perm, labApi, apiDocsUrl, sender}) {/*...*/},
    async queryPermission(perm, sender) {/*...*/},
    async requestPermission(perm, sender) {/*...*/},
    async grantPermission(perm, senderURL) {/*...*/}
  },
  uiAPI: {
    async showModal(sender, modalName, opts) {/*...*/},
    async capturePage(url, opts) {/*...*/}
  },
  rpcAPI: {
    exportAPI(apiName, apiManifest, apiImpl, [guardFn])
  },
  downloadsWebAPI: {...},
  browserWebAPI: {...}
})

// setup the protocol handler
protocol.registerStreamProtocol('dat', beakerCore.dat.protocol.electronHandler, err => {
  if (err) throw ProtocolSetupError(err, 'Failed to create protocol: dat')
})

In the webview preload:

import beakerCoreWebview from '@beaker/core/webview'

beakerCoreWebview.setup({
  // APIs
  rpcAPI: {
    importAPI(apiName, apiManifest, opts)
  }
})

API (@beaker/core)

setup()

getEnvVar()

debugLogger(name)

import {debugLogger} from '@beaker/core'
const debug = debugLogger('dat')

// write to the debug log under 'dat'
debug('dat-related stuff')

getLogFilePath()

getLogFileContent(start, end)

globals

dbs

dbs.archives

dbs.bookmarks

dbs.history

dbs.settings

dbs.sitedata

dbs.templates

dat

dat.library

dat.dns

dat.folderSync

dat.garbageCollector

dat.protocol

dat.debug

API (@beaker/core/webview)

setup()

Keywords

FAQs

Package last updated on 28 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc