mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-04 20:29:01 +00:00
Merge pull request #5176 from naturalcrit/fix-brew-download
Fix brew download and source
This commit is contained in:
@@ -113,7 +113,7 @@ const api = {
|
||||
|
||||
return userThemes;
|
||||
},
|
||||
getBrew : (accessType, stubOnly = false)=>{
|
||||
getBrew : (accessType, stubOnly = false, split = true)=>{
|
||||
// Create middleware with the accessType passed in as part of the scope
|
||||
return async (req, res, next)=>{
|
||||
// Get relevant IDs for the brew
|
||||
@@ -178,7 +178,7 @@ const api = {
|
||||
stub = _.defaults(stub, DEFAULT_BREW_LOAD); // Fill in blank fields
|
||||
|
||||
req.brew = migrateSystemsToTags(stub);
|
||||
splitTextStyleAndMetadata(req.brew);
|
||||
split && splitTextStyleAndMetadata(req.brew);
|
||||
next();
|
||||
};
|
||||
},
|
||||
|
||||
@@ -19,7 +19,7 @@ import { splitTextStyleAndMetadata } from '../shared/helpers.js';
|
||||
import GoogleActions from './googleActions.js';
|
||||
|
||||
import api from './homebrew.api.js';
|
||||
const { getBrew, getUsersBrewThemes } = api;
|
||||
const { getBrew, getUsersBrewThemes, mergeBrewText } = api;
|
||||
|
||||
const welcomeText = fs.readFileSync('./client/homebrew/pages/homePage/welcome_msg.md', 'utf8');
|
||||
const welcomeTextLegacy = fs.readFileSync('./client/homebrew/pages/homePage/welcome_msg_legacy.md', 'utf8');
|
||||
@@ -122,7 +122,7 @@ export default function pageRoutes({
|
||||
});
|
||||
|
||||
//Source page
|
||||
app.get('/source/:id', asyncHandler(getBrew('share')), (req, res)=>{
|
||||
app.get('/source/:id', asyncHandler(getBrew('share', false, false)), (req, res)=>{
|
||||
const { brew } = req;
|
||||
|
||||
const replaceStrings = { '&': '&', '<': '<', '>': '>' };
|
||||
@@ -135,10 +135,11 @@ export default function pageRoutes({
|
||||
});
|
||||
|
||||
//Download brew source page
|
||||
app.get('/download/:id', asyncHandler(getBrew('share')), (req, res)=>{
|
||||
app.get('/download/:id', asyncHandler(getBrew('share', false, false)), (req, res)=>{
|
||||
const { brew } = req;
|
||||
sanitizeBrew(brew, 'share');
|
||||
const prefix = 'HB - ';
|
||||
console.log(brew);
|
||||
|
||||
const encodeRFC3986ValueChars = (str)=>{
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user