Compare commits

..

4 commits

Author SHA1 Message Date
SleeplessOne1917
b6415f828e
Merge pull request #1711 from LemmyNet/cache-dev
Fix some issues
2023-06-29 19:26:40 -04:00
SleeplessOne1917
cc184a86c8 Fix authorized route false flag 2023-06-29 18:12:22 -04:00
SleeplessOne1917
2d88e42cab Fix dev caching issue 2023-06-29 16:33:08 -04:00
Dessalines
9e7fec772d v0.18.1-rc.5 2023-06-29 16:20:38 -04:00
4 changed files with 10 additions and 13 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "lemmy-ui", "name": "lemmy-ui",
"version": "0.18.1-rc.4", "version": "0.18.1-rc.5",
"description": "An isomorphic UI for lemmy", "description": "An isomorphic UI for lemmy",
"repository": "https://github.com/LemmyNet/lemmy-ui", "repository": "https://github.com/LemmyNet/lemmy-ui",
"license": "AGPL-3.0", "license": "AGPL-3.0",
@ -8,7 +8,7 @@
"scripts": { "scripts": {
"analyze": "webpack --mode=none", "analyze": "webpack --mode=none",
"prebuild:dev": "yarn clean && node generate_translations.js", "prebuild:dev": "yarn clean && node generate_translations.js",
"build:dev": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) NODE_ENV=development --mode=development", "build:dev": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=development",
"prebuild:prod": "yarn clean && node generate_translations.js", "prebuild:prod": "yarn clean && node generate_translations.js",
"build:prod": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production", "build:prod": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production",
"clean": "yarn run rimraf dist", "clean": "yarn run rimraf dist",

View file

@ -27,17 +27,13 @@ export function setCacheControl(
res: Response, res: Response,
next: NextFunction next: NextFunction
) { ) {
// Avoid setting Cache-Control in development
if (process.env.NODE_ENV === "development") {
return next();
}
const user = UserService.Instance; const user = UserService.Instance;
let caching: string; let caching: string;
if ( if (
req.path.match(/\.(js|css|txt|manifest\.webmanifest)\/?$/) || process.env.NODE_ENV === "production" &&
req.path.includes("/css/themelist") (req.path.match(/\.(js|css|txt|manifest\.webmanifest)\/?$/) ||
req.path.includes("/css/themelist"))
) { ) {
// Static content gets cached publicly for a day // Static content gets cached publicly for a day
caching = "public, max-age=86400"; caching = "public, max-age=86400";

View file

@ -1,5 +1,5 @@
export default function isAuthPath(pathname: string) { export default function isAuthPath(pathname: string) {
return /create_.*|inbox|settings|admin|reports|registration_applications/g.test( return /^\/create_.*|inbox|settings|admin|reports|registration_applications/g.test(
pathname pathname
); );
} }

View file

@ -14,7 +14,7 @@ const banner = `
@license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0 @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0
`; `;
function getBase(env) { function getBase(env, mode) {
return { return {
output: { output: {
filename: "js/server.js", filename: "js/server.js",
@ -54,6 +54,7 @@ function getBase(env) {
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
"process.env.COMMIT_HASH": `"${env.COMMIT_HASH}"`, "process.env.COMMIT_HASH": `"${env.COMMIT_HASH}"`,
"process.env.NODE_ENV": `"${mode}"`,
}), }),
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: "styles/styles.css", filename: "styles/styles.css",
@ -69,7 +70,7 @@ function getBase(env) {
} }
const createServerConfig = (env, mode) => { const createServerConfig = (env, mode) => {
const base = getBase(env); const base = getBase(env, mode);
const config = merge({}, base, { const config = merge({}, base, {
mode, mode,
entry: "./src/server/index.tsx", entry: "./src/server/index.tsx",
@ -97,7 +98,7 @@ const createServerConfig = (env, mode) => {
}; };
const createClientConfig = (env, mode) => { const createClientConfig = (env, mode) => {
const base = getBase(env); const base = getBase(env, mode);
const config = merge({}, base, { const config = merge({}, base, {
mode, mode,
entry: "./src/client/index.tsx", entry: "./src/client/index.tsx",