constants.js 828 B

123456789101112131415161718192021222324252627282930
  1. const fs = require('fs');
  2. const path = require('path');
  3. const https = require('https');
  4. const { app } = require('electron');
  5. const cert = fs.readFileSync('server\\Configs\\cer\\cert.pem');
  6. const agent = new https.Agent({
  7. ca: cert,
  8. rejectUnauthorized: true,
  9. // secureProtocol: 'TLSv1_2_method', // 强制使用 TLS 1.2
  10. });
  11. let serverPath;
  12. if (app.isPackaged) {
  13. serverPath = path.dirname(app.getPath('exe'));
  14. } else {
  15. serverPath = __dirname;
  16. }
  17. const baseUrl = 'https://exam.habook.local:8888';
  18. const remoteVersionsUrl = 'https://teammodelos.blob.core.chinacloudapi.cn/0-public/exam-server/versions.json';
  19. const remoteZipBaseUrl = 'https://teammodelos.blob.core.chinacloudapi.cn/0-public/exam-server';
  20. module.exports = {
  21. serverPath,
  22. baseUrl,
  23. remoteVersionsUrl,
  24. remoteZipBaseUrl,
  25. agent
  26. };