From 77d0e351486c0eec0094de96569b7690a0fe2977 Mon Sep 17 00:00:00 2001 From: thijsheijden <hi@thijsheijden.nl> Date: Mon, 28 Mar 2022 14:33:54 +0200 Subject: [PATCH] feat: moved from datastrophe to graphpolaris domain --- README.md | 10 ++--- apps/web-graphpolaris/project.json | 38 ++++++++++++------- .../src/components/login/loginScreen.tsx | 8 ++-- .../data-access/api/src/lib/database.ts | 6 +-- libs/shared/data-access/api/src/lib/user.ts | 2 +- .../src/lib/authorizationHandler.ts | 6 +-- 6 files changed, 38 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 9f79b01a9..ebcaddb86 100644 --- a/README.md +++ b/README.md @@ -7,23 +7,23 @@ Due to the way auth works (using a sameSite cookie), the procedure for running l ### MacOS / Linux 1. `sudo vim /etc/hosts` open the hosts file with your prefered text editor as root -2. Add a new row containing `127.0.0.1 local.datastrophe.science.uu.nl`, this will route traffic from `local.datastrophe.science.uu.nl` to `127.0.0.1` +2. Add a new row containing `127.0.0.1 local.graphpolaris.com`, this will route traffic from `local.graphpolaris.com` to `127.0.0.1` 3. `brew install mkcert` install mkcert utility 4. `mkcert -install` generate local CA (certificate authority) 5. Move into the /certs folder at the project root using `cd` -6. `mkcert --key-file local-key.pem --cert-file local-cert.pem local.datastrophe.science.uu.nl` create certificates for local SSL +6. `mkcert --key-file local-key.pem --cert-file local-cert.pem local.graphpolaris.com` create certificates for local SSL ### Windows 1. Open the `hosts` file under `C:\Windows\System32\drivers\etc` using a text editor, as administrator -2. Add a new row containing `127.0.0.1 local.datastrophe.science.uu.nl`, this will route traffic from `local.datastrophe.science.uu.nl` to `127.0.0.1` +2. Add a new row containing `127.0.0.1 local.graphpolaris.com`, this will route traffic from `local.graphpolaris.com` to `127.0.0.1` 3. Install mkcert using any of the ways described [here](https://github.com/FiloSottile/mkcert#windows) 4. Open an elevated Powershell or CMD session 5. Move into the /certs folder at the project root using `cd` -6. `mkcert --key-file local-key.pem --cert-file local-cert.pem local.datastrophe.science.uu.nl` create certificates for local SSL +6. `mkcert --key-file local-key.pem --cert-file local-cert.pem local.graphpolaris.com` create certificates for local SSL > No idea if the Windows steps work ## Running Locally -To run the application using SSL (with these keys) simply run `nx run web-graphpolaris:dev`, or `yarn nx run web-graphpolaris:dev` if `nx` is not installed globally. This should open a window to `https://local.datastrophe.science.uu.nl:4200/` automatically. +To run the application using SSL (with these keys) simply run `nx run web-graphpolaris:dev`, or `yarn nx run web-graphpolaris:dev` if `nx` is not installed globally. This should open a window to `https://local.graphpolaris.com:4200/` automatically. diff --git a/apps/web-graphpolaris/project.json b/apps/web-graphpolaris/project.json index dc9c691ac..864038895 100644 --- a/apps/web-graphpolaris/project.json +++ b/apps/web-graphpolaris/project.json @@ -7,7 +7,7 @@ "executor": "@nrwl/web:dev-server", "options": { "buildTarget": "web-graphpolaris:build", - "host": "local.datastrophe.science.uu.nl", + "host": "local.graphpolaris.com", "port": 4200, "watch": true, "hmr": true, @@ -19,7 +19,9 @@ }, "build": { "executor": "@nrwl/web:webpack", - "outputs": ["{options.outputPath}"], + "outputs": [ + "{options.outputPath}" + ], "defaultConfiguration": "production", "options": { "compiler": "babel", @@ -33,18 +35,18 @@ "apps/web-graphpolaris/src/favicon.ico", "apps/web-graphpolaris/src/assets" ], - "styles": ["apps/web-graphpolaris/src/styles.scss"], + "styles": [ + "apps/web-graphpolaris/src/styles.scss" + ], "scripts": [], "webpackConfig": "@nrwl/react/plugins/webpack" }, "configurations": { "production": { - "fileReplacements": [ - { - "replace": "apps/graphpolaris/src/environments/environment.ts", - "with": "apps/graphpolaris/src/environments/environment.prod.ts" - } - ], + "fileReplacements": [{ + "replace": "apps/graphpolaris/src/environments/environment.ts", + "with": "apps/graphpolaris/src/environments/environment.prod.ts" + }], "optimization": true, "outputHashing": "all", "sourceMap": false, @@ -69,14 +71,20 @@ }, "lint": { "executor": "@nrwl/linter:eslint", - "outputs": ["{options.outputFile}"], + "outputs": [ + "{options.outputFile}" + ], "options": { - "lintFilePatterns": ["apps/graphpolaris/**/*.{ts,tsx,js,jsx}"] + "lintFilePatterns": [ + "apps/graphpolaris/**/*.{ts,tsx,js,jsx}" + ] } }, "test": { "executor": "@nrwl/jest:jest", - "outputs": ["coverage/apps/graphpolaris"], + "outputs": [ + "coverage/apps/graphpolaris" + ], "options": { "jestConfig": "apps/web-graphpolaris/jest.config.js", "passWithNoTests": true @@ -105,7 +113,9 @@ }, "build-storybook": { "executor": "@nrwl/storybook:build", - "outputs": ["{options.outputPath}"], + "outputs": [ + "{options.outputPath}" + ], "options": { "uiFramework": "@storybook/react", "outputPath": "dist/storybook/graphpolaris", @@ -121,4 +131,4 @@ } }, "tags": [] -} +} \ No newline at end of file diff --git a/apps/web-graphpolaris/src/components/login/loginScreen.tsx b/apps/web-graphpolaris/src/components/login/loginScreen.tsx index 93339edaa..fc1cf4a89 100644 --- a/apps/web-graphpolaris/src/components/login/loginScreen.tsx +++ b/apps/web-graphpolaris/src/components/login/loginScreen.tsx @@ -102,7 +102,7 @@ const LoginScreen = () => { <img onClick={() => openSignInWindow( - 'https://datastrophe.science.uu.nl/user/sign-in?provider=1' + 'https://api.graphpolaris.com/user/sign-in?provider=1' ) } src="assets/login-screen/google.png" @@ -111,7 +111,7 @@ const LoginScreen = () => { <img onClick={() => openSignInWindow( - 'https://datastrophe.science.uu.nl/user/sign-in?provider=2' + 'https://api.graphpolaris.com/user/sign-in?provider=2' ) } src="assets/login-screen/github.png" @@ -119,9 +119,7 @@ const LoginScreen = () => { /> <p onClick={() => - openSignInWindow( - 'https://datastrophe.science.uu.nl/user/create_free/' - ) + openSignInWindow('https://api.graphpolaris.com/user/create_free/') } > Developer diff --git a/libs/shared/data-access/api/src/lib/database.ts b/libs/shared/data-access/api/src/lib/database.ts index 8d6700de6..da706c42a 100644 --- a/libs/shared/data-access/api/src/lib/database.ts +++ b/libs/shared/data-access/api/src/lib/database.ts @@ -14,7 +14,7 @@ export type AddDatabaseRequest = { export function AddDatabase(request: AddDatabaseRequest): Promise<void> { return new Promise((resolve, reject) => { - fetch('https://datastrophe.science.uu.nl/user/database', { + fetch('https://api.graphpolaris.com/user/database', { method: 'POST', credentials: 'same-origin', headers: new Headers({ @@ -34,7 +34,7 @@ export function AddDatabase(request: AddDatabaseRequest): Promise<void> { export function GetAllDatabases(): Promise<Array<string>> { return new Promise<Array<string>>((resolve, reject) => { - fetch('https://datastrophe.science.uu.nl/user/database', { + fetch('https://api.graphpolaris.com/user/database', { method: 'GET', credentials: 'same-origin', headers: new Headers({ @@ -57,7 +57,7 @@ export function GetAllDatabases(): Promise<Array<string>> { export function DeleteDatabase(name: string): Promise<void> { return new Promise((resolve, reject) => { - fetch('https://datastrophe.science.uu.nl/user/database/' + name, { + fetch('https://api.graphpolaris.com/user/database/' + name, { method: 'DELETE', credentials: 'same-origin', headers: new Headers({ diff --git a/libs/shared/data-access/api/src/lib/user.ts b/libs/shared/data-access/api/src/lib/user.ts index 457ce20f6..b3d7b3fc9 100644 --- a/libs/shared/data-access/api/src/lib/user.ts +++ b/libs/shared/data-access/api/src/lib/user.ts @@ -10,7 +10,7 @@ export type User = { export function GetUserInfo(): Promise<User> { return new Promise<User>((resolve, reject) => { - fetch('https://datastrophe.science.uu.nl/user/', { + fetch('https://api.graphpolaris.com/user/', { method: 'GET', credentials: 'same-origin', headers: new Headers({ diff --git a/libs/shared/data-access/authorization/src/lib/authorizationHandler.ts b/libs/shared/data-access/authorization/src/lib/authorizationHandler.ts index fc9292241..bc6001fd2 100644 --- a/libs/shared/data-access/authorization/src/lib/authorizationHandler.ts +++ b/libs/shared/data-access/authorization/src/lib/authorizationHandler.ts @@ -1,5 +1,3 @@ -import { Cookies } from 'react-cookie'; - export class AuthorizationHandler { private static _instance: AuthorizationHandler; private accessToken = ''; @@ -52,7 +50,7 @@ export class AuthorizationHandler { */ private async getNewAccessToken(): Promise<authResponse> { // If we have an access token already, append it to the url as a query param to keep sessionID the same - let url = 'https://datastrophe.science.uu.nl/auth/refresh'; + let url = 'https://api.graphpolaris.com/auth/refresh'; if (this.accessToken != '') { url += '?access_token=' + this.accessToken; } @@ -104,7 +102,7 @@ export class AuthorizationHandler { * initialiseRefreshToken attempts to initialise a refresh token */ private async initialiseRefreshToken() { - fetch('https://datastrophe.science.uu.nl/auth/refresh', { + fetch('https://api.graphpolaris.com/auth/refresh', { method: 'POST', credentials: 'include', }) -- GitLab