nextpress-core 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/np-install.js +2 -0
- package/lib/container-lib/docker-compose.yml +4 -1
- package/lib/container-lib/nginx.conf +2 -0
- package/lib/nextjs-lib/globals/get-field/get-field.ts +2 -2
- package/lib/nextjs-lib/nextpress.next.config.ts +22 -0
- package/lib/nextjs-lib/services/get-menu.ts +10 -10
- package/lib/wp-lib/src/nextpress_disable_core_depency_updates.php +12 -6
- package/lib/wp-lib/src/nextpress_remove_menu_pages.php +2 -2
- package/package.json +1 -1
package/cli/np-install.js
CHANGED
|
@@ -116,6 +116,7 @@ services:
|
|
|
116
116
|
DATABASE_URL: mysql://root:${MYSQL_ROOT_PASSWORD}@db:3306/${MYSQL_DATABASE}
|
|
117
117
|
WP_SERVICE_URL: http://wordpress:80
|
|
118
118
|
WP_SITE_URL: ${WP_SITE_URL}
|
|
119
|
+
DOMAIN_NAME: ${DOMAIN_NAME}
|
|
119
120
|
CROSS_CONTAINER_API_KEY: ${CROSS_CONTAINER_API_KEY}
|
|
120
121
|
healthcheck:
|
|
121
122
|
test: ["CMD-SHELL", "wget --spider -q http://0.0.0.0:3000 || exit 1"]
|
|
@@ -138,10 +139,12 @@ services:
|
|
|
138
139
|
next-js:
|
|
139
140
|
condition: service_healthy
|
|
140
141
|
ports:
|
|
141
|
-
- "
|
|
142
|
+
- "80:80"
|
|
142
143
|
volumes:
|
|
143
144
|
- ./node_modules/nextpress-core/lib/container-lib/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
|
144
145
|
- ./nginx.extend.conf:/etc/nginx/snippets/extend.conf:ro
|
|
146
|
+
environment:
|
|
147
|
+
DOMAIN_NAME: ${DOMAIN_NAME}
|
|
145
148
|
healthcheck:
|
|
146
149
|
test: ["CMD-SHELL", "pgrep nginx || exit 1"]
|
|
147
150
|
interval: 30s
|
|
@@ -23,7 +23,7 @@ declare global {
|
|
|
23
23
|
fieldGroup: T,
|
|
24
24
|
selector: K,
|
|
25
25
|
location?: Location
|
|
26
|
-
) => Promise<FieldProps<T>[K]>;
|
|
26
|
+
) => Promise<FieldProps<T>[K] | undefined>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
globalThis.getField = async (fieldGroup, selector, location) => {
|
|
@@ -41,7 +41,7 @@ globalThis.getField = async (fieldGroup, selector, location) => {
|
|
|
41
41
|
// break;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
if (!location) return
|
|
44
|
+
if (!location) return;
|
|
45
45
|
|
|
46
46
|
const values = await (async () => {
|
|
47
47
|
if (location === 'options') {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { NextConfig } from "next";
|
|
2
|
+
|
|
3
|
+
const wpUrl = new URL(process.env.WP_SERVICE_URL ?? '');
|
|
4
|
+
|
|
5
|
+
const nextpressNextConfig: NextConfig = {
|
|
6
|
+
reactCompiler: true,
|
|
7
|
+
images: {
|
|
8
|
+
dangerouslyAllowLocalIP: true, // Required compromise to allow cross fetching within docker container
|
|
9
|
+
remotePatterns: [
|
|
10
|
+
{
|
|
11
|
+
protocol: wpUrl.protocol.replace(':', '') === 'https' ? 'https' : 'http',
|
|
12
|
+
hostname: wpUrl.hostname,
|
|
13
|
+
port: wpUrl.port || undefined,
|
|
14
|
+
pathname: '/wp-content/uploads/**',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
qualities: [25, 50, 75, 100],
|
|
18
|
+
},
|
|
19
|
+
allowedDevOrigins: [process.env.DOMAIN_NAME ?? ''],
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default nextpressNextConfig;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { IMenuItem } from "../entities/post/post.interface";
|
|
2
2
|
import { getThemeMods } from "./get-theme-mods";
|
|
3
3
|
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
children:
|
|
4
|
+
export type NextpressMenu = {
|
|
5
|
+
item: IMenuItem,
|
|
6
|
+
children: NextpressMenu[]
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Retrieves a menu by its location identifier.
|
|
11
11
|
*
|
|
12
12
|
* @param {string} menuLocation - The location identifier of the menu.
|
|
13
|
-
* @returns {Promise<
|
|
13
|
+
* @returns {Promise<NextpressMenu[] | undefined>} An array of menu items representing the menu tree, or undefined if the menu is not found.
|
|
14
14
|
*/
|
|
15
|
-
export async function getMenu(menuLocation: string): Promise<
|
|
15
|
+
export async function getMenu(menuLocation: string): Promise<NextpressMenu[] | undefined> {
|
|
16
16
|
const navMenuLocations = await getThemeMods('nav_menu_locations');
|
|
17
17
|
if (!navMenuLocations || typeof navMenuLocations !== 'object') return;
|
|
18
18
|
|
|
@@ -40,8 +40,8 @@ export async function getMenu(menuLocation: string): Promise<Menu[] | undefined>
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const map = new Map<number,
|
|
44
|
-
const tree:
|
|
43
|
+
const map = new Map<number, NextpressMenu>();
|
|
44
|
+
const tree: NextpressMenu[] = [];
|
|
45
45
|
|
|
46
46
|
for (const item of menuItems) {
|
|
47
47
|
if (!item.menuItemAttributes) continue;
|
|
@@ -71,8 +71,8 @@ export async function getMenu(menuLocation: string): Promise<Menu[] | undefined>
|
|
|
71
71
|
menuItemAttributes
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const node:
|
|
75
|
-
|
|
74
|
+
const node: NextpressMenu = {
|
|
75
|
+
item: safeItem,
|
|
76
76
|
children: []
|
|
77
77
|
};
|
|
78
78
|
|
|
@@ -96,7 +96,7 @@ export async function getMenu(menuLocation: string): Promise<Menu[] | undefined>
|
|
|
96
96
|
|
|
97
97
|
if (parentNode) {
|
|
98
98
|
parentNode.children.push(currentNode);
|
|
99
|
-
map.set(parentNode.
|
|
99
|
+
map.set(parentNode.item.ID, parentNode);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -7,22 +7,28 @@ namespace Nextpress;
|
|
|
7
7
|
* Allows translations, other plugins, and themes to update normally.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
// Block updates and notifications only for WordPress Core
|
|
10
11
|
add_filter('pre_site_transient_update_core', function($transient) {
|
|
11
12
|
if (!\is_object($transient)) {
|
|
12
13
|
$transient = new \stdClass();
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
$transient->updates = [];
|
|
17
|
+
$transient->response = [];
|
|
18
|
+
|
|
19
|
+
if (!isset($transient->version_checked)) {
|
|
20
|
+
global $wp_version;
|
|
21
|
+
$transient->version_checked = isset($wp_version) ? $wp_version : '';
|
|
17
22
|
}
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
|
|
24
|
+
if (!isset($transient->last_checked)) {
|
|
25
|
+
$transient->last_checked = time();
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
return $transient;
|
|
23
29
|
});
|
|
24
30
|
|
|
25
|
-
//
|
|
31
|
+
// Intercept Plugin update checks specifically for Secure Custom Fields
|
|
26
32
|
add_filter('site_transient_update_plugins', function($transient) {
|
|
27
33
|
if (!\is_object($transient) || !isset($transient->response)) {
|
|
28
34
|
return $transient;
|
|
@@ -39,7 +45,7 @@ add_filter('site_transient_update_plugins', function($transient) {
|
|
|
39
45
|
return $transient;
|
|
40
46
|
});
|
|
41
47
|
|
|
42
|
-
//
|
|
48
|
+
// Block automatic background updates for Core and SCF
|
|
43
49
|
add_filter('auto_update_core', '__return_false');
|
|
44
50
|
add_filter('auto_update_plugin', function($update, $item) {
|
|
45
51
|
if (\is_object($item) && isset($item->plugin) && $item->plugin === 'advanced-custom-fields/acf.php') {
|
|
@@ -7,8 +7,8 @@ add_action('admin_menu', function() {
|
|
|
7
7
|
|
|
8
8
|
// Create a brand new top-level menu item for Customize
|
|
9
9
|
add_menu_page(
|
|
10
|
-
'Customize',
|
|
11
|
-
'Customize',
|
|
10
|
+
__('Customize'), // Page title
|
|
11
|
+
__('Customize'), // Menu title
|
|
12
12
|
'edit_theme_options', // Capability required to see it
|
|
13
13
|
'customize.php', // Direct link to the Customizer
|
|
14
14
|
'', // No function needed for an existing file
|