mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: copy default favicon if it doesn't exist
This commit is contained in:
19
src/upgrades/1.17.0/default_favicon.js
Normal file
19
src/upgrades/1.17.0/default_favicon.js
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
const nconf = require('nconf');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const file = require('../../file');
|
||||
|
||||
module.exports = {
|
||||
name: 'Store default favicon if it does not exist',
|
||||
timestamp: Date.UTC(2021, 2, 9),
|
||||
method: async function () {
|
||||
const pathToIco = path.join(nconf.get('upload_path'), 'system', 'favicon.ico');
|
||||
const defaultIco = path.join(nconf.get('base_dir'), 'public', 'favicon.ico');
|
||||
const exists = await file.exists(pathToIco);
|
||||
if (!exists) {
|
||||
await fs.promises.copyFile(defaultIco, pathToIco);
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user