@jswork/next-fanyi-api-sign
Advanced tools
Comparing version 1.0.0 to 1.0.1
/*! | ||
* name: @jswork/next-fanyi-api-sign | ||
* description: Get baidu translate api sign. | ||
* homepage: https://github.com/afeiship/next-fanyi-api-sign | ||
* version: 1.0.0 | ||
* date: 2020-11-22 17:46:22 | ||
* homepage: https://js.work | ||
* version: 1.0.1 | ||
* date: 2023-05-17 10:20:52 | ||
* license: MIT | ||
*/ | ||
(function () { | ||
var global = global || this || window || Function('return this')(); | ||
var nx = global.nx || require('@jswork/next'); | ||
var md5 = require('md5'); | ||
var DEFAULT_OPTIONS = { | ||
q: 'apple', | ||
salt: Math.random().toString(36), | ||
appid: '20191225000369703', | ||
secret: '_m5Ircd6tovvjicHKyMh' | ||
}; | ||
'use strict'; | ||
nx.fanyiApiSign = function (inOptions) { | ||
var options = nx.mix(null, DEFAULT_OPTIONS, inOptions); | ||
var q = options.q; | ||
var salt = options.salt; | ||
var secret = options.secret; | ||
var appid = options.appid; | ||
var res = appid + q + salt + secret; | ||
return nx.mix(options, { sign: md5(res) }); | ||
}; | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = nx.fanyiApiSign; | ||
} | ||
})(); | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
exports['default'] = void 0; | ||
var _next = _interopRequireDefault(require('@jswork/next')); | ||
var _md = _interopRequireDefault(require('md5')); | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { default: obj }; | ||
} | ||
var defaults = { | ||
q: 'apple', | ||
salt: Math.random().toString(36), | ||
appid: process.env.BAIDU_FANYI_APP_ID, | ||
secret: process.env.BAIDU_FANYI_SECRET | ||
}; | ||
_next['default'].fanyiApiSign = function (inOptions) { | ||
var options = _next['default'].mix(null, defaults, inOptions); | ||
var q = options.q; | ||
var salt = options.salt; | ||
var secret = options.secret; | ||
var appid = options.appid; | ||
var res = appid + q + salt + secret; | ||
return _next['default'].mix(options, { | ||
sign: (0, _md['default'])(res) | ||
}); | ||
}; | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = _next['default'].fanyiApiSign; | ||
} | ||
var _default = _next['default'].fanyiApiSign; | ||
exports['default'] = _default; |
{ | ||
"name": "@jswork/next-fanyi-api-sign", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Get baidu translate api sign.", | ||
"homepage": "https://github.com/afeiship/next-fanyi-api-sign", | ||
"homepage": "https://js.work", | ||
"author": { | ||
@@ -17,22 +17,30 @@ "name": "afei", | ||
"main": "dist/index.js", | ||
"module": "dist/index.esm.js", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@jswork/gulp-pkg-header": "^1.0.2", | ||
"@jswork/next": "^1.0.2", | ||
"@jswork/next-param": "^1.0.0", | ||
"@babel/core": "^7.21.3", | ||
"@babel/preset-env": "^7.20.2", | ||
"@jswork/gulp-pkg-header": "^1.0.8", | ||
"@jswork/gulp-registry": "^1.0.22", | ||
"@jswork/next": "^1.1.7", | ||
"@jswork/next-param": "^1.0.11", | ||
"del": "^6.0.0", | ||
"gulp": "^4.0.2", | ||
"gulp-debug": "^4.0.0", | ||
"gulp-header": "^2.0.9", | ||
"gulp-ignore": "^3.0.0", | ||
"gulp-load-plugins": "^2.0.5", | ||
"gulp-babel": "^8.0.0", | ||
"gulp-prettier": "^4.0.0", | ||
"gulp-rename": "^2.0.0", | ||
"gulp-size": "^3.0.0", | ||
"gulp-replace": "^1.1.4", | ||
"gulp-uglify": "^3.0.2", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.1.2", | ||
"release-it": "^14.2.1", | ||
"uglify-js": "3.11.6", | ||
"jest": "^29.5.0", | ||
"jest-location-mock": "^1.0.9", | ||
"node-fetch": "2.6.7", | ||
"uglify-save-license": "^0.4.1" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
[ | ||
"@babel/preset-env" | ||
] | ||
] | ||
}, | ||
"publishConfig": { | ||
@@ -43,12 +51,4 @@ "access": "public", | ||
"dependencies": { | ||
"md5": "^2.3.0", | ||
"node-fetch": "^2.6.1" | ||
}, | ||
"keywords": [ | ||
"next", | ||
"fanyi", | ||
"baidu", | ||
"api", | ||
"sign" | ||
] | ||
} | ||
"md5": "^2.3.0" | ||
} | ||
} |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
6179
1
6
72
0
0
5
- Removednode-fetch@^2.6.1
- Removednode-fetch@2.7.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)