security.js 675 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. import { logger } from 'ee-core/log';
  3. import { app as electronApp } from 'electron';
  4. /**
  5. * 安全
  6. * @class
  7. */
  8. class SecurityService {
  9. /**
  10. * 创建
  11. */
  12. create () {
  13. logger.info('[security] load');
  14. const runWithDebug = process.argv.find(e => e.includes("--inspect") || e.includes("--inspect-brk") || e.includes("--remote-debugging-port"));
  15. // 不允许远程调试
  16. if (runWithDebug) {
  17. logger.error('[error] Remote debugging is not allowed, runWithDebug:', runWithDebug);
  18. electronApp.quit();
  19. }
  20. }
  21. }
  22. SecurityService.toString = () => '[class SecurityService]';
  23. export const securityService = new SecurityService();