-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into frontend-tests
- Loading branch information
Showing
19 changed files
with
379 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
web: node server | ||
web: npm run heroku-start && node server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react' | ||
|
||
export default class DonateBox extends React.Component { | ||
render() { | ||
return ( | ||
<div> | ||
<div id="donate"> | ||
Love Shields? Please consider{' '} | ||
<a href="https://opencollective.com/shields">donating</a> to sustain | ||
our activities | ||
</div> | ||
<style jsx>{` | ||
#donate { | ||
padding: 25px 50px; | ||
} | ||
`}</style> | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict' | ||
|
||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
const secretsPath = path.join(__dirname, '..', 'private', 'secret.json') | ||
|
||
if (fs.existsSync(secretsPath)) { | ||
console.log('Found existing private/secret.json, not overwriting.') | ||
} else { | ||
console.log('private/secret.json does not exist, creating.') | ||
const privatePath = path.dirname(secretsPath) | ||
if (!fs.existsSync(privatePath)) { | ||
fs.mkdirSync(privatePath) | ||
} | ||
const secrets = { wheelmap_token: process.env.WHEELMAP_TOKEN } | ||
const secretsString = JSON.stringify(secrets) | ||
fs.writeFileSync(secretsPath, secretsString) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"gh_client_id": "${GH_CLIENT_ID}", | ||
"gh_client_secret": "${GH_CLIENT_SECRET}", | ||
"shieldsIps": [ "${SHIELDS_IP}" ], | ||
"gh_token": "${GH_TOKEN}", | ||
"npm_token": "${NPM_TOKEN}" | ||
} | ||
{ | ||
"gh_client_id": "${GH_CLIENT_ID}", | ||
"gh_client_secret": "${GH_CLIENT_SECRET}", | ||
"shieldsIps": [ "${SHIELDS_IP}" ], | ||
"gh_token": "${GH_TOKEN}", | ||
"npm_token": "${NPM_TOKEN}", | ||
"wheelmap_token": "${WHEELMAP_TOKEN}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,58 @@ | ||
'use strict' | ||
|
||
const LegacyService = require('../legacy-service') | ||
const { makeBadgeData: getBadgeData } = require('../../lib/badge-data') | ||
const BaseJsonService = require('../base-json') | ||
const Joi = require('joi') | ||
const { nonNegativeInteger } = require('../validators') | ||
const { metric } = require('../../lib/text-formatters') | ||
|
||
const schema = Joi.object({ activity_total: nonNegativeInteger }) | ||
|
||
module.exports = class Bountysource extends BaseJsonService { | ||
async fetch({ team }) { | ||
const url = `https://api.bountysource.com/teams/${team}` | ||
return this._requestJson({ | ||
schema, | ||
url, | ||
options: { | ||
headers: { Accept: 'application/vnd.bountysource+json; version=2' }, | ||
}, | ||
}) | ||
} | ||
|
||
module.exports = class Bountysource extends LegacyService { | ||
static get category() { | ||
return 'funding' | ||
} | ||
|
||
static get defaultBadgeData() { | ||
return { label: 'bounties' } | ||
} | ||
|
||
static get route() { | ||
return { | ||
base: 'bountysource', | ||
base: 'bountysource/team', | ||
pattern: ':team/activity', | ||
} | ||
} | ||
|
||
static get examples() { | ||
return [ | ||
{ | ||
title: 'Bountysource', | ||
previewUrl: 'team/mozilla-core/activity', | ||
namedParams: { team: 'mozilla-core' }, | ||
staticExample: this.render({ total: 53000 }), | ||
}, | ||
] | ||
} | ||
|
||
static registerLegacyRouteHandler({ camp, cache }) { | ||
camp.route( | ||
/^\/bountysource\/team\/([^/]+)\/activity\.(svg|png|gif|jpg|json)$/, | ||
cache((data, match, sendBadge, request) => { | ||
const team = match[1] // eg, `mozilla-core`. | ||
const format = match[2] | ||
const url = `https://api.bountysource.com/teams/${team}` | ||
const options = { | ||
headers: { Accept: 'application/vnd.bountysource+json; version=2' }, | ||
} | ||
const badgeData = getBadgeData('bounties', data) | ||
request(url, options, (err, res, buffer) => { | ||
if (err != null) { | ||
badgeData.text[1] = 'inaccessible' | ||
sendBadge(format, badgeData) | ||
return | ||
} | ||
try { | ||
if (res.statusCode !== 200) { | ||
throw Error('Bad response.') | ||
} | ||
const parsedData = JSON.parse(buffer) | ||
const activity = parsedData.activity_total | ||
badgeData.colorscheme = 'brightgreen' | ||
badgeData.text[1] = activity | ||
sendBadge(format, badgeData) | ||
} catch (e) { | ||
if (res.statusCode === 404) { | ||
badgeData.text[1] = 'not found' | ||
} else { | ||
badgeData.text[1] = 'invalid' | ||
} | ||
sendBadge(format, badgeData) | ||
} | ||
}) | ||
}) | ||
) | ||
static render({ total }) { | ||
return { | ||
message: metric(total), | ||
color: 'brightgreen', | ||
} | ||
} | ||
|
||
async handle({ team }) { | ||
const json = await this.fetch({ team }) | ||
return this.constructor.render({ total: json.activity_total }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.