Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify components to support ionic fork #192

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

justinr1234
Copy link
Contributor

No description provided.

const headers = {};
if (nextDataEl?.textContent) {
const data = JSON.parse(nextDataEl.textContent);
headers["CSRF-Token"] = data.query.CSRF_TOKEN;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer require a CSRF token

};

export const withApollo = (Component: any, options?: WithApolloOptions) =>
options?.useNext === false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optionally disable nextjs processing for apollo, but enable it by default

@@ -1,5 +1,20 @@
import csrf from "csurf";
import { Express } from "express";
import url from "url";

const skipList = process.env.CSRF_SKIP_REFERERS
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow us to pass a list of referrers like:

CSRF_SKIP_REFERERS=localhost:8100,mobile.mydomain.com

@app/server/src/middleware/installCors.ts Outdated Show resolved Hide resolved
@app/server/src/app.ts Outdated Show resolved Hide resolved
{ initialState, ctx }: InitApolloOptions<NormalizedCacheObject>,
withApolloOptions?: WithApolloOptions
): ApolloClient<NormalizedCacheObject> => {
const ROOT_URL = process.env.ROOT_URL || withApolloOptions?.rootUrl;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow us to pass in a different rootUrl in the options to withApollo


import { GraphileApolloLink } from "./GraphileApolloLink";

interface WithApolloOptions {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

withApollo can now be called as:

withApollo(App, {
  useNext: false,
  rootUrl: process.env.REACT_APP_ROOT_URL,
});

@@ -4,3 +4,4 @@ node_modules
/data/schema.sql
/@app/graphql/index.*
/@app/client/.next
**/build
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore any build folders, such as the one ionic generates

package.json Outdated Show resolved Hide resolved
@benjie
Copy link
Member

benjie commented Sep 1, 2020

As it stands, this PR contains a lot of changes; as discussed on Discord, lets break it up into a number of bite-sized PRs that will be easier to review and iterate so we can merge things a bit faster. Please make sure that each PR comes with an explanation why this change is valuable in general (not specifically limited to Ionic, e.g. you might show how the change is also necessary for Create React App). Here's some PR topics that would make sense from this:

Formatting changes

  • Merged

I notice that cypress.yml had the option re-wrapped; this should be handled automatically by prettier which formats all our yaml for us, but if this is not the case, a change that enforces prettier formatting of the relevant files would be welcome.

sudo apt-get update

  • Merged

This fix should be in place for everyone, please send it as a standalone PR.

withApollo.ts -> .tsx

  • Merged

A simple rename of this file could be included such that the diff when you later edit it will be much clearer. Actually; since this is just a file rename I'll do it now... Done.

cors

  • Merged

This is going to be a controversial addition which will require quite a bit of back-and-forth (but I'm generally in favour of merging, when done right); lets get it as a clean PR on its own.

lerna run setup

  • Merged

Raise this as a separate PR including a small mention in the README. If it passes tests I see no reason not to merge it.

Session changes (allowed origins)

  • Merged

Please raise a PR for just this change with a good explanation of why it's needed, whether it's needed only for development, and any security concerns/caveats there may be with it's introduction.

@justinr1234
Copy link
Contributor Author

@benjie updated

@benjie
Copy link
Member

benjie commented Sep 2, 2020

I missed the CSRF stuff; we should split that out too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants