├── License.md
├── README.md
├── _locales
├── en
│ └── messages.json
├── ja
│ └── messages.json
└── zh_CN
│ └── messages.json
├── background
└── background.js
├── content
├── alert_error.html
├── alert_info.html
├── alert_warning.html
├── buttons.html
└── modal.html
├── icon
└── icon.png
├── lambda-hub.js
├── lib
├── diff.min.js
├── diff2html-ui.min.js
├── diff2html.css
├── diff2html.min.js
├── github.css
├── highlight.min.js
├── jquery.min.js
└── jszip.min.js
├── manifest.json
└── options
├── options.css
├── options.html
└── options.js
/License.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Ke Xu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # lambda-github
2 | [](https://chrome.google.com/webstore/detail/google-apps-script-github/bmjcibkkmbmabejialhgnnmhpmdmijij)
3 | [](https://chrome.google.com/webstore/detail/google-apps-script-github/bmjcibkkmbmabejialhgnnmhpmdmijij)
4 | [](https://chrome.google.com/webstore/detail/google-apps-script-github/bmjcibkkmbmabejialhgnnmhpmdmijij)
5 | [](https://chrome.google.com/webstore/detail/google-apps-script-github/bmjcibkkmbmabejialhgnnmhpmdmijij)
6 |
7 | Chrome-extension for manage lambda inline code with github/github enterprise.
8 |
9 | #NOTE: Currently does not work with the new lambda UI
10 |
11 | #Install
12 | Install this extension from [chrome web store](https://chrome.google.com/webstore/detail/bmjcibkkmbmabejialhgnnmhpmdmijij).
13 |
14 | #Usage
15 | After install, when you open AWS Lambda console, a new button will appear to ask you login in to Github/Github Enterprise.
16 |
17 | 
18 |
19 | ##Login
20 | Login to your Github/Github Enterprise account, with Two-factor authentication support.
21 |
22 | Actually, this is not a login action, but to create the `access token` which will be used for the extension
23 | >Note: the access token will be stored in `chrome.storage.sync`(password will not be stored), if you take this as a security hole, pleast **DO NOT** use this extension.
24 |
25 | ##Bind
26 | After login, you can bind your lambda function with Github repo and branch, or create a new one. and decide which file to sync.
27 | 
28 |
29 | ##Manage
30 | Manage your code with the similar `Push` and `Pull`.
31 |
32 | **The code will sync to Github's repo, with a default file named `index.js`(nodejs) or `index.py`(python) under the root path.**
33 |
34 | - `Pull` only works for lambda's `$LATEST` version, since published version or alias is readonly.
35 | - `Push` will commit your current shown code(work for any qualifier) to the binding repo/branch.
36 | - A diff dialog will shown before you confirm to `Push` or `Pull`.
37 | - `Push` must have a commit comment which will be asked at the diff dialog.
38 |
39 | ##Logout
40 | You can logout from the extension's option page any time. After logout, the access token stored in extension will be deleted,
41 | but you will need to delete the token it self from Github/Github Enterprise's settins page.
42 |
43 | #Support
44 | please create an issue for any question or bug report.
45 |
--------------------------------------------------------------------------------
/_locales/en/messages.json:
--------------------------------------------------------------------------------
1 | {
2 | "appName": {
3 | "message": "Lambda Github Assistant"
4 | },
5 | "appDesc": {
6 | "message": "Manage your lambda inline code with github(or github enterprise)"
7 | }
8 | }
--------------------------------------------------------------------------------
/_locales/ja/messages.json:
--------------------------------------------------------------------------------
1 | {
2 | "appName": {
3 | "message": "Lambda Github アシスタント"
4 | },
5 | "appDesc": {
6 | "message": "GithubとGithub EnterpriseでAWS Lambdaのインラインコードを管理"
7 | }
8 | }
--------------------------------------------------------------------------------
/_locales/zh_CN/messages.json:
--------------------------------------------------------------------------------
1 | {
2 | "appName": {
3 | "message": "Lambda Github 助手"
4 | },
5 | "appDesc": {
6 | "message": "使用Github或Github Enterprise管理AWS Lambda的inline代码"
7 | }
8 | }
--------------------------------------------------------------------------------
/background/background.js:
--------------------------------------------------------------------------------
1 | chrome.runtime.onInstalled.addListener(function() {
2 | chrome.declarativeContent.onPageChanged.removeRules(undefined, () => {
3 | chrome.declarativeContent.onPageChanged.addRules([
4 | {
5 | conditions: [
6 | new chrome.declarativeContent.PageStateMatcher({
7 | pageUrl: { urlContains: 'console.aws.amazon.com' }
8 | })
9 | ],
10 | actions: [ new chrome.declarativeContent.ShowPageAction() ]
11 | }
12 | ]);
13 | });
14 | });
15 |
16 | chrome.webRequest.onCompleted.addListener((details) => {
17 | chrome.storage.local.set({ tab: details.tabId} );
18 | chrome.tabs.sendMessage(details.tabId, {cmd: "init"});
19 | },
20 | {
21 | urls: [
22 | "https://*.console.aws.amazon.com/lambda/services/ajax?operation=getFunctionCode*"
23 | ],
24 | types: ["xmlhttprequest"]
25 | },
26 | [
27 | "responseHeaders"
28 | ]
29 | )
30 |
31 | chrome.webRequest.onBeforeSendHeaders.addListener((details) => {
32 | details.requestHeaders.forEach((header) => {
33 | if(header.name == 'X-Csrf-Token' && header.value !== "") {
34 | chrome.storage.sync.set({ csrf: header.value} );
35 | }
36 | })
37 | },
38 | {
39 | urls: [ "https://*.console.aws.amazon.com/lambda/services/ajax?operation=getFunctionCode*" ],
40 | types: ["xmlhttprequest"]
41 | },
42 | [
43 | "requestHeaders"
44 | ]);
--------------------------------------------------------------------------------
/content/alert_error.html:
--------------------------------------------------------------------------------
1 |
18 |
20 |
21 |
17 |
19 |
20 |
20 |
22 |
23 |