mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-26 11:42:39 +00:00
Add local statics for images and typefaces
This solves issue #1958. Add static paths /staticImages and /staticFonts If a local environment is detected ( per existing loginc for login ) paths are added using the values in HB_IMAGES and HB_FONTS or the default values of /staticImages and /staticFonts respectively.
This commit is contained in:
6
package-lock.json
generated
6
package-lock.json
generated
@@ -24,6 +24,7 @@
|
||||
"express": "^4.18.2",
|
||||
"express-async-handler": "^1.2.0",
|
||||
"express-static-gzip": "2.1.7",
|
||||
"fs": "^0.0.1-security",
|
||||
"fs-extra": "11.1.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"jwt-simple": "^0.5.6",
|
||||
@@ -6466,6 +6467,11 @@
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/fs": {
|
||||
"version": "0.0.1-security",
|
||||
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
||||
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
|
||||
},
|
||||
"node_modules/fs-extra": {
|
||||
"version": "11.1.1",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"description": "Create authentic looking D&D homebrews using only markdown",
|
||||
"version": "3.10.0",
|
||||
"engines": {
|
||||
"npm": "^10.2.x",
|
||||
"npm": "^10.2.x",
|
||||
"node": ">=20.8.x"
|
||||
},
|
||||
"repository": {
|
||||
@@ -93,6 +93,7 @@
|
||||
"express": "^4.18.2",
|
||||
"express-async-handler": "^1.2.0",
|
||||
"express-static-gzip": "2.1.7",
|
||||
"fs": "^0.0.1-security",
|
||||
"fs-extra": "11.1.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"jwt-simple": "^0.5.6",
|
||||
|
||||
@@ -8,6 +8,7 @@ const express = require('express');
|
||||
const yaml = require('js-yaml');
|
||||
const app = express();
|
||||
const config = require('./config.js');
|
||||
const fs = require('fs');
|
||||
|
||||
const { homebrewApi, getBrew } = require('./homebrew.api.js');
|
||||
const GoogleActions = require('./googleActions.js');
|
||||
@@ -416,6 +417,9 @@ if(isLocalEnvironment){
|
||||
const payload = jwt.encode({ username: username, issued: new Date }, config.get('secret'));
|
||||
return res.json(payload);
|
||||
});
|
||||
// Add Static Local Paths
|
||||
app.use('/staticImages', express.static(config.get('hb_images') && fs.existsSync(config.get('hb_images')) ? config.get('hb_images') :'staticImages'));
|
||||
app.use(express.static(config.get('hb_fonts') && fs.existsSync(config.get('hb_fonts')) ? config.get('hb_fonts'):'staticFonts'));
|
||||
}
|
||||
|
||||
//Render the page
|
||||
|
||||
Reference in New Issue
Block a user