index.js 735 B

123456789101112131415161718192021222324252627282930313233
  1. const Log = require('ee-core/log');
  2. const EE = require('ee-core/ee');
  3. /**
  4. * 安全插件
  5. * @class
  6. */
  7. class SecurityAddon {
  8. constructor() {
  9. }
  10. /**
  11. * 创建
  12. */
  13. create () {
  14. Log.info('[addon:security] load');
  15. const { CoreApp } = EE;
  16. const runWithDebug = process.argv.find(function(e){
  17. let isHasDebug = e.includes("--inspect") || e.includes("--inspect-brk") || e.includes("--remote-debugging-port");
  18. return isHasDebug;
  19. })
  20. // 不允许远程调试
  21. if (runWithDebug) {
  22. Log.error('[error] Remote debugging is not allowed, runWithDebug:', runWithDebug);
  23. CoreApp.appQuit();
  24. }
  25. }
  26. }
  27. SecurityAddon.toString = () => '[class SecurityAddon]';
  28. module.exports = SecurityAddon;