Socket
Socket
Sign inDemoInstall

nodebb-plugin-freelog

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodebb-plugin-freelog - npm Package Compare versions

Comparing version 0.0.29 to 0.0.30

38

index.js

@@ -11,16 +11,20 @@ const plugin = {};

// 签到处理
// 签到处理(回复指定ID的帖子)
plugin.topicReplyHandler = async function(data) {
let signTid = 0; // 签到帖ID
if (data.data.host === 'forum.freelog.com') {
signTid = 1;
} else if (data.data.host === 'forum.testfreelog.com') {
signTid = 2;
} else {
return;
}
const env = process.env.NODE_ENV;
const signTid = env === 'production' ? 1 : 2; // 根据环境设定签到帖ID.
console.log(JSON.stringify(data));
if (data.data.tid !== signTid) {
return;
}
console.log('freelog-topicReplyHandler', JSON.stringify(data));
const url = env === 'production' ? 'https://api.freelog.com/v2/activities/task/records/complete4TaskConfigCode' : 'http://api.testfreelog.com/v2/activities/task/records/complete4TaskConfigCode';
axios.post(url, {
taskConfigCode: 'TS000013',
userId: data.data.uid
}, {
headers: { 'content-type': 'application/json' }
}).catch(console.error);
};

@@ -41,2 +45,13 @@

// 拦截一下用户注册.
plugin.userCreateFilter = async function(param) {
if (!param.data.uid) {
throw new Error('缺少uid,无法创建成功.');
}
// 把freelog-userId赋值给nodebb-uid
param.user.uid = param.data.uid;
return param;
};
// 登录重新,登录通过api.freelog.com来确认身份和密码
plugin.overrideLogin = function(req, username, password, next) {

@@ -49,2 +64,3 @@ passport.use(new passportLocal({

plugin.login = function(req, username, password, next) {
console.log('jwt', req.cookies.authInfo);
if (!username) {

@@ -93,3 +109,3 @@ return next(new Error('[[error:invalid-username]]'));

picture: freelogUserInfo.headImage
// email: freelogUserInfo.email 会报错,nodebb会校验邮箱数据是否存在
// email: freelogUserInfo.email 会报错,nodebb会校验邮箱
}).then(() => {

@@ -96,0 +112,0 @@ User.getUserData(freelogUserInfo.userId).then(userData => {

@@ -5,3 +5,3 @@ {

"description": "NodeBB Forum",
"version": "0.0.29",
"version": "0.0.30",
"homepage": "http://www.nodebb.org",

@@ -8,0 +8,0 @@ "repository": {

@@ -21,2 +21,6 @@ {

{
"hook": "filter:user.create",
"method": "userCreateFilter"
},
{
"hook": "static:auth.validate",

@@ -23,0 +27,0 @@ "method": "authValidate"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc