diff --git a/src/server/index.coffee b/src/server/index.coffee deleted file mode 100644 index 558775b9bd..0000000000 --- a/src/server/index.coffee +++ /dev/null @@ -1,96 +0,0 @@ -http = require 'http' -path = require 'path' -express = require 'express' -gzippo = require 'gzippo' -derby = require 'derby' -racer = require 'racer' -auth = require 'derby-auth' -app = require '../app' -serverError = require './serverError' -MongoStore = require('connect-mongo')(express) -priv = require './private' -habitrpgStore = require './store' -middleware = require './middleware' - -## RACER CONFIGURATION ## - -#racer.io.set('transports', ['xhr-polling']) -racer.ioClient.set('reconnection limit', 300000) # max reconect timeout to 5 minutes -racer.set('bundleTimeout', 40000) -#unless process.env.NODE_ENV == 'production' -# racer.use(racer.logPlugin) -# derby.use(derby.logPlugin) - -# Infinite stack trace -Error.stackTraceLimit = Infinity if process.env.NODE_ENV is 'development' - -## SERVER CONFIGURATION ## - -expressApp = express() -server = http.createServer expressApp -module.exports = server - -derby.use require('racer-db-mongo') -module.exports.habitStore = store = derby.createStore - db: {type: 'Mongo', uri: process.env.NODE_DB_URI, safe:true} - listen: server - -ONE_YEAR = 1000 * 60 * 60 * 24 * 365 -TWO_WEEKS = 1000 * 60 * 60 * 24 * 14 -root = path.dirname path.dirname __dirname -publicPath = path.join root, 'public' - -# Authentication setup -strategies = - facebook: - strategy: require("passport-facebook").Strategy - conf: - clientID: process.env.FACEBOOK_KEY - clientSecret: process.env.FACEBOOK_SECRET -options = - domain: process.env.BASE_URL || 'http://localhost:3000' - allowPurl: true - schema: require('../app/character').newUserObject() - -# This has to happen before our middleware stuff -auth.store(store, habitrpgStore.customAccessControl) - -mongo_store = new MongoStore {url: process.env.NODE_DB_URI}, -> - expressApp - .use(middleware.allowCrossDomain) - .use(express.favicon("#{publicPath}/favicon.ico")) - # Gzip static files and serve from memory - .use(gzippo.staticGzip(publicPath, maxAge: ONE_YEAR)) - # Gzip dynamically rendered content - .use(express.compress()) - .use(express.bodyParser()) - .use(express.methodOverride()) - # Uncomment and supply secret to add Derby session handling - # Derby session middleware creates req.session and socket.io sessions - .use(express.cookieParser()) - .use(store.sessionMiddleware - secret: process.env.SESSION_SECRET || 'YOUR SECRET HERE' - cookie: { maxAge: TWO_WEEKS } # defaults to 2 weeks? aka, can delete this line? - store: mongo_store - ) - # Adds req.getModel method - .use(store.modelMiddleware()) - # API should be hit before all other routes - .use('/api/v1', require('./api').middleware) - .use(require('./deprecated').middleware) - # Show splash page for newcomers - .use(middleware.splash) - .use(priv.middleware) - .use(middleware.view) - .use(auth.middleware(strategies, options)) - # Creates an express middleware from the app's routes - .use(app.router()) - .use(require('./static').middleware) - .use(expressApp.router) - .use(serverError(root)) - - priv.routes(expressApp) - - # Errors - expressApp.all '*', (req) -> - throw "404: #{req.url}" diff --git a/src/server/middleware.coffee b/src/server/middleware.coffee deleted file mode 100644 index 09d83783f4..0000000000 --- a/src/server/middleware.coffee +++ /dev/null @@ -1,27 +0,0 @@ -splash = (req, res, next) -> - isStatic = req.url.split('/')[1] is 'static' - unless req.query?.play? or req.getModel().get('_userId') or isStatic - res.redirect('/static/front') - else - next() - -view = (req, res, next) -> - model = req.getModel() - ## Set _mobileDevice to true or false so view can exclude portions from mobile device - model.set '_mobileDevice', /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(req.header 'User-Agent') - model.set '_nodeEnv', model.flags.nodeEnv - next() - -#CORS middleware -allowCrossDomain = (req, res, next) -> - res.header "Access-Control-Allow-Origin", (req.headers.origin || "*") - res.header "Access-Control-Allow-Methods", "OPTIONS,GET,POST,PUT,HEAD,DELETE" - res.header "Access-Control-Allow-Headers", "Content-Type,Accept,Content-Encoding,X-Requested-With,x-api-user,x-api-key" - - # wtf is this for? - if req.method is 'OPTIONS' - res.send(200); - else - next() - -module.exports = { splash, view, allowCrossDomain } diff --git a/views/app/avatar.html b/views/app/avatar.html deleted file mode 100644 index d5b6a07d47..0000000000 --- a/views/app/avatar.html +++ /dev/null @@ -1,263 +0,0 @@ - - {{#each _partyMembers as :profile}} - - - <@footer> - - - - {{/}} - - -
-
- {#with @profile.preferences as :p} - - - - - {#if :p.showHelm} - - {else} - - {/} - - - {/} - {#if and(@profile.items.currentPet, not(@minimal))} - - {/} -
-
- - -

{{t("items")}}

-

{itemText('weapon',_user.items.weapon)}: {itemStat('weapon',_user.items.weapon)}% Exp gain

-

{itemText('armor',_user.items.armor)}: {itemStat('armor',_user.items.armor)}% Defense

-

{itemText('head',_user.items.head)}: {itemStat('head',_user.items.head)}% Defense

-

{itemText('shield',_user.items.shield)}: {itemStat('shield',_user.items.shield)}% Defense

- -

{{t("stats")}}

-

HP: {floor(_user.stats.hp)} / 50

-

GP: {floor(_user.stats.gp)}

-

Lvl: {_user.stats.lvl}

-

Exp: {floor(_user.stats.exp)} / {tnl(_user.stats.lvl)}

-

{{t("strength")}}: {userStr(_user.stats.lvl)}

-

{{t("defense")}}: {userDef(_user.stats.lvl)}

-

{{t("petsFound")}}: {count(_user.items.pets)}

-
-

{{t("totalStrength")}}: {totalStr(_user.stats.lvl, _user.items.weapon)} %

-

{{t("totalDefense")}}: {totalDef(_user.stats.lvl, _user.items.armor, _user.items.head, _user.items.shield)} %

- - - - - - {#with _user.preferences as :p} - - -
  • - - - - - - -
  • - - -
  • - - - - - - -
  • - - -
  • - - - - - - - -
  • -
    - - {#if equal(_user.preferences.gender, 'f')} - -
  • - - - - -
  • -
    - {/} - {/} - - - - - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    -
    - -
    -
    -
      - - {#each _user.profile.websites as :website} -
    • {:website}
    • - {/} -
    - -
    - - -
    -
    -

    {{username(@profile.auth, @profile.profile.name)}}

    - {{#if @profile.profile.imageUrl}} - - {{/}} - {{#if @profile.profile.blurb}} -

    {{@profile.profile.blurb}}

    - {{/}} - {{#if @profile.profile.websites}} -
      - {{#each @profile.profile.websites as :website}} -
    • {{:website}}
    • - {{/}} -
    - {{/}} -
    -
    -

    {{t("achievments")}}

    - -
    -
    - - -
    - - - - - - - - - - - - - - - -
    {{@profile.backer.npc}} NPC
    - {{t("npcText")}} -
    - - -
    - {{#if @profile.backer.contributor}} - {{@profile.backer.contributor}} - {{else}} - {{t("contribName")}} - {{/}} -
    - {{t("contribText")}} :) -
    - - -
    {{t("kickstartName1")}} ${{@profile.backer.tier}} {{t("kickstartName2")}}
    - {{t("kickstartText")}} -
    - - -
    {#if @profile.achievements.streak}{@profile.achievements.streak}{else}0{/} {{t("streakName")}}
    - {{t("streakText1")}} {#if @profile.achievements.streak}{@profile.achievements.streak}{else}0{/} {{t("streakText2")}} -
    - - -
    {{t("origUserName")}}
    - {{t("origUserText")}} -
    - - -
    {{t("ultimGearName")}}
    - {{t("ultimGearText")}} -
    - - -
    {{t("beastMastName")}}
    - {{t("beastMastName")}} -
    - -
    - - - {#if @unlocked} -
    {@content} -
    - {else if @unlockable} - {{#if equal(_user.id,@profile.id)}} - - {@content} - -
    - {{/}} - {/} - - - - - - diff --git a/views/app/filters.html b/views/app/filters.html deleted file mode 100644 index c65c60d9b9..0000000000 --- a/views/app/filters.html +++ /dev/null @@ -1,61 +0,0 @@ - -
    -
    - {{t("tags")}}: -
    - -
    - - - - - - - - - -
    - {{t("tags")}} - -
    \ No newline at end of file diff --git a/views/app/footer.html b/views/app/footer.html deleted file mode 100644 index 61a8314f66..0000000000 --- a/views/app/footer.html +++ /dev/null @@ -1,72 +0,0 @@ - - \ No newline at end of file diff --git a/views/app/game-pane.html b/views/app/game-pane.html deleted file mode 100644 index 1fed4ccc6b..0000000000 --- a/views/app/game-pane.html +++ /dev/null @@ -1,172 +0,0 @@ - -
    - - - - - - - -
    - -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    - -
    - -
    - -
    - -
    - -
    -
    -
    -

    {{t("inventory")}}

    - -
    -
    -

    {{t("market")}}

    - -
    -
    -
    - -
    - -
    - -
    - -
    - -
    - {{#if _loggedIn}} - - {{/}} -
    -
    - -
    - - -
    -
    -
    - -
    -
    -

    Daniel Johansson

    -
    - {{t("NPCJohanssonText1")}} Daniel, {{t("NPCJohanssonText2")}} -
    -
    -
    -
    - -
    {{t("tavernRestingInfo")}}
    - - - -
    -
    -

    {{t("tavernTalkTitle")}}

    -
    -
    - -
    -
      - {#each _tavern.chat.messages as :message} - - {/} -
    -
    -
    - - - - -
    - -
    -
    -

    Alexander Augustin

    -
    {{t("NPCAugustinText1")}} Alexander. {{t("NPCAugustinText2")}}
    -
    - -

    {{t("eggs")}}

    - {#with _items.pets as :egg} - - - {#with :egg[0]}{/} - {#with :egg[1]}{/} - {#with :egg[2]}{/} - {#with :egg[3]}{/} - - - {#with :egg[4]}{/} - {#with :egg[5]}{/} - {#with :egg[6]}{/} - {#with :egg[7]}{/} - - - {#with :egg[8]}{/} - -
    - {/} -

    {{t("hatchingPotions")}}

    - {#with _items.hatchingPotions as :hatchingPotion} - - - {#with :hatchingPotion[0]}{/} - {#with :hatchingPotion[1]}{/} - {#with :hatchingPotion[2]}{/} - {#with :hatchingPotion[3]}{/} - - - {#with :hatchingPotion[4]}{/} - {#with :hatchingPotion[5]}{/} - {#with :hatchingPotion[6]}{/} - {#with :hatchingPotion[7]}{/} - - - {#with :hatchingPotion[8]}{/} - {#with :hatchingPotion[9]}{/} - -
    - {/} -
    diff --git a/views/app/index.html b/views/app/index.html deleted file mode 100644 index d06c1f43e2..0000000000 --- a/views/app/index.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - HabitRPG | Gamify Your Life - - - - - - - - - - - -
    - - {#if _undo}{{t("undo")}}{/} - - - - -
    - - - -
    -
    -
    - - - -
    -
    - -
    -
    - -
    -
    -
    - diff --git a/views/app/modals.html b/views/app/modals.html deleted file mode 100644 index 4e781b7142..0000000000 --- a/views/app/modals.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - -
    - -
    -
    -
    - -
    -
    -
    -

    {{t("deathTitle")}}

    -
    -
    -
    - -
    -

    {{t("deathText")}}

    -
    -
    - -
    -
    - - - - -

    {{t("rerollNotes")}}


    -

    {{t("rerollModelText1")}} ({{t("rerollModelText2")}}). {{t("rerollModelText3")}}

    - <@footer> - {#if lt(_user.balance,1)} - {{t("buyMoreGems")}}Not enough Gems - {else} - {{t("rerollName")}}4 {{t("gems")}} - {/} - -
    - - - - -

    {{t("petsOutOfGems")}}

    - <@footer> - {{t("buyMoreGems")}}{{t("notEnoughGems")}} - -
    - - -

    {{t("whyAdsContent1")}}

    -

    {{t("whyAdsContent2")}} {{t("whyAdsContent3")}}.

    - <@footer> - - -
    - - - - - - {{#if @noDismiss}} - - {{/}} - \ No newline at end of file diff --git a/views/app/party.html b/views/app/party.html deleted file mode 100644 index 54e6991500..0000000000 --- a/views/app/party.html +++ /dev/null @@ -1,68 +0,0 @@ - - {#if _partyMembers} -
    -
    -

    {{_party.name}}

    - - {{#each _partyMembers as :member}} - - {{/}} -
    {{username(:member.auth, :member.profile.name)}}({{:member.id}})
    -
    - {#if _partyError} -
    {_partyError}
    - {/} -
    - - -
    -
    - {{t("leave")}} -
    -
    -

    {{t("chat")}}

    -
    -
    - -
    -
      - {#each _party.chat as :message} - - {/} -
    -
    -
    - - {else if _user.party.invitation} - -

    {{t("invitedTo")}} {_party.name}

    - {{t("accept")}} - {{t("reject")}} - - {else} -

    {{t("createAParty")}}

    - -

    {{t("noPartyText")}}

    -
    {_user.id}
    -
    - {#if _partyError} -
    {_partyError}
    - {/} -
    - - -
    -
    - - {/} - - - -
  • - - {{@message.user}} {{@message.text}} - {relativeDate(@message.timestamp, _currentTime)} - {{#if equal(@message.uuid,_user.id)}}{{#with @message}}{{/}}{{/}} - -
  • diff --git a/views/app/pets.html b/views/app/pets.html deleted file mode 100644 index ce0e4bc2e3..0000000000 --- a/views/app/pets.html +++ /dev/null @@ -1,133 +0,0 @@ - - - -

    {{t("dropsEnabledText1")}} {_user.items.eggs.0.text} {{t("dropsEnabledText2")}}! {_user.items.eggs.0.notes}

    - <@footer> - - -
    - - -

    {_drop.dialog}

    - - - <@footer> - - -
    - - -

    -

    {{t("beastMastUnlocked")}} -

    - <@footer> - - -
    - - - - - - - - -
    - {.text}
    {.value} {{t("gems")}} - - - - -
    - {.text}
    {.value} {{t("gems")}} - - - -
    -
    - -
  • - - {#if not(_user.items.eggs)} -

    {{t("noEggs")}}

    - {/if} - {#each _user.items.eggs as :egg} -
    - -

    {:egg.text}

    -
    - {/each} -
    -
  • -
  • - - {#if not(_user.items.hatchingPotions)} -

    {{t("noHatchingPotions")}}

    - {/if} - {#each _user.items.hatchingPotions as :hatchingPotion} -
    - -

    {:hatchingPotion}

    -
    - {/each} -
    -
  • -
    -
    - {#if _hatchEgg} -
    -

    {{t("hatchYourEgg")}}

    - {#if not(_user.items.hatchingPotions)} -

    {{t("noHatchingPotions")}}

    - {else} -

    {{t("whichHatchingPotion1")}} {_hatchEgg.text} {{t("whichHatchingPotion2")}}

    -
    - - -
    - {/if} -
    - {/if} -
    - - -
    {count(_user.items.pets)} / 90 {{t("petsFound")}}
    - - {{#each _items.pets as :pet}} - - {{#each _items.hatchingPotions as :potion}} - - {{/}} - - {{/}} -
    - -
    -

    {{t("rarePets")}}

    - - - - {{#if gt(_user.backer.tier,79)}}{{/}} - -
    - - - - -
    - {#if ownsPet(@pet, _user.items.pets)} - - {else} - - {/} -
    \ No newline at end of file diff --git a/views/app/rewards.html b/views/app/rewards.html deleted file mode 100644 index 294659e7c9..0000000000 --- a/views/app/rewards.html +++ /dev/null @@ -1,40 +0,0 @@ - - -

    -

    {{t("ultimGearUnlocked")}} -

    - <@footer> - - -
    - - - - -
    {gems(_user.balance)} {{t("gems")}} -
    - - - - -
  • - -
    - -
    - - -
    - {#if equal(@item.type,'reroll')} - - {else} - - {@item.value} - - - {/} -
    - - -

    {@item.text}

    -
  • diff --git a/views/app/settings.html b/views/app/settings.html deleted file mode 100644 index c2dd2a2a07..0000000000 --- a/views/app/settings.html +++ /dev/null @@ -1,157 +0,0 @@ - -
    -
    -

    {{t("settings")}}

    -

    {{t("customDayStart")}}

    -
    - - :00 ({{t("24HrClock")}}) -
    -
    - {{t("clockInfo")}} -
    - -
    -

    {{t("misc")}}

    - - - {{#if _user.auth.local}} -
    -

    {{t("changePass")}}

    - - {{/}} - -
    -

    {{t("dangerZone")}}

    - {{t("reset")}} -  {{t("restore")}} -  {{t("delete")}} -
    -
    -

    API

    - {{t("APIText")}} -
    {{t("userId")}}
    -
    {_user.id}
    - -
    {{t("APIToken")}}
    -
    {_user.apiToken}
    -
    -
    - - - {{#if _loggedIn}} - -

    {{t("resetText1")}}

    -

    {{t("resetText2")}}

    - <@footer> - - - -
    - - -

    {{t("restoreText1")}}

    - - {#with _user} -
    -

    {{t("stats")}}

    -
    - - HP -
    -
    - - Exp -
    -
    - - GP -
    -
    - - {{t("level")}} -
    - -

    {{t("items")}}

    -
    - - {{t("weapon")}} -
    -
    - - {{t("armor")}} -
    -
    - - {{t("helm")}} -
    -
    - - {{t("shield")}} -
    - -
    - {/} - - <@footer> - - -
    - - -

    {{t("deleteText1")}}{{t("deleteText2")}} {{t("deleteText3")}}

    -

    - <@footer> - - - -
    - - {{else}} - - {{t("loginFacebookAlt")}}/ -

    {{t("or")}}

    - - - -
    -
    -
    -
    -
    - {{/}} - - -
    - {{#unless _loggedIn}} - - {{else}} - - {{/}} - - - {#if _user.party.invitation} - - {/} - - - {#if newChatMessages(_party.chat,_user.party.lastMessageSeen)} - - {/} - -