t-comm
Version:
专业、稳定、纯粹的工具库
33 lines (31 loc) • 690 B
JavaScript
/**
* 获取rtx信息
* @private
* @example
* ```ts
* getRtxInfo().then((info) => {
* console.log(info); // { rtx: 'xxx', ... }
* });
* ```
*/
function getRtxInfo() {
return new Promise(function (resolve, reject) {
var cached = localStorage.getItem('AEGIS_RTX');
if (cached) {
resolve(cached);
return;
}
var url = "".concat(location.origin, "/ts:auth/tauth/info.ashx");
fetch(url).then(function (response) {
if (response.status === 200) {
return response.json();
}
return {};
}).then(function (data) {
resolve(data);
})["catch"](function (err) {
reject(err);
});
});
}
export { getRtxInfo };