lightshortcuts 1.0.9 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,32 @@
1
1
  "use strict"
2
2
 
3
3
  // API列表
4
- const offlineURlPrefix = `/light/light-platform-client/v/appdiy/offline/`;
4
+ // 旧的入口 lightadmin/pas-api
5
+ // /ltpas/apppas/v/appdiy/offline/
6
+ const offlineURlPrefix = `/lightadmin/pas-api/light/light-platform-client/v/appdiy/offline/`;
7
+ const newVerOfflineURlPrefix = `/light/light-platform-client/v/appdiy/offline/`;
5
8
  const ApiList = {
6
- fileUpload: "/ltcommon/file/v/upload?bizType=h5_offline_src",
7
- checkSession: "/light/light-platform-client/v/auth/check_session",
9
+ submitLogin: "/lightadmin/pas-api/light/light-platform-client/v/submitLogin",
10
+ getCaptcha:"/lightadmin/pas-api/light/light-platform-client/v/auth/get_captcha",
11
+ fileUpload: "/lightadmin/pas-api/ltcommon/file/v/upload",//上传文件
12
+ checkSession: "/lightadmin/pas-api/light/light-platform-client/v/auth/check_session",
8
13
  logout:"/light/light-platform-client/v/auth/logout",
9
14
  queryOfflinePkgList: offlineURlPrefix + "query_offline_pkglist1",
10
- queryOfflineVersionlist: offlineURlPrefix + "query_offline_versionlist",
15
+ queryOfflineVersionlist: "/ltpas/apppas/v/appdiy/offline/query_offline_versionlist",
11
16
  addOfflineH5pkg: offlineURlPrefix + "add_offline_h5pkg",
12
17
  checkOfflinePkgid: offlineURlPrefix + "check_offline_pkgid",
13
18
  checkOfflinePkgname: offlineURlPrefix + "check_offline_pkgname",
14
- addOfflineVersion: offlineURlPrefix + "add_offline_version",
15
- addOfflineTask: offlineURlPrefix + "add_offline_task",
16
- queryOfflineTask: offlineURlPrefix + "query_offline_task",
17
- updateOfflineTask: offlineURlPrefix + "update_offline_task",
19
+ addOfflineVersion: "/ltpas/apppas/v/appdiy/offline/add_offline_version",
20
+ addOfflineTask: "/ltpas/apppas/v/appdiy/offline/add_offline_task",
21
+ queryOfflineTask: "/lightadmin/pas-api/light/light-platform-client/v/appdiy/offline/query_offline_task",
22
+ updateOfflineTask: "/ltpas/apppas/v/appdiy/offline/update_offline_task",
23
+ queryOfflineVersionDetail: offlineURlPrefix + "query_offline_version_detail",
24
+ wechatWebhook: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send",
25
+ // H5web相关
26
+ addH5webPkg: "/lightadmin/pas-api/light/light-platform-client/v/comp/add_pkg",//添加H5web包
27
+ releaseMuchVersion: "/lightadmin/pas-api/light/light-platform-client/v/comp/release_much_version",//发布H5web版本
28
+ queryCompList: "/lightadmin/pas-api/light/light-platform-client/v/comp/query_comp_list",//查询H5应用ID列表
29
+ queryApp: "/lightadmin/pas-api/light/light-platform-client/v/appdiy/common/queryApp",//获取APP列表
18
30
  };
19
31
 
20
32
  module.exports={ApiList}
package/lib/defaults.js CHANGED
@@ -1,23 +1,22 @@
1
1
  "use strict";
2
2
  var defaults = {
3
3
  publishInfo: {
4
- // token: "XXXXX", //登录token
5
4
  pkgid: "XXXXX", //离线包ID
6
5
  set_pkg_version: "1.0.1", //指定发布版本
7
- publish_app_arr: [3577, 3592], //发布到指定APP,默认开发版
6
+ publish_app_arr: ["3542", "3543"], //发布到指定APP,默认开发版
8
7
  apps_name: {
9
- 3592: "开发版_iOS",
10
- 3577: "开发版_安卓",
11
- 3559: "测试",
8
+ 3542: "开发版",
9
+ 3543: "仿真版",
12
10
  },
13
- android_version_scope: "7.0.6.0", //Android端离线包兼容版本
14
- ios_version_scope: "7.0.6", //iOS端离线包兼容版本
11
+ android_version_scope: "7.0.7.0", //Android端离线包兼容版本
12
+ ios_version_scope: "7.0.7", //iOS端离线包兼容版本
13
+ harmony_version_scope: "1.0.1", //Harmony端离线包兼容版本
15
14
  pkg_zip_name: "dist.zip",
16
15
  pkg_dir: "./dist/", //离线包所在路径
17
16
  release_desc: "功能更新", //发布日志
18
17
  task_status: "0", //对上一版本的处理:0:发布,1:暂停,2:下架
19
18
  },
20
- lightBaseURL: "https://xxx.xxx.xxx/lightadmin/pas-api",
19
+ lightBaseURL: "http://new-light-dev.ghzq",
21
20
  };
