Skip to content

Commit

Permalink
Merge branch 'master' into go-signer
Browse files Browse the repository at this point in the history
  • Loading branch information
floating committed Mar 21, 2018
2 parents 7f6eff7 + f9f0559 commit fff75c6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/store/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ export const addRequest = (u, request) => {
u('signer.requests', (requests, state) => {
if (state.frame.type === 'tray') ipcRenderer.send('frame:showTray')
if (request.type === 'approveTransaction') requests[request.handlerId] = request
if (request.type === 'requestProvider') requests[request.origin] = request
if (request.type === 'requestProvider') requests[request.origin.replace('.', '')] = request
return requests
})
}

export const giveAccess = (u, origin, access) => {
origin = origin.replace('.', '')
u('permissions', origin, 'provider', provider => access)
u('signer.requests', (requests, state) => {
delete requests[origin]
Expand All @@ -50,6 +51,7 @@ export const giveAccess = (u, origin, access) => {
}

export const toggleAccess = (u, origin) => {
origin = origin.replace('.', '')
u('permissions', origin, 'provider', provider => !provider)
}

Expand Down
2 changes: 1 addition & 1 deletion app/ws/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import store from '../store'

const allowed = (req, proceed) => {
let obs = store.observer(_ => {
let permissions = store('permissions', req.origin)
let permissions = store('permissions', req.origin.replace('.', ''))
if (!permissions) return store.addRequest({type: 'requestProvider', origin: req.origin, notice: `${req.origin} is requesting access to the provider.`})
setTimeout(_ => obs.remove(), 0) // Add fix for this pattern in restore
permissions.provider ? proceed(req.accept(null, req.origin)) : req.reject()
Expand Down
5 changes: 5 additions & 0 deletions extension/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* globals chrome */

chrome.browserAction.onClicked.addListener(tab => {
chrome.tabs.executeScript(tab.ib, {file: 'inject.js'})
})
3 changes: 3 additions & 0 deletions extension/inject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(_ => {
console.log('Injecting Frame Connection')
})()
20 changes: 20 additions & 0 deletions extension/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "Frame",
"version": "0.0.0",
"manifest_version": 0,
"description": "Frame",
"homepage_url": "https://github.com/floating/frame",
"background": {
"scripts": ["index.js"],
"persistent": true
},
"browser_action": {
"default_title": "Frame"
},
"permissions": [
"activeTab",
"https://*/*",
"http://*/*",
"tabs"
]
}

0 comments on commit fff75c6

Please sign in to comment.