Skip to content

Commit b22c187

Browse files
authored
Merge pull request #385 from EvanNotFound/dev
feat: add NPMMirror CDN status logging and handling in welcome script
2 parents 18464e9 + a2ec6cb commit b22c187

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

scripts/events/welcome.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ hexo.on("ready", async () => {
6565
hexo.locals.set(`cdnTestStatus_cdnjs`, 404);
6666
hexo.locals.set(`cdnTestStatus_sustech`, 404);
6767
hexo.locals.set(`cdnTestStatus_zstatic`, 404);
68+
hexo.locals.set(`cdnTestStatus_npmMirror`, 404);
6869
}
6970
});
7071

@@ -112,8 +113,19 @@ function checkVersionAndCDNAvailability(data) {
112113
);
113114
}
114115

116+
if (data.npmMirrorCDN) {
117+
hexo.log.info(
118+
`\x1b[32m%s\x1b[0m`,
119+
`CDN available: NPMMirror (Recommended)`,
120+
);
121+
hexo.locals.set(`cdnTestStatus_npmMirror`, 200);
122+
} else {
123+
hexo.log.warn(`\x1b[31m%s\x1b[0m`, `NPMMirror CDN is unavailable yet.`);
124+
hexo.locals.set(`cdnTestStatus_npmMirror`, 404);
125+
}
126+
115127
if (data.zstaticCDN) {
116-
hexo.log.info(`\x1b[32m%s\x1b[0m`, `CDN available: ZStatic (Recommended)`);
128+
hexo.log.info(`\x1b[32m%s\x1b[0m`, `CDN available: ZStatic`);
117129
hexo.locals.set(`cdnTestStatus_zstatic`, 200);
118130
} else {
119131
hexo.log.warn(`\x1b[31m%s\x1b[0m`, `ZStatic CDN is unavailable yet.`);

0 commit comments

Comments
 (0)