Skip to content

📲 Access a WordPress site in an app, powered by React + WordPress REST API!

License

Notifications You must be signed in to change notification settings

soup-bowl/pressify

Repository files navigation

CodeFactor

Uses the power of the WordPress REST API and Progressive Web Apps to form a portable app viewer for WordPress-based sites.

Check it out in action!

For a site to work, it has to meet the following criteria:

  • A WordPress site with the WP-JSON API endpoint visible.
    • This is 'on' by default, but some security plugins suggest disabling it for 'security' reasons.
  • The API is not behind a strict CORS policy.
  • The WordPress site hasn't customised the default access policies.
    • A typical custom config will be to require authentication for viewing endpoints, which this tool will not handle.
    • The tool is built to handle these scenarios, but will degrade the experience.

Warning

While we will sanitise the HTML response from the source API, this tool will obtain and display HTML from the specified site. Please only use this tool with websites you trust!

For more info, see React docs on dangerouslySetInnerHTML.

Getting Started

With Gitpod

Open in Gitpod

Without Gitpod

This project requires NodeJS to develop, test and compile the code. The following will quickstart you.

npm install
npm start

The API the system will communicate with is defined in the appropriate .env.

Testing Offline Capabilities

If you want to test the PWA functionality locally, you can add the following to the VitePWA() segment in vite.config.ts:

devOptions: { enabled: true },

react-hooks/exhaustive-deps

This has been ignored on the UseEffect commands where the WP API is called. This is because once wp is added to the dependency array, an infinite loop is triggered. I welcome thoughts and suggestions to fix this, but until then (and it causing no foreseeable bugs), it has been disabled.

About

📲 Access a WordPress site in an app, powered by React + WordPress REST API!

Topics

Resources

License

Stars

Watchers

Forks

Languages