nodebb-plugin-freelog
Advanced tools
Comparing version 0.0.3 to 0.0.4
29
index.js
const plugin = {}; | ||
const passport = module.parent.require('passport'); | ||
const passportLocal = module.parent.require('passport-local').Strategy; | ||
const axios = require('axios'); | ||
const userController = require.main.require('./src/controllers/user'); | ||
// 签到处理 | ||
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; | ||
} | ||
if (data.data.tid !== signTid) { | ||
return; | ||
} | ||
console.log('freelog-topicReplyHandler', JSON.stringify(data)); | ||
}; | ||
plugin.auth = async function() { | ||
}; | ||
plugin.loadHandler = async function(params) { | ||
@@ -12,2 +32,11 @@ console.log('freelog-loadHandler', JSON.stringify(params)); | ||
plugin.overrideLogin = async function(req, username, password, next) { | ||
if (!username) { | ||
return next(new Error('[[error:invalid-username]]')); | ||
} | ||
console.log(username, password); | ||
console.log('登录成功'); | ||
userController.getUserDataByField(1, 'username', username, next); | ||
}; | ||
module.exports = plugin; |
@@ -5,3 +5,3 @@ { | ||
"description": "NodeBB Forum", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"homepage": "http://www.nodebb.org", | ||
@@ -12,3 +12,6 @@ "repository": { | ||
}, | ||
"main": "index.js" | ||
"main": "index.js", | ||
"dependencies": { | ||
"axios": "^0.27.2" | ||
} | ||
} |
@@ -15,4 +15,8 @@ { | ||
"method": "topicReplyHandler" | ||
}, | ||
{ | ||
"hook": "action:auth.overrideLogin", | ||
"method": "overrideLogin" | ||
} | ||
] | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3178
56
1
+ Addedaxios@^0.27.2
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@0.27.2(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)