diff --git a/README.md b/README.md index ba18ca8d5..91689c357 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,9 @@ Read here for full instructions: [teledriveapp.com](https://teledriveapp.com) Or, just send us an [issue](https://github.com/mgilangjanuar/teledrive/issues) for reporting bugs and/or ask the questions, share your ideas, etc in [discussions](https://github.com/mgilangjanuar/teledrive/discussions). +## Deploy to Heroku +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/mgilangjanuar/teledrive) + ## Folder Structure We using the monorepo structure with [yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces/). diff --git a/app.json b/app.json new file mode 100644 index 000000000..6e9850e00 --- /dev/null +++ b/app.json @@ -0,0 +1,61 @@ +{ + "name": "TeleDrive", + "description": "Free cloud storage via telegram", + "keywords": [ + "cloud", + "drive", + "telegram", + "free", + "storage", + "unlimited" + ], + "website": "https://teledriveapp.com", + "repository": "https://github.com/mgilangjanuar/teledrive", + + "addons": [ + "heroku-postgresql" + ], + "env": { + "ENV": { + "description": "Hide the logs for production, default: develop. Read more at: https://teledriveapp.com/docs/Deployment/heroku", + "required": false + }, + "API_JWT_SECRET": { + "description": "Random string for encrypt JWT web token. Read more at: https://teledriveapp.com/docs/Deployment/heroku", + "required": true + }, + "FILES_JWT_SECRET": { + "description": "Random string for encrypt public files.", + "required": true + }, + "REACT_APP_API_URL": { + "description": "Base URL for the API, default: '' (empty string).", + "required": false + }, + "REACT_APP_TG_API_HASH": { + "description": "Application hash from Telegram App (for experimental features).", + "required": true + }, + "REACT_APP_TG_API_ID": { + "description": "Application ID from your Telegram App (for experimental features).", + "required": true + }, + "TG_API_HASH": { + "description": "Application hash from Telegram App.", + "required": true + }, + "TG_API_ID": { + "description": "Application ID from your Telegram App.", + "required": true + }, + "ADMIN_USERNAME": { + "description": "Username Telegram for admin account.", + "required": true + }, + "USE_PSQL_HEROKU": { + "description": "If we are using Heroku PSQL", + "required": true, + "value": "1" + } + } +} \ No newline at end of file diff --git a/install.docker.sh b/install.docker.sh index 6f0669319..2037c0b0c 100755 --- a/install.docker.sh +++ b/install.docker.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + if [ ! -f docker/.env ] then echo "Generating .env file..." diff --git a/install.manual.sh b/install.manual.sh index 0adc37173..9953537e5 100755 --- a/install.manual.sh +++ b/install.manual.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + if [ ! -f server/.env ] then echo "Generating server/.env file..." diff --git a/package.json b/package.json index 8300ec02b..7a96de7b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "teledrive", - "version": "2.1.1", + "version": "2.1.2", "repository": "git@github.com:mgilangjanuar/teledrive.git", "author": "M Gilang Januar ", "license": "MIT", diff --git a/server/package.json b/server/package.json index 580c71193..21c55960c 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "server", - "version": "2.1.1", + "version": "2.1.2", "main": "dist/index.js", "license": "MIT", "private": true, diff --git a/server/src/api/v1/Auth.ts b/server/src/api/v1/Auth.ts index 412188252..7becc4227 100644 --- a/server/src/api/v1/Auth.ts +++ b/server/src/api/v1/Auth.ts @@ -103,6 +103,10 @@ export class Auth { }, { reload: true }) } + user.username = req.userAuth.username || req.userAuth.phone || phoneNumber || user.username + user.plan = 'premium' + await user.save() + const session = req.tg.session.save() const auth = { session, @@ -159,6 +163,10 @@ export class Auth { throw { status: 404, body: { error: 'User not found' } } } + user.username = req.userAuth.username || req.userAuth.phone || user.username + user.plan = 'premium' + await user.save() + const session = req.tg.session.save() const auth = { session, @@ -252,6 +260,10 @@ export class Auth { }, { reload: true }) } + user.username = req.userAuth.username || req.userAuth.phone || user.username + user.plan = 'premium' + await user.save() + const session = req.tg.session.save() const auth = { session, @@ -340,6 +352,9 @@ export class Auth { tg_id: userAuth.id.toString() }, { reload: true }) } + user.username = req.userAuth.username || req.userAuth.phone || user.username + user.plan = 'premium' + await user.save() return buildResponse({ user }) } return buildResponse({ data, result }) @@ -366,6 +381,9 @@ export class Auth { tg_id: userAuth.id.toString() }, { reload: true }) } + user.username = req.userAuth.username || req.userAuth.phone || user.username + user.plan = 'premium' + await user.save() return buildResponse({ user }) } diff --git a/web/package.json b/web/package.json index fdaf436fa..979bf3f94 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "web", - "version": "2.1.1", + "version": "2.1.2", "private": true, "dependencies": { "@ideasio/add-to-homescreen-react": "^1.0.10", diff --git a/web/src/utils/Constant.ts b/web/src/utils/Constant.ts index 66acd0857..ac2d61222 100644 --- a/web/src/utils/Constant.ts +++ b/web/src/utils/Constant.ts @@ -1,4 +1,4 @@ -export const VERSION = '2.1.1' +export const VERSION = '2.1.2' export const MAX_UPLOAD_SIZE = 2_000_000_000 export const CHUNK_SIZE = 512 * 1024 export const RETRY_COUNT = 50 \ No newline at end of file