@heroku/skynet 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/categories.js +2 -2
- package/commands/deprovision.js +2 -2
- package/commands/suspend/app-owner.js +2 -2
- package/commands/suspend/apps.js +2 -2
- package/commands/suspend/user.js +3 -3
- package/commands/unsuspend/apps.js +2 -2
- package/commands/unsuspend/user.js +2 -2
- package/commands/userpass/add.js +3 -3
- package/commands/userpass/remove.js +3 -3
- package/lib/skynet.js +6 -4
- package/package.json +1 -1
package/commands/categories.js
CHANGED
|
@@ -5,7 +5,7 @@ let SkynetAPI = require('../lib/skynet')
|
|
|
5
5
|
|
|
6
6
|
function * run (context) {
|
|
7
7
|
sudo()
|
|
8
|
-
const skynet = new SkynetAPI(context.
|
|
8
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
9
9
|
let response = yield skynet.categories()
|
|
10
10
|
response = JSON.parse(response)
|
|
11
11
|
cli.table(response, {
|
|
@@ -19,7 +19,7 @@ function * run (context) {
|
|
|
19
19
|
module.exports = {
|
|
20
20
|
topic: 'skynet',
|
|
21
21
|
command: 'categories',
|
|
22
|
-
description: 'categories to use for suspension and deprovisions',
|
|
22
|
+
description: '(requires sudo) categories to use for suspension and deprovisions',
|
|
23
23
|
help: `Examples:
|
|
24
24
|
$ heroku skynet:categories`,
|
|
25
25
|
flags: [],
|
package/commands/deprovision.js
CHANGED
|
@@ -28,7 +28,7 @@ function readlines (file) {
|
|
|
28
28
|
|
|
29
29
|
function * run (context) {
|
|
30
30
|
sudo()
|
|
31
|
-
const skynet = new SkynetAPI(context.
|
|
31
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
32
32
|
let user = context.flags.user || process.env.HEROKU_USER
|
|
33
33
|
let file = context.flags.infile
|
|
34
34
|
let notes = context.flags.notes
|
|
@@ -56,7 +56,7 @@ function * run (context) {
|
|
|
56
56
|
module.exports = {
|
|
57
57
|
topic: 'skynet',
|
|
58
58
|
command: 'deprovision',
|
|
59
|
-
description: 'suspends a user and deprovisions all addons',
|
|
59
|
+
description: '(requires sudo) suspends a user and deprovisions all addons',
|
|
60
60
|
help: `Examples:
|
|
61
61
|
$ heroku skynet:deprovision -u foo@bar.com -n "helpful suspend message" -c "spam"`,
|
|
62
62
|
flags: [
|
|
@@ -28,7 +28,7 @@ function readlines (file) {
|
|
|
28
28
|
|
|
29
29
|
function * run (context) {
|
|
30
30
|
sudo()
|
|
31
|
-
const skynet = new SkynetAPI(context.
|
|
31
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
32
32
|
let app = context.flags.app
|
|
33
33
|
let file = context.flags.infile
|
|
34
34
|
let notes = context.flags.notes
|
|
@@ -56,7 +56,7 @@ function * run (context) {
|
|
|
56
56
|
module.exports = {
|
|
57
57
|
topic: 'skynet',
|
|
58
58
|
command: 'suspend:app-owner',
|
|
59
|
-
description: 'suspends the owner of a given app',
|
|
59
|
+
description: '(requires sudo) suspends the owner of a given app',
|
|
60
60
|
help: `Examples:
|
|
61
61
|
$ heroku skynet:suspend:app-owner -a foobar -n "helpful suspend message" -c "ddos"`,
|
|
62
62
|
flags: [
|
package/commands/suspend/apps.js
CHANGED
|
@@ -5,7 +5,7 @@ let SkynetAPI = require('../../lib/skynet')
|
|
|
5
5
|
|
|
6
6
|
function * run (context) {
|
|
7
7
|
sudo()
|
|
8
|
-
const skynet = new SkynetAPI(context.
|
|
8
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
9
9
|
let response = yield skynet.suspendApp(context.flags.app, context.flags.notes)
|
|
10
10
|
response = JSON.parse(response)
|
|
11
11
|
cli.log(`suspending...${cli.color.cyan(response.status)}.\n${response.message}`)
|
|
@@ -14,7 +14,7 @@ function * run (context) {
|
|
|
14
14
|
module.exports = {
|
|
15
15
|
topic: 'skynet',
|
|
16
16
|
command: 'suspend:app',
|
|
17
|
-
description: 'suspends an app',
|
|
17
|
+
description: '(requires sudo) suspends an app',
|
|
18
18
|
help: `Examples:
|
|
19
19
|
$ heroku skynet:suspend:app -a test-app -n "helpful suspend message"`,
|
|
20
20
|
flags: [
|
package/commands/suspend/user.js
CHANGED
|
@@ -28,7 +28,7 @@ function readlines (file) {
|
|
|
28
28
|
|
|
29
29
|
function * run (context) {
|
|
30
30
|
sudo()
|
|
31
|
-
const skynet = new SkynetAPI(context.
|
|
31
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
32
32
|
let user = context.flags.user || process.env.HEROKU_USER
|
|
33
33
|
let file = context.flags.infile
|
|
34
34
|
let notes = context.flags.notes
|
|
@@ -56,9 +56,9 @@ function * run (context) {
|
|
|
56
56
|
module.exports = {
|
|
57
57
|
topic: 'skynet',
|
|
58
58
|
command: 'suspend:user',
|
|
59
|
-
description: 'suspends a user',
|
|
59
|
+
description: '(requires sudo) suspends a user',
|
|
60
60
|
help: `Examples:
|
|
61
|
-
$ heroku skynet:suspend:user -u foo@bar.com -n "helpful suspend message" -c "ddos"`,
|
|
61
|
+
$ heroku sudo skynet:suspend:user -u foo@bar.com -n "helpful suspend message" -c "ddos"`,
|
|
62
62
|
flags: [
|
|
63
63
|
{name: 'user', char: 'u', description: 'user to suspend', hasValue: true},
|
|
64
64
|
{name: 'infile', char: 'i', description: 'file of users to suspend', hasValue: true},
|
|
@@ -5,7 +5,7 @@ let SkynetAPI = require('../../lib/skynet')
|
|
|
5
5
|
|
|
6
6
|
function * run (context) {
|
|
7
7
|
sudo()
|
|
8
|
-
const skynet = new SkynetAPI(context.
|
|
8
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
9
9
|
let response = yield skynet.unsuspendApp(context.flags.app, context.flags.notes)
|
|
10
10
|
response = JSON.parse(response)
|
|
11
11
|
cli.log(`suspending...${cli.color.cyan(response.status)}.\n${response.message}`)
|
|
@@ -14,7 +14,7 @@ function * run (context) {
|
|
|
14
14
|
module.exports = {
|
|
15
15
|
topic: 'skynet',
|
|
16
16
|
command: 'unsuspend:app',
|
|
17
|
-
description: 'unsuspends an app',
|
|
17
|
+
description: '(requires sudo) unsuspends an app',
|
|
18
18
|
help: `Examples:
|
|
19
19
|
$ heroku skynet:unsuspend:app -a test-app`,
|
|
20
20
|
flags: [
|
|
@@ -5,7 +5,7 @@ let SkynetAPI = require('../../lib/skynet')
|
|
|
5
5
|
|
|
6
6
|
function * run (context) {
|
|
7
7
|
sudo()
|
|
8
|
-
const skynet = new SkynetAPI(context.
|
|
8
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
9
9
|
let user = context.flags.user || process.env.HEROKU_USER
|
|
10
10
|
|
|
11
11
|
let response = yield cli.action(`unsuspending ${cli.color.cyan(user)}`, skynet.unsuspendUser(user))
|
|
@@ -16,7 +16,7 @@ function * run (context) {
|
|
|
16
16
|
module.exports = {
|
|
17
17
|
topic: 'skynet',
|
|
18
18
|
command: 'unsuspend:user',
|
|
19
|
-
description: 'unsuspends a user',
|
|
19
|
+
description: '(requires sudo) unsuspends a user',
|
|
20
20
|
help: `Examples:
|
|
21
21
|
$ heroku skynet:unsuspend:user -u foo@bar.com`,
|
|
22
22
|
flags: [
|
package/commands/userpass/add.js
CHANGED
|
@@ -3,8 +3,8 @@ let co = require('co')
|
|
|
3
3
|
let SkynetAPI = require('../../lib/skynet')
|
|
4
4
|
|
|
5
5
|
function * run (context) {
|
|
6
|
-
const skynet = new SkynetAPI(context.
|
|
7
|
-
yield cli.action(`adding ${cli.color.cyan(context.flags.userpass)} to ${cli.color.cyan(context.flags.user)}`, skynet.addUserpass(context.flags.user, context.flags.
|
|
6
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
7
|
+
yield cli.action(`adding ${cli.color.cyan(context.flags.userpass)} to ${cli.color.cyan(context.flags.user)}`, skynet.addUserpass(context.flags.user, context.flags.flag))
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
|
15
15
|
$ heroku skynet:userpass:add -u foo@bar.com -f cant-install-abused-addons`,
|
|
16
16
|
flags: [
|
|
17
17
|
{name: 'user', char: 'u', description: 'user to apply userpass flag to', hasValue: true, required: true},
|
|
18
|
-
{name: '
|
|
18
|
+
{name: 'flag', char: 'f', description: 'flag to add to the given user', hasValue: true, required: true}
|
|
19
19
|
],
|
|
20
20
|
run: cli.command(co.wrap(run))
|
|
21
21
|
}
|
|
@@ -3,8 +3,8 @@ let co = require('co')
|
|
|
3
3
|
let SkynetAPI = require('../../lib/skynet')
|
|
4
4
|
|
|
5
5
|
function * run (context) {
|
|
6
|
-
const skynet = new SkynetAPI(context.
|
|
7
|
-
yield cli.action(`removing ${cli.color.cyan(context.flags.userpass)} from ${cli.color.cyan(context.flags.user)}`, skynet.removeUserpass(context.flags.user, context.flags.
|
|
6
|
+
const skynet = new SkynetAPI(context.auth.password)
|
|
7
|
+
yield cli.action(`removing ${cli.color.cyan(context.flags.userpass)} from ${cli.color.cyan(context.flags.user)}`, skynet.removeUserpass(context.flags.user, context.flags.flag))
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
|
15
15
|
$ heroku skynet:userpass:remove -u foo@bar.com -f cant-install-abused-addons`,
|
|
16
16
|
flags: [
|
|
17
17
|
{name: 'user', char: 'u', description: 'user to remove user_pass from', hasValue: true, required: true},
|
|
18
|
-
{name: '
|
|
18
|
+
{name: 'flag', char: 'f', description: 'flag to remove from given user', hasValue: true, required: true}
|
|
19
19
|
],
|
|
20
20
|
run: cli.command(co.wrap(run))
|
|
21
21
|
}
|
package/lib/skynet.js
CHANGED
|
@@ -3,8 +3,9 @@ const qs = require('querystring')
|
|
|
3
3
|
const SKYNET_BASE_URL = 'https://skynet.herokai.com/api-h'
|
|
4
4
|
|
|
5
5
|
module.exports = class SkynetAPI {
|
|
6
|
-
constructor (
|
|
7
|
-
|
|
6
|
+
constructor (token) {
|
|
7
|
+
let packageJSON = require('../package.json')
|
|
8
|
+
this.version = `skynet-${packageJSON.version}`
|
|
8
9
|
this.token = token
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -53,12 +54,13 @@ module.exports = class SkynetAPI {
|
|
|
53
54
|
})
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
suspendAppOwner (app, notes, category) {
|
|
57
|
+
suspendAppOwner (app, notes, category, force = false) {
|
|
57
58
|
var body = {
|
|
58
59
|
value: app,
|
|
59
60
|
reason: notes,
|
|
60
61
|
method: 'skynet-cli',
|
|
61
|
-
category: category
|
|
62
|
+
category: category,
|
|
63
|
+
force: force
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
return this.request('/suspend/app-owner', {
|