• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ringcentral / google-forms-notification-add-in / 9791525289

04 Jul 2024 09:03AM UTC coverage: 95.112% (-0.1%) from 95.238%
9791525289

push

github

web-flow
misc: filter data in logs (#67)

* misc: filter data in logs

* misc: filter code

248 of 274 branches covered (90.51%)

Branch coverage included in aggregate %.

43 of 49 new or added lines in 9 files covered. (87.76%)

686 of 708 relevant lines covered (96.89%)

14.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.0
/src/server/index.js
1
const path = require('path');
4✔
2
const express = require('express');
4✔
3
const morgan = require('morgan');
4✔
4
const bodyParser = require('body-parser');
4✔
5
const authorizationRoute = require('./routes/authorization');
4✔
6
const subscriptionRoute = require('./routes/subscription');
4✔
7
const notificationRoute = require('./routes/notification');
4✔
8
const viewRoute = require('./routes/view');
4✔
9
const constants = require('./lib/constants');
4✔
10
const { checkAuth } = require('./middlewares/auth');
4✔
11

12
const app = express()
4✔
13
app.use(morgan(function (tokens, req, res) {
4✔
14
  let url = tokens.url(req, res);
106✔
15
  const rcWebhookUri = req.query.rcWebhookUri || req.query.webhook;
106✔
16
  if (rcWebhookUri) {
106✔
17
    const webhookId = rcWebhookUri.split('/').pop();
10✔
18
    if (webhookId) {
10✔
19
      url = url.replace(webhookId, '[MASK]');
9✔
20
    }
21
  }
22
  const code = req.query.code;
106✔
23
  if (code) {
106!
NEW
24
    url = url.replace(code, '[MASK]');
×
25
  }
26
  if (url.indexOf('/get-form-data') === 0) {
106✔
27
    const formIds = req.query.formIds;
11✔
28
    if (formIds) {
11✔
29
      url = url.replace(formIds, '[MASK]');
6✔
30
    }
31
  }
32
  return [
106✔
33
    tokens.method(req, res),
34
    url,
35
    tokens.status(req, res),
36
    tokens.res(req, res, 'content-length'), '-',
37
    tokens['response-time'](req, res), 'ms'
38
  ].join(' ');
39
}));
40
app.use(bodyParser.urlencoded({ extended: false }))
4✔
41
app.use(bodyParser.json())
4✔
42

43
app.set('views', path.resolve(__dirname, './views'));
4✔
44
app.set('view engine', 'pug');
4✔
45

46
// setup client
47
app.get(constants.route.forClient.CLIENT_SETUP, viewRoute.setup);
4✔
48
// authorization
49
app.get(constants.route.forClient.OPEN_AUTH_PAGE, authorizationRoute.openAuthPage);
4✔
50
app.get(constants.route.forThirdParty.AUTH_CALLBACK, authorizationRoute.oauthCallback);
4✔
51
app.get(constants.route.forClient.GET_USER_INFO, checkAuth, authorizationRoute.getUserInfo);
4✔
52
app.post(constants.route.forClient.GENERATE_TOKEN, authorizationRoute.generateToken);
4✔
53
// revoke
54
app.post(constants.route.forClient.REVOKE_TOKEN, authorizationRoute.revokeToken);
4✔
55
// configure
56
app.post(constants.route.forClient.SUBSCRIBE, subscriptionRoute.subscribe);
4✔
57
app.delete(constants.route.forClient.SUBSCRIBE, subscriptionRoute.deleteSubscription);
4✔
58
app.get(constants.route.forClient.GET_FORM_DATA, checkAuth, subscriptionRoute.getFormData);
4✔
59
// notification
60
app.post(constants.route.forThirdParty.NOTIFICATION, notificationRoute.notification);
4✔
61
// Home page
62
app.get('/home', viewRoute.home);
4✔
63
if (process.env.GOOGLE_SITE_VERIFICATION_TOKEN) {
4!
64
  app.get(`/${process.env.GOOGLE_SITE_VERIFICATION_TOKEN}.html`, (req, res) => {
4✔
65
    res.send(`google-site-verification: ${process.env.GOOGLE_SITE_VERIFICATION_TOKEN}.html`);
1✔
66
  });
67
}
68
app.get('/', viewRoute.home);
4✔
69

70
exports.app = app;
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc