A React/Redux front-end for Cloudflare's WordPress, Magento2, and cPanel plugins.
Branch: master
Clone or download
jwineman Merge pull request #140 from cloudflare/jwineman/PI-817-splash-page-h…
…ost-signup

PI-817: Updating <SplashPage> to be aware of the host API for the sig…
Latest commit 5fa743f Jul 18, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets Changed to svgs Jun 27, 2017
fonts
lang
src PI-817: Vojtech code review. Jul 17, 2017
stylesheets Adde new splash page Jun 27, 2017
.babelrc
.eslintrc.json Yarn upgrade and new eslint rules Jun 27, 2017
.gitignore Removed Mocha, Chai in favor of Jest. src/test -> __tests__. added n… ( Mar 20, 2017
.travis.yml Added yarn.lock (#92) Feb 13, 2017
CHANGELOG.MD PI-1200 release v3.0.0 Jul 17, 2017
CONTRIBUTING.md
README.md
config.json.sample PI-1200 Updated config fetch to use our new endpoint, deleted config.… Jul 14, 2017
package.json
webpack.config.js Yarn upgrade and new eslint rules Jun 27, 2017
yarn.lock Yarn upgrade and new eslint rules Jun 27, 2017

README.md

Build using Yarn

  1. yarn install
  2. yarn run build

Development Tasks

$ yarn run build
$ yarn run build:production
$ yarn run lint
$ yarn run format
$ yarn run test

Production

For production run yarn run build:production to get a minified version of compiled.js

Building Your Own Backend

This repository serves as the front end for all of our 3rd party integrations. It is intended to be backend agnostic with the intention of making it as easy as possible to port it to new backends. If you would like to build a custom backend just follow these steps:

  1. Implement RestProxyCallback()
    /*
     * A callback for cf-util-http to proxy all calls to our backend
     *
     * @param {Object} [opts]
     * @param {String} [opts.method] - GET/POST/PUT/PATCH/DELETE
     * @param {String} [opts.url]
     * @param {Object} [opts.parameters]
     * @param {Object} [opts.headers]
     * @param {Object} [opts.body]
     * @param {Function} [opts.onSuccess]
     * @param {Function} [opts.onError]
     */
     function RestProxyCallback(opts) {}

This method is called on every request before it is sent. It should route all absolute URLs to the endpoint for your backend. Requests with relative URLs for things like localization (./lang/*.js) and config (./config.json) should remain unchanged.

  1. Build your backend data store Your backend needs to store the following information about each user:

  2. In index.html create a variable in local storage called cfEmail which contains Cloudflare Client V4 API Email of the current user.

  3. Build an API Client for the Cloudflare V4 API which adds the necessary headers to each request.

  4. Build an API Client for the Cloudflare Host API which adds the Host Key to all requests.

JSON response for endpoint /config

{
    "debug": false,
    "featureManagerIsFullZoneProvisioningEnabled": false,
    "isDNSPageEnabled": true,
    "isSubdomainCheckEnabled": true,
    "homePageCards": [
        "ApplyDefaultSettingsCard",
        "AutomaticHTTPSRewritesCard",
        "IpRewriteCard",
        "PluginSpecificCacheCard",
        "PluginSpecificCacheTagCard"
    ],
    "moreSettingsCards": {
        "container.moresettings.speed": [
            "AlwaysOnlineCard",
            "BrowserCacheTTLCard",
            "BypassCacheByCookieCard",
            "CacheLevelCard",
            "DevelopmentModeCard",
            "IPV6Card",
            "ImageOptimizationCard",
            "MinifyCard",
            "PurgeCacheCard",
            "RailgunCard"
        ],
        "container.moresettings.security": [
            "AdvanceDDoSCard",
            "BrowserIntegrityCheckCard",
            "ChallengePassageCard",
            "SecurityLevelCard",
            "SSLCard",
            "WAFCard"
        ]
    },
    "locale": "en",
    "integrationName": "frontend",
    "useHostAPILogin": true,
    "version": "2.8.1"
}