Skip to content

Commit 9e6ac0c

Browse files
1.4.1 (#37)
### 1.4.1 1. api: Fix an issue that reported an error if `ban` was turned on without `rename`.
1 parent 9860f44 commit 9e6ac0c

File tree

3 files changed

+45
-41
lines changed

3 files changed

+45
-41
lines changed

CHANGELOG

+17-23
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
1-
### 1.4.0 [#18](https://github.com/hestudio-community/bing-wallpaper-get/issues/18)
2-
### Developer Information
3-
1. **If there is an environment variable type switch, it needs to be moved to `external.js` or it will not load on `v1.4.0` and later.**
4-
2. **Developers need to manually clean up `/image.jpg` created by previous versions (optional).**
1+
### 1.4.1
2+
1. api: Fix an issue that reported an error if `ban` was turned on without `rename`.
53

6-
### Security update
4+
### 1.4.0
75
1. server.callback.hbwgconfig: (Security update) Disable viewing of project raw configuration via variable.
8-
9-
### Feature
10-
1. (feature)server.tmp(develop): Move temporary files to the `/tmp` directory: this directory is automatically cleared and reset after a program restart. The default folder name can be changed via environment variables.
11-
2. (feature)server.tmp(develop): Cache `external.js` synchronously to `/tmp` before subsequent mounts.
12-
3. (feature)debug(develop): `/debug` (GET) debugging interface
13-
4. (feature)source.bingsrc(develop): Returns the result of the original request to the bing server.
14-
5. (feature)rubots(develop): Add `robots.txt`
15-
6. (feature)external.refreshtask(develop): Developers can customize some tasks to be performed when the server refreshes resources.
16-
17-
### Bug Fixes
18-
1. server.getupdate: Change the default notification level from `info` to `warn`.
19-
2. server.getupdate: Remove compatibility code for environment variable type switches.
20-
3. server.getupdate: Fix bugs in `getupdate`.
21-
4. api: Allows to change the URL of the API.
22-
5. api: Allows to disable the API.
23-
6. server: Move the program version number loading display to the first place.
24-
7. server: Check if wget exists on the device.
25-
8. server.getupdate.packageurl: Updates the package.json source, defaults to getting it from npm instead of Github.
6+
2. (feature)server.tmp(develop): Move temporary files to the `/tmp` directory: this directory is automatically cleared and reset after a program restart. The default folder name can be changed via environment variables.
7+
3. (feature)server.tmp(develop): Cache `external.js` synchronously to `/tmp` before subsequent mounts.
8+
4. (feature)debug(develop): `/debug` (GET) debugging interface
9+
5. (feature)source.bingsrc(develop): Returns the result of the original request to the bing server.
10+
6. (feature)rubots(develop): Add `robots.txt`
11+
7. (feature)external.refreshtask(develop): Developers can customize some tasks to be performed when the server refreshes resources.
12+
8. server.getupdate: Change the default notification level from `info` to `warn`.
13+
9. server.getupdate: Remove compatibility code for environment variable type switches.
14+
10. server.getupdate: Fix bugs in `getupdate`.
15+
11. api: Allows to change the URL of the API.
16+
12. api: Allows to disable the API.
17+
13. server: Move the program version number loading display to the first place.
18+
14. server: Check if wget exists on the device.
19+
15. server.getupdate.packageurl: Updates the package.json source, defaults to getting it from npm instead of Github.
2620

2721
### 1.3.2
2822
1. (feature)server.header: Allow custom real IP addresses to be passed into the header.

get.js

+27-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
require('dotenv').config()
21

3-
const VERSION = '1.4.0'
2+
require('dotenv').config()
3+
const VERSION = '1.4.1'
44

55
const express = require('express')
66
const schedule = require('node-schedule')
@@ -142,7 +142,7 @@ if (!ChildProcess.execSync('wget --version').toString().split('\n')[0].includes(
142142
}
143143

144144
// 1.3.0 Version update prompt
145-
if (typeof hbwgConfig.external !== 'undefined' && hbwgConfig.external.getupdate === false) hbwgConfig.getupdate = false
145+
if (typeof hbwgConfig.external === 'object' && hbwgConfig.external.getupdate === false) hbwgConfig.getupdate = false
146146
else hbwgConfig.getupdate = true
147147

148148
if (process.env.hbwg_packageurl) hbwgConfig.packageurl = process.env.hbwg_packageurl
@@ -162,7 +162,7 @@ if (hbwgConfig.getupdate !== false) {
162162
.then((result) => AfterGetVersion(result))
163163
}
164164

165-
if (typeof hbwgConfig.external !== 'undefined' && hbwgConfig.external.refreshtime) {
165+
if (typeof hbwgConfig.external === 'object' && hbwgConfig.external.refreshtime) {
166166
logback('Timer configuration imported.')
167167
hbwgConfig.external.refreshtime(rule)
168168
} else {
@@ -173,7 +173,7 @@ if (typeof hbwgConfig.external !== 'undefined' && hbwgConfig.external.refreshtim
173173
}
174174

175175
// refreshtask
176-
if (typeof hbwgConfig.external !== 'undefined' && hbwgConfig.external.refreshtask) {
176+
if (typeof hbwgConfig.external === 'object' && hbwgConfig.external.refreshtask) {
177177
hbwgConfig.refreshtask = hbwgConfig.external.refreshtask
178178
}
179179

@@ -237,7 +237,7 @@ const job = schedule.scheduleJob(rule, function () {
237237
cacheimg()
238238

239239
// Load configuration file
240-
if (typeof hbwgConfig.external !== 'undefined' && hbwgConfig.external.beforestart) {
240+
if (typeof hbwgConfig.external === 'object' && hbwgConfig.external.beforestart) {
241241
logback('Initialization configuration has been imported.')
242242
hbwgConfig.external.beforestart(app, getback, postback, logback, logerr)
243243
}
@@ -252,30 +252,40 @@ hbwgConfig.apiconfig = {
252252
}
253253

254254
// api configuration
255-
if (typeof hbwgConfig.external !== 'undefined' && hbwgConfig.external.api) {
255+
if (typeof hbwgConfig.external === 'object' && typeof hbwgConfig.external.api === 'object') {
256256
logback('The api configuration has been loaded.')
257257
// rename
258-
if (typeof hbwgConfig.external.api.rename.getimage === 'string') hbwgConfig.apiconfig.getimage = String(hbwgConfig.external.api.rename.getimage)
259-
if (typeof hbwgConfig.external.api.rename.gettitle === 'string') hbwgConfig.apiconfig.gettitle = String(hbwgConfig.external.api.rename.gettitle)
260-
if (typeof hbwgConfig.external.api.rename.getcopyright === 'string') hbwgConfig.apiconfig.getcopyright = String(hbwgConfig.external.api.rename.getcopyright)
258+
if (typeof hbwgConfig.external.api.rename === 'object') {
259+
if (typeof hbwgConfig.external.api.rename.getimage === 'string') hbwgConfig.apiconfig.getimage = String(hbwgConfig.external.api.rename.getimage)
260+
if (typeof hbwgConfig.external.api.rename.gettitle === 'string') hbwgConfig.apiconfig.gettitle = String(hbwgConfig.external.api.rename.gettitle)
261+
if (typeof hbwgConfig.external.api.rename.getcopyright === 'string') hbwgConfig.apiconfig.getcopyright = String(hbwgConfig.external.api.rename.getcopyright)
262+
}
261263
// ban
262264
if (Array.isArray(hbwgConfig.external.api.ban)) {
263265
for (let i = 0; i < hbwgConfig.external.api.ban.length; i++) {
264-
if (hbwgConfig.external.api.ban[i] === 'getimage') hbwgConfig.apiconfig.getimage = false
265-
if (hbwgConfig.external.api.ban[i] === 'gettitle') hbwgConfig.apiconfig.gettitle = false
266-
if (hbwgConfig.external.api.ban[i] === 'getcopyright') hbwgConfig.apiconfig.getcopyright = false
266+
switch (hbwgConfig.external.api.ban[i]) {
267+
case 'getimage':
268+
hbwgConfig.apiconfig.getimage = false
269+
break
270+
case 'gettitle':
271+
hbwgConfig.apiconfig.gettitle = false
272+
break
273+
case 'getcopyright':
274+
hbwgConfig.apiconfig.getcopyright = false
275+
break
276+
}
267277
}
268278
}
269279
}
270280

271281
// bing source config
272-
if (typeof hbwgConfig.external !== 'undefined' && hbwgConfig.external.bingsrc) {
282+
if (typeof hbwgConfig.external === 'object' && hbwgConfig.external.bingsrc) {
273283
if (typeof hbwgConfig.external.bingsrc.url === 'string') hbwgConfig.apiconfig.bingsrc = String(hbwgConfig.external.bingsrc.url)
274284
else hbwgConfig.apiconfig.bingsrc = '/bingsrc'
275285
} else hbwgConfig.apiconfig.bingsrc = false
276286

277287
// robots.txt
278-
if (typeof hbwgConfig.external !== 'undefined') {
288+
if (typeof hbwgConfig.external === 'object') {
279289
if (hbwgConfig.external.robots === false) hbwgConfig.robots = false
280290
else if (typeof hbwgConfig.external.robots === 'string') hbwgConfig.robots = String(hbwgConfig.external.robots)
281291
}
@@ -297,7 +307,7 @@ if (hbwgConfig.robots !== false) {
297307
})
298308
}
299309

300-
if (typeof hbwgConfig.external !== 'undefined' && typeof hbwgConfig.external.rootprogram === 'function') {
310+
if (typeof hbwgConfig.external === 'object' && typeof hbwgConfig.external.rootprogram === 'function') {
301311
logback('Root directory component imported successfully.')
302312
hbwgConfig.rootprogram = hbwgConfig.external.rootprogram
303313
}
@@ -367,7 +377,7 @@ if (hbwgConfig.apiconfig.bingsrc) {
367377
}
368378

369379
// debug
370-
if (typeof hbwgConfig.external !== 'undefined') {
380+
if (typeof hbwgConfig.external === 'object') {
371381
if (hbwgConfig.external.debug) {
372382
logwarn('Debug Mode is enable!')
373383
if (!hbwgConfig.external.debug.url) hbwgConfig.apiconfig.debug = '/debug'

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hestudio-bingwallpaper-get",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "A Bing wallpaper API interface that can directly image output images.",
55
"main": "get.js",
66
"scripts": {

0 commit comments

Comments
 (0)