8000 codecombat/server.coffee at master · adeleglise/codecombat · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"app","path":"app","contentType":"directory"},{"name":"bin","path":"bin","contentType":"directory"},{"name":"scripts","path":"scripts","contentType":"directory"},{"name":"server","path":"server","contentType":"directory"},{"name":"test","path":"test","contentType":"directory"},{"name":"vendor","path":"vendor","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".npmignore","path":".npmignore","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"bower.json","path":"bower.json","contentType":"file"},{"name":"brunch.coffee","path":"brunch.coffee","contentType":"file"},{"name":"index.js","path":"index.js","contentType":"file"},{"name":"karma.conf.js","path":"karma.conf.js","contentType":"file"},{"name":"package.json","path":"package.json","contentType":"file"},{"name":"server.coffee","path":"server.coffee","contentType":"file"},{"name":"server_config.js","path":"server_config.js","contentType":"file"}],"totalCount":18}},"fileTreeProcessingTime":10.889128,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":15772577,"defaultBranch":"master","name":"codecombat","ownerLogin":"adeleglise","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2014-01-09T16:44:13.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/6353678?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1614123394.500661","canEdit":false,"refType":"branch","currentOid":"fd3e678a955a766e977be3f444fef815353d2246"},"path":"server.coffee","currentUser":null,"blob":{"rawLines":["# Put lodash and underscore.string into the global namespace","GLOBAL._ = require 'lodash' ","_.str = require 'underscore.string' ","_.mixin _.str.exports() ","","express = require 'express' ","path = require 'path' ","winston = require 'winston' ","passport = require 'passport' ","useragent = require 'express-useragent'","","auth = require './server/auth'","db = require './server/db'","file = require './server/file'","folder = require './server/folder'","user = require './server/handlers/user'","logging = require './server/logging'","sprites = require './server/sprites'","contact = require './server/contact'","languages = require './server/languages'","","https = require 'https' ","http = require 'http' ","fs = require 'graceful-fs' ","","config = require './server_config'","","logging.setup()","db.connectDatabase()","","# MailChimp setup","mcapi = require 'mailchimp-api'","mc = new mcapi.Mailchimp(config.mail.mailchimpAPIKey)","GLOBAL.mc = mc","","# Express server setup","app = express()","","active_responses = []","","oldBrowser = (req, res, next) -\u003e"," return next() if req.query['try-old-browser-anyway'] or not isOldBrowser(req)"," res.sendfile(path.join(__dirname, 'public', 'index_old_browser.html'))","","# determines order of middleware and request handling","app.configure(-\u003e"," app.use (req, res, next) -\u003e"," req.setTimeout 15000, -\u003e"," console.log 'timed out!'"," req.abort()"," self.emit('pass',message)"," next()",""," app.use(express.logger('dev'))"," app.use(express.static(path.join(__dirname, 'public')))"," app.use(useragent.express())"," app.use '/play/', oldBrowser # When they go directly to play a level, they won't see our browser warning, so give it to 'em."," app.set('port', config.port)"," app.set('views', __dirname + '/app/views')"," app.set('view engine', 'jade')"," app.set('view options', { layout: false })"," app.use(express.favicon())"," app.use(express.cookieParser(config.cookie_secret))"," app.use(express.bodyParser())"," app.use(express.methodOverride())"," app.use(express.cookieSession({secret:'defenestrate'}))"," app.use(passport.initialize())"," app.use(passport.session())"," if(config.slow_down)"," app.use((req, res, next) -\u003e setTimeout((-\u003e next()), 1000))"," user.setupMiddleware(app)",""," app.use(app.router)",")","","app.configure('development', -\u003e app.use(express.errorHandler()))","","auth.setupRoutes(app)","db.setupRoutes(app)","sprites.setupRoutes(app)","contact.setupRoutes(app)","file.setupRoutes(app)","folder.setupRoutes(app)","languages.setupRoutes(app)","","# Some sort of cross-domain communication hack facebook requires","app.get('/channel.html', (req, res) -\u003e"," res.sendfile(path.join(__dirname, 'public', 'channel.html'))",")","","# blitz.io (load tester) auth","app.get '/mu-a2a0832f-10763ae9-170d6c87-70a62423', (req, res) -\u003e"," res.send('42')","","# Anything that isn't handled at this point gets index.html","app.get('*', (req, res) -\u003e"," res.sendfile(path.join(__dirname, 'public', 'index.html'))",")","","#ssl_options =","# key: fs.readFileSync('ssl/key.pem')","# cert: fs.readFileSync('ssl/cert.pem')","","module.exports.startServer = -\u003e"," http.createServer(app).listen(app.get('port'))"," winston.info(\"Express SSL server listening on port \" + app.get('port'))","# https.createServer(ssl_options, app).listen(config['ssl_port']);"," return app","","isOldBrowser = (req) -\u003e"," # https://github.com/biggora/express-useragent/blob/master/lib/express-useragent.js"," return false unless ua = req.useragent"," return true if ua.isiPad or ua.isiPod or ua.isiPhone or ua.isOpera"," return false unless ua and ua.Browser in [\"Chrome\", \"Safari\", \"Firefox\", \"IE\"] and ua.Version"," b = ua.Browser"," v = parseInt ua.Version.split('.')[0], 10"," return true if b is 'Chrome' and v \u003c 17"," return true if b is 'Safari' and v \u003c 6"," return true if b is 'Firefox' and v \u003c 21"," return true if b is 'IE' and v \u003c 10"," false"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/adeleglise/codecombat/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"server.coffee","displayUrl":"https://github.com/adeleglise/codecombat/blob/master/server.coffee?raw=true","headerInfo":{"blobSize":"3.64 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"74887af","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fadeleglise%2Fcodecombat%2Fblob%2Fmaster%2Fserver.coffee","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"121","truncatedSloc":"101"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"CoffeeScript","languageID":63,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/adeleglise/codecombat/blob/master/server.coffee","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/adeleglise/codecombat/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/adeleglise/codecombat/raw/refs/heads/master/server.coffee","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":true,"symbols":[]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/adeleglise/codecombat/branches":{"post":"8ksjkYlyCbORRrsi5GmcNdSyxd8CxvIhYtB5VvRjF_DP43FlrhpYlnZSYfHDyIaXjEltPZSRJeUTE783WoNzfg"},"/repos/preferences":{"post":"2_4PS68KWV9Qj7pCdgbJ-LPIL1Fk4Y4Xv9rifFpS59yfMGioeXVl0PQn7WXFJMxO2HkLs1fKvXYDJHqq_6c-1g"}}},"title":"codecombat/server.coffee at master · adeleglise/codecombat","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}
0