Skip to content

Commit d8502d4

Browse files
committed
Merge pull request #72 from hindessm/google-calendar-fixes
Google calendar fixes
2 parents bc5777d + 3aaf94c commit d8502d4

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

google/calendar.html

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,31 @@
3030
</script>
3131

3232
<script type="text/x-red" data-help-name="google calendar">
33-
<p>Create an entry in a <a href="https://www.google.com/calendar">Google Calendar</a>.</p>
33+
<p>Return the next event in a <a href="https://www.google.com/calendar">Google Calendar</a>.</p>
3434
<p>The incoming message can provide the following properties:
3535
<ul>
36-
<li><b>payload</b> - an object containing the query parameters described in <a href="https://developers.google.com/google-apps/calendar/v3/reference/events/list">event list API documentation</a></li>
37-
<li><b>calendar</b> - the calendar to add the event to (optional, defaults to the node calendar property or the users primary calendar)</li>
36+
<li><b>payload</b> - a text search string used to select relevant events</li>
37+
<li><b>calendar</b> - the calendar to retrieve the event from (optional, defaults to the node calendar property or the users primary calendar)</li>
38+
</ul>
39+
</p>
40+
<p>The message sent from the node will have properties:
41+
<ul>
42+
<li><b>title</b> - the summary string from the calendar entry</li>
43+
<li><b>description</b> - the description from the calendar entry</li>
44+
<li><b>location.description</b> - the location string from the calendar entry</li>
45+
<li><b>data</b> - the raw event from the google calendar query as described in the <a href="https://developers.google.com/google-apps/calendar/v3/reference/events/list">event list API documentation</a></li>
46+
<li><b>payload</b> - an object containing:
47+
<ul>
48+
<li><b>title</b> - the summary string from the calendar entry</li>
49+
<li><b>description</b> - the description from the calendar entry</li>
50+
<li><b>location.description</b> - the location string from the calendar entry</li>
51+
<li><b>start</b> - Javascript Date of start time - midnight for all day event</li>
52+
<li><b>end</b> - Javascript Date of end time - midnight for all day event</li>
53+
<li><b>allDayEvent</b> - true if event is an all day event</li>
54+
<li><b>creator</b> - object containing name and email properties</li>
55+
<li><b>attendees</b> - list of objects containing name and email properties</li>
56+
</ul>
57+
</li>
3858
</ul>
3959
</p>
4060
</script>

google/google.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ module.exports = function(RED) {
150150

151151
var csrfToken = crypto.randomBytes(18).toString('base64').replace(/\//g, '-').replace(/\+/g, '_');
152152
credentials.csrfToken = csrfToken;
153+
credentials.callback = callback;
153154
res.cookie('csrf', csrfToken);
154155
res.redirect(url.format({
155156
protocol: 'https',
@@ -194,11 +195,7 @@ module.exports = function(RED) {
194195
code: req.query.code,
195196
client_id: credentials.clientId,
196197
client_secret: credentials.clientSecret,
197-
redirect_uri: url.format({
198-
protocol: req.protocol,
199-
host: req.headers.host,
200-
pathname: RED.httpAdmin.path() + 'google-credentials/auth/callback'
201-
}),
198+
redirect_uri: credentials.callback
202199
},
203200
}, function(err, result, data) {
204201
if (err) {
@@ -216,6 +213,7 @@ module.exports = function(RED) {
216213
data.expires_in + (new Date().getTime()/1000);
217214
credentials.tokenType = data.token_type;
218215
delete credentials.csrfToken;
216+
delete credentials.callback;
219217
RED.nodes.addCredentials(node_id, credentials);
220218
request.get({
221219
url: 'https://www.googleapis.com/plus/v1/people/me',

0 commit comments

Comments
 (0)