wgt-node-utils 1.1.2 → 1.1.5
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/dist/bundle.js +1 -1
- package/package.json +1 -1
- package/src/index.js +28 -33
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -694,38 +694,33 @@ class wgtNodeUtils {
|
|
|
694
694
|
* @param {string} hostname 网站域名
|
|
695
695
|
* @returns
|
|
696
696
|
*/
|
|
697
|
-
getPolicyAndContact = (url, hostname) => {
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
}
|
|
726
|
-
resolve(data);
|
|
727
|
-
})
|
|
728
|
-
})
|
|
729
|
-
}
|
|
697
|
+
getPolicyAndContact = async (url, hostname) => {
|
|
698
|
+
let self = this
|
|
699
|
+
try {
|
|
700
|
+
const res = await axios.get(url);
|
|
701
|
+
const properties = res.data?.data?.properties || {};
|
|
702
|
+
|
|
703
|
+
// 默认值
|
|
704
|
+
const contactEmail = properties.contact || "gamebridgenoreply@gmail.com";
|
|
705
|
+
const title = properties.title || "";
|
|
706
|
+
const txt = properties.txt || self.setPolicyText(hostname, "This Privacy Policy is effective [ Jan 5,], 2021 for all users.");
|
|
707
|
+
|
|
708
|
+
// 构建结果
|
|
709
|
+
const data = {
|
|
710
|
+
contact: `<a href="mailto:${contactEmail}" target="">${contactEmail}</a>`,
|
|
711
|
+
title: title ? title : '',
|
|
712
|
+
txt: title ? `<h2>${title}</h2>${txt}` : txt,
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
return data;
|
|
716
|
+
} catch (error) {
|
|
717
|
+
console.error("Error fetching policy and contact data:", error);
|
|
718
|
+
return {
|
|
719
|
+
contact: `<a href="mailto:gamebridgenoreply@gmail.com" target="">gamebridgenoreply@gmail.com</a>`,
|
|
720
|
+
title: '',
|
|
721
|
+
txt: self.setPolicyText(hostname, "This Privacy Policy is effective [ Jan 5,], 2021 for all users."),
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
};
|
|
730
725
|
}
|
|
731
726
|
module.exports = new wgtNodeUtils('cli_a538bc45e770d00b', 'EDK1uleQyLym6WWDISo00dwx4gssiskJ');
|