diff --git a/.gitignore b/.gitignore index 4b3d9eb..9ce5739 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,26 @@ node_modules package-lock.json -.env \ No newline at end of file +.env# 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* diff --git a/index.js b/index.js deleted file mode 100644 index a02e4f6..0000000 --- a/index.js +++ /dev/null @@ -1,87 +0,0 @@ -const Express = require('express') -const app = Express() -const port = (process.env.PORT || 3030) - -const axios = require('axios') -require('dotenv').config() - -const favicon = require('serve-favicon'); -app.use(favicon(__dirname + '/public/favicon.ico')); - -const hbs = require('hbs') - -hbs.registerPartials(__dirname + '/views/partials') -app.set('view engine', 'hbs') - -app.use(Express.static('public')); - -app.get('/', (req, res) => { - res.render('index') -}) - -app.get('/auth', async (req, res) => { - - async function requestAccessToken() { - try { - const reqData = { - code: req.query.code, - grant_type: "authorization_code", - redirect_uri: "https://telegram-to-notion.herokuapp.com/auth" - } - - const auth = { - Authorization: "Basic " + Buffer.from(`${process.env.NOTION_INTEGRATION_ID}:${process.env.NOTION_INTEGRATION_SECRET}`).toString('base64') - } - - console.log(auth) - - const response = await axios({ - method: "POST", - url: "https://api.notion.com/v1/oauth/token", - data: reqData, - auth: { - username: Buffer.from(process.env.NOTION_INTEGRATION_ID.toString('base64')), - password: Buffer.from(process.env.NOTION_INTEGRATION_SECRET.toString('base64')) - } //THANK YOU https://stackoverflow.com/questions/67534080/notion-api-invalid-client-oauth-integration/68699544#68699544?newreg=949504cf865c4a52b2c0ce7afe936c9b - }) - - console.log(response.status) //400 in positive case - console.log(response.data) - - /** - * access_token: string, - * token_type: string, - * bot_id: string, - * workspace_name: string, - * workspace_icon: string, - * workspace_id: string - */ - - return response - } - catch (error) { - console.log("error") - console.log(error) - - return {status: 400} - } - } - - const response = await requestAccessToken() - - res.render('auth', { - name: "fran", - success: response.status === 200 ? true : false, - data: response.data - }) -}) - -app.get('/privacy-policy', (req, res) => { - res.render('privacy-policy') -}) - -app.get('/terms-of-use', (req, res) => { - res.render('terms-of-use') -}) - -app.listen(port, () => console.log('port', port)) \ No newline at end of file diff --git a/package.json b/package.json index 1ac8c52..120fc85 100644 --- a/package.json +++ b/package.json @@ -1,29 +1,38 @@ { "name": "telegram-to-notion-website", - "version": "1.0.0", - "description": "Website for the Telegram to Notion Bot", - "main": "index.js", - "scripts": { - "dev": "nodemon index.js", - "start": "node index.js" - }, - "keywords": [ - "telegram", - "notion", - "bot", - "website" - ], - "author": "FranP-Code", - "license": "ISC", - "devDependencies": { - "nodemon": "^2.0.15" - }, + "version": "0.1.0", + "private": true, "dependencies": { - "axios": "^0.26.1", - "dotenv": "^16.0.0", - "express": "^4.17.3", - "hbs": "^4.2.0", - "path": "^0.12.7", - "serve-favicon": "^2.5.0" + "@testing-library/jest-dom": "^5.16.4", + "@testing-library/react": "^13.0.1", + "@testing-library/user-event": "^13.5.0", + "react": "^18.0.0", + "react-dom": "^18.0.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" + ] } } diff --git a/public/css/auth.css b/public/css/auth.css deleted file mode 100644 index f5a785c..0000000 --- a/public/css/auth.css +++ /dev/null @@ -1,29 +0,0 @@ -.request-success { - - display: flex; - align-items: center; - - background-color: #ffebcd; - - padding: 3vh 0px 3vh 2vw; - - user-select: all; - -webkit-user-select: all; -} - -.request-success code { - overflow-wrap: anywhere; -} - -.request-success img { - - width: 50px; - - margin-right: 3vw; - - user-select: none; -} - -.request-error { - color: rgb(143, 0, 0) -} \ No newline at end of file diff --git a/public/css/global.css b/public/css/global.css deleted file mode 100644 index c20e0a9..0000000 --- a/public/css/global.css +++ /dev/null @@ -1,21 +0,0 @@ -html, body { - margin: 0; - padding: 0; -} - -body { - margin: 0vh 3vw; - font-family: 'Be Vietnam Pro', sans-serif; -} - -#beta-banner { - background-color: #F38181; - color: #393E46; - - padding: 2vh 0.5vw; - margin: 0px -3vw; -} - -#beta-banner p { - margin: 0; -} \ No newline at end of file diff --git a/public/css/index.css b/public/css/index.css deleted file mode 100644 index 2a346e1..0000000 --- a/public/css/index.css +++ /dev/null @@ -1,26 +0,0 @@ -.main { - display: flex; - flex-direction: column; -} - -.button { - width: fit-content; - - background-color: #4797ff; - color: #fff; - - padding: 2vh 5vw; - - border-radius: 5px; - - text-decoration: none; - font-weight: bold; -} - -ul { - margin-top: 5vh; -} -ul li{ - font-size: 20pt; - font-weight: bold; -} \ No newline at end of file diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index b69e332..0000000 Binary files a/public/favicon.ico and /dev/null differ diff --git a/public/img/auth_copy.svg b/public/img/auth_copy.svg deleted file mode 100644 index 2eb127c..0000000 --- a/public/img/auth_copy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..aa069f2 --- /dev/null +++ b/public/index.html @@ -0,0 +1,43 @@ + + +
+ + + + + + + + + +
-
-Right now is on **beta version**, because it haves all the features needed but it needs a little more of styling in the differents pages.
-
-## Link
-
-**[Here](https://telegram-to-notion.herokuapp.com) you can visit it**
-
-## Credits
-
-- Copy icon from [feather](https://feathericons.com)
-- Main font is [Be Vietnam Pro](https://fonts.google.com/specimen/Be+Vietnam+Pro)
-
-## Additional
-
-Dont forget to check also the [Telegram to Notion Bot](https://github.com/FranP-code/Telegram-to-Notion-Bot) repository.
diff --git a/src/App.js b/src/App.js
new file mode 100644
index 0000000..d7991e6
--- /dev/null
+++ b/src/App.js
@@ -0,0 +1,8 @@
+function App() {
+ return (
+ <>
+ >
+ );
+}
+
+export default App;
\ No newline at end of file
diff --git a/src/index.js b/src/index.js
new file mode 100644
index 0000000..5d4fdcf
--- /dev/null
+++ b/src/index.js
@@ -0,0 +1,16 @@
+import React from 'react';
+import ReactDOM from 'react-dom/client';
+import App from './App';
+import reportWebVitals from './reportWebVitals';
+
+const root = ReactDOM.createRoot(document.getElementById('root'));
+root.render(
+ {{data.access_token}}
-