From 6d05ceadbac773e84423113b8f066fc829945053 Mon Sep 17 00:00:00 2001 From: Tao Bojlen Date: Mon, 27 Aug 2018 23:31:27 +0200 Subject: [PATCH] loading instances --- backend/settings/base.py | 2 + backend/settings/dev.py | 6 +++ backend/settings/production.py | 6 ++- frontend/package.json | 4 ++ frontend/public/index.html | 2 +- frontend/src/App.tsx | 17 +++++++- frontend/src/components/InstanceSearch.tsx | 47 +++++++++++++--------- frontend/src/components/Nav.tsx | 19 ++++++++- frontend/src/index.css | 14 +++++++ frontend/src/index.tsx | 9 +++-- frontend/src/redux/actions.ts | 10 ++--- frontend/src/util.ts | 11 +++++ frontend/yarn.lock | 28 +++++++++++-- 13 files changed, 139 insertions(+), 36 deletions(-) create mode 100644 frontend/src/util.ts diff --git a/backend/settings/base.py b/backend/settings/base.py index f9d57fb..86c6350 100644 --- a/backend/settings/base.py +++ b/backend/settings/base.py @@ -54,11 +54,13 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'rest_framework', 'silk', + 'corsheaders', 'scraper.apps.ScraperConfig', 'apiv1.apps.Apiv1Config', ] MIDDLEWARE = [ + 'corsheaders.middleware.CorsMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', diff --git a/backend/settings/dev.py b/backend/settings/dev.py index a96496a..e58f186 100644 --- a/backend/settings/dev.py +++ b/backend/settings/dev.py @@ -4,3 +4,9 @@ DEBUG = True ALLOWED_HOSTS += ['localhost'] +CORS_ORIGIN_WHITELIST = [ + 'localhost:3000', + 'localhost:8000', + '127.0.0.1', +] + diff --git a/backend/settings/production.py b/backend/settings/production.py index 20db018..62905c7 100644 --- a/backend/settings/production.py +++ b/backend/settings/production.py @@ -1,3 +1,7 @@ from .base import * -ALLOWED_HOSTS += ['fediverse.space'] \ No newline at end of file +ALLOWED_HOSTS += ['fediverse.space'] + +CORS_ORIGIN_WHITELIST = [ + 'fediverse.space', +] diff --git a/frontend/package.json b/frontend/package.json index 4be6db8..af80a9f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -6,12 +6,14 @@ "@blueprintjs/core": "^3.4.0", "@blueprintjs/icons": "^3.1.0", "@blueprintjs/select": "^3.1.0", + "classnames": "^2.2.6", "cross-fetch": "^2.2.2", "normalize.css": "^8.0.0", "react": "^16.4.2", "react-dom": "^16.4.2", "react-redux": "^5.0.7", "react-scripts-ts": "2.17.0", + "react-virtualized": "^9.20.1", "redux": "^4.0.0", "redux-thunk": "^2.3.0" }, @@ -22,11 +24,13 @@ "eject": "react-scripts-ts eject" }, "devDependencies": { + "@types/classnames": "^2.2.6", "@types/jest": "^23.3.1", "@types/node": "^10.9.2", "@types/react": "^16.4.12", "@types/react-dom": "^16.0.7", "@types/react-redux": "^6.0.6", + "@types/react-virtualized": "^9.18.7", "typescript": "^3.0.1" } } diff --git a/frontend/public/index.html b/frontend/public/index.html index ed0ebaf..2dbd680 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -19,7 +19,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - React App + fediverse.space