This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/openwhisk-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 15ad135  Automatic Site Publish by Jenkins
15ad135 is described below

commit 15ad1352833c8006f738d60097d6192f40e3ce06
Author: jenkins <[email protected]>
AuthorDate: Mon Apr 12 16:18:39 2021 +0000

    Automatic Site Publish by Jenkins
---
 apis/README.md       | 37 ++++++++++++++++++++++++++++++++
 apis/slack-invite.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 feed.xml             |  2 +-
 package-lock.json    | 12 +++++------
 slack.html           |  4 ++--
 5 files changed, 105 insertions(+), 9 deletions(-)

diff --git a/apis/README.md b/apis/README.md
new file mode 100644
index 0000000..943be61
--- /dev/null
+++ b/apis/README.md
@@ -0,0 +1,37 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# Slack Inviter API
+
+The file [`slack-invite.js`](./slack-invite.js) implements an OpenWhisk action
+which uses the [Slack invite 
API](https://api.slack.com/methods/admin.users.invite)
+to send an email invitation to join the OpenWhisk Slack team.
+
+The action requires a [Slack 
token](https://api.slack.com/authentication/token-types#user)
+to work correctly.
+
+The API call is made in [`_layouts/slack.html`](../_layouts/slack.html) using
+[Nimbella's anonymous action invocation](https://nimbella.com). The token for
+the API call is uniquely encrypted for this action. Should this token change,
+the encrypted value can be regenerated with the following Nimbella encryption 
API,
+replacing the placeholder `<token>` with the actual Slack App token.
+
+```bash
+curl 
https://encrypt.nimbella.io/github.com/apache/openwhisk-website/blob/slack/apis/slack-invite.js?slacktoken=<token>
+```
diff --git a/apis/slack-invite.js b/apis/slack-invite.js
new file mode 100644
index 0000000..05dae9e
--- /dev/null
+++ b/apis/slack-invite.js
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// jshint esversion: 9
+// jshint asi:true
+const request = require('needle')
+const options = {
+  headers: {
+    'Content-Type': 'application/x-www-form-urlencoded'
+  }
+}
+
+function main({email, org, slacktoken}) {
+  return request(
+    'post',
+    `https://${org}.slack.com/api/users.admin.invite`,
+    {
+      email: email,
+      token: slacktoken,
+      set_active: true
+    },
+    options
+  )
+  .then(res => {
+    if (res.statusCode == 200 && res.body.ok) {
+      return {
+        body: { message:`Success! Check ${email} for an invite from Slack.` }
+      }
+    } else {
+      return {
+        statusCode: 400,
+        body: { error: res.body }
+      }
+    }
+  })
+  .catch(err => {
+    console.error(err)
+     return ({
+       statusCode: 400,
+       body: { error: err.message }
+    })
+  })
+}
+
+exports.main = main
diff --git a/feed.xml b/feed.xml
index 9b6c2a2..d4421a5 100644
--- a/feed.xml
+++ b/feed.xml
@@ -1,2 +1,2 @@
-<?xml version="1.0" encoding="utf-8"?><feed 
xmlns="http://www.w3.org/2005/Atom"; ><generator uri="https://jekyllrb.com/"; 
version="3.3.0">Jekyll</generator><link href="/feed.xml" rel="self" 
type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" 
/><updated>2021-04-05T16:01:11+00:00</updated><id>/feed.xml</id><title 
type="html">Apache OpenWhisk is a serverless, open source cloud 
platform</title><subtitle>An open source platform for serverless, event-driven 
code at any  [...]
+<?xml version="1.0" encoding="utf-8"?><feed 
xmlns="http://www.w3.org/2005/Atom"; ><generator uri="https://jekyllrb.com/"; 
version="3.3.0">Jekyll</generator><link href="/feed.xml" rel="self" 
type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" 
/><updated>2021-04-12T16:18:33+00:00</updated><id>/feed.xml</id><title 
type="html">Apache OpenWhisk is a serverless, open source cloud 
platform</title><subtitle>An open source platform for serverless, event-driven 
code at any  [...]
 </subtitle></feed>
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 6de6499..24169e9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -577,9 +577,9 @@
       "dev": true
     },
     "balanced-match": {
-      "version": "1.0.0",
-      "resolved": 
"https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz";,
-      "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+      "version": "1.0.2",
+      "resolved": 
"https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz";,
+      "integrity": 
"sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
       "dev": true
     },
     "brace-expansion": {
@@ -875,9 +875,9 @@
       }
     },
     "hosted-git-info": {
-      "version": "2.8.8",
-      "resolved": 
"https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz";,
-      "integrity": 
"sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
+      "version": "2.8.9",
+      "resolved": 
"https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz";,
+      "integrity": 
"sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
       "dev": true
     },
     "invariant": {
diff --git a/slack.html b/slack.html
index 34c41d6..57484ee 100644
--- a/slack.html
+++ b/slack.html
@@ -248,10 +248,10 @@ function addListenersToSections()
     var btn = $("button");
     var res = $("#result");
     var email = $('#inputEmail');
-    var actionUrl = 
"https://service.us.apiconnect.ibmcloud.com/gws/apigateway/api/3e172721d7ba44ac0cb5633eae516fb1284fd9a45633e4172dbe7a780b6572c6/api/slackinvite";;
+    var actionUrl = 
"https://js-http.nimbella.io/github.com/apache/openwhisk-website/blob/slack/apis/slack-invite.js?__c=N0_25b48535e252995f2f0960d9002bf55f_0_45725642996e63884cf84425ac19b3db85d5cfe6037cbb39dba06a2dfbff22e551827e951cc36405f048fb2d41f36edfbab2fa9d852f629f7603017ed5a7ba70d5817eada2ba18535fb355e2b627fe5f89f2b1705491eb3418d153581644b4be_";;
     function handler() {
       var email = $("input")[0].value;
-      $.get(actionUrl, { email: email })
+      $.get(actionUrl, { email: email, org: 'openwhisk-team' })
         .done(function (data) {
           btn.addClass("btn-success");
           btn.html("WOOT. CHECK YOUR EMAIL!");

Reply via email to