DongyoungKwon

Fix a bug that occurred when multiple people use

# Teleprompter-SST
# Teleprompter-STT
## Table of Contents
- [ν”„λ‘œμ νŠΈ μ†Œκ°œ](#-ν”„λ‘œμ νŠΈ-μ†Œκ°œ)
- [μ£Όμš” κΈ°λŠ₯](#-μ£Όμš”-κΈ°λŠ₯)
- [Directory ꡬ쑰](#-directory-ꡬ쑰)
- [μ„€μΉ˜ 방법](#-μ„€μΉ˜-방법)
- [νŒ€μ›](#-νŒ€μ›)
- [Reference](#-reference)
- [License](#-license)
## πŸŽ™ ν”„λ‘œμ νŠΈ μ†Œκ°œ
- μŒμ„±μ— 맞좰 λŒ€λ³Έμ„ 화면에 μ‹€μ‹œκ°„μœΌλ‘œ 좜λ ₯ν•˜λŠ” 프둬프터 μ„œλΉ„μŠ€
- Untactμ‹œλŒ€μ— ν™”μƒνšŒμ˜μ—μ„œ νŽΈν•˜κ²Œ λ°œν‘œν•  수 μžˆλ„λ‘ λ„μ™€μ£ΌλŠ” μ„œλΉ„μŠ€
## πŸ“œ μ£Όμš”κΈ°λŠ₯
- [**Web Speech API**](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API) && [**String-Similarity API**](https://www.npmjs.com/package/string-similarity) μ‚¬μš©
## πŸ“œ μ£Όμš” κΈ°λŠ₯
- [**Web Speech API**](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API) && [**string-similarity API**](https://www.npmjs.com/package/string-similarity) μ‚¬μš©
- Real-time Script Output
## πŸ—‚ Directory ꡬ쑰
```bash
Teleprompter-SST
Teleprompter-STT
β”œβ”€β”€ client ---> Front-end [React]
β”‚ β”œβ”€β”€ public ---> 정적 파일 보관
β”‚ β”‚ β”œβ”€β”€ favicon.ico
β”‚ β”‚ β”œβ”€β”€ index.html
β”‚ β”‚ β”œβ”€β”€ manifest.json
β”‚ β”‚ └── robots.txt
......@@ -38,50 +45,71 @@ Teleprompter-SST
β”‚ β”‚ └── styles.js ---> PrompterPage.js Style
β”‚ β”œβ”€β”€ .gitignore
β”‚ β”œβ”€β”€ package-lock.json
β”‚ β”œβ”€β”€ package.json
β”‚ └── yarn.lock
β”‚ └── package.json
β”‚
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE ---> MIT License
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
β”œβ”€β”€ README.md
β”œβ”€β”€ server.js ---> Back-end [Node Express]
└── yarn.lock
└── server.js ---> Back-end [Node.js Express]
```
## :keyboard: μ„€μΉ˜ 방법
#### ☝️ React & Express μ„œλ²„ λ™μ‹œ ꡬ동 (Local Server둜 λ™μž‘)
##### client 폴더 이동
`$ cd Teleprompter-STT/client`
##### React에 ν•„μš”ν•œ λͺ¨λ“ˆ μ„€μΉ˜
`$ npm install`
##### Teleprompter-STT 폴더 이동
`$ cd ..`
##### Node.js에 ν•„μš”ν•œ λͺ¨λ“ˆ μ„€μΉ˜
`$ npm install`
## ⌨️ μ„€μΉ˜ 방법
##### React & Express μ„œλ²„ λ™μ‹œ μ‹œμž‘
`$ npm run dev`
<br>
#### ✌️ Express μ„œλ²„λ‘œλ§Œ ꡬ동 (Heroku둜 배포 κ°€λŠ₯)
#### client 폴더 이동
`$ cd Teleprompter-SST/client`
##### client 폴더 이동
`$ cd Teleprompter-STT/client`
#### package.json에 λͺ…μ‹œλœ λͺ¨λ“ˆ μ„€μΉ˜
##### React에 ν•„μš”ν•œ λͺ¨λ“ˆ μ„€μΉ˜
`$ npm install`
#### Teleprompter-SST 폴더 이동
##### Build File 생성
`$ npm run build`
##### Teleprompter-STT 폴더 이동
`$ cd ..`
#### package.json에 λͺ…μ‹œλœ λͺ¨λ“ˆ μ„€μΉ˜
##### Node.js에 ν•„μš”ν•œ λͺ¨λ“ˆ μ„€μΉ˜
`$ npm install`
#### μ‹œμž‘
##### Express μ„œλ²„ μ‹œμž‘
`$ npm run server`
#### Local Address 접속
`http://localhost:3000`
## πŸ§‘β€πŸ’» νŒ€μ›
## πŸ‘₯ νŒ€μ›
- κΆŒλ™μ˜ (2016110307)
- 김닀솔 (2017110268)
## πŸ“‹ Reference
- [**Web Speech API**](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API)
- [**String-Similarity API**](https://www.npmjs.com/package/string-similarity)
- [**string-similarity API**](https://www.npmjs.com/package/string-similarity)
- [**Material-Ui**](https://material-ui.com/)
## πŸ“‹ License
Teleprompter-SST is [MIT licensed](./LICENSE).
\ No newline at end of file
Teleprompter-STT is [MIT licensed](./LICENSE).
<br>
[πŸ‘†Back To The Top](#teleprompter-stt)
\ No newline at end of file
......
{
"name": "teleprompter-frontend",
"version": "0.1.0",
"name": "teleprompter-stt-frontend",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "teleprompter-frontend",
"version": "0.1.0",
"name": "teleprompter-stt-frontend",
"version": "1.0.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.0",
......
......@@ -17,4 +17,4 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
</html>
\ No newline at end of file
......
......@@ -35,4 +35,4 @@
to {
transform: rotate(360deg);
}
}
}
\ No newline at end of file
......
......@@ -9,7 +9,7 @@ class App extends Component {
return (
<>
<Route path="/" component={MainPage} exact={true} />
<Route path="/prompter:script" component={PrompterPage} exact={true} />
<Route path="/prompter" component={PrompterPage} exact={true} />
</>
);
}
......
@import url(http://fonts.googleapis.com/earlyaccess/notosanskr.css);
@import url(https://fonts.googleapis.com/earlyaccess/notosanskr.css);
body {
margin: 0;
......
......@@ -70,7 +70,7 @@ class MainPage extends Component {
this.setState({
script: ''
})
this.props.history.push(`/prompter:${this.script}`);
this.props.history.push('/prompter');
}
// Send script to Server
......
import React, { Fragment } from 'react';
import React, { Fragment, useEffect } from 'react';
import axios from 'axios'
import { withStyles, Button} from '@material-ui/core';
import {
......@@ -21,14 +21,16 @@ function PrompterPage({match}) {
const [progress, setProgress] = React.useState(0);
// Serverλ‘œλΆ€ν„° Script λ°›μ•„μ˜΄
axios.get(`api/${match.params["script"].slice(1)}`)
.then(res => { // .then : 응닡(μƒνƒœμ½”λ“œ200~300미만)μ„±κ³΅μ‹œ
console.log(res.data);
setWords(res.data.split(" ")); // λ°›μ•„μ˜¨ Script λ¬Έμžμ—΄ 처리
})
.catch(error => {
console.log(error);
});
useEffect(() => {
axios.get('api/script')
.then(res => { // .then : 응닡(μƒνƒœμ½”λ“œ200~300미만)μ„±κ³΅μ‹œ
console.log(res.data);
setWords(res.data.split(" ")); // λ°›μ•„μ˜¨ Script λ¬Έμžμ—΄ 처리
})
.catch(error => {
console.log(error);
});
}, [match.params]);
const handleListening = () => {
if (listening) {
......
This diff is collapsed. Click to expand it.
......@@ -5,9 +5,9 @@
"main": "index.js",
"scripts": {
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client",
"client": "cd client && yarn start",
"client": "cd client && npm run start",
"server": "nodemon server.js",
"dev": "concurrently --kill-others-on-fail \"yarn server\" \"yarn client\""
"dev": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\""
},
"repository": {
"type": "git",
......
......@@ -13,14 +13,14 @@ let scriptReceived = "";
app.get('/api/:script', (req, res) => {
res.send(
scriptReceived
)
);
});
app.post('/api/:script', (req, res) => {
scriptReceived = req.body.script;
});
app.use(express.static(path.join(__dirname, './client/build'))); // μ •μ νŒŒμΌλ‘œ 바꿔진 React[front-end]λ₯Ό Express μ„œλ²„λ‘œ μ‚¬μš©ν•˜μ—¬ 기쑴의 2개의 μ„œλ²„λ‘œ μš΄μ˜ν•˜λŠ” 것을 ν•˜λ‚˜μ˜ μ„œλ²„λ‘œ μ‚¬μš©ν•  수 μžˆλ„λ‘ ν•΄μ€Œ
app.use(express.static(path.join(__dirname, './client/build'))); // μ •μ νŒŒμΌλ‘œ 바꿔진 React[front-end]λ₯Ό Express μ„œλ²„λ‘œλ§Œ μ΄μš©ν•  수 μžˆλ„λ‘ ν•΄μ€Œ
app.get('*', (req, res, next)=>{
res.sendFile(path.join(__dirname, "./client/build", "index.html"));
......