22
21
 
23
22
  module.exports = defaults;
@@ -0,0 +1,177 @@
1
+ const hsUtils = require('./hsUtils');
2
+
3
+ function i(e, t) {
4
+ e.constructor == String
5
+ ? (e = (
6
+ t && 'binary' === t.encoding
7
+ ? hsUtils.stringToBytes
8
+ : hsUtils.utfStringToBytes
9
+ )(e))
10
+ : a(e)
11
+ ? (e = Array.prototype.slice.call(e, 0))
12
+ : Array.isArray(e) || (e = e.toString());
13
+ for (
14
+ var n = hsUtils.bytesToWords(e),
15
+ t = 8 * e.length,
16
+ s = 1732584193,
17
+ c = -271733879,
18
+ d = -1732584194,
19
+ h = 271733878,
20
+ u = 0;
21
+ u < n.length;
22
+ u++
23
+ )
24
+ n[u] =
25
+ (16711935 & ((n[u] << 8) | (n[u] >>> 24))) |
26
+ (4278255360 & ((n[u] << 24) | (n[u] >>> 8)));
27
+ (n[t >>> 5] |= 128 << t % 32), (n[14 + (((64 + t) >>> 9) << 4)] = t);
28
+ for (
29
+ var p = i._ff, f = i._gg, m = i._hh, g = i._ii, u = 0;
30
+ u < n.length;
31
+ u += 16
32
+ ) {
33
+ var b = s,
34
+ x = c,
35
+ v = d,
36
+ y = h,
37
+ s = p(s, c, d, h, n[u + 0], 7, -680876936),
38
+ h = p(h, s, c, d, n[u + 1], 12, -389564586),
39
+ d = p(d, h, s, c, n[u + 2], 17, 606105819),
40
+ c = p(c, d, h, s, n[u + 3], 22, -1044525330);
41
+ (s = p(s, c, d, h, n[u + 4], 7, -176418897)),
42
+ (h = p(h, s, c, d, n[u + 5], 12, 1200080426)),
43
+ (d = p(d, h, s, c, n[u + 6], 17, -1473231341)),
44
+ (c = p(c, d, h, s, n[u + 7], 22, -45705983)),
45
+ (s = p(s, c, d, h, n[u + 8], 7, 1770035416)),
46
+ (h = p(h, s, c, d, n[u + 9], 12, -1958414417)),
47
+ (d = p(d, h, s, c, n[u + 10], 17, -42063)),
48
+ (c = p(c, d, h, s, n[u + 11], 22, -1990404162)),
49
+ (s = p(s, c, d, h, n[u + 12], 7, 1804603682)),
50
+ (h = p(h, s, c, d, n[u + 13], 12, -40341101)),
51
+ (d = p(d, h, s, c, n[u + 14], 17, -1502002290)),
52
+ (s = f(
53
+ s,
54
+ (c = p(c, d, h, s, n[u + 15], 22, 1236535329)),
55
+ d,
56
+ h,
57
+ n[u + 1],
58
+ 5,
59
+ -165796510
60
+ )),
61
+ (h = f(h, s, c, d, n[u + 6], 9, -1069501632)),
62
+ (d = f(d, h, s, c, n[u + 11], 14, 643717713)),
63
+ (c = f(c, d, h, s, n[u + 0], 20, -373897302)),
64
+ (s = f(s, c, d, h, n[u + 5], 5, -701558691)),
65
+ (h = f(h, s, c, d, n[u + 10], 9, 38016083)),
66
+ (d = f(d, h, s, c, n[u + 15], 14, -660478335)),
67
+ (c = f(c, d, h, s, n[u + 4], 20, -405537848)),
68
+ (s = f(s, c, d, h, n[u + 9], 5, 568446438)),
69
+ (h = f(h, s, c, d, n[u + 14], 9, -1019803690)),
70
+ (d = f(d, h, s, c, n[u + 3], 14, -187363961)),
71
+ (c = f(c, d, h, s, n[u + 8], 20, 1163531501)),
72
+ (s = f(s, c, d, h, n[u + 13], 5, -1444681467)),
73
+ (h = f(h, s, c, d, n[u + 2], 9, -51403784)),
74
+ (d = f(d, h, s, c, n[u + 7], 14, 1735328473)),
75
+ (s = m(
76
+ s,
77
+ (c = f(c, d, h, s, n[u + 12], 20, -1926607734)),
78
+ d,
79
+ h,
80
+ n[u + 5],
81
+ 4,
82
+ -378558
83
+ )),
84
+ (h = m(h, s, c, d, n[u + 8], 11, -2022574463)),
85
+ (d = m(d, h, s, c, n[u + 11], 16, 1839030562)),
86
+ (c = m(c, d, h, s, n[u + 14], 23, -35309556)),
87
+ (s = m(s, c, d, h, n[u + 1], 4, -1530992060)),
88
+ (h = m(h, s, c, d, n[u + 4], 11, 1272893353)),
89
+ (d = m(d, h, s, c, n[u + 7], 16, -155497632)),
90
+ (c = m(c, d, h, s, n[u + 10], 23, -1094730640)),
91
+ (s = m(s, c, d, h, n[u + 13], 4, 681279174)),
92
+ (h = m(h, s, c, d, n[u + 0], 11, -358537222)),
93
+ (d = m(d, h, s, c, n[u + 3], 16, -722521979)),
94
+ (c = m(c, d, h, s, n[u + 6], 23, 76029189)),
95
+ (s = m(s, c, d, h, n[u + 9], 4, -640364487)),
96
+ (h = m(h, s, c, d, n[u + 12], 11, -421815835)),
97
+ (d = m(d, h, s, c, n[u + 15], 16, 530742520)),
98
+ (s = g(
99
+ s,
100
+ (c = m(c, d, h, s, n[u + 2], 23, -995338651)),
101
+ d,
102
+ h,
103
+ n[u + 0],
104
+ 6,
105
+ -198630844
106
+ )),
107
+ (h = g(h, s, c, d, n[u + 7], 10, 1126891415)),
108
+ (d = g(d, h, s, c, n[u + 14], 15, -1416354905)),
109
+ (c = g(c, d, h, s, n[u + 5], 21, -57434055)),
110
+ (s = g(s, c, d, h, n[u + 12], 6, 1700485571)),
111
+ (h = g(h, s, c, d, n[u + 3], 10, -1894986606)),
112
+ (d = g(d, h, s, c, n[u + 10], 15, -1051523)),
113
+ (c = g(c, d, h, s, n[u + 1], 21, -2054922799)),
114
+ (s = g(s, c, d, h, n[u + 8], 6, 1873313359)),
115
+ (h = g(h, s, c, d, n[u + 15], 10, -30611744)),
116
+ (d = g(d, h, s, c, n[u + 6], 15, -1560198380)),
117
+ (c = g(c, d, h, s, n[u + 13], 21, 1309151649)),
118
+ (s = g(s, c, d, h, n[u + 4], 6, -145523070)),
119
+ (h = g(h, s, c, d, n[u + 11], 10, -1120210379)),
120
+ (d = g(d, h, s, c, n[u + 2], 15, 718787259)),
121
+ (c = g(c, d, h, s, n[u + 9], 21, -343485551)),
122
+ (s = (s + b) >>> 0),
123
+ (c = (c + x) >>> 0),
124
+ (d = (d + v) >>> 0),
125
+ (h = (h + y) >>> 0);
126
+ }
127
+ return hsUtils.endian([s, c, d, h]);
128
+ }
129
+
130
+ i._ff = function (e, t, n, i, o, r, a) {
131
+ return (
132
+ (((e = e + ((t & n) | (~t & i)) + (o >>> 0) + a) << r) | (e >>> (32 - r))) +
133
+ t
134
+ );
135
+ };
136
+
137
+ i._gg = function (e, t, n, i, o, r, a) {
138
+ return (
139
+ (((e = e + ((t & i) | (n & ~i)) + (o >>> 0) + a) << r) | (e >>> (32 - r))) +
140
+ t
141
+ );
142
+ };
143
+
144
+ i._hh = function (e, t, n, i, o, r, a) {
145
+ return (((e = e + (t ^ n ^ i) + (o >>> 0) + a) << r) | (e >>> (32 - r))) + t;
146
+ };
147
+
148
+ i._ii = function (e, t, n, i, o, r, a) {
149
+ return (
150
+ (((e = e + (n ^ (t | ~i)) + (o >>> 0) + a) << r) | (e >>> (32 - r))) + t
151
+ );
152
+ };
153
+
154
+ i._blocksize = 16;
155
+ i._digestsize = 16;
156
+
157
+ function a(e) {
158
+ return (
159
+ null != e &&
160
+ (a2(e) ||
161
+ ('function' == typeof (t = e).readFloatLE &&
162
+ 'function' == typeof t.slice &&
163
+ a2(t.slice(0, 0))) ||
164
+ !!e._isBuffer)
165
+ );
166
+ var t;
167
+ }
168
+
169
+ function a2(e) {
170
+ return (
171
+ !!e.constructor &&
172
+ 'function' == typeof e.constructor.isBuffer &&
173
+ e.constructor.isBuffer(e)
174
+ );
175
+ }
176
+
177
+ module.exports = i;
@@ -0,0 +1,74 @@
1
+ const i = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
2
+ const o = {
3
+ rotl: function (e, t) {
4
+ return (e << t) | (e >>> (32 - t));
5
+ },
6
+ rotr: function (e, t) {
7
+ return (e << (32 - t)) | (e >>> t);
8
+ },
9
+ endian: function (e) {
10
+ if (e.constructor == Number)
11
+ return (16711935 & o.rotl(e, 8)) | (4278255360 & o.rotl(e, 24));
12
+ for (var t = 0; t < e.length; t++) e[t] = o.endian(e[t]);
13
+ return e;
14
+ },
15
+ randomBytes: function (e) {
16
+ for (var t = []; 0 < e; e--) t.push(Math.floor(256 * Math.random()));
17
+ return t;
18
+ },
19
+ bytesToWords: function (e) {
20
+ for (var t = [], n = 0, i = 0; n < e.length; n++, i += 8)
21
+ t[i >>> 5] |= e[n] << (24 - (i % 32));
22
+ return t;
23
+ },
24
+ wordsToBytes: function (e) {
25
+ for (var t = [], n = 0; n < 32 * e.length; n += 8)
26
+ t.push((e[n >>> 5] >>> (24 - (n % 32))) & 255);
27
+ return t;
28
+ },
29
+ bytesToHex: function (e) {
30
+ for (var t = [], n = 0; n < e.length; n++)
31
+ t.push((e[n] >>> 4).toString(16)), t.push((15 & e[n]).toString(16));
32
+ return t.join('');
33
+ },
34
+ hexToBytes: function (e) {
35
+ for (var t = [], n = 0; n < e.length; n += 2)
36
+ t.push(parseInt(e.substr(n, 2), 16));
37
+ return t;
38
+ },
39
+ bytesToBase64: function (e) {
40
+ for (var t = [], n = 0; n < e.length; n += 3)
41
+ for (var o = (e[n] << 16) | (e[n + 1] << 8) | e[n + 2], r = 0; r < 4; r++)
42
+ 8 * n + 6 * r <= 8 * e.length
43
+ ? t.push(i.charAt((o >>> (6 * (3 - r))) & 63))
44
+ : t.push('=');
45
+ return t.join('');
46
+ },
47
+ base64ToBytes: function (e) {
48
+ e = e.replace(/[^A-Z0-9+\/]/gi, '');
49
+ for (var t = [], n = 0, o = 0; n < e.length; o = ++n % 4)
50
+ 0 != o &&
51
+ t.push(
52
+ ((i.indexOf(e.charAt(n - 1)) & (Math.pow(2, -2 * o + 8) - 1)) <<
53
+ (2 * o)) |
54
+ (i.indexOf(e.charAt(n)) >>> (6 - 2 * o))
55
+ );
56
+ return t;
57
+ },
58
+ stringToBytes: function (e) {
59
+ for (var t = [], n = 0; n < e.length; n++) t.push(255 & e.charCodeAt(n));
60
+ return t;
61
+ },
62
+ bytesToString: function (e) {
63
+ for (var t = [], n = 0; n < e.length; n++)
64
+ t.push(String.fromCharCode(e[n]));
65
+ return t.join('');
66
+ },
67
+ utfStringToBytes: function (e) {
68
+ e = unescape(encodeURIComponent(e));
69
+ for (var t = [], n = 0; n < e.length; n++) t.push(255 & e.charCodeAt(n));
70
+ return t;
71
+ }
72
+ };
73
+
74
+ module.exports = o;
@@ -0,0 +1,164 @@
1
+ /**
2
+ * 压缩dist目录为zip文件的脚本
3
+ */
4
+ const fsPromises = require("fs/promises");
5
+ const fs = require("fs");
6
+ const archiver = require("archiver");
7
+ const path = require("path");
8
+ const { fmtTime } = require("../utils");
9
+
10
+ const log = (message, ...args) => {
11
+ console.log(`[${fmtTime()}] ${message}`, ...args);
12
+ };
13
+
14
+ const error = (message, ...args) => {
15
+ console.error(`[${fmtTime()}] ${message}`, ...args);
16
+ };
17
+
18
+ const warn = (message, ...args) => {
19
+ console.warn(`[${fmtTime()}] ${message}`, ...args);
20
+ };
21
+
22
+ const info = (message, ...args) => {
23
+ console.info(`[${fmtTime()}] ${message}`, ...args);
24
+ };
25
+
26
+ // 压缩配置
27
+ const zipOptions = {
28
+ zlib: {
29
+ level: parseInt(process.env.ZIP_COMPRESSION_LEVEL || "9", 10),
30
+ },
31
+ forceLocalTime: true,
32
+ statConcurrency: parseInt(process.env.ZIP_STAT_CONCURRENCY || "4", 10),
33
+ statTimeout: parseInt(process.env.ZIP_STAT_TIMEOUT || "10000", 10),
34
+ };
35
+
36
+ /**
37
+ * 创建zip压缩文件
38
+ * @function createZip
39
+ * @async
40
+ * @param {Object} options - 压缩选项
41
+ * @param {string} [options.sourceFolder] - 要打包的文件路径,默认本路径下的dist目录
42
+ * @param {string} [options.outputZipFile] - 输出的zip文件路径,默认本路径下的dist目录
43
+ * @param {string} [options.zipFilename] - 文件名,默认为"dist.zip"
44
+ * @returns {Promise<string>} 返回生成的zip文件完整路径
45
+ * @throws {Error} 当输入参数无效或压缩过程中发生错误时抛出
46
+ * @example
47
+ * // 调用示例
48
+ * createZip().then(zipPath => {
49
+ * log(`压缩完成,文件路径:${zipPath}`);
50
+ * }).catch(err => {
51
+ * error(`压缩失败:${err.message}`);
52
+ * });
53
+ *
54
+ * // 自定义参数示例
55
+ * createZip({
56
+ * sourceFolder: './build',
57
+ * outputZipFile: './output',
58
+ * zipFilename: 'myapp.zip'
59
+ * });
60
+ */
61
+ async function createZip(options = {}) {
62
+ const {
63
+ sourceFolder = path.join(__dirname, "../dist"),
64
+ outputZipFile = path.join(__dirname, "../dist"),
65
+ zipFilename = "dist.zip",
66
+ } = options;
67
+
68
+ const finalOutputPath = path.join(outputZipFile, zipFilename);
69
+
70
+ try {
71
+ // 检查源目录是否存在
72
+ const stat = await fsPromises.stat(sourceFolder);
73
+ if (!stat.isDirectory()) {
74
+ throw new Error(`源目录不是有效的目录: ${sourceFolder}`);
75
+ }
76
+
77
+ // 检查目录是否为空(排除.DS_Store文件)
78
+ const files = await fsPromises.readdir(sourceFolder);
79
+ const validFiles = files.filter((file) => file !== ".DS_Store");
80
+ if (validFiles.length === 0) {
81
+ throw new Error(`目录为空: ${sourceFolder}`);
82
+ }
83
+
84
+ // 删除旧的zip文件
85
+ try {
86
+ await fsPromises.unlink(finalOutputPath);
87
+ log(` 🗑️ 已删除旧的压缩文件: ${finalOutputPath}\n`);
88
+ } catch (err) {
89
+ // 文件不存在时忽略错误
90
+ if (err.code !== "ENOENT") throw err;
91
+ }
92
+
93
+ const output = fs.createWriteStream(finalOutputPath);
94
+ const archive = archiver("zip", zipOptions);
95
+
96
+ // 事件处理
97
+ output.on("close", () => {
98
+ const fileSize = (archive.pointer() / 1024).toFixed(2);
99
+ log(`\n 📦 总共压缩了 ${totalFiles} 个文件`);
100
+ log(` 🔥🔥🔥 已完成文件压缩: ${finalOutputPath}, size: ${fileSize} KiB.`);
101
+ });
102
+
103
+ output.on("error", (err) => {
104
+ error("写入流错误:", err);
105
+ // 确保资源被正确清理
106
+ if (archive) {
107
+ archive.abort();
108
+ }
109
+ });
110
+
111
+ archive.on("error", (err) => {
112
+ error("压缩错误:", err);
113
+ // 确保资源被正确清理
114
+ if (output) {
115
+ output.close();
116
+ }
117
+ throw err;
118
+ });
119
+
120
+ // 进度报告
121
+ archive.on("progress", (progress) => {
122
+ // 显示进度
123
+ const totalFiles = progress.entries.total;
124
+ const processedFiles = progress.entries.processed;
125
+ const percent =
126
+ totalFiles > 0 ? ((processedFiles / totalFiles) * 100).toFixed(1) : 0;
127
+
128
+ // 使用回车符清除当前行并重新输出
129
+ process.stdout.write(
130
+ `\r ⏳ 正在压缩: ${processedFiles}/${totalFiles} 文件 (${percent}%)`,
131
+ );
132
+ });
133
+
134
+ // 添加文件计数信息
135
+ let totalFiles = 0;
136
+ archive.on("entry", () => {
137
+ totalFiles++;
138
+ });
139
+
140
+ // 开始压缩
141
+ archive.pipe(output);
142
+
143
+ // 添加所有文件和目录,确保空目录也被包含
144
+ archive.glob(
145
+ "**/*",
146
+ {
147
+ cwd: sourceFolder,
148
+ ignore: [zipFilename, ".DS_Store"],
149
+ dot: true, // 包含隐藏文件
150
+ nodir: false, // 匹配目录
151
+ },
152
+ { directory: true },
153
+ ); // 确保目录条目被正确处理
154
+
155
+ // 完成压缩
156
+ await archive.finalize();
157
+ return finalOutputPath;
158
+ } catch (err) {
159
+ error(`压缩发生异常: ${err.message}`);
160
+ throw err;
161
+ }
162
+ }
163
+
164
+ module.exports = { createZip };
package/lib/utils.js CHANGED
@@ -3,6 +3,9 @@ const { access, statSync, constants, writeFile, readdirSync } = require("fs");
3
3
 
