CH-J Server Managerquản lý máy chủ qua SSH
Menu
Mã nguồn đã công bố

CH-J Server Manager

Duyệt thư mục và tệp của một bản phát hành ứng dụng cụ thể.

Tải mã nguồn dạng ZIP
CH-J / Server Manager 339 tệp
core-20261014T184258Z-3fbed0b93fdf Ngày thêm: Chưa ghi nhận ngày · Ngày dựng:
version.js Ngày thêm: Chưa ghi nhận ngày 1,7 KB · 56 dòng
Mã Tải tệp xuống
1"use strict";
3const VERSION_PATTERN = /^v?(\d+)\.(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
5function parseVersion(input) {
6 const raw = String(input || "").trim();
7 const match = VERSION_PATTERN.exec(raw);
8 if (!match) {
9 throw new Error(`Invalid version: ${raw || "<empty>"}`);
10 }
12 return {
13 raw: raw.replace(/^v/i, ""),
14 numbers: [match[1], match[2], match[3] || "0", match[4] || "0"].map(Number),
15 prerelease: match[5] ? match[5].split(".") : []
16 };
19function comparePrerelease(left, right) {
20 if (left.length === 0 && right.length === 0) return 0;
21 if (left.length === 0) return 1;
22 if (right.length === 0) return -1;
24 const length = Math.max(left.length, right.length);
25 for (let index = 0; index < length; index += 1) {
26 if (left[index] === undefined) return -1;
27 if (right[index] === undefined) return 1;
28 if (left[index] === right[index]) continue;
30 const leftNumeric = /^\d+$/.test(left[index]);
31 const rightNumeric = /^\d+$/.test(right[index]);
32 if (leftNumeric && rightNumeric) {
33 return Number(left[index]) > Number(right[index]) ? 1 : -1;
34 }
35 if (leftNumeric !== rightNumeric) return leftNumeric ? -1 : 1;
36 return left[index] > right[index] ? 1 : -1;
37 }
38 return 0;
41function compareVersions(leftInput, rightInput) {
42 const left = parseVersion(leftInput);
43 const right = parseVersion(rightInput);
45 for (let index = 0; index < left.numbers.length; index += 1) {
46 if (left.numbers[index] === right.numbers[index]) continue;
47 return left.numbers[index] > right.numbers[index] ? 1 : -1;
48 }
49 return comparePrerelease(left.prerelease, right.prerelease);
52module.exports = {
53 VERSION_PATTERN,
54 compareVersions,
55 parseVersion
56};
SHA-256f72255fe2089bfcd9cdd4727c5a47e9e563195db470dbe8073ebe311aa120804

CH-J Proprietary Software License 1.14 · Mã nguồn được cung cấp theo CH-J Proprietary Software License 1.14. Việc công khai mã nguồn không thay đổi các điều khoản giấy phép và không cấp thêm quyền nào.

SHA-256 của tệp nén3df08cf5e899262a6ce92d7ec2caf5c42b683f1f2b57055662b845ff7dde67a8
Tệp