mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-22 09:37:53 +00:00
js files
This commit is contained in:
@@ -53,7 +53,7 @@ fs.emptyDirSync('./build');
|
||||
const themes = { Legacy: {}, V3: {} };
|
||||
|
||||
let themeFiles = fs.readdirSync('./themes/Legacy');
|
||||
for (let dir of themeFiles) {
|
||||
for (const dir of themeFiles) {
|
||||
const themeData = JSON.parse(fs.readFileSync(`./themes/Legacy/${dir}/settings.json`).toString());
|
||||
themeData.path = dir;
|
||||
themes.Legacy[dir] = (themeData);
|
||||
@@ -70,7 +70,7 @@ fs.emptyDirSync('./build');
|
||||
}
|
||||
|
||||
themeFiles = fs.readdirSync('./themes/V3');
|
||||
for (let dir of themeFiles) {
|
||||
for (const dir of themeFiles) {
|
||||
const themeData = JSON.parse(fs.readFileSync(`./themes/V3/${dir}/settings.json`).toString());
|
||||
themeData.path = dir;
|
||||
themes.V3[dir] = (themeData);
|
||||
@@ -113,7 +113,7 @@ fs.emptyDirSync('./build');
|
||||
const stream = fs.createWriteStream(editorThemeFile, { flags: 'a' });
|
||||
stream.write('[\n"default"');
|
||||
|
||||
for (let themeFile of editorThemeFiles) {
|
||||
for (const themeFile of editorThemeFiles) {
|
||||
stream.write(`,\n"${themeFile.slice(0, -4)}"`);
|
||||
}
|
||||
stream.write('\n]\n');
|
||||
|
||||
@@ -75,7 +75,7 @@ describe('Tests for admin api', ()=>{
|
||||
|
||||
const response = await app
|
||||
.post('/admin/notification/add')
|
||||
.set('Authorization', 'Basic ' + Buffer.from('admin:password3').toString('base64'))
|
||||
.set('Authorization', `Basic ${Buffer.from('admin:password3').toString('base64')}`)
|
||||
.send(inputNotification);
|
||||
|
||||
expect(response.status).toBe(500);
|
||||
|
||||
@@ -11,7 +11,6 @@ const version = packageJSON.version;
|
||||
import _ from 'lodash';
|
||||
import jwt from 'jwt-simple';
|
||||
import express from 'express';
|
||||
import yaml from 'js-yaml';
|
||||
import config from './config.js';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
|
||||
@@ -181,6 +181,7 @@ const api = {
|
||||
`${text}`;
|
||||
return text;
|
||||
},
|
||||
|
||||
getGoodBrewTitle : (text)=>{
|
||||
const tokens = Markdown.marked.lexer(text);
|
||||
return (tokens.find((token)=>token.type === 'heading' || token.type === 'paragraph')?.text || 'No Title')
|
||||
@@ -294,7 +295,7 @@ const api = {
|
||||
|
||||
currentTheme = req.brew;
|
||||
splitTextStyleAndMetadata(currentTheme);
|
||||
if(!currentTheme.tags.some(tag => tag === "meta:theme" || tag === "meta:Theme"))
|
||||
if(!currentTheme.tags.some((tag)=>tag === 'meta:theme' || tag === 'meta:Theme'))
|
||||
throw { brewId: req.params.id, name: 'Invalid Theme Selected', message: 'Selected theme does not have the meta:theme tag', status: 422, HBErrorCode: '10' };
|
||||
themeName ??= currentTheme.title;
|
||||
themeAuthor ??= currentTheme.authors?.[0];
|
||||
|
||||
@@ -87,7 +87,7 @@ renderer.paragraph = function(token){
|
||||
//Fix local links in the Preview iFrame to link inside the frame
|
||||
renderer.link = function (token) {
|
||||
let { href, title, tokens } = token;
|
||||
const text = this.parser.parseInline(tokens)
|
||||
const text = this.parser.parseInline(tokens);
|
||||
let self = false;
|
||||
if(href[0] == '#') {
|
||||
self = true;
|
||||
@@ -110,7 +110,7 @@ renderer.link = function (token) {
|
||||
|
||||
// Expose `src` attribute as `--HB_src` to make the URL accessible via CSS
|
||||
renderer.image = function (token) {
|
||||
let {href, title, text} = token;
|
||||
const { href, title, text } = token;
|
||||
if(href === null)
|
||||
return text;
|
||||
|
||||
@@ -873,7 +873,7 @@ const extractHTMLStyleTags = (htmlString)=>{
|
||||
?.filter((attr)=>!attr.startsWith('class="') && !attr.startsWith('style="') && !attr.startsWith('id="'))
|
||||
.reduce((obj, attr)=>{
|
||||
const index = attr.indexOf('=');
|
||||
let [key, value] = [attr.substring(0, index), attr.substring(index + 1)];
|
||||
const [key, value] = [attr.substring(0, index), attr.substring(index + 1)];
|
||||
obj[key.trim()] = value.replace(/"/g, '');
|
||||
return obj;
|
||||
}, {}) || null;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable max-lines */
|
||||
|
||||
|
||||
import Markdown from 'naturalcrit/markdown.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable max-lines */
|
||||
|
||||
|
||||
import Markdown from 'naturalcrit/markdown.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable max-lines */
|
||||
|
||||
|
||||
import Markdown from 'naturalcrit/markdown.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable max-lines */
|
||||
|
||||
|
||||
module.exports = [
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable max-lines */
|
||||
|
||||
|
||||
module.exports = [
|
||||
];
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable max-lines */
|
||||
|
||||
const fontAwesome = {
|
||||
// FONT-AWESOME SOLID
|
||||
'fas_0' : 'fas fa-0',
|
||||
|
||||
Reference in New Issue
Block a user