4
4
  var bind = require("./helpers/bind");
5
5
 
6
+ const hsUtils = require('./helpers/hsUtils');
7
+ const hsMd5 = require('./helpers/hsMd5');
8
+
6
9
  // utils is a library of generic helper functions non-specific to this project;
7
10
 
8
11
  var toString = Object.prototype.toString;
@@ -272,7 +275,7 @@ function forEach(obj, fn) {
272
275
  *
273
276
  * ```js
274
277
  * var result = merge({foo: 123}, {foo: 456});
275
- * console.log(result.foo); // outputs 456
278
+ * log(result.foo); // outputs 456
276
279
  * ```
277
280
  *
278
281
  * @param {Object} obj1 Object to merge
@@ -332,10 +335,10 @@ function stripBOM(content) {
332
335
 
333
336
  const fmtTime = function () {
334
337
  var date = new Date();
335
- hh = `${date.getHours() < 10 ? "0" : ""}${date.getHours()}`;
336
- min = `${date.getMinutes() < 10 ? "0" : ""}${date.getMinutes()}`;
337
- sec = `${date.getSeconds() < 10 ? "0" : ""}${date.getSeconds()}`;
338
- mymilliseconds = date.getMilliseconds();
338
+ var hh = `${date.getHours() < 10 ? "0" : ""}${date.getHours()}`;
339
+ var min = `${date.getMinutes() < 10 ? "0" : ""}${date.getMinutes()}`;
340
+ var sec = `${date.getSeconds() < 10 ? "0" : ""}${date.getSeconds()}`;
341
+ var mymilliseconds = date.getMilliseconds();
339
342
  return hh + ":" + min + ":" + sec + ":" + mymilliseconds;
340
343
  };
341
344
 
@@ -404,8 +407,66 @@ const getZipFileList = async function (path) {
404
407
  readFileList(path, filesList);
405
408
  return filesList;
406
409
  };
410
+ //解析cookie
411
+ const getCookieObj = function (cookies) {
412
+ if (!cookies || typeof cookies !== "string") {
413
+ return {};
414
+ }
415
+
416
+ const cookieObj = {};
417
+ const cookieArr = cookies.split(";");
418
+
419
+ cookieArr.forEach((item) => {
420
+ const trimmedItem = item.trim();
421
+ if (!trimmedItem) {
422
+ return;
423
+ }
424
+
425
+ const equalIndex = trimmedItem.indexOf("=");
426
+ if (equalIndex === -1) {
427
+ return;
428
+ }
429
+
430
+ const key = trimmedItem.substring(0, equalIndex).trim();
431
+ const value = trimmedItem.substring(equalIndex + 1).trim();
432
+
433
+ if (key) {
434
+ cookieObj[key] = value;
435
+ }
436
+ });
437
+
438
+ return cookieObj;
439
+ };
440
+
441
+ // 密码md5加密
442
+ const pwdMd5 = function (password, email) {
443
+ return (password = md5First(password)), (0, md5)(password.concat(email));
444
+ };
445
+
446
+ function md5First(e) {
447
+ return (e = (0, md5)(e)), (e = md5Second(e)), md5Second(e);
448
+ }
449
+
450
+ function md5Second(e) {
451
+ var t = (0, md5)(e);
452
+ return (0, md5)(e.concat(t));
453
+ }
454
+
455
+ function md5(e, t) {
456
+ if (null == e) throw new Error('Illegal argument ' + e);
457
+ return (
458
+ (e = hsUtils.wordsToBytes(hsMd5(e, t))),
459
+ t && t.asBytes
460
+ ? e
461
+ : t && t.asString
462
+ ? hsUtils.bytesToString(e)
463
+ : hsUtils.bytesToHex(e)
464
+ );
465
+ }
407
466
 
408
467
  module.exports = {
468
+ pwdMd5,
469
+ getCookieObj,
409
470
  fmtTime,
410
471
  getPkgInfo,
411
472
  setPkgVersion,
package/lsc.config.json CHANGED
@@ -1,11 +1,26 @@
1
1
  {
2
- "token": "XXXXX",
3
- "pkgid": "XXXXX",
4
- "set_pkg_version": "1.2.1",
5
- "publish_app_arr": [3592, 3577],
6
- "android_version_scope": "7.0.7.0",
2
+ "pkgid": "lscpkg",
3
+ "need_wechat_push": false,
4
+ "set_pkg_version": "1.0.1",
7
5
  "ios_version_scope": "7.0.7",
8
- "pkg_zip_name": "XXXXX.zip",
6
+ "android_version_scope": "7.0.7.0",
7
+ "harmony_version_scope": "1.0.1",
8
+ "publish_app_arr": [
9
+ "3542"
10
+ ],
9
11
  "pkg_dir": "./dist/",
10
- "task_status": "2"
12
+ "pkg_zip_name": "lscdemo.zip",
13
+ "task_status": 2,
14
+ "apps_name": {
15
+ "3542": "开发版",
16
+ "3543": "仿真版"
17
+ },
18
+ "publish_h5web_arr": [
19
+ "8112734868610136",
20
+ "8112734868610049"
21
+ ],
22
+ "h5web_name": {
23
+ "8112734868610136": "账户分析PC公版",
24
+ "8112734868610049": "账户分析超级终端版"
25
+ }
11
26
  }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "lightshortcuts",
3
3
  "dependencies": {
4
+ "archiver": "^7.0.1",
4
5
  "axios": "^0.24.0",
5
6
  "chalk": "^5.0.0",
6
7
  "commander": "^8.3.0",
@@ -9,10 +10,9 @@
9
10
  "inquirer": "^8.2.0",
10
11
  "qs": "^6.10.3"
11
12
  },
12
- "version": "1.0.9",
13
+ "version": "1.1.1",
13
14
  "description": "Light离线包自动发布工具",
14
15
  "main": "index.js",
15
- "devDependencies": {},
16
16
  "scripts": {
17
17
  "start": "lsc publish",
18
18
  "test": "echo \"Error: no test specified\" && exit 1"