chore: remove react client

This commit is contained in:
Dmitrii Vershinin 2023-09-27 18:14:30 +05:00
parent 8ee516850b
commit 2381fcf68f
13 changed files with 0 additions and 14259 deletions

View File

@ -1,23 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@ -1,70 +0,0 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\
You may also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

View File

@ -1,41 +0,0 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.4.0",
"react": "^18.2.0",
"react-cookie": "^5.0.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.15.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -1,22 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>

View File

@ -1,38 +0,0 @@
import {
createBrowserRouter,
RouterProvider,
} from "react-router-dom";
import { CookiesProvider } from "react-cookie";
import Login from "./Login";
import Consent from "./Consent";
import Error from "./Error";
const router = createBrowserRouter([
{
path: "/",
element: <div>Home</div>
},
{
path: "/login",
element: <Login />,
},
{
path: "/consent",
element: <Consent />
},
{
path: "/error",
element: <Error />
}
]);
function App() {
return (
<CookiesProvider>
<RouterProvider router={router} />
</CookiesProvider>
);
};
export default App;

View File

@ -1,144 +0,0 @@
import React from "react";
import { useSearchParams } from "react-router-dom";
import { useCookies } from 'react-cookie';
export default function Consent() {
const [searchParams] = useSearchParams();
const [cookies] = useCookies(['XSRF-TOKEN']);
const clientId = searchParams.get("clientId") || "";
const principalName = searchParams.get("principalName") || "";
const state = searchParams.get("state") || "";
const scopes = searchParams.get("scopes").split(",") || [];
const previouslyApprovedScopes = searchParams.get("previouslyApprovedScopes") ? searchParams.get("previouslyApprovedScopes").split(",") : [];
const approve = async () => {
const formData = new FormData();
formData.append("client_id", clientId);
formData.append("state", state);
scopes.forEach(scope => {
formData.append("scope", scope);
});
const resp = await fetch(`${process.env.REACT_APP_AUTHORIZATION_SERVER}/oauth2/authorize`, {
method: 'POST',
body: formData,
headers: {
'X-XSRF-TOKEN': cookies['XSRF-TOKEN'],
},
credentials: "include",
redirect: "follow"
});
if (resp.redirected)
window.location.href = resp.url;
}
// TODO: Loader, error page and so on
return (
<div className="container">
<div className="py-5">
<h1 className="text-center text-primary">App permissions</h1>
</div>
<div className="row">
<div className="col text-center">
<p>
<span className="px-1">
The application
</span>
<span className="font-weight-bold text-primary">{clientId}</span>
<span className="px-1">
wants to access your account
</span>
<span className="font-weight-bold">{principalName}</span>
</p>
</div>
</div>
<div className="row pb-3">
<div className="col text-center">
<p>
The following permissions are requested by the above app.
<br />
Please review these and consent if you approve.
</p>
</div>
</div>
<div className="row">
<div className="col text-center">
<div name="consent_form">
<input type="hidden" name="client_id" value={clientId} />
<input type="hidden" name="state" value={state} />
{scopes.length > 0 && (
<div className="form-group form-check py-1">
{scopes.map((scope) => (<>
<span
className="font-weight-bold px-1"
key={scope}
>
{scope}
</span>
</>))}
</div>
)}
{previouslyApprovedScopes.length > 0 && (
<>
<p>
You have already granted the following permissions to the
above app:
</p>
{previouslyApprovedScopes.map((scope) => (
<>
<div className="form-group form-check py-1">
<span
className="font-weight-bold"
>
{scope}
</span>
</div>
</>
))}
</>
)}
<div className="form-group pt-3">
<button
className="btn btn-primary btn-lg"
id="submit-consent"
onClick={approve}
>
Submit Consent
</button>
</div>
<div className="form-group">
<button
className="btn btn-link regular"
type="button"
id="cancel-consent"
onClick={() => window.close()}
>
Cancel
</button>
</div>
</div>
</div>
</div>
<div className="row pt-4">
<div className="col text-center">
<p>
<small>
Your consent to provide access is required.
<br />
If you do not approve, click Cancel, in which case no information
will be shared with the app.
</small>
</p>
</div>
</div>
</div>
);
}
/*
FORMDATA
client_id: fc8482ff-b1e4-4397-8a48-13b88f3c25fe
state: huIv-Dc0E01S_lGYPbjXAdSz4Fo5r3pA4eFhaU5G23I=
scope: accounts:read
*/

View File

@ -1,7 +0,0 @@
import React from 'react';
export default function Error() {
return (
<div>Error</div>
)
};

View File

@ -1,86 +0,0 @@
import React, { useState } from "react";
import axios from "axios";
import { useSearchParams } from "react-router-dom";
import { useCookies } from 'react-cookie';
export default function Login() {
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
const [searchParams, setSearchParams] = useSearchParams();
const [cookies] = useCookies(['XSRF-TOKEN']);
const login = async () => {
const formData = new FormData();
formData.append("username", username);
formData.append("password", password);
formData.append("_csrf", cookies['XSRF-TOKEN']);
await fetch(`${process.env.REACT_APP_AUTHORIZATION_SERVER}/login?${searchParams.toString()}`, {
method: 'POST',
body: formData,
headers: {
'X-XSRF-TOKEN': cookies['XSRF-TOKEN'],
},
credentials: "include",
redirect: "manual"
});
window.location.href = `${process.env.REACT_APP_AUTHORIZATION_SERVER}/oauth2/authorize?${searchParams.toString()}&continue`;
}
return (
<div className="container">
<div className="row">
<div className="col-md-6 offset-md-3">
{searchParams.get("error") && (
<div>
<div className="alert alert-danger">Invalid Email or Password</div>
</div>
)}
{searchParams.get("logout") && (
<div>
<div className="alert alert-success"> You have been logged out.</div>
</div>
)}
<div className="card">
<div className="card-header">
<h2 className="text-center">Login Form</h2>
</div>
<div className="card-body">
<div
className="form-horizontal"
>
<div className="form-group mb-3">
<label className="control-label"> Email</label>
<input
type="text"
id="username"
name="username"
className="form-control"
placeholder="Enter email address"
onChange={(e) => setUsername(e.target.value)}
/>
</div>
<div className="form-group mb-3">
<label className="control-label"> Password</label>
<input
type="password"
id="password"
name="password"
className="form-control"
placeholder="Enter password"
onChange={(e) => setPassword(e.target.value)}
/>
</div>
<div className="form-group mb-3">
<button type="button" className="btn btn-primary" onClick={login}>
Submit
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}

View File

@ -1,10 +0,0 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

View File

@ -1,17 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import reportWebVitals from './reportWebVitals';
import './index.css';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
reportWebVitals();

View File

@ -1,13 +0,0 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

File diff suppressed because it is too large Load Diff