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')
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
