-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: tabs.sendMessage error handling (#38)
fixed sendMessage error handling to properly display error notification when active tab is not aws console * add permissions and logic to properly match aws tab url * add outmatch lib to parse url globs * use typescript manifests closes #34
- Loading branch information
1 parent
c53c939
commit 8d7b61c
Showing
19 changed files
with
206 additions
and
217 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { mergeManifestWithVersion } from './mergeManifestsWithVersion'; | ||
export { writeManifest } from './writeManifest'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Plugin } from 'esbuild'; | ||
|
||
import path from 'path'; | ||
import fs from 'fs'; | ||
|
||
export const writeManifest = (manifest: object): Plugin => ({ | ||
name: 'writeManifest', | ||
setup: (build) => { | ||
build.onEnd(async () => { | ||
const json = JSON.stringify(manifest, null, 2); | ||
await fs.promises.writeFile( | ||
path.join( | ||
process.cwd(), | ||
build.initialOptions.outdir || '', | ||
'manifest.json' | ||
), | ||
json, | ||
); | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import matchAwsConsoleUrl from './matchAwsConsoleUrl'; | ||
|
||
test.each([ | ||
[undefined, false], | ||
['', false], | ||
['https://console.aws.amazon.com/console/lambda', false], | ||
['https://us-east-1.console.aws.amazon.com/console/lambda', true], | ||
['https://us-east-1.console.aws.amazon.com/console/home?region=us-east-1', true], | ||
['https://eu-central-1.console.aws.amazon.com/console/home?region=eu-central-1', true], | ||
['https://phd.console.aws.amazon.com/console/home?region=eu-central-1', true], | ||
['https://us-east-1.console.amazonaws-us-gov.com/console/home?region=ueu-central-1', true], | ||
['https://us-east-1.console.amazonaws.cn/console/home', true], | ||
])('test matchAwsConsoleUrl "%s"', (url, expected) => { | ||
expect(matchAwsConsoleUrl(url)).toEqual(expected); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import outmatch from 'outmatch'; | ||
|
||
import awsConsoleUrls from '../const/awsConsoleUrls'; | ||
|
||
export default (url: string | undefined) => { | ||
return outmatch(awsConsoleUrls, { separator: '.' })(url || ''); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default [ | ||
'https://*.console.aws.amazon.com/*', | ||
'https://phd.aws.amazon.com/*', | ||
'https://*.console.amazonaws-us-gov.com/*', | ||
'https://*.console.amazonaws.cn/*' | ||
]; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import common from './manifest.common'; | ||
import awsConsoleUrls from './common/const/awsConsoleUrls'; | ||
|
||
export default { | ||
...common, | ||
manifest_version: 3, | ||
action: { | ||
default_title: "AWS role switch", | ||
default_popup: "popup/popup.html", | ||
browser_style: true, | ||
default_icon: { | ||
128: "assets/icon128.png" | ||
} | ||
}, | ||
permissions: [ | ||
"storage" | ||
], | ||
host_permissions: [ | ||
...awsConsoleUrls, | ||
], | ||
commands: { | ||
_execute_action: { | ||
description: "Open the popup window", | ||
suggested_key: { | ||
default: "Ctrl+Shift+L" | ||
} | ||
} | ||
}, | ||
background: { | ||
service_worker: "background/background.js" | ||
}, | ||
}; |
Oops, something went wrong.