hexo-swpp 1.0.2 → 1.1.0
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/index.js +3 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -105,7 +105,7 @@ const buildNewJson = path => {
|
|
|
105
105
|
})
|
|
106
106
|
let publicRoot = config.public_dir || 'public/'
|
|
107
107
|
if (!publicRoot.endsWith('/')) publicRoot += '/'
|
|
108
|
-
fs.writeFileSync(`${publicRoot}${path}`, JSON.stringify(result))
|
|
108
|
+
fs.writeFileSync(`${publicRoot}${path}`, JSON.stringify(result), 'utf-8')
|
|
109
109
|
logger.info(`Generated: ${path}`)
|
|
110
110
|
return result
|
|
111
111
|
}
|
|
@@ -118,6 +118,7 @@ const getJsonFromNetwork = async path => {
|
|
|
118
118
|
const url = root + path
|
|
119
119
|
try {
|
|
120
120
|
const result = await axios.get(url, {
|
|
121
|
+
responseEncoding: 'utf-8',
|
|
121
122
|
headers: {
|
|
122
123
|
referer: new URL(url).hostname,
|
|
123
124
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.62'
|
|
@@ -193,7 +194,7 @@ const buildUpdateJson = (name, dif, oldUpdate) => {
|
|
|
193
194
|
const writeJson = json => {
|
|
194
195
|
if (json) {
|
|
195
196
|
logger.info(`Generated: ${name}`)
|
|
196
|
-
fs.writeFileSync(`public/${name}`, JSON.stringify(json))
|
|
197
|
+
fs.writeFileSync(`public/${name}`, JSON.stringify(json), 'utf-8')
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
// 读取拓展 json
|