Merge branch 'develop' into api-v3

This commit is contained in:
Matteo Pagliazzi
2016-04-22 17:43:48 +02:00
32 changed files with 1362 additions and 1354 deletions
+1 -1
View File
@@ -37,7 +37,7 @@
"jquery-ui": "1.10.3",
"jquery.cookie": "1.4.0",
"js-emoji": "snicker/js-emoji#f25d8a303f",
"marked": "0.2.9",
"remarkable": "^1.6.2",
"ngInfiniteScroll": "1.0.0",
"pnotify": "1.3.1",
"sticky": "*",
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 142 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

+51 -56
View File
@@ -6,18 +6,10 @@
*/
(function(){
var md = function () {
marked.setOptions({
gfm:true,
pedantic:false,
sanitize:true
// callback for code highlighter
// Uncomment this (and htljs.tabReplace below) if we add in highlight.js (http://www.heikura.me/#!/angularjs-markdown-directive)
// highlight:function (code, lang) {
// if (lang != undefined)
// return hljs.highlight(lang, code).value;
//
// return hljs.highlightAuto(code).value;
// }
var remarkable = new Remarkable({
// TODO: Add in code highlighting?
// highlight: function (#<{(|str, lang|)}>#) { return ''; }
linkify: true
});
emoji.img_path = 'common/img/emoji/unicode/';
@@ -26,57 +18,60 @@
if (markdown == undefined)
return '';
markdown = marked(markdown);
markdown = remarkable.render(markdown);
markdown = emoji.replace_colons(markdown);
markdown = emoji.replace_unified(markdown);
return markdown;
};
// This was applie to marked, the old markdown library which has an xss exploit.
// If we want this behavior again, we'll need to rewrite it.
// ---
// [nickgordon20131123] this hacky override wraps images with a link to the image in a new window, and also adds some classes in case we want to style
marked.InlineLexer.prototype.outputLink = function(cap, link) {
var escape = function(html, encode) {
return html
.replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
};
if (cap[0].charAt(0) !== '!') {
return '<a class="markdown-link" target="_blank" href="'
+ escape(link.href)
+ '"'
+ (link.title
? ' title="'
+ escape(link.title)
+ '"'
: '')
+ '>'
+ this.output(cap[1])
+ '</a>';
} else {
return '<a class="markdown-img-link" target="_blank" href="'
+ escape(link.href)
+ '"'
+ (link.title
? ' title="'
+ escape(link.title)
+ '"'
: '')
+ '><img class="markdown-img" src="'
+ escape(link.href)
+ '" alt="'
+ escape(cap[1])
+ '"'
+ (link.title
? ' title="'
+ escape(link.title)
+ '"'
: '')
+ '></a>';
}
}
// marked.InlineLexer.prototype.outputLink = function(cap, link) {
// var escape = function(html, encode) {
// return html
// .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&amp;')
// .replace(/</g, '&lt;')
// .replace(/>/g, '&gt;')
// .replace(/"/g, '&quot;')
// .replace(/'/g, '&#39;');
// };
// if (cap[0].charAt(0) !== '!') {
// return '<a class="markdown-link" target="_blank" href="'
// + escape(link.href)
// + '"'
// + (link.title
// ? ' title="'
// + escape(link.title)
// + '"'
// : '')
// + '>'
// + this.output(cap[1])
// + '</a>';
// } else {
// return '<a class="markdown-img-link" target="_blank" href="'
// + escape(link.href)
// + '"'
// + (link.title
// ? ' title="'
// + escape(link.title)
// + '"'
// : '')
// + '><img class="markdown-img" src="'
// + escape(link.href)
// + '" alt="'
// + escape(cap[1])
// + '"'
// + (link.title
// ? ' title="'
// + escape(link.title)
// + '"'
// : '')
// + '></a>';
// }
// }
//hljs.tabReplace = ' ';
+1 -1
View File
@@ -31,7 +31,7 @@ module.exports = function karmaConfig (config) {
'website/public/bower_components/ngInfiniteScroll/build/ng-infinite-scroll.js',
'website/public/bower_components/select2/select2.js',
'website/public/bower_components/angular-ui-select2/src/select2.js',
'website/public/bower_components/marked/lib/marked.js',
'website/public/bower_components/remarkable/dist/remarkable.min.js',
'website/public/bower_components/js-emoji/emoji.js',
'common/dist/scripts/habitrpg-shared.js',
+1 -1
View File
@@ -58,7 +58,6 @@
"js2xmlparser": "~1.0.0",
"lodash": "^3.10.1",
"loggly": "~1.0.8",
"marked": "^0.3.5",
"merge-stream": "^1.0.0",
"method-override": "^2.3.5",
"moment": "~2.10.6",
@@ -79,6 +78,7 @@
"ps-tree": "^1.0.0",
"push-notify": "^1.1.1",
"q": "^1.4.1",
"remarkable": "^1.6.2",
"request": "~2.44.0",
"run-sequence": "^1.1.4",
"s3-upload-stream": "^1.0.6",
+1 -1
View File
@@ -16,7 +16,7 @@ nvm use
nvm alias default current
echo Update npm...
npm install -g npm@3
npm install -g npm@2
echo Installing global modules...
npm install -g gulp bower grunt-cli mocha
+1 -1
View File
@@ -65,7 +65,7 @@ apt-get install -qq ntp
echo Installing nvm, node and global node modules...
/vagrant/vagrant_scripts/install_node.sh
echo All done! run npm install to install the required node modules and then npm start to start the server
echo "'vagrant up' is finished. Continue with the instructions at http://habitica.wikia.com/wiki/Setting_up_Habitica_Locally"
# Uncomment both lines to autostart the habitica server when provisioning
# echo Starting Habitica server...
+1 -1
View File
@@ -8,7 +8,7 @@
"bower_components/bootstrap-tour/build/js/bootstrap-tour.js",
"bower_components/angular/angular.js",
"bower_components/angular-sanitize/angular-sanitize.js",
"bower_components/marked/lib/marked.js",
"bower_components/remarkable/dist/remarkable.min.js",
"bower_components/angular-ui-router/release/angular-ui-router.js",
"bower_components/angular-resource/angular-resource.min.js",
"bower_components/angular-ui-utils/ui-utils.min.js",
+6 -3
View File
@@ -1,7 +1,10 @@
import locals from '../../middlewares/api-v3/locals';
import _ from 'lodash';
import Remarkable from 'remarkable';
const marked = require('marked');
const md = new Remarkable({
html: true,
});
let api = {};
@@ -39,7 +42,7 @@ _.each(staticPages, (name) => {
async handler (req, res) {
res.render(`static/${name}.jade`, {
env: res.locals.habitrpg,
marked,
md,
userCount: TOTAL_USER_COUNT,
});
},
@@ -57,7 +60,7 @@ _.each(shareables, (name) => {
async handler (req, res) {
res.render(`social/${name}`, {
env: res.locals.habitrpg,
marked,
md,
userCount: TOTAL_USER_COUNT,
});
},
+2 -2
View File
@@ -7,7 +7,7 @@ var request = require('request');
var IS_PROD = nconf.get('NODE_ENV') === 'production';
module.exports = function(server,mongoose) {
if (IS_PROD) {
/* if (IS_PROD) {
var mins = 3, // how often to run this check
useAvg = false, // use average over 3 minutes, or simply the last minute's report
url = 'https://api.newrelic.com/v2/applications/'+nconf.get('NEW_RELIC_APPLICATION_ID')+'/metrics/data.json?names[]=Apdex&values[]=score';
@@ -35,7 +35,7 @@ module.exports = function(server,mongoose) {
throw memoryLeakMessage;
}
}, mins*60*1000);
}
} */
return domainMiddleware({
server: {
+1 -1
View File
@@ -400,7 +400,7 @@ export let schema = new Schema({
hideHeader: {type: Boolean, default: false},
skin: {type: String, default: '915533'},
shirt: {type: String, default: 'blue'},
timezoneOffset: Number,
timezoneOffset: {type: Number, default: 0},
sound: {type: String, default: 'off', enum: ['off', 'danielTheBard', 'gokulTheme', 'luneFoxTheme', 'wattsTheme']},
chair: {type: String, default: 'none'},
timezoneOffsetAtLastCron: Number,
+6 -2
View File
@@ -4,6 +4,10 @@ var router = express.Router();
var _ = require('lodash');
var locals = require('../middlewares/api-v2/locals');
var i18n = require('../libs/api-v2/i18n');
var Remarkable = require('remarkable');
var md = new Remarkable({
html: true,
});
const TOTAL_USER_COUNT = '1,100,000';
@@ -26,7 +30,7 @@ _.each(pages, function(name){
router.get('/static/' + name, i18n.getUserLanguage, locals, function(req, res) {
res.render( 'static/' + name, {
env: res.locals.habitrpg,
marked: require('marked'),
md: md,
userCount: TOTAL_USER_COUNT
});
});
@@ -40,7 +44,7 @@ _.each(shareables, function(name){
router.get('/social/' + name, i18n.getUserLanguage, locals, function(req, res) {
res.render( 'social/' + name, {
env: res.locals.habitrpg,
marked: require('marked'),
md: md,
userCount: TOTAL_USER_COUNT
});
});
+2 -2
View File
@@ -22,8 +22,8 @@ block content
- for heading, index in headings
a.h2.accordion.collapsed(ng-href='#' + heading, data-toggle='collapse')=env.t('faqQuestion' + index)
.clearfix.collapse(id=heading)
!=marked(env.t('webFaqAnswer' + index))
!=md.render(env.t('webFaqAnswer' + index))
hr
h3!=marked(env.t('webFaqStillNeedHelp'))
h3!=md.render(env.t('webFaqStillNeedHelp'))
+2 -2
View File
@@ -18,6 +18,6 @@ block content
- for step in stepsNum
h3=env.t('step'+step)
p
!=marked(env.t('webStep'+step+'Text'))
!=md.render(env.t('webStep'+step+'Text'))
hr
!=marked(env.t('overviewQuestions'))
!=md.render(env.t('overviewQuestions'))