@xuda.io/runtime-bundle 1.0.1127 → 1.0.1129
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.
- package/js/xuda-runtime-bundle.js +33 -11
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-mini-bundle.js +2 -2
- package/js/xuda-runtime-mini-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +33 -11
- package/js/xuda-runtime-slim.min.es.js +33 -11
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +28 -7
- package/js/xuda-worker-bundle.js +28 -7
- package/js/xuda-worker-bundle.min.js +1 -1
- package/js/xuda_common-bundle.js +26 -5
- package/js/xuda_common-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -1047,11 +1047,32 @@ func.common.get_data_from_websocket = async function (SESSION_ID, serviceP, data
|
|
|
1047
1047
|
});
|
|
1048
1048
|
};
|
|
1049
1049
|
|
|
1050
|
-
func.common.sha256 = async function (
|
|
1051
|
-
const enc = new TextEncoder();
|
|
1052
|
-
const buf = await crypto.subtle.digest('SHA-256', enc.encode(str));
|
|
1053
|
-
const bytes = new Uint8Array(buf);
|
|
1054
|
-
return [...bytes].map((b) => b.toString(16).padStart(2, '0')).join('');
|
|
1050
|
+
func.common.sha256 = async function (inputString) {
|
|
1051
|
+
// const enc = new TextEncoder();
|
|
1052
|
+
// const buf = await crypto.subtle.digest('SHA-256', enc.encode(str));
|
|
1053
|
+
// const bytes = new Uint8Array(buf);
|
|
1054
|
+
// return [...bytes].map((b) => b.toString(16).padStart(2, '0')).join('');
|
|
1055
|
+
|
|
1056
|
+
// 1. Create a hash buffer from the input string using SHA-256.
|
|
1057
|
+
// This part remains the same as it provides a strong, unique cryptographic starting point.
|
|
1058
|
+
const buffer = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(inputString));
|
|
1059
|
+
|
|
1060
|
+
// 2. Interpret the first 8 bytes (64 bits) of the hash as one big number.
|
|
1061
|
+
const view = new DataView(buffer);
|
|
1062
|
+
const bigInt = view.getBigUint64(0, false); // `false` for big-endian
|
|
1063
|
+
|
|
1064
|
+
// 3. Convert the BigInt to a Base36 string.
|
|
1065
|
+
// The .toString(36) method handles the conversion to an alphanumeric representation (0-9, a-z).
|
|
1066
|
+
const base36Hash = bigInt.toString(36);
|
|
1067
|
+
|
|
1068
|
+
// 4. Take the first 10 characters. If it's shorter, it will just return the whole string.
|
|
1069
|
+
// For a 64-bit integer, the Base36 representation will be about 13 characters long,
|
|
1070
|
+
// so slicing is a reliable way to get a fixed length.
|
|
1071
|
+
const shortHash = base36Hash.slice(0, 10);
|
|
1072
|
+
|
|
1073
|
+
// 5. Pad the start in the unlikely case the hash is shorter than 10 characters.
|
|
1074
|
+
// This ensures the output is always exactly 10 characters long.
|
|
1075
|
+
return shortHash.padStart(10, '0');
|
|
1055
1076
|
};
|
|
1056
1077
|
|
|
1057
1078
|
glb.new_xu_render = false;
|
|
@@ -5978,7 +5999,7 @@ func.utils.get_plugin_resource = function (SESSION_ID, plugin_name, plugin_resou
|
|
|
5978
5999
|
return `${_conf.plugins_drive_path}/${_session.app_id}/node_modules/${plugin_name}/${resource}`;
|
|
5979
6000
|
} else {
|
|
5980
6001
|
// return `./node_modules/${plugin_name}/${resource}?app_id=${_session.app_id}`;
|
|
5981
|
-
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}`;
|
|
6002
|
+
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}&ts=${_session?.opt?.app_build_id || 0}`;
|
|
5982
6003
|
}
|
|
5983
6004
|
};
|
|
5984
6005
|
|
|
@@ -6054,7 +6075,7 @@ func.utils.get_plugin_npm_cdn = async function (SESSION_ID, plugin_name, resourc
|
|
|
6054
6075
|
return `../../plugins/${plugin_name}/${resource}`;
|
|
6055
6076
|
}
|
|
6056
6077
|
|
|
6057
|
-
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}`;
|
|
6078
|
+
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}&ts=${_session?.opt?.app_build_id || 0}`;
|
|
6058
6079
|
};
|
|
6059
6080
|
|
|
6060
6081
|
return get_path(resource);
|
package/js/xuda-worker-bundle.js
CHANGED
|
@@ -1047,11 +1047,32 @@ func.common.get_data_from_websocket = async function (SESSION_ID, serviceP, data
|
|
|
1047
1047
|
});
|
|
1048
1048
|
};
|
|
1049
1049
|
|
|
1050
|
-
func.common.sha256 = async function (
|
|
1051
|
-
const enc = new TextEncoder();
|
|
1052
|
-
const buf = await crypto.subtle.digest('SHA-256', enc.encode(str));
|
|
1053
|
-
const bytes = new Uint8Array(buf);
|
|
1054
|
-
return [...bytes].map((b) => b.toString(16).padStart(2, '0')).join('');
|
|
1050
|
+
func.common.sha256 = async function (inputString) {
|
|
1051
|
+
// const enc = new TextEncoder();
|
|
1052
|
+
// const buf = await crypto.subtle.digest('SHA-256', enc.encode(str));
|
|
1053
|
+
// const bytes = new Uint8Array(buf);
|
|
1054
|
+
// return [...bytes].map((b) => b.toString(16).padStart(2, '0')).join('');
|
|
1055
|
+
|
|
1056
|
+
// 1. Create a hash buffer from the input string using SHA-256.
|
|
1057
|
+
// This part remains the same as it provides a strong, unique cryptographic starting point.
|
|
1058
|
+
const buffer = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(inputString));
|
|
1059
|
+
|
|
1060
|
+
// 2. Interpret the first 8 bytes (64 bits) of the hash as one big number.
|
|
1061
|
+
const view = new DataView(buffer);
|
|
1062
|
+
const bigInt = view.getBigUint64(0, false); // `false` for big-endian
|
|
1063
|
+
|
|
1064
|
+
// 3. Convert the BigInt to a Base36 string.
|
|
1065
|
+
// The .toString(36) method handles the conversion to an alphanumeric representation (0-9, a-z).
|
|
1066
|
+
const base36Hash = bigInt.toString(36);
|
|
1067
|
+
|
|
1068
|
+
// 4. Take the first 10 characters. If it's shorter, it will just return the whole string.
|
|
1069
|
+
// For a 64-bit integer, the Base36 representation will be about 13 characters long,
|
|
1070
|
+
// so slicing is a reliable way to get a fixed length.
|
|
1071
|
+
const shortHash = base36Hash.slice(0, 10);
|
|
1072
|
+
|
|
1073
|
+
// 5. Pad the start in the unlikely case the hash is shorter than 10 characters.
|
|
1074
|
+
// This ensures the output is always exactly 10 characters long.
|
|
1075
|
+
return shortHash.padStart(10, '0');
|
|
1055
1076
|
};
|
|
1056
1077
|
|
|
1057
1078
|
glb.new_xu_render = false;
|
|
@@ -5978,7 +5999,7 @@ func.utils.get_plugin_resource = function (SESSION_ID, plugin_name, plugin_resou
|
|
|
5978
5999
|
return `${_conf.plugins_drive_path}/${_session.app_id}/node_modules/${plugin_name}/${resource}`;
|
|
5979
6000
|
} else {
|
|
5980
6001
|
// return `./node_modules/${plugin_name}/${resource}?app_id=${_session.app_id}`;
|
|
5981
|
-
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}`;
|
|
6002
|
+
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}&ts=${_session?.opt?.app_build_id || 0}`;
|
|
5982
6003
|
}
|
|
5983
6004
|
};
|
|
5984
6005
|
|
|
@@ -6054,7 +6075,7 @@ func.utils.get_plugin_npm_cdn = async function (SESSION_ID, plugin_name, resourc
|
|
|
6054
6075
|
return `../../plugins/${plugin_name}/${resource}`;
|
|
6055
6076
|
}
|
|
6056
6077
|
|
|
6057
|
-
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}`;
|
|
6078
|
+
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}&ts=${_session?.opt?.app_build_id || 0}`;
|
|
6058
6079
|
};
|
|
6059
6080
|
|
|
6060
6081
|
return get_path(resource);
|