46 | 47 |
48 | 49 | {{{body}}} 50 | 51 |
52 | 53 | 54 | 84 | 85 | 86 | 139 | 140 | 141 | 142 |
143 | 144 |
145 | 146 | -------------------------------------------------------------------------------- /grand-central-station/data/fashiongerry.json: -------------------------------------------------------------------------------- 1 | { 2 | "bot": { 3 | 4 | "name": "fashiongerry" 5 | }, 6 | "bitly": { 7 | "user": "zackproser", 8 | "key": "R_254f95zvbt5db628f683349ac25e5" 9 | }, 10 | "twitter": { 11 | "tracking_name": ["fashion", "mensfashion", "menswear", "mensstyle", "lifestyle", "clothes", "topfash", "beauty"], 12 | "consumer_key": "NHfpctrElDdavsbfeCZ5LUkksp", 13 | "consumer_secret": "29X5tmewIzvyC0HaGZKB0uVGLU5uuF3MyOFUGjLEZQPXAX", 14 | "access_token": "3119025013-rPuJ9OzcvblWBZutaW2enLNNBMJvbBF2JvWYC", 15 | "access_token_secret": "QVMthNt7fgNmzvcNTyo2CalXJaVK1FYt0dBSbOmP", 16 | "users_to_ignore": [ 17 | "balabart", 18 | "another jerk", 19 | "shitfuck mcgee" 20 | ], 21 | "target_hashtags": ["fashion", "mensfashion", "menswear", "mensstyle", "lifestyle", "clothes", "style"], 22 | "retweet_disqualifiers": ["sex", "$", "£", "buy", "free", "cheap", "best", "webinar", "coupon", "offer", "bot", "backlink", "sale", "special", "nigga", "dick", "pussy", "cock", "penis", "blowjob", "anal", "porn"], 23 | "retweet_thank_yous": ["Thanks for your support!", "Thank you for retweeting", "Thx for rting!", "THX Retweeters", "Much appreciated!", "Thx for helping out!"], 24 | "youre_welcomes": ["NP", "Np", "Anytime", "You got it", "Sure thing", "yw", "YW", "no problem", "happy to help", "you know it", "no prob", "Sure", "Anytime"] 25 | }, 26 | 27 | "mongo": { 28 | "host": "127.0.0.1", 29 | "port": 27017 30 | }, 31 | 32 | "scraper": { 33 | "feeds": [ 34 | "http://www.gq.com/services/rss/feeds/latest.xml", 35 | "http://www.gq.com/services/rss/feeds/styleguy.xml", 36 | "http://www.gq.com/services/rss/feeds/women.xml", 37 | "http://www.gq.com/services/rss/feeds/howto.xml", 38 | "http://www.gq.com/style/blogs/the-gq-eye/rss.xml", 39 | "http://www.anothermag.com/feed", 40 | "http://www.7thmanmagazine.com/feed/", 41 | "http://www.essential-homme.com/feed/", 42 | "http://therakeonline.com/feed/", 43 | "http://thehoundstoothblog.com/feed/", 44 | "http://www.modernfellows.com/feed/", 45 | "http://hespokestyle.com/feed/", 46 | "http://offthecuffdc.com/feed", 47 | "http://www.contemporarystandard.com/feed/", 48 | "http://thehundreds.com/feed/", 49 | "http://feeds.feedburner.com/acontinuouslean/", 50 | "http://putthison.com/rss", 51 | "http://feeds.feedburner.com/Upscalehype", 52 | "http://www.gilt.com/giltmanual/feed/" 53 | ] 54 | }, 55 | "aws": { 56 | 57 | "awsId": "AKIAIBJHsdv6XWHVPQ", 58 | "awsSecret": "Y6aA/knUFpJ78dfRPlg2/63gnWh2PKLS8RND+9j", 59 | "assocId": "fashiongerry-20", 60 | "searchIndex": "All", 61 | "product_keywords": ["mens fashion", "mens clothing", "mens luxury", "mens watches", "mens shoes", "mens sportscoats", "mens wallets", "mens belts"] 62 | }, 63 | 64 | 65 | 66 | "timers": { 67 | 68 | "retweetTimer": { 69 | "min": 35, 70 | "max": 45 71 | }, 72 | "thankYouTimer": { 73 | "min": 35, 74 | "max": 55 75 | }, 76 | "checkThankYouTimer": { 77 | "min": 35, 78 | "max": 55 79 | }, 80 | "pruneInterval": { 81 | "min": 5, 82 | "max": 25 83 | }, 84 | "followInterval": { 85 | "min": 25, 86 | "max": 45 87 | }, 88 | "favoriteTimer": { 89 | "min": 35, 90 | "max": 55 91 | }, 92 | "scrapeInterval": { 93 | "min": 1, 94 | "max": 3 95 | }, 96 | "tweetInterval": { 97 | "min": 35, 98 | "max": 55 99 | }, 100 | "productResearchInterval": { 101 | "min": 5, 102 | "max": 15 103 | }, 104 | "advertisementInterval": { 105 | "min": 30, 106 | "max": 95 107 | } 108 | } 109 | } -------------------------------------------------------------------------------- /grand-central-station/data/hivemind-seed.json: -------------------------------------------------------------------------------- 1 | { 2 | "users_to_ignore": ["balabart","jerkface","shitfuck mcgee"], 3 | "retweet_disqualifiers": ["sex", "$", "£", "buy", "free", "cheap", "best", "webinar", "coupon", "offer", "bot", "backlink", "sale", "special", "nigga", "dick", "pussy", "cock", "penis", "blowjob", "anal", "porn", "gay", "lesbian", "LGBT", "fag", "fuck", "shit", "piss", "asshole", "rape", "vagina", "bung", "balls", "sack", "drinking", "smoking", "lesbian", "gay", "liberal", "conservative", "high", "drunk", "stoned", "gun", "kill", "violence", "bitch", "whore", "bone", "muslim", "christian", "jew", "arab", "terroris", "lgbt", "gay", "fag", "bitch"] 4 | } -------------------------------------------------------------------------------- /grand-central-station/data/seed.json: -------------------------------------------------------------------------------- 1 | { 2 | "bot": { 3 | 4 | "name": "" 5 | }, 6 | "bitly": { 7 | "user": "", 8 | "key": "" 9 | }, 10 | "twitter": { 11 | "tracking_name": [], 12 | "consumer_key": "", 13 | "consumer_secret": "", 14 | "access_token": "", 15 | "access_token_secret": "", 16 | "users_to_ignore": [], 17 | "target_hashtags": [], 18 | "retweet_disqualifiers": [], 19 | "retweet_thank_yous": [], 20 | "youre_welcomes": [] 21 | }, 22 | 23 | "mongo": { 24 | "host": "127.0.0.1", 25 | "port": 27017 26 | }, 27 | 28 | "scraper": { 29 | "feeds": [] 30 | }, 31 | "aws": { 32 | 33 | "awsId": "", 34 | "awsSecret": "", 35 | "assocId": "", 36 | "searchIndex": "All", 37 | "product_keywords": [] 38 | }, 39 | "timers": { 40 | 41 | "retweetTimer": { 42 | "min": 15, 43 | "max": 35 44 | }, 45 | "thankYouTimer": { 46 | "min": 5, 47 | "max": 10 48 | }, 49 | "checkThankYouTimer": { 50 | "min": 35, 51 | "max": 45 52 | }, 53 | "pruneInterval": { 54 | "min": 5, 55 | "max": 25 56 | }, 57 | "followInterval": { 58 | "min": 5, 59 | "max": 25 60 | }, 61 | "favoriteTimer": { 62 | "min": 20, 63 | "max": 35 64 | }, 65 | "scrapeInterval": { 66 | "min": 1, 67 | "max": 3 68 | }, 69 | "tweetInterval": { 70 | "min": 25, 71 | "max": 40 72 | }, 73 | "productResearchInterval": { 74 | "min": 5, 75 | "max": 15 76 | }, 77 | "advertisementInterval": { 78 | "min": 30, 79 | "max": 95 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /grand-central-station/data/urbanplanner34.json: -------------------------------------------------------------------------------- 1 | { 2 | "bot": { 3 | 4 | "name": "gregbot" 5 | }, 6 | "bitly": { 7 | "user": "zackproser", 8 | "key": "R_254f953fbsdvwebt628f6df49ac25e5" 9 | }, 10 | "twitter": { 11 | "tracking_name": ["architecture", "greencities", "urban", "planning", "cityreads", "smartcities", "greentech", "urbaninnovation", "urbanstudies", "economicdevelopment", "community"], 12 | "consumer_key": "ZF6yXPdfvebgw9xzZHdvbOLaF", 13 | "consumer_secret": "PYK2ETaAnfevdvdU8u1OxPL4hdtaMFeO26bmoXD3ibR4", 14 | "access_token": "3109417369-zg18MpEfebgTKZ6PI4YcrvtMKlggPbQz8SI", 15 | "access_token_secret": "625NYPjaTUFlASuulfvebc0MRJfDmN5PK8yzHFvc", 16 | "users_to_ignore": [ 17 | "balabart", 18 | "anotherjerk", 19 | "shitfuckmcgee" 20 | ], 21 | "target_hashtags": ["urban", "greencities", "cityreads", "greentech", "innovation", "city", "architecture", "urbanstudies"], 22 | "retweet_disqualifiers": ["sex", "$", "£", "buy", "free", "cheap", "best", "webinar", "coupon", "offer", "bot", "backlink", "sale", "special", "nigga", "dick", "pussy", "cock", "penis", "cum", "jiz"], 23 | "retweet_thank_yous": ["Thanks a lot!", "Thank you"], 24 | "youre_welcomes": ["NP!", "Np :)", "Anytime", "You got it!", "Sure thing!"] 25 | }, 26 | 27 | "mongo": { 28 | "host": "127.0.0.1", 29 | "port": 27017 30 | }, 31 | 32 | "scraper": { 33 | "feeds": [ 34 | "http://www.planetizen.com/frontpage/feed", 35 | "http://www.globalsiteplans.com/feed/", 36 | "http://thedailypothole.tumblr.com/rss", 37 | "http://dirt.asla.org/feed/", 38 | "http://urbanomnibus.net/feed/", 39 | "http://feeds2.feedburner.com/Newgeography", 40 | "http://blog.cubitplanning.com/feed/", 41 | "http://www.cnt.org/feed/", 42 | "http://streetsblog.net/feed/", 43 | "http://grist.org/feed/", 44 | "http://www.pbs.org/wnet/blueprintamerica/category/blogs/feed/", 45 | "http://www.thetransportpolitic.com/feed/", 46 | "http://spacing.ca/toronto/feed/", 47 | "http://www.digitalurban.org/feed", 48 | "http://feeds.feedburner.com/weburbanist", 49 | "http://feeds.feedburner.com/thecityfix/posts", 50 | "http://rethinkcollegepark.net/blog/feed/", 51 | "http://feeds.feedburner.com/designobserver", 52 | "http://bldgblog.blogspot.co.uk/feeds/posts/default", 53 | "http://feeds.feedburner.com/contemporist", 54 | "http://feeds.feedburner.com/Eikongraphia", 55 | "http://feeds.feedburner.com/archidose", 56 | "http://unhappyhipsters.com/rss", 57 | "http://architectureblog.tumblr.com/rss", 58 | "http://urbanplanningblog.com/feed/", 59 | "http://feeds.feedburner.com/Austincontrarian", 60 | "http://feeds.feedburner.com/city-journal", 61 | "http://ownyourcity.ca/feed/" 62 | ] 63 | }, 64 | "aws": { 65 | 66 | "awsId": "AKIAIBJdvb6XWHVPQ", 67 | "awsSecret": "Y6aA/knUFpJvrbPlg2/63gnWh2PKLS8RND+9j", 68 | "assocId": "gregbot-urbanplanning-20", 69 | "searchIndex": "All", 70 | "product_keywords": ["urban planning", "economic development", "community", "community planning", "architecture", "green building", "innovation"] 71 | }, 72 | 73 | "util": { 74 | 75 | "bitly_user": "zackproser", 76 | "bitly_key": "R_254f95scvfbdrvbghj49ac25e5" 77 | }, 78 | 79 | "timers": { 80 | 81 | "retweetTimer": { 82 | "min": 25, 83 | "max": 50 84 | }, 85 | "thankYouTimer": { 86 | "min": 5, 87 | "max": 25 88 | }, 89 | "checkThankYouTimer": { 90 | "min": 25, 91 | "max": 55 92 | }, 93 | "pruneInterval": { 94 | "min": 20, 95 | "max": 35 96 | }, 97 | "followInterval": { 98 | "min": 35, 99 | "max": 55 100 | }, 101 | "favoriteTimer": { 102 | "min": 35, 103 | "max": 55 104 | }, 105 | "scrapeInterval": { 106 | "min": 1, 107 | "max": 3 108 | }, 109 | "tweetInterval": { 110 | "min": 35, 111 | "max": 50 112 | }, 113 | "productResearchInterval": { 114 | "min": 25, 115 | "max": 45 116 | }, 117 | "advertisementInterval": { 118 | "min": 90, 119 | "max": 180 120 | } 121 | } 122 | } -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { "modules": false }], 4 | "stage-2" 5 | ], 6 | "plugins": ["transform-runtime"], 7 | "comments": false, 8 | "env": { 9 | "test": { 10 | "presets": ["env", "stage-2"], 11 | "plugins": [ "istanbul" ] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // http://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module' 8 | }, 9 | env: { 10 | browser: true, 11 | }, 12 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style 13 | extends: 'standard', 14 | // required to lint *.vue files 15 | plugins: [ 16 | 'html' 17 | ], 18 | // add your custom rules here 19 | 'rules': { 20 | // allow paren-less arrow functions 21 | 'arrow-parens': 0, 22 | // allow async-await 23 | 'generator-star-spacing': 0, 24 | // allow debugger during development 25 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | test/unit/coverage 8 | test/e2e/reports 9 | selenium-debug.log 10 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserlist" field in package.json 6 | "autoprefixer": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/README.md: -------------------------------------------------------------------------------- 1 | # new 2 | 3 | > Goodneighbor Frontend 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # build for production and view the bundle analyzer report 18 | npm run build --report 19 | 20 | # run unit tests 21 | npm run unit 22 | 23 | # run e2e tests 24 | npm run e2e 25 | 26 | # run all tests 27 | npm test 28 | ``` 29 | 30 | For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 31 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/build/build.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | process.env.NODE_ENV = 'production' 4 | 5 | var ora = require('ora') 6 | var rm = require('rimraf') 7 | var path = require('path') 8 | var chalk = require('chalk') 9 | var webpack = require('webpack') 10 | var config = require('../config') 11 | var webpackConfig = require('./webpack.prod.conf') 12 | 13 | var spinner = ora('building for production...') 14 | spinner.start() 15 | 16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 17 | if (err) throw err 18 | webpack(webpackConfig, function (err, stats) { 19 | spinner.stop() 20 | if (err) throw err 21 | process.stdout.write(stats.toString({ 22 | colors: true, 23 | modules: false, 24 | children: false, 25 | chunks: false, 26 | chunkModules: false 27 | }) + '\n\n') 28 | 29 | console.log(chalk.cyan(' Build complete.\n')) 30 | console.log(chalk.yellow( 31 | ' Tip: built files are meant to be served over an HTTP server.\n' + 32 | ' Opening index.html over file:// won\'t work.\n' 33 | )) 34 | }) 35 | }) 36 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/build/check-versions.js: -------------------------------------------------------------------------------- 1 | var chalk = require('chalk') 2 | var semver = require('semver') 3 | var packageConfig = require('../package.json') 4 | var shell = require('shelljs') 5 | function exec (cmd) { 6 | return require('child_process').execSync(cmd).toString().trim() 7 | } 8 | 9 | var versionRequirements = [ 10 | { 11 | name: 'node', 12 | currentVersion: semver.clean(process.version), 13 | versionRequirement: packageConfig.engines.node 14 | }, 15 | ] 16 | 17 | if (shell.which('npm')) { 18 | versionRequirements.push({ 19 | name: 'npm', 20 | currentVersion: exec('npm --version'), 21 | versionRequirement: packageConfig.engines.npm 22 | }) 23 | } 24 | 25 | module.exports = function () { 26 | var warnings = [] 27 | for (var i = 0; i < versionRequirements.length; i++) { 28 | var mod = versionRequirements[i] 29 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 30 | warnings.push(mod.name + ': ' + 31 | chalk.red(mod.currentVersion) + ' should be ' + 32 | chalk.green(mod.versionRequirement) 33 | ) 34 | } 35 | } 36 | 37 | if (warnings.length) { 38 | console.log('') 39 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 40 | console.log() 41 | for (var i = 0; i < warnings.length; i++) { 42 | var warning = warnings[i] 43 | console.log(' ' + warning) 44 | } 45 | console.log() 46 | process.exit(1) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/build/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 4 | 5 | hotClient.subscribe(function (event) { 6 | if (event.action === 'reload') { 7 | window.location.reload() 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/build/dev-server.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | var config = require('../config') 4 | if (!process.env.NODE_ENV) { 5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) 6 | } 7 | 8 | var opn = require('opn') 9 | var path = require('path') 10 | var express = require('express') 11 | var webpack = require('webpack') 12 | var proxyMiddleware = require('http-proxy-middleware') 13 | var webpackConfig = process.env.NODE_ENV === 'testing' 14 | ? require('./webpack.prod.conf') 15 | : require('./webpack.dev.conf') 16 | 17 | // default port where dev server listens for incoming traffic 18 | var port = process.env.PORT || config.dev.port 19 | // automatically open browser, if not set will be false 20 | var autoOpenBrowser = !!config.dev.autoOpenBrowser 21 | // Define HTTP proxies to your custom API backend 22 | // https://github.com/chimurai/http-proxy-middleware 23 | var proxyTable = config.dev.proxyTable 24 | 25 | var app = express() 26 | var compiler = webpack(webpackConfig) 27 | 28 | var devMiddleware = require('webpack-dev-middleware')(compiler, { 29 | publicPath: webpackConfig.output.publicPath, 30 | quiet: true 31 | }) 32 | 33 | var hotMiddleware = require('webpack-hot-middleware')(compiler, { 34 | log: () => {} 35 | }) 36 | // force page reload when html-webpack-plugin template changes 37 | compiler.plugin('compilation', function (compilation) { 38 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { 39 | hotMiddleware.publish({ action: 'reload' }) 40 | cb() 41 | }) 42 | }) 43 | 44 | // proxy api requests 45 | Object.keys(proxyTable).forEach(function (context) { 46 | var options = proxyTable[context] 47 | if (typeof options === 'string') { 48 | options = { target: options } 49 | } 50 | app.use(proxyMiddleware(options.filter || context, options)) 51 | }) 52 | 53 | // handle fallback for HTML5 history API 54 | app.use(require('connect-history-api-fallback')()) 55 | 56 | // serve webpack bundle output 57 | app.use(devMiddleware) 58 | 59 | // enable hot-reload and state-preserving 60 | // compilation error display 61 | app.use(hotMiddleware) 62 | 63 | // serve pure static assets 64 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) 65 | app.use(staticPath, express.static('./static')) 66 | 67 | var uri = 'http://localhost:' + port 68 | 69 | var _resolve 70 | var readyPromise = new Promise(resolve => { 71 | _resolve = resolve 72 | }) 73 | 74 | console.log('> Starting dev server...') 75 | devMiddleware.waitUntilValid(() => { 76 | console.log('> Listening at ' + uri + '\n') 77 | // when env is testing, don't need open it 78 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { 79 | opn(uri) 80 | } 81 | _resolve() 82 | }) 83 | 84 | var server = app.listen(port) 85 | 86 | module.exports = { 87 | ready: readyPromise, 88 | close: () => { 89 | server.close() 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/build/utils.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var config = require('../config') 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 4 | 5 | exports.assetsPath = function (_path) { 6 | var assetsSubDirectory = process.env.NODE_ENV === 'production' 7 | ? config.build.assetsSubDirectory 8 | : config.dev.assetsSubDirectory 9 | return path.posix.join(assetsSubDirectory, _path) 10 | } 11 | 12 | exports.cssLoaders = function (options) { 13 | options = options || {} 14 | 15 | var cssLoader = { 16 | loader: 'css-loader', 17 | options: { 18 | minimize: process.env.NODE_ENV === 'production', 19 | sourceMap: options.sourceMap 20 | } 21 | } 22 | 23 | // generate loader string to be used with extract text plugin 24 | function generateLoaders (loader, loaderOptions) { 25 | var loaders = [cssLoader] 26 | if (loader) { 27 | loaders.push({ 28 | loader: loader + '-loader', 29 | options: Object.assign({}, loaderOptions, { 30 | sourceMap: options.sourceMap 31 | }) 32 | }) 33 | } 34 | 35 | // Extract CSS when that option is specified 36 | // (which is the case during production build) 37 | if (options.extract) { 38 | return ExtractTextPlugin.extract({ 39 | use: loaders, 40 | fallback: 'vue-style-loader' 41 | }) 42 | } else { 43 | return ['vue-style-loader'].concat(loaders) 44 | } 45 | } 46 | 47 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 48 | return { 49 | css: generateLoaders(), 50 | postcss: generateLoaders(), 51 | less: generateLoaders('less'), 52 | sass: generateLoaders('sass', { indentedSyntax: true }), 53 | scss: generateLoaders('sass'), 54 | stylus: generateLoaders('stylus'), 55 | styl: generateLoaders('stylus') 56 | } 57 | } 58 | 59 | // Generate loaders for standalone style files (outside of .vue) 60 | exports.styleLoaders = function (options) { 61 | var output = [] 62 | var loaders = exports.cssLoaders(options) 63 | for (var extension in loaders) { 64 | var loader = loaders[extension] 65 | output.push({ 66 | test: new RegExp('\\.' + extension + '$'), 67 | use: loader 68 | }) 69 | } 70 | return output 71 | } 72 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var config = require('../config') 3 | var isProduction = process.env.NODE_ENV === 'production' 4 | 5 | module.exports = { 6 | loaders: utils.cssLoaders({ 7 | sourceMap: isProduction 8 | ? config.build.productionSourceMap 9 | : config.dev.cssSourceMap, 10 | extract: isProduction 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var config = require('../config') 4 | var vueLoaderConfig = require('./vue-loader.conf') 5 | 6 | function resolve (dir) { 7 | return path.join(__dirname, '..', dir) 8 | } 9 | 10 | module.exports = { 11 | entry: { 12 | app: './src/main.js' 13 | }, 14 | output: { 15 | path: config.build.assetsRoot, 16 | filename: '[name].js', 17 | publicPath: process.env.NODE_ENV === 'production' 18 | ? config.build.assetsPublicPath 19 | : config.dev.assetsPublicPath 20 | }, 21 | resolve: { 22 | extensions: ['.js', '.vue', '.json'], 23 | alias: { 24 | 'vue$': 'vue/dist/vue.esm.js', 25 | '@': resolve('src') 26 | } 27 | }, 28 | module: { 29 | rules: [ 30 | { 31 | test: /\.(js|vue)$/, 32 | loader: 'eslint-loader', 33 | enforce: 'pre', 34 | include: [resolve('src'), resolve('test')], 35 | options: { 36 | formatter: require('eslint-friendly-formatter') 37 | } 38 | }, 39 | { 40 | test: /\.vue$/, 41 | loader: 'vue-loader', 42 | options: vueLoaderConfig 43 | }, 44 | { 45 | test: /\.js$/, 46 | loader: 'babel-loader', 47 | include: [resolve('src'), resolve('test')] 48 | }, 49 | { 50 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 51 | loader: 'url-loader', 52 | options: { 53 | limit: 10000, 54 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 55 | } 56 | }, 57 | { 58 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 59 | loader: 'url-loader', 60 | options: { 61 | limit: 10000, 62 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 63 | } 64 | } 65 | ] 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var webpack = require('webpack') 3 | var config = require('../config') 4 | var merge = require('webpack-merge') 5 | var baseWebpackConfig = require('./webpack.base.conf') 6 | var HtmlWebpackPlugin = require('html-webpack-plugin') 7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 8 | 9 | // add hot-reload related code to entry chunks 10 | Object.keys(baseWebpackConfig.entry).forEach(function (name) { 11 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 12 | }) 13 | 14 | module.exports = merge(baseWebpackConfig, { 15 | module: { 16 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) 17 | }, 18 | // cheap-module-eval-source-map is faster for development 19 | devtool: '#cheap-module-eval-source-map', 20 | plugins: [ 21 | new webpack.DefinePlugin({ 22 | 'process.env': config.dev.env 23 | }), 24 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 25 | new webpack.HotModuleReplacementPlugin(), 26 | new webpack.NoEmitOnErrorsPlugin(), 27 | // https://github.com/ampedandwired/html-webpack-plugin 28 | new HtmlWebpackPlugin({ 29 | filename: 'index.html', 30 | template: 'index.html', 31 | inject: true 32 | }), 33 | new FriendlyErrorsPlugin() 34 | ] 35 | }) 36 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var webpack = require('webpack') 4 | var config = require('../config') 5 | var merge = require('webpack-merge') 6 | var baseWebpackConfig = require('./webpack.base.conf') 7 | var CopyWebpackPlugin = require('copy-webpack-plugin') 8 | var HtmlWebpackPlugin = require('html-webpack-plugin') 9 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 10 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 11 | 12 | var env = process.env.NODE_ENV === 'testing' 13 | ? require('../config/test.env') 14 | : config.build.env 15 | 16 | var webpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ 19 | sourceMap: config.build.productionSourceMap, 20 | extract: true 21 | }) 22 | }, 23 | devtool: config.build.productionSourceMap ? '#source-map' : false, 24 | output: { 25 | path: config.build.assetsRoot, 26 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 27 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 28 | }, 29 | plugins: [ 30 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 31 | new webpack.DefinePlugin({ 32 | 'process.env': env 33 | }), 34 | new webpack.optimize.UglifyJsPlugin({ 35 | compress: { 36 | warnings: false 37 | }, 38 | sourceMap: true 39 | }), 40 | // extract css into its own file 41 | new ExtractTextPlugin({ 42 | filename: utils.assetsPath('css/[name].[contenthash].css') 43 | }), 44 | // Compress extracted CSS. We are using this plugin so that possible 45 | // duplicated CSS from different components can be deduped. 46 | new OptimizeCSSPlugin({ 47 | cssProcessorOptions: { 48 | safe: true 49 | } 50 | }), 51 | // generate dist index.html with correct asset hash for caching. 52 | // you can customize output by editing /index.html 53 | // see https://github.com/ampedandwired/html-webpack-plugin 54 | new HtmlWebpackPlugin({ 55 | filename: process.env.NODE_ENV === 'testing' 56 | ? 'index.html' 57 | : config.build.index, 58 | template: 'index.html', 59 | inject: true, 60 | minify: { 61 | removeComments: true, 62 | collapseWhitespace: true, 63 | removeAttributeQuotes: true 64 | // more options: 65 | // https://github.com/kangax/html-minifier#options-quick-reference 66 | }, 67 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 68 | chunksSortMode: 'dependency' 69 | }), 70 | // split vendor js into its own file 71 | new webpack.optimize.CommonsChunkPlugin({ 72 | name: 'vendor', 73 | minChunks: function (module, count) { 74 | // any required modules inside node_modules are extracted to vendor 75 | return ( 76 | module.resource && 77 | /\.js$/.test(module.resource) && 78 | module.resource.indexOf( 79 | path.join(__dirname, '../node_modules') 80 | ) === 0 81 | ) 82 | } 83 | }), 84 | // extract webpack runtime and module manifest to its own file in order to 85 | // prevent vendor hash from being updated whenever app bundle is updated 86 | new webpack.optimize.CommonsChunkPlugin({ 87 | name: 'manifest', 88 | chunks: ['vendor'] 89 | }), 90 | // copy custom static assets 91 | new CopyWebpackPlugin([ 92 | { 93 | from: path.resolve(__dirname, '../static'), 94 | to: config.build.assetsSubDirectory, 95 | ignore: ['.*'] 96 | } 97 | ]) 98 | ] 99 | }) 100 | 101 | if (config.build.productionGzip) { 102 | var CompressionWebpackPlugin = require('compression-webpack-plugin') 103 | 104 | webpackConfig.plugins.push( 105 | new CompressionWebpackPlugin({ 106 | asset: '[path].gz[query]', 107 | algorithm: 'gzip', 108 | test: new RegExp( 109 | '\\.(' + 110 | config.build.productionGzipExtensions.join('|') + 111 | ')$' 112 | ), 113 | threshold: 10240, 114 | minRatio: 0.8 115 | }) 116 | ) 117 | } 118 | 119 | if (config.build.bundleAnalyzerReport) { 120 | var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 121 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 122 | } 123 | 124 | module.exports = webpackConfig 125 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/build/webpack.test.conf.js: -------------------------------------------------------------------------------- 1 | // This is the webpack config used for unit tests. 2 | 3 | var utils = require('./utils') 4 | var webpack = require('webpack') 5 | var merge = require('webpack-merge') 6 | var baseConfig = require('./webpack.base.conf') 7 | 8 | var webpackConfig = merge(baseConfig, { 9 | // use inline sourcemap for karma-sourcemap-loader 10 | module: { 11 | rules: utils.styleLoaders() 12 | }, 13 | devtool: '#inline-source-map', 14 | resolveLoader: { 15 | alias: { 16 | // necessary to to make lang="scss" work in test when using vue-loader's ?inject option 17 | // see discussion at https://github.com/vuejs/vue-loader/issues/724 18 | 'scss-loader': 'sass-loader' 19 | } 20 | }, 21 | plugins: [ 22 | new webpack.DefinePlugin({ 23 | 'process.env': require('../config/test.env') 24 | }) 25 | ] 26 | }) 27 | 28 | // no need for app entry during tests 29 | delete webpackConfig.entry 30 | 31 | module.exports = webpackConfig 32 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | 4 | module.exports = { 5 | build: { 6 | env: require('./prod.env'), 7 | index: path.resolve(__dirname, '../dist/index.html'), 8 | assetsRoot: path.resolve(__dirname, '../dist'), 9 | assetsSubDirectory: 'static', 10 | assetsPublicPath: '/', 11 | productionSourceMap: true, 12 | // Gzip off by default as many popular static hosts such as 13 | // Surge or Netlify already gzip all static assets for you. 14 | // Before setting to `true`, make sure to: 15 | // npm install --save-dev compression-webpack-plugin 16 | productionGzip: false, 17 | productionGzipExtensions: ['js', 'css'], 18 | // Run the build command with an extra argument to 19 | // View the bundle analyzer report after build finishes: 20 | // `npm run build --report` 21 | // Set to `true` or `false` to always turn it on or off 22 | bundleAnalyzerReport: process.env.npm_config_report 23 | }, 24 | dev: { 25 | env: require('./dev.env'), 26 | port: 8080, 27 | autoOpenBrowser: true, 28 | assetsSubDirectory: 'static', 29 | assetsPublicPath: '/', 30 | proxyTable: {}, 31 | // CSS Sourcemaps off by default because relative paths are "buggy" 32 | // with this option, according to the CSS-Loader README 33 | // (https://github.com/webpack/css-loader#sourcemaps) 34 | // In our experience, they generally work as expected, 35 | // just be aware of this issue when enabling this option. 36 | cssSourceMap: false 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/config/test.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var devEnv = require('./dev.env') 3 | 4 | module.exports = merge(devEnv, { 5 | NODE_ENV: '"testing"' 6 | }) 7 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | new 6 | 7 | 8 |
9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "new", 3 | "version": "1.0.0", 4 | "description": "Goodneighbor Frontend", 5 | "author": "Zack Proser ", 6 | "private": true, 7 | "scripts": { 8 | "dev": "node build/dev-server.js", 9 | "start": "node build/dev-server.js", 10 | "build": "node build/build.js", 11 | "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run", 12 | "e2e": "node test/e2e/runner.js", 13 | "test": "npm run unit && npm run e2e", 14 | "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs" 15 | }, 16 | "dependencies": { 17 | "bootswatch": "^3.3.7", 18 | "vue": "^2.3.3", 19 | "vue-router": "^2.3.1" 20 | }, 21 | "devDependencies": { 22 | "autoprefixer": "^6.7.2", 23 | "babel-core": "^6.22.1", 24 | "babel-eslint": "^7.1.1", 25 | "babel-loader": "^6.2.10", 26 | "babel-plugin-transform-runtime": "^6.22.0", 27 | "babel-preset-env": "^1.3.2", 28 | "babel-preset-stage-2": "^6.22.0", 29 | "babel-register": "^6.22.0", 30 | "chalk": "^1.1.3", 31 | "connect-history-api-fallback": "^1.3.0", 32 | "copy-webpack-plugin": "^4.0.1", 33 | "css-loader": "^0.28.0", 34 | "eslint": "^3.19.0", 35 | "eslint-friendly-formatter": "^2.0.7", 36 | "eslint-loader": "^1.7.1", 37 | "eslint-plugin-html": "^2.0.0", 38 | "eslint-config-standard": "^6.2.1", 39 | "eslint-plugin-promise": "^3.4.0", 40 | "eslint-plugin-standard": "^2.0.1", 41 | "eventsource-polyfill": "^0.9.6", 42 | "express": "^4.14.1", 43 | "extract-text-webpack-plugin": "^2.0.0", 44 | "file-loader": "^0.11.1", 45 | "friendly-errors-webpack-plugin": "^1.1.3", 46 | "html-webpack-plugin": "^2.28.0", 47 | "http-proxy-middleware": "^0.17.3", 48 | "webpack-bundle-analyzer": "^2.2.1", 49 | "cross-env": "^4.0.0", 50 | "karma": "^1.4.1", 51 | "karma-coverage": "^1.1.1", 52 | "karma-mocha": "^1.3.0", 53 | "karma-phantomjs-launcher": "^1.0.2", 54 | "karma-phantomjs-shim": "^1.4.0", 55 | "karma-sinon-chai": "^1.3.1", 56 | "karma-sourcemap-loader": "^0.3.7", 57 | "karma-spec-reporter": "0.0.30", 58 | "karma-webpack": "^2.0.2", 59 | "lolex": "^1.5.2", 60 | "mocha": "^3.2.0", 61 | "chai": "^3.5.0", 62 | "sinon": "^2.1.0", 63 | "sinon-chai": "^2.8.0", 64 | "inject-loader": "^3.0.0", 65 | "babel-plugin-istanbul": "^4.1.1", 66 | "phantomjs-prebuilt": "^2.1.14", 67 | "chromedriver": "^2.27.2", 68 | "cross-spawn": "^5.0.1", 69 | "nightwatch": "^0.9.12", 70 | "selenium-server": "^3.0.1", 71 | "semver": "^5.3.0", 72 | "shelljs": "^0.7.6", 73 | "opn": "^4.0.2", 74 | "optimize-css-assets-webpack-plugin": "^1.3.0", 75 | "ora": "^1.2.0", 76 | "rimraf": "^2.6.0", 77 | "url-loader": "^0.5.8", 78 | "vue-loader": "^12.1.0", 79 | "vue-style-loader": "^3.0.1", 80 | "vue-template-compiler": "^2.3.3", 81 | "webpack": "^2.6.1", 82 | "webpack-dev-middleware": "^1.10.0", 83 | "webpack-hot-middleware": "^2.18.0", 84 | "webpack-merge": "^4.1.0" 85 | }, 86 | "engines": { 87 | "node": ">= 4.0.0", 88 | "npm": ">= 3.0.0" 89 | }, 90 | "browserslist": [ 91 | "> 1%", 92 | "last 2 versions", 93 | "not ie <= 8" 94 | ] 95 | } 96 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 68 | 69 | 77 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/src/components/Avatars.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 76 | 77 | 78 | 86 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/src/components/Hivemind.vue: -------------------------------------------------------------------------------- 1 | 38 | 39 | 89 | 100 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/src/components/Navigation.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 38 | 39 | 42 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | 7 | Vue.config.productionTip = false 8 | 9 | /* eslint-disable no-new */ 10 | new Vue({ 11 | el: '#app', 12 | router, 13 | template: '', 14 | components: { App } 15 | }) 16 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Hivemind from '@/components/Hivemind' 4 | import Avatars from '@/components/Avatars' 5 | import Avatar from '@/components/Avatar' 6 | 7 | Vue.use(Router) 8 | 9 | export default new Router({ 10 | routes: [ 11 | { 12 | path: '/', 13 | name: 'Hivemind', 14 | component: Hivemind 15 | }, 16 | { 17 | path: '/avatars', 18 | name: 'Avatars', 19 | component: Avatars 20 | }, 21 | { 22 | name: 'Avatar', 23 | path: '/avatar/:name', 24 | component: Avatar 25 | } 26 | ] 27 | }) 28 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/src/services/RESTService.js: -------------------------------------------------------------------------------- 1 | var xhr = require('xhr') 2 | 3 | export default class { 4 | 5 | static api (method, uri, body, cb) { 6 | console.log(`method = ${method} uri=${uri}`) 7 | console.dir(`http://localhost:3100${uri}`) 8 | xhr({ 9 | method, 10 | useXDR: true, 11 | body, 12 | uri: `http://localhost:3100${uri}`, 13 | json: true, 14 | headers: { 15 | 'Content-Type': 'application/json', 16 | 'Authorization': 'Basic ' + btoa('goodneighbor' + ':' + 'qde786DGWZDSYDASYUDGzd2E7F6WE') 17 | } 18 | }, (err, res) => { 19 | console.dir(err) 20 | console.dir(res) 21 | if (err) { 22 | console.error(err) 23 | return cb(err) 24 | } else { 25 | return cb(res.statusCode, res) 26 | } 27 | }) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/goodneighbor-admin-ui/static/.gitkeep -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // the name of the method is the filename. 3 | // can be used in tests like this: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // for how to write custom assertions see 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | exports.assertion = function (selector, count) { 10 | this.message = 'Testing if element <' + selector + '> has count: ' + count 11 | this.expected = count 12 | this.pass = function (val) { 13 | return val === this.expected 14 | } 15 | this.value = function (res) { 16 | return res.value 17 | } 18 | this.command = function (cb) { 19 | var self = this 20 | return this.api.execute(function (selector) { 21 | return document.querySelectorAll(selector).length 22 | }, [selector], function (res) { 23 | cb.call(self, res) 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/test/e2e/nightwatch.conf.js: -------------------------------------------------------------------------------- 1 | require('babel-register') 2 | var config = require('../../config') 3 | 4 | // http://nightwatchjs.org/gettingstarted#settings-file 5 | module.exports = { 6 | src_folders: ['test/e2e/specs'], 7 | output_folder: 'test/e2e/reports', 8 | custom_assertions_path: ['test/e2e/custom-assertions'], 9 | 10 | selenium: { 11 | start_process: true, 12 | server_path: require('selenium-server').path, 13 | host: '127.0.0.1', 14 | port: 4444, 15 | cli_args: { 16 | 'webdriver.chrome.driver': require('chromedriver').path 17 | } 18 | }, 19 | 20 | test_settings: { 21 | default: { 22 | selenium_port: 4444, 23 | selenium_host: 'localhost', 24 | silent: true, 25 | globals: { 26 | devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) 27 | } 28 | }, 29 | 30 | chrome: { 31 | desiredCapabilities: { 32 | browserName: 'chrome', 33 | javascriptEnabled: true, 34 | acceptSslCerts: true 35 | } 36 | }, 37 | 38 | firefox: { 39 | desiredCapabilities: { 40 | browserName: 'firefox', 41 | javascriptEnabled: true, 42 | acceptSslCerts: true 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/test/e2e/runner.js: -------------------------------------------------------------------------------- 1 | // 1. start the dev server using production config 2 | process.env.NODE_ENV = 'testing' 3 | var server = require('../../build/dev-server.js') 4 | 5 | server.ready.then(() => { 6 | // 2. run the nightwatch test suite against it 7 | // to run in additional browsers: 8 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings" 9 | // 2. add it to the --env flag below 10 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 11 | // For more information on Nightwatch's config file, see 12 | // http://nightwatchjs.org/guide#settings-file 13 | var opts = process.argv.slice(2) 14 | if (opts.indexOf('--config') === -1) { 15 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 16 | } 17 | if (opts.indexOf('--env') === -1) { 18 | opts = opts.concat(['--env', 'chrome']) 19 | } 20 | 21 | var spawn = require('cross-spawn') 22 | var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 23 | 24 | runner.on('exit', function (code) { 25 | server.close() 26 | process.exit(code) 27 | }) 28 | 29 | runner.on('error', function (err) { 30 | server.close() 31 | throw err 32 | }) 33 | }) 34 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/test/e2e/specs/test.js: -------------------------------------------------------------------------------- 1 | // For authoring Nightwatch tests, see 2 | // http://nightwatchjs.org/guide#usage 3 | 4 | module.exports = { 5 | 'default e2e tests': function (browser) { 6 | // automatically uses dev Server port from /config.index.js 7 | // default: http://localhost:8080 8 | // see nightwatch.conf.js 9 | const devServer = browser.globals.devServerURL 10 | 11 | browser 12 | .url(devServer) 13 | .waitForElementVisible('#app', 5000) 14 | .assert.elementPresent('.hello') 15 | .assert.containsText('h1', 'Welcome to Your Vue.js App') 16 | .assert.elementCount('img', 1) 17 | .end() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | }, 5 | "globals": { 6 | "expect": true, 7 | "sinon": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/test/unit/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | 5 | // require all test files (files that ends with .spec.js) 6 | const testsContext = require.context('./specs', true, /\.spec$/) 7 | testsContext.keys().forEach(testsContext) 8 | 9 | // require all src files except main.js for coverage. 10 | // you can also change this to match only the subset of files that 11 | // you want coverage for. 12 | const srcContext = require.context('../../src', true, /^\.\/(?!main(\.js)?$)/) 13 | srcContext.keys().forEach(srcContext) 14 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/test/unit/karma.conf.js: -------------------------------------------------------------------------------- 1 | // This is a karma config file. For more details see 2 | // http://karma-runner.github.io/0.13/config/configuration-file.html 3 | // we are also using it with karma-webpack 4 | // https://github.com/webpack/karma-webpack 5 | 6 | var webpackConfig = require('../../build/webpack.test.conf') 7 | 8 | module.exports = function (config) { 9 | config.set({ 10 | // to run in additional browsers: 11 | // 1. install corresponding karma launcher 12 | // http://karma-runner.github.io/0.13/config/browsers.html 13 | // 2. add it to the `browsers` array below. 14 | browsers: ['PhantomJS'], 15 | frameworks: ['mocha', 'sinon-chai', 'phantomjs-shim'], 16 | reporters: ['spec', 'coverage'], 17 | files: ['./index.js'], 18 | preprocessors: { 19 | './index.js': ['webpack', 'sourcemap'] 20 | }, 21 | webpack: webpackConfig, 22 | webpackMiddleware: { 23 | noInfo: true 24 | }, 25 | coverageReporter: { 26 | dir: './coverage', 27 | reporters: [ 28 | { type: 'lcov', subdir: '.' }, 29 | { type: 'text-summary' } 30 | ] 31 | } 32 | }) 33 | } 34 | -------------------------------------------------------------------------------- /grand-central-station/goodneighbor-admin-ui/test/unit/specs/Hello.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Hello from '@/components/Hello' 3 | 4 | describe('Hello.vue', () => { 5 | it('should render correct contents', () => { 6 | const Constructor = Vue.extend(Hello) 7 | const vm = new Constructor().$mount() 8 | expect(vm.$el.querySelector('.hello h1').textContent) 9 | .to.equal('Welcome to Your Vue.js App') 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /grand-central-station/grand-central-station.js: -------------------------------------------------------------------------------- 1 | var 2 | path = require('path'), 3 | bodyParser = require('body-parser'), 4 | express = require('express'), 5 | hbs = require('express-hbs'), 6 | app = express(), 7 | MongoClient = require('mongodb').MongoClient, 8 | logger = require('log4js').getLogger('grand-central-station'), 9 | fs = require('fs'), 10 | path = require('path'), 11 | ip = require('ip'), 12 | Helpers = require('../Helpers'), 13 | auth = require('http-auth'), 14 | request = require('request'), 15 | ClericModule = require('./lib/Cleric'), 16 | Rollbar = require('rollbar'), 17 | os = require('os') 18 | ; 19 | /** 20 | * Global app handle 21 | */ 22 | global.app = app 23 | 24 | var rollbar = new Rollbar({ 25 | accessToken: process.env.ROLLBAR_ACCESS_TOKEN, 26 | handleUncaughtExceptions: (os.hostname() === process.env.DEVELOPMENT_MACHINE_HOSTNAME) ? false : true, 27 | handleUnhandledRejections: (os.hostname() === process.env.DEVELOPMENT_MACHINE_HOSTNAME) ? false : true 28 | }) 29 | 30 | //Run sanity check on environment variables 31 | Helpers.Validation.startupCheck('grand-central-station') 32 | 33 | //Configure basic auth 34 | var basic = auth.basic({ 35 | realm: 'Admin' 36 | }, (username, password, callback) => { 37 | callback(username === process.env.ADMIN_USERNAME && password === process.env.ADMIN_PASSWORD) 38 | }) 39 | 40 | var authMiddleware = auth.connect(basic) 41 | 42 | global.authMiddleware = authMiddleware 43 | 44 | global.Cleric = new ClericModule() 45 | 46 | //Configure port that this manager app should listen on 47 | app.set('port', process.env.GRAND_CENTRAL_STATION_PORT) 48 | 49 | app.set('gcs_api_root', process.env.GCS_API_ROOT) 50 | 51 | app.set('views', path.join(__dirname, 'build/views')) 52 | app.set('view engine', 'hbs') 53 | //Set static path to build folder 54 | app.use(express.static(__dirname + '/build')) 55 | app.use(bodyParser.json()) 56 | app.use(bodyParser.urlencoded({ extended: true })) 57 | 58 | //Save handle to logger 59 | app.set('logger', logger) 60 | 61 | let connect = () => { 62 | MongoClient.connect('mongodb://goodneighbor-db/hivemind', (err, db) => { 63 | if (err) { 64 | app.get('logger').error(`GCS Error connecting to mongodb: ${err}`) 65 | process.exit(1) 66 | } 67 | 68 | app.set('db', db) 69 | app.set('hivemind', db.collection('hivemind')) 70 | app.set('avatars', db.collection('avatars')) 71 | 72 | app.get('avatars').ensureIndex({ "name": 1 }, { unique: true, dropDups: true }, (err, doc) => { 73 | if (err) { 74 | console.error(err) 75 | } 76 | app.get('logger').info('Set unique index on avatars collection name field') 77 | }) 78 | 79 | app.get('hivemind').ensureIndex({ "name": 1 }, { unique: true, dropDups: true }, (err, doc) => { 80 | if (err) { 81 | console.error(err) 82 | } 83 | app.get('logger').info('Set unique index on hivemind collection name field') 84 | }) 85 | }) 86 | } 87 | 88 | setTimeout(connect, 8000) 89 | 90 | //Enable CORS 91 | app.use((req, res, next) => { 92 | res.header("Access-Control-Allow-Origin", "*") 93 | res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, authorization, Accept") 94 | res.header("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS") 95 | next() 96 | }) 97 | 98 | //Allow OPTIONS pre-flight requests to work 99 | app.all('*', (req, res, next) => { 100 | if (req.method === 'OPTIONS') { 101 | var headers = {} 102 | headers["Access-Control-Allow-Origin"] = "*" 103 | headers["Access-Control-Allow-Headers"] = "Origin, X-Requested-With, Content-Type, Authorization, Accept" 104 | headers["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS, PUT, DELETE" 105 | res.writeHead(200, headers) 106 | res.end() 107 | } else { 108 | next() 109 | } 110 | }) 111 | 112 | //Serve admin client static assets 113 | app.use(express.static(path.join(__dirname, 'dist'))) 114 | 115 | /** 116 | * Load all routes 117 | */ 118 | app.use('/', require('./routes/index')) 119 | 120 | //Listen for HTTP requests 121 | app.listen(app.get('port'), () => { 122 | app.get('logger').info(`Grand central station app listening on ${app.get('port')}`) 123 | }) 124 | 125 | setInterval(() => { //After the burning there is only the burning and after the burning there is only te burning 126 | Cleric.recoverFallenAvatars((err) => { 127 | if (err) app.get('logger').error(`auto recovering fallen avatars error: ${error}`) 128 | }) 129 | }, process.env.FALLEN_AVATAR_RECOVERY_INTERVAL_MILLISECONDS) -------------------------------------------------------------------------------- /grand-central-station/lib/Cleric/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/cleric') -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-BoldItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-BoldItalic-webfont.eot -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-BoldItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-BoldItalic-webfont.woff -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-Italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-Italic-webfont.eot -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-Italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-Italic-webfont.woff -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-Light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-Light-webfont.eot -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-Light-webfont.woff -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-LightItalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-LightItalic-webfont.eot -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-LightItalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-LightItalic-webfont.woff -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /grand-central-station/out/fonts/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zackproser/goodneighbor/f14dabd2d8462b9dc4fa899c64b132d4534d9379/grand-central-station/out/fonts/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /grand-central-station/out/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JSDoc: Home 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 |

Home

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |

30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
51 | 52 | 55 | 56 |
57 | 58 |
59 | Documentation generated by JSDoc 3.4.3 on Fri Aug 04 2017 20:45:23 GMT-0700 (PDT) 60 |
61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /grand-central-station/out/scripts/linenumber.js: -------------------------------------------------------------------------------- 1 | /*global document */ 2 | (function() { 3 | var source = document.getElementsByClassName('prettyprint source linenums'); 4 | var i = 0; 5 | var lineNumber = 0; 6 | var lineId; 7 | var lines; 8 | var totalLines; 9 | var anchorHash; 10 | 11 | if (source && source[0]) { 12 | anchorHash = document.location.hash.substring(1); 13 | lines = source[0].getElementsByTagName('li'); 14 | totalLines = lines.length; 15 | 16 | for (; i < totalLines; i++) { 17 | lineNumber++; 18 | lineId = 'line' + lineNumber; 19 | lines[i].id = lineId; 20 | if (lineId === anchorHash) { 21 | lines[i].className += ' selected'; 22 | } 23 | } 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /grand-central-station/out/scripts/prettify/lang-css.js: -------------------------------------------------------------------------------- 1 | PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", 2 | /^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); 3 | -------------------------------------------------------------------------------- /grand-central-station/out/styles/prettify-jsdoc.css: -------------------------------------------------------------------------------- 1 | /* JSDoc prettify.js theme */ 2 | 3 | /* plain text */ 4 | .pln { 5 | color: #000000; 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | /* string content */ 11 | .str { 12 | color: #006400; 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | 17 | /* a keyword */ 18 | .kwd { 19 | color: #000000; 20 | font-weight: bold; 21 | font-style: normal; 22 | } 23 | 24 | /* a comment */ 25 | .com { 26 | font-weight: normal; 27 | font-style: italic; 28 | } 29 | 30 | /* a type name */ 31 | .typ { 32 | color: #000000; 33 | font-weight: normal; 34 | font-style: normal; 35 | } 36 | 37 | /* a literal value */ 38 | .lit { 39 | color: #006400; 40 | font-weight: normal; 41 | font-style: normal; 42 | } 43 | 44 | /* punctuation */ 45 | .pun { 46 | color: #000000; 47 | font-weight: bold; 48 | font-style: normal; 49 | } 50 | 51 | /* lisp open bracket */ 52 | .opn { 53 | color: #000000; 54 | font-weight: bold; 55 | font-style: normal; 56 | } 57 | 58 | /* lisp close bracket */ 59 | .clo { 60 | color: #000000; 61 | font-weight: bold; 62 | font-style: normal; 63 | } 64 | 65 | /* a markup tag name */ 66 | .tag { 67 | color: #006400; 68 | font-weight: normal; 69 | font-style: normal; 70 | } 71 | 72 | /* a markup attribute name */ 73 | .atn { 74 | color: #006400; 75 | font-weight: normal; 76 | font-style: normal; 77 | } 78 | 79 | /* a markup attribute value */ 80 | .atv { 81 | color: #006400; 82 | font-weight: normal; 83 | font-style: normal; 84 | } 85 | 86 | /* a declaration */ 87 | .dec { 88 | color: #000000; 89 | font-weight: bold; 90 | font-style: normal; 91 | } 92 | 93 | /* a variable name */ 94 | .var { 95 | color: #000000; 96 | font-weight: normal; 97 | font-style: normal; 98 | } 99 | 100 | /* a function name */ 101 | .fun { 102 | color: #000000; 103 | font-weight: bold; 104 | font-style: normal; 105 | } 106 | 107 | /* Specify class=linenums on a pre to get line numbering */ 108 | ol.linenums { 109 | margin-top: 0; 110 | margin-bottom: 0; 111 | } 112 | -------------------------------------------------------------------------------- /grand-central-station/out/styles/prettify-tomorrow.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* Pretty printing styles. Used with prettify.js. */ 4 | /* SPAN elements with the classes below are added by prettyprint. */ 5 | /* plain text */ 6 | .pln { 7 | color: #4d4d4c; } 8 | 9 | @media screen { 10 | /* string content */ 11 | .str { 12 | color: #718c00; } 13 | 14 | /* a keyword */ 15 | .kwd { 16 | color: #8959a8; } 17 | 18 | /* a comment */ 19 | .com { 20 | color: #8e908c; } 21 | 22 | /* a type name */ 23 | .typ { 24 | color: #4271ae; } 25 | 26 | /* a literal value */ 27 | .lit { 28 | color: #f5871f; } 29 | 30 | /* punctuation */ 31 | .pun { 32 | color: #4d4d4c; } 33 | 34 | /* lisp open bracket */ 35 | .opn { 36 | color: #4d4d4c; } 37 | 38 | /* lisp close bracket */ 39 | .clo { 40 | color: #4d4d4c; } 41 | 42 | /* a markup tag name */ 43 | .tag { 44 | color: #c82829; } 45 | 46 | /* a markup attribute name */ 47 | .atn { 48 | color: #f5871f; } 49 | 50 | /* a markup attribute value */ 51 | .atv { 52 | color: #3e999f; } 53 | 54 | /* a declaration */ 55 | .dec { 56 | color: #f5871f; } 57 | 58 | /* a variable name */ 59 | .var { 60 | color: #c82829; } 61 | 62 | /* a function name */ 63 | .fun { 64 | color: #4271ae; } } 65 | /* Use higher contrast and text-weight for printable form. */ 66 | @media print, projection { 67 | .str { 68 | color: #060; } 69 | 70 | .kwd { 71 | color: #006; 72 | font-weight: bold; } 73 | 74 | .com { 75 | color: #600; 76 | font-style: italic; } 77 | 78 | .typ { 79 | color: #404; 80 | font-weight: bold; } 81 | 82 | .lit { 83 | color: #044; } 84 | 85 | .pun, .opn, .clo { 86 | color: #440; } 87 | 88 | .tag { 89 | color: #006; 90 | font-weight: bold; } 91 | 92 | .atn { 93 | color: #404; } 94 | 95 | .atv { 96 | color: #060; } } 97 | /* Style */ 98 | /* 99 | pre.prettyprint { 100 | background: white; 101 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 102 | font-size: 12px; 103 | line-height: 1.5; 104 | border: 1px solid #ccc; 105 | padding: 10px; } 106 | */ 107 | 108 | /* Specify class=linenums on a pre to get line numbering */ 109 | ol.linenums { 110 | margin-top: 0; 111 | margin-bottom: 0; } 112 | 113 | /* IE indents via margin-left */ 114 | li.L0, 115 | li.L1, 116 | li.L2, 117 | li.L3, 118 | li.L4, 119 | li.L5, 120 | li.L6, 121 | li.L7, 122 | li.L8, 123 | li.L9 { 124 | /* */ } 125 | 126 | /* Alternate shading for lines */ 127 | li.L1, 128 | li.L3, 129 | li.L5, 130 | li.L7, 131 | li.L9 { 132 | /* */ } 133 | -------------------------------------------------------------------------------- /grand-central-station/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "grand-central-station", 3 | "version": "1.0.0", 4 | "description": "The admin management interface for good neighbor", 5 | "main": "grand-central-station.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://zackproser@bitbucket.org/zackproser/grand-central-station.git" 12 | }, 13 | "keywords": [ 14 | "good", 15 | "neighbor" 16 | ], 17 | "author": "Zack Proser (http://www.zackproser.com/)", 18 | "license": "ISC", 19 | "homepage": "https://bitbucket.org/zackproser/grand-central-station#readme", 20 | "dependencies": { 21 | "body-parser": "^1.14.1", 22 | "bootstrap-vue": "^0.16.1", 23 | "bootswatch": "^3.3.7", 24 | "colors": "^1.1.2", 25 | "express": "^4.13.3", 26 | "express-hbs": "^0.8.4", 27 | "http-auth": "^2.2.8", 28 | "ip": "^1.1.0", 29 | "log4js": "^0.6.29", 30 | "mongodb": "2.2.30", 31 | "pm2": "^2.4.6", 32 | "request": "^2.67.0", 33 | "rollbar": "^2.0.1", 34 | "xhr": "^2.4.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /grand-central-station/routes/admin.js: -------------------------------------------------------------------------------- 1 | var express = require('express') 2 | , router = express.Router() 3 | 4 | /** 5 | * Handle naked lookups in addition to www.grandcentralstation.com 6 | */ 7 | router.get('/', (req, res, next) => { 8 | //Accept and serve requets without www. 9 | if (req.headers.host.match('/^www/') !== null) { 10 | return res.redirect('http://' + req.headers.host.replace('/^www\./', '') + req.url) 11 | } else { 12 | return next() 13 | } 14 | }) 15 | 16 | /** 17 | * Serve admin client 18 | */ 19 | router.get('/', (req, res) => { 20 | res.render('index.html') 21 | }) 22 | 23 | /** 24 | * Return a list of the currently running avatars 25 | * 26 | * @return {Object} live_avatars - array of avatar objects 27 | */ 28 | router.get('/running-avatars', authMiddleware, (req, res) => { 29 | //Inspect processes to get actually running avatars 30 | Cleric.getRunningAvatars((err, liveAvatars) => { 31 | res.status(200).json(liveAvatars) 32 | }) 33 | }) 34 | 35 | /** 36 | * Serve Hivemind data 37 | */ 38 | router.get('/hivemind', authMiddleware, (req, res) => { 39 | app.get('hivemind').find({}).toArray((err, docs) => { 40 | if (err) { 41 | console.error(err) 42 | return res.status(500).json(err) 43 | } 44 | docs.filter( doc => doc.data = doc[doc.name] ) 45 | docs.filter( doc => delete doc[doc.name] ) 46 | return res.status(200).json(docs) 47 | }) 48 | }) 49 | 50 | /** 51 | * Create a new avatar by name 52 | * 53 | * @param {String} req.body.name - The name of the new avatar to create 54 | */ 55 | router.post('/create-new-avatar', (req, res) => { 56 | 57 | //Ensure that user-specified name does not collide 58 | let proposed_name = req.body.name 59 | 60 | app.get('avatars').findOne({ name: proposed_name }, (err, doc) => { 61 | if (err) console.error(err) 62 | 63 | //If there is no record of the proposed name, we can send a successful response 64 | if (null == doc) { 65 | 66 | //Get seed schema 67 | let seed_data = require('./data/seed.json') 68 | seed_data.bot.name = proposed_name 69 | 70 | let avatar = { name: proposed_name, config: seed_data } 71 | 72 | app.get('avatars').save(avatar, (err, doc) => { 73 | if (err) console.error(err) 74 | //New avatar successfully created - send success response 75 | res.status(200).send({ status: "clear" }) 76 | }) 77 | 78 | } else { 79 | //Send http code for conflict 80 | res.status(409).json({ status: 'conflict' }) 81 | } 82 | }) 83 | }) 84 | 85 | /** 86 | * Add a Hivemind item 87 | * 88 | * @param {String} type The type of item to add 89 | * @param {String} data The value of the item to add 90 | */ 91 | router.post('/hivemind/item', (req, res) => { 92 | //Mongo append to array field 93 | var update_object = {} 94 | update_object[req.body.type] = req.body.data 95 | 96 | app.get('hivemind').update({ name: req.body.type }, { $addToSet: update_object }, (err, doc) => { 97 | if (err) console.error(err) 98 | app.get('logger').info('Appended ' + req.body.data + ' to ' + req.body.type + ' field') 99 | 100 | app.get('hivemind').find({ name: req.body.type }).toArray((err, doc) => { 101 | if (err) console.error(err) 102 | 103 | res.status(200).json({ status: 'success', update_data: doc[0][req.body.type] }) 104 | }) 105 | }) 106 | }) 107 | 108 | /** 109 | * Delete a Hivemind item 110 | * 111 | * @param {String} type The type of item to delete 112 | * @param {String} data The value of the item to delete 113 | */ 114 | router.delete('/hivemind/item', (req, res) => { 115 | 116 | let update_object = {} 117 | update_object[req.body.type] = req.body.data 118 | 119 | app.get('hivemind').update({ name: req.body.type }, { $pull: update_object }, (err, doc) => { 120 | if (err) console.error(err) 121 | app.get('logger').info(`Removed ${req.body.data} from ${req.body.type} field`) 122 | 123 | app.get('hivemind').find({ name: req.body.type }).toArray((err, doc) => { 124 | if (err) console.error(err) 125 | 126 | res.status(200).send({ status: 'success', update_data: doc[0][req.body.type] }) 127 | }) 128 | }) 129 | }) 130 | 131 | module.exports = router -------------------------------------------------------------------------------- /grand-central-station/routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express') 2 | , router = express.Router() 3 | 4 | //Admin manager app routes 5 | router.use('/', require('./admin')) 6 | 7 | //Avatar control routes 8 | router.use('/avatars', require('./avatars')) 9 | 10 | module.exports = router -------------------------------------------------------------------------------- /grand-central-station/start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | node grand-central-station.js 3 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | verifyInstalled () { 4 | command -v $1 >/dev/null 2>&1 || { echo >&2 "You must install $1. Aborting."; exit 1; } 5 | echo "Verifying $1 is installed: OK" 6 | } 7 | 8 | printFinalHints() { 9 | echo "Your mongo database has been seeded with Goodneighbor production data" 10 | echo "However, this is Goodneighbor production data, not your data." 11 | echo "Now, you need to modify the running avatars so they are yours" 12 | echo "Using the admin UI is probably the easiest way to accomplish this" 13 | echo "To run the admin UI, you should look in the Dockerfile for all ENV variables that are necessary" 14 | echo "Pass them to node on startup like so: " 15 | echo "CONTENT_HYDRATION_INTERVAL_MILLISECONDS=120000 ADMIN_USERNAME='goodneighbor' ADMIN_PASSWORD='somepassword' AVATAR_CONFIG_API_KEY='CJSKCGdfvhdugef^DS%6drw7' CONFIG_UPDATE_URL='http://localhost:3100/avatars/config/' CONFIG_POLL_INTERVAL_MILLISECONDS=120000 GCS_API_ROOT='http://127.0.0.1:3100' FALLEN_AVATAR_RECOVERY_INTERVAL_MILLISECONDS=12000 GRAND_CENTRAL_STATION_PORT=3100 node grand-central-station.js" 16 | echo "Visit the Twitter Developer app and create your own apps (one for each avatar)" 17 | echo "Give them read and write access and generate their oAuth credentials" 18 | echo "When you have their auth credentials, replace the dummy data here with your own credentials" 19 | echo "Then configure all of the Twitter, scraper and timer settings to your liking" 20 | echo "Remember, if you feel the urge to ask for support, be sure to leave me alone" 21 | echo "This is free software. You're welcome for having it all." 22 | echo "If you want to run this in production for yourself you will need to invest some effort" 23 | echo "in figuring out how it works" 24 | } 25 | 26 | verifyInstalled node 27 | verifyInstalled mongo 28 | verifyInstalled mongorestore 29 | 30 | echo "Loading Goodneighbor production data into your local mongo instance..." 31 | mongorestore db-seeder/goodneighbor-production-data 32 | LOAD_STATUS=$? 33 | if [ $LOAD_STATUS -eq 0 ]; then 34 | echo "Success!" 35 | else 36 | echo "Error loading data!" && exit 1; 37 | fi 38 | 39 | printFinalHints --------------------------------------------------------------------------------