feat: descriptive open full page action

This commit is contained in:
kyranjamie
2021-08-06 14:12:01 +02:00
committed by Thomas Osmonson
parent 25be795774
commit 92f2cd26d9
5 changed files with 24 additions and 49 deletions

View File

@@ -0,0 +1,5 @@
---
'@stacks/wallet-web': minor
---
Adds a context menu that opens the wallet in full page mode

View File

@@ -6,7 +6,7 @@ const manifest = {
author: 'Hiro PBC',
description:
'Hiro Wallet. Use the Stacks blockchain to access privacy-friendly apps, and keep data in your control.',
permissions: ['activeTab'],
permissions: ['activeTab', 'contextMenus'],
manifest_version: 2,
background: {
scripts: ['background.js'],

View File

@@ -16,9 +16,12 @@ import {
import type { VaultActions } from '@background/vault-types';
import { popupCenter } from '@background/popup';
import { vaultMessageHandler } from '@background/vault';
import { initContextMenuActions } from '@background/init-context-menus';
const IS_TEST_ENV = process.env.TEST_ENV === 'true';
initContextMenuActions();
// Playwright does not currently support Chrome extension popup testing:
// https://github.com/microsoft/playwright/issues/5593
async function openRequestInFullPage(path: string, urlParams: URLSearchParams) {

View File

@@ -0,0 +1,15 @@
function openNewTabWithWallet() {
return chrome.tabs.create({ url: 'full-page.html' });
}
export function initContextMenuActions() {
chrome.contextMenus.removeAll();
chrome.contextMenus.create({
title: 'Open Hiro Wallet in a new tab',
contexts: ['browser_action'],
async onclick() {
await openNewTabWithWallet();
},
});
}

View File

@@ -1,48 +0,0 @@
{
"name": "<% NAME %>",
"author": "Hiro PBC",
"version": "<% VERSION %>",
"description": "Hiro Wallet. Use the Stacks blockchain to access privacy-friendly apps, and keep data in your control.",
"icons": {
"128": "assets/connect-logo/Stacks128w.png",
"256": "assets/connect-logo/Stacks256w.png",
"512": "assets/connect-logo/Stacks512w.png"
},
"content_security_policy": "script-src 'self'<% DEV_CSR %>; object-src <% DEV_OBJECT_SRC %>; frame-src 'none'; frame-ancestors 'none';",
"permissions": ["activeTab"],
"manifest_version": 2,
"background": {
"scripts": ["background.js"],
"persistent": true
},
"web_accessible_resources": ["inpage.js"],
"browser_action": {
"default_title": "Stacks",
"default_icon": "assets/connect-logo/Stacks128w.png",
"default_popup": "extension.html"
},
"commands": {
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+B",
"mac": "MacCtrl+Shift+B"
},
"description": "Opens Stacks App"
}
},
"options_ui": {
"page": "full-page.html",
"open_in_tab": true
},
"content_scripts": [
{
"js": ["content-script.js"],
"matches": ["*://*/*"]
}
],
"browser_specific_settings": {
"gecko": {
"id": "{e22ae397-03d7-4622-bd8f-ecaca8c9b277}"
}
}
}