Skip to content

Commit 4b78a07

Browse files
committed
initial commit
0 parents  commit 4b78a07

File tree

9 files changed

+159
-0
lines changed

9 files changed

+159
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[{package.json,*.yml}]
11+
indent_style = space
12+
indent_size = 2

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text=auto
2+
*.js text eol=lf

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
language: node_js
2+
node_js:
3+
- 'node'

index.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
'use strict';
2+
const fs = require('fs');
3+
const request = require('request');
4+
5+
const contentTypes = new Map([
6+
['.gif', 'image/gif'],
7+
['.mp4', 'video/mp4'],
8+
['.webm', 'video/webm'],
9+
['.apng', 'image/apng']
10+
]);
11+
12+
const action = async context => {
13+
const filePath = await context.filePath();
14+
15+
context.setProgress('Uploading…');
16+
17+
const formData = {
18+
image: fs.createReadStream(filePath)
19+
};
20+
21+
// const options = {
22+
// hostname: context.config.get('host'),
23+
// port: context.config.get('port'),
24+
// path: context.config.get('path'),
25+
// method: context.config.get('method')
26+
// }
27+
28+
var upload = request.post({url:'https://i.cwlf.uk', formData: formData}, function(error, response, data) {
29+
let uploadURL = data;
30+
context.copyToClipboard(uploadURL);
31+
context.notify('URL copied to the clipboard');
32+
})
33+
};
34+
35+
const http = {
36+
title: 'Send HTTP(S) request',
37+
formats: ['gif', 'mp4', 'webm', 'apng'],
38+
action,
39+
config: {
40+
// host: {
41+
// title: 'Hostname',
42+
// type: 'string',
43+
// default: 'i.cwlf.uk',
44+
// required: true
45+
// },
46+
// port: {
47+
// title: 'Port',
48+
// type: 'string',
49+
// default: '443',
50+
// required: false
51+
// },
52+
// path: {
53+
// title: 'Path',
54+
// type: 'string',
55+
// default: '/',
56+
// required: false
57+
// },
58+
// method: {
59+
// title: 'HTTP Method',
60+
// type: 'string',
61+
// default: 'POST',
62+
// required: false
63+
// }
64+
}
65+
};
66+
67+
exports.shareServices = [http];

license

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018 Chip Wolf
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
13+
all 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
21+
THE SOFTWARE.

package.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "kap-http",
3+
"version": "0.1.0",
4+
"description": "Send HTTP(s) request",
5+
"license": "MIT",
6+
"repository": "ChipWolf/kap-http",
7+
"author": {
8+
"name": "Chip Wolf",
9+
"email": "[email protected]",
10+
"url": "github.com/ChipWolf"
11+
},
12+
"scripts": {
13+
"test": "echo notest"
14+
},
15+
"files": [
16+
"index.js"
17+
],
18+
"keywords": [
19+
"kap-plugin",
20+
"http",
21+
"https",
22+
"upload",
23+
"share"
24+
],
25+
"dependencies": {
26+
"request": "*"
27+
},
28+
"devDependencies": {
29+
"ava": "*",
30+
"kap-plugin-test": "^0.5.0",
31+
"sinon": "^2.3.2",
32+
"xo": "*"
33+
}
34+
}

readme.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# kap-http [![Build Status](https://travis-ci.org/ChipWolf/kap-http.svg?branch=master)](https://travis-ci.org/ChipWolf/kap-http)
2+
3+
> [Kap](https://github.com/wulkano/kap) plugin - Send HTTP(S) request
4+
5+
6+
## Install
7+
8+
In the `Kap` menu, go to `Preferences…`, select the `Plugins` pane, find this plugin, and click `Install`.
9+
10+
11+
## Usage
12+
13+
In the editor, after recording, select one of the export formats, and then `Send HTTP(S) request`.
14+
15+
16+
## License
17+
18+
MIT © [ChipWolf](https://github.com/ChipWolf)

0 commit comments

Comments
 (0)