feat(wire): Add wire protocol, WireTarget & WireParser, Smartmail JSON serialization; refactor plugins and update dependencies

This commit is contained in:
2025-11-29 15:36:36 +00:00
parent 4277ace8cd
commit ddf442274e
14 changed files with 3969 additions and 2567 deletions

View File

@@ -251,8 +251,9 @@ export class EmailAddressValidator {
*/
public async fetchDomains() {
if (!this.domainMap) {
const localFileString = plugins.smartfile.fs.toStringSync(
plugins.path.join(paths.assetDir, 'domains.json')
const localFileString = plugins.fs.readFileSync(
plugins.path.join(paths.assetDir, 'domains.json'),
'utf8'
);
const localFileObject = JSON.parse(localFileString);
@@ -262,12 +263,10 @@ export class EmailAddressValidator {
}
try {
const onlineFileObject = (
await plugins.smartrequest.getJson(
'https://raw.githubusercontent.com/romainsimon/emailvalid/master/domains.json'
)
).body;
this.domainMap = onlineFileObject;
const response = await plugins.SmartRequest.create()
.url('https://raw.githubusercontent.com/romainsimon/emailvalid/master/domains.json')
.get();
this.domainMap = await response.json();
} catch (e) {
this.domainMap = localFileObject;
}