-
Notifications
You must be signed in to change notification settings - Fork 120
6411 Асцатрян Л.Ш. Лаб 2, Вар 2 #107
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
Open
LiliaASt
wants to merge
3
commits into
itsecd:main
Choose a base branch
from
LiliaASt:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| REACT_APP_API_KEY=5c35214b-1ca9-4216-a86e-d852deeecfaf | ||
| REACT_APP_PROXY_URL=http://localhost:3001/api/rasp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # 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* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| { | ||
| "name": "electric_train", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "dependencies": { | ||
| "@testing-library/dom": "^10.4.1", | ||
| "@testing-library/jest-dom": "^6.9.1", | ||
| "@testing-library/react": "^16.3.2", | ||
| "@testing-library/user-event": "^13.5.0", | ||
| "bootstrap": "^5.3.0", | ||
| "cors": "^2.8.6", | ||
| "dotenv": "^17.4.0", | ||
| "express": "^5.2.1", | ||
| "leaflet": "^1.9.4", | ||
| "node-fetch": "^2.7.0", | ||
| "ol": "^10.8.0", | ||
| "react": "^19.2.4", | ||
| "react-bootstrap": "^2.10.0", | ||
| "react-dom": "^19.2.4", | ||
| "react-scripts": "5.0.1", | ||
| "web-vitals": "^2.1.4" | ||
| }, | ||
| "scripts": { | ||
| "start": "react-scripts start", | ||
| "start:all": "concurrently \"npm run server\" \"npm run start\"", | ||
| "server": "node server.js", | ||
| "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" | ||
| ] | ||
| }, | ||
| "devDependencies": { | ||
| "concurrently": "^9.1.2" | ||
| } | ||
| } |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
| <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" | ||
| /> | ||
| <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
| <!-- | ||
| manifest.json provides metadata used when your web app is installed on a | ||
| user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
| --> | ||
| <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
| <!-- | ||
| Notice the use of %PUBLIC_URL% in the tags above. | ||
| It will be replaced with the URL of the `public` folder during the build. | ||
| Only files inside the `public` folder can be referenced from the HTML. | ||
|
|
||
| Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
| 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`. | ||
| --> | ||
| <title>React App</title> | ||
| </head> | ||
| <body> | ||
| <noscript>You need to enable JavaScript to run this app.</noscript> | ||
| <div id="root"></div> | ||
| <!-- | ||
| This HTML file is a template. | ||
| If you open it directly in the browser, you will see an empty page. | ||
|
|
||
| You can add webfonts, meta tags, or analytics to this file. | ||
| The build step will place the bundled scripts into the <body> tag. | ||
|
|
||
| To begin the development, run `npm start` or `yarn start`. | ||
| To create a production bundle, use `npm run build` or `yarn build`. | ||
| --> | ||
| </body> | ||
| </html> | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "short_name": "React App", | ||
| "name": "Create React App Sample", | ||
| "icons": [ | ||
| { | ||
| "src": "favicon.ico", | ||
| "sizes": "64x64 32x32 24x24 16x16", | ||
| "type": "image/x-icon" | ||
| }, | ||
| { | ||
| "src": "logo192.png", | ||
| "type": "image/png", | ||
| "sizes": "192x192" | ||
| }, | ||
| { | ||
| "src": "logo512.png", | ||
| "type": "image/png", | ||
| "sizes": "512x512" | ||
| } | ||
| ], | ||
| "start_url": ".", | ||
| "display": "standalone", | ||
| "theme_color": "#000000", | ||
| "background_color": "#ffffff" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # https://www.robotstxt.org/robotstxt.html | ||
| User-agent: * | ||
| Disallow: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| const express = require('express'); | ||
| const cors = require('cors'); | ||
| const fetch = require('node-fetch'); | ||
| require('dotenv').config(); | ||
|
|
||
| const app = express(); | ||
| const port = 3001; | ||
|
|
||
| const API_KEY = process.env.REACT_APP_API_KEY || '5c35214b-1ca9-4216-a86e-d852deeecfaf'; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. лучше вот так const API_KEY = process.env.REACT_APP_API_KEY ?? null;
if (!API_KEY) {
console.error("Invalid API_KEY")
return;
} |
||
|
|
||
| app.use(cors()); | ||
| app.use(express.json()); | ||
|
|
||
| app.use('/api/rasp', async (req, res) => { | ||
| try { | ||
| const apiPath = req.originalUrl.replace('/api/rasp', ''); | ||
| const separator = apiPath.includes('?') ? '&' : '?'; | ||
| const targetUrl = `https://api.rasp.yandex.net/v3.0${apiPath}${separator}apikey=${API_KEY}`; | ||
|
|
||
| console.log('Прокси запрос к:', targetUrl.replace(API_KEY, '***HIDDEN***')); | ||
|
|
||
| const response = await fetch(targetUrl, { | ||
| headers: { | ||
| 'Accept': 'application/json', | ||
| 'User-Agent': 'Mozilla/5.0' | ||
| } | ||
| }); | ||
|
|
||
| const text = await response.text(); | ||
|
|
||
| try { | ||
| const data = JSON.parse(text); | ||
| res.json(data); | ||
| } catch (e) { | ||
| console.error('Ошибка парсинга JSON'); | ||
| res.status(500).json({ error: 'API вернул невалидный JSON' }); | ||
| } | ||
|
|
||
| } catch (error) { | ||
| console.error('Ошибка прокси:', error.message); | ||
| res.status(500).json({ error: 'Ошибка при выполнении запроса к API' }); | ||
| } | ||
| }); | ||
|
|
||
| app.listen(port, () => { | ||
| console.log(`✅ Прокси сервер запущен на http://localhost:${port}`); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| .App { | ||
| min-height: 100vh; | ||
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | ||
| } | ||
|
|
||
| .app-header { | ||
| background: rgba(255, 255, 255, 0.95); | ||
| padding: 1rem; | ||
| box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); | ||
| text-align: center; | ||
| } | ||
|
|
||
| .app-header h1 { | ||
| margin: 0; | ||
| font-size: 1.5rem; | ||
| color: #333; | ||
| } | ||
|
|
||
| .app-header p { | ||
| margin: 0.5rem 0 0; | ||
| font-size: 0.9rem; | ||
| color: #666; | ||
| } | ||
|
|
||
| .map-container { | ||
| height: 100vh; | ||
| padding: 0; | ||
| position: relative; | ||
| } | ||
|
|
||
| .map-container > div { | ||
| height: 100%; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .ol-map { | ||
| width: 100%; | ||
| height: 100%; | ||
| min-height: 500px; | ||
| } | ||
|
|
||
| .ol-viewport { | ||
| border-radius: 0; | ||
| } | ||
|
|
||
| .sidebar { | ||
| background: white; | ||
| height: 100vh; | ||
| overflow-y: auto; | ||
| padding: 1rem; | ||
| box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1); | ||
| } | ||
|
|
||
| .nav-tabs { | ||
| margin-bottom: 1rem; | ||
| } | ||
|
|
||
| .nav-tabs .nav-link { | ||
| color: #667eea; | ||
| font-weight: 500; | ||
| } | ||
|
|
||
| .nav-tabs .nav-link.active { | ||
| background-color: #667eea; | ||
| color: white; | ||
| border-color: #667eea; | ||
| } | ||
|
|
||
| .tab-content { | ||
| padding: 1rem 0; | ||
| } | ||
|
|
||
| @media (max-width: 768px) { | ||
| .map-container { | ||
| height: 50vh; | ||
| } | ||
|
|
||
| .sidebar { | ||
| height: 50vh; | ||
| } | ||
|
|
||
| .app-header h1 { | ||
| font-size: 1.2rem; | ||
| } | ||
| } | ||
|
|
||
| .ol-popup { | ||
| position: absolute; | ||
| background-color: white; | ||
| padding: 10px; | ||
| border-radius: 8px; | ||
| border: 1px solid #ccc; | ||
| box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); | ||
| font-size: 14px; | ||
| min-width: 150px; | ||
| z-index: 1000; | ||
| } | ||
|
|
||
| .ol-popup:before { | ||
| content: ''; | ||
| position: absolute; | ||
| bottom: -10px; | ||
| left: 50%; | ||
| transform: translateX(-50%); | ||
| border-width: 10px 10px 0; | ||
| border-style: solid; | ||
| border-color: white transparent transparent; | ||
| } | ||
|
|
||
| .ol-popup button { | ||
| margin-top: 8px; | ||
| padding: 5px 10px; | ||
| background-color: #667eea; | ||
| color: white; | ||
| border: none; | ||
| border-radius: 4px; | ||
| cursor: pointer; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .ol-popup button:hover { | ||
| background-color: #5a67d8; | ||
| } | ||
|
|
||
| .station-search .station-item { | ||
| cursor: pointer; | ||
| transition: background-color 0.2s; | ||
| } | ||
|
|
||
| .station-search .station-item:hover { | ||
| background-color: #f8f9fa; | ||
| } | ||
|
|
||
| .schedule-item { | ||
| transition: background-color 0.2s; | ||
| } | ||
|
|
||
| .schedule-item:hover { | ||
| background-color: #f8f9fa; | ||
| } | ||
|
|
||
| .route-results { | ||
| margin-top: 1rem; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Комментарии в целом можно удалить и тег
<noscript>