Authored by shuaiguo

Merge branch 'hotfix/share'

/* eslint-disable indent */
import { get, first } from 'lodash';
import emojiRegex from 'emoji-regex';
function _version2num(version) {
if (!version) {
... ... @@ -38,10 +40,16 @@ function handleProtocol(url) {
return url.join('//');
}
const filterEmoji = text => {
text = text.replace(emojiRegex(), '');
text = text.replace(/\ud83c|\ud83d|\ud83e/gi, '');
return text;
};
// eslint-disable-next-line no-unused-vars
const getDetailShareData = (article, app_version = '6.9.11') => {
let shareImage = '';
let desc = '';
if (article.sort === 2) {
... ... @@ -79,8 +87,18 @@ const getDetailShareData = (article, app_version = '6.9.11') => {
hideType = ['8', '9'];
}
let authorName = article.authorName || '';
// 过滤掉换行
// desc = ClearBr(desc);
// authorName = ClearBr(article.authorName || '');
// 过滤掉emoji表情
desc = filterEmoji(desc);
authorName = filterEmoji(article.authorName || '');
return {
title: `@${article.authorName} 在有货社区上发了一篇内容,快点开看看!`,
title: `@${authorName} 在有货社区上发了一篇内容,快点开看看!`,
imgUrl: handleProtocol(
get(shareImage.split('?'), '[0]') || DEFAULT_SHARE_IMAGE,
),
... ... @@ -89,13 +107,13 @@ const getDetailShareData = (article, app_version = '6.9.11') => {
article.articleId
}?share=true`,
),
desc,
desc: `${desc}`,
hideType,
shareType: 'grassDetail',
userName: article.authorName,
userName: authorName,
userIcon: article.authorHeadIco,
articleId: article.articleId,
authGroupId: article.authGroupId
authGroupId: article.authGroupId,
};
};
... ...
... ... @@ -92,8 +92,8 @@ module.exports = {
debugStdout: true
}
},
zookeeperServer: '127.0.0.1:2181',
jsSdk: '//cdn.yoho.cn/js-sdk/1.3.10/jssdk.js',
zookeeperServer: '127.0.0.1:2181',
redis: {
connect: {
host: '192.168.102.49',
... ... @@ -226,12 +226,6 @@ if (isProduction) {
service: process.env.TEST_API || 'http://api-test3.dev.yohocorp.com/'
},
useCache: true,
monitorReport: {
host: '192.168.102.22',
port: 8086,
db: 'web_monitor',
},
zookeeperServer: 'zk01-yohoops-org:2181',
loggers: {
infoFile: {
name: 'info',
... ... @@ -263,6 +257,38 @@ if (isProduction) {
prettyPrint: true,
debugStdout: true
}
},
zookeeperServer: 'zk.yohoops.com:2181',
monitorReport: {
// influxdb
host: 'influxdb.yohoops.com',
port: 8086,
db: 'web_monitor',
},
redis: {
connect: {
host: 'redis.yohoops.com',
port: '6379',
enable_offline_queue: false,
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
console.log('connect redis server fail');
}
if (options.attempt < 10) {
return Math.min(options.attempt * 100, 1000);
} else if (options.attempt > 10 && options.attempt < 100) {
return 1000;
} else {
return 1000 * 10;
}
}
},
session: {
host: 'redis.yohoops.com',
port: '6379',
prefix: 'yohobuy_session:'
}
}
});
}
... ...
{
"name": "yoho-community-web",
"version": "6.9.11-beta44",
"version": "6.9.14-beta-8",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -45,6 +45,7 @@
"cors": "^2.8.5",
"cube-ui": "^1.12.6",
"dayjs": "^1.8.5",
"emoji-regex": "^8.0.0",
"express": "^4.16.4",
"express-session": "^1.15.6",
"fastclick": "^1.0.6",
... ...
... ... @@ -2835,6 +2835,7 @@ emoji-regex@^7.0.1:
emoji-regex@^8.0.0:
version "8.0.0"
resolved "http://npm.yohops.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
integrity sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=
emojis-list@^2.0.0:
version "2.1.0"
... ...