Skip to content

Commit

Permalink
Merge for Signer v1.4.0
Browse files Browse the repository at this point in the history
Signer v1.4.0
  • Loading branch information
George-cl authored Sep 8, 2021
2 parents 83aa5ca + 4348296 commit 1266914
Show file tree
Hide file tree
Showing 23 changed files with 1,015 additions and 516 deletions.
69 changes: 42 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "casperlabs-signer",
"version": "1.3.0",
"version": "1.4.0",
"private": true,
"dependencies": {
"@babel/core": "^7.14.6",
Expand All @@ -21,7 +21,7 @@
"@types/react-dom": "^16.9.14",
"axios": "^0.21.1",
"browser-passworder": "^2.0.3",
"casper-js-sdk": "^2.2.3",
"casper-js-sdk": "^2.5.1",
"copy-to-clipboard": "^3.3.1",
"download": "^8.0.0",
"eslint-config-react-app": "^6.0.0",
Expand Down Expand Up @@ -50,6 +50,7 @@
"tweetnacl": "^1.0.3",
"tweetnacl-ts": "latest",
"tweetnacl-util": "^0.15.1",
"typedjson": "^1.7.0",
"validator": "^12.2.0",
"webpack": "4.44.2",
"webpack-extension-reloader": "^1.1.4",
Expand Down
6 changes: 4 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"manifest_version": 2,
"version": "1.3.0",
"version": "1.4.0",
"name": "CasperLabs Signer",
"author": "https://casperlabs.io",
"description": "CasperLabs Signer tool for signing transactions on the blockchain.",
Expand Down Expand Up @@ -28,7 +28,9 @@
"*://casperholders.io/*",
"*://*.casperholders.io/*",
"*://casperholders.com/*",
"*://*.casperholders.com/*"
"*://*.casperholders.com/*",
"*://*.casperstats.io/*",
"*://casperstats.io/*"
],
"js": ["./scripts/content/content.js"],
"run_at": "document_start",
Expand Down
5 changes: 5 additions & 0 deletions src/background/AuthController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,11 @@ class AuthController {
async clearAccount() {
this.appState.userAccounts.clear();
}

@action.bound
configureTimeout(durationMins: number) {
this.appState.idleTimeoutMins = durationMins;
}
}

export default AuthController;
31 changes: 21 additions & 10 deletions src/background/PopupManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@

import { browser } from 'webextension-polyfill-ts';

export type openPurpose = 'connect' | 'sign' | 'importAccount' | 'noAccount';
export type openPurpose =
| 'connect'
| 'signDeploy'
| 'signMessage'
| 'importAccount'
| 'noAccount';

const normalPopupWidth = 300;
const normalPopupHeight = 480;
const expandedPopupHeight = 820;
// Pads around popup window
const popupBuffer = {
right: 20,
top: 40
};
/**
* A Class to manager Popup
* Provide inject and background a way to show popup.
Expand All @@ -13,11 +26,8 @@ export default class PopupManager {
browser.windows
.getCurrent()
.then(window => {
let popupWidth = 300;
let bufferRight = 20;
let bufferTop = 40;
let windowWidth =
window.width === undefined || null ? 300 : window.width;
window.width === undefined || null ? normalPopupWidth : window.width;
let xOffset = window.left === undefined || null ? 0 : window.left;
let yOffset = window.top === undefined || null ? 0 : window.top;
browser.windows.create({
Expand All @@ -26,18 +36,19 @@ export default class PopupManager {
? 'index.html?#/import'
: 'index.html?#/',
type: 'popup',
height: openFor === 'sign' ? 820 : 480,
width: 300,
left: windowWidth + xOffset - popupWidth - bufferRight,
top: yOffset + bufferTop
height:
openFor === 'signDeploy' ? expandedPopupHeight : normalPopupHeight,
width: normalPopupWidth,
left: windowWidth + xOffset - normalPopupWidth - popupBuffer.right,
top: yOffset + popupBuffer.top
});
})
.catch(() => {
let title, message;
if (openFor === 'connect') {
title = 'Connection Request';
message = 'Open Signer to Approve or Reject Connection';
} else if (openFor === 'sign') {
} else if (openFor === 'signDeploy' || openFor === 'signMessage') {
title = 'Signature Request';
message = 'Open Signer to Approve or Cancel Signing';
} else {
Expand Down
Loading

0 comments on commit 1266914

Please sign in to comment.