Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #247 from mgilangjanuar/staging
Browse files Browse the repository at this point in the history
Release v1.8.7
  • Loading branch information
mgilangjanuar authored Feb 4, 2022
2 parents 3219a94 + 5835fa5 commit 5a27186
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 288 deletions.
246 changes: 3 additions & 243 deletions .github/workflows/build-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ env:
DEV_USER: root
DEV_HOST_SG_1: 159.223.92.212
DEV_HOST_SG_2: 10.104.0.2
DEV_HOST_GE_DB: 104.248.23.115
DEV_HOST_GE_1: 159.89.108.133
DEV_HOST_GE_2: 165.227.157.185
DEV_HOST_US_DB: 159.223.111.175
DEV_HOST_US_1: 143.198.114.6
DEV_HOST_GE_1: 104.248.23.115
DEV_HOST_US_1: 159.223.111.175

jobs:
build:
Expand Down Expand Up @@ -313,243 +310,6 @@ jobs:
message: 🔥 Deploy to GE_1 Failed!
format: markdown

ge2:
name: Upload & Deploy to GE2
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2

- run: mv build-root/build-root.tar.gz . && mv build-server/build-server.tar.gz . && mv build-web/build-web.tar.gz .

# Upload to GE_2
- name: Upload build-root.tar.gz to ge_2
uses: appleboy/scp-action@master
with:
source: build-root.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST_GE_2 }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
debug: true
- name: Upload build-server.tar.gz to ge_2
uses: appleboy/scp-action@master
with:
source: build-server.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST_GE_2 }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Upload build-web.tar.gz to ge_2
uses: appleboy/scp-action@master
with:
source: build-web.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST_GE_2 }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}

# Deployment GE_2
- name: Extract build-root.tar.gz to ge_2
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }} && rm -rf node_modules && tar -xzf build-root.tar.gz && rm -rf build-root.tar.gz
host: ${{ env.DEV_HOST_GE_2 }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Extract build-web.tar.gz to ge_2
if: ${{ github.event_name == 'push' }}
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }}/web && rm -rf node_modules && rm -rf build && cd .. && tar -xzf build-web.tar.gz && rm -rf build-web.tar.gz
host: ${{ env.DEV_HOST_GE_2 }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Extract build-server.tar.gz to ge_2
if: ${{ github.event_name == 'push' }}
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }}/server && rm -rf node_modules && rm -rf dist && cd .. && tar -xzf build-server.tar.gz && rm -rf build-server.tar.gz && git pull origin main --rebase && cd ${{ env.APP_DIR }} && /usr/local/bin/pm2 restart td
host: ${{ env.DEV_HOST_GE_2 }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}

# Notification
- name: Success Notification
uses: appleboy/telegram-action@master
with:
to: -700697945
token: ${{ secrets.TG_BOT_TOKEN }}
message: 🎉 Deployed to GE_2
format: markdown
- name: Failed Notification
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: -700697945
token: ${{ secrets.TG_BOT_TOKEN }}
message: 🔥 Deploy to GE_2 Failed!
format: markdown

gedb:
name: Upload & Deploy to GEDB
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2

- run: mv build-root/build-root.tar.gz . && mv build-server/build-server.tar.gz . && mv build-web/build-web.tar.gz .

# Upload to GE_DB
- name: Upload build-root.tar.gz to ge_db
uses: appleboy/scp-action@master
with:
source: build-root.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST_GE_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
debug: true
- name: Upload build-server.tar.gz to ge_db
uses: appleboy/scp-action@master
with:
source: build-server.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST_GE_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Upload build-web.tar.gz to ge_db
uses: appleboy/scp-action@master
with:
source: build-web.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST_GE_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}

# Deployment GE_DB
- name: Extract build-root.tar.gz to ge_db
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }} && rm -rf node_modules && tar -xzf build-root.tar.gz && rm -rf build-root.tar.gz
host: ${{ env.DEV_HOST_GE_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Extract build-web.tar.gz to ge_db
if: ${{ github.event_name == 'push' }}
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }}/web && rm -rf node_modules && rm -rf build && cd .. && tar -xzf build-web.tar.gz && rm -rf build-web.tar.gz
host: ${{ env.DEV_HOST_GE_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Extract build-server.tar.gz to ge_db
if: ${{ github.event_name == 'push' }}
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }}/server && rm -rf node_modules && rm -rf dist && cd .. && tar -xzf build-server.tar.gz && rm -rf build-server.tar.gz && git pull origin main --rebase && cd ${{ env.APP_DIR }} && /usr/local/bin/pm2 restart td
host: ${{ env.DEV_HOST_GE_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}

# Notification
- name: Success Notification
uses: appleboy/telegram-action@master
with:
to: -700697945
token: ${{ secrets.TG_BOT_TOKEN }}
message: 🎉 Deployed to GE_DB
format: markdown
- name: Failed Notification
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: -700697945
token: ${{ secrets.TG_BOT_TOKEN }}
message: 🔥 Deploy to GE_DB Failed!
format: markdown

usdb:
name: Upload & Deploy to USDB
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2

- run: mv build-root/build-root.tar.gz . && mv build-server/build-server.tar.gz . && mv build-web/build-web.tar.gz .

# Upload to US_DB
- name: Upload build-root.tar.gz to us_db
uses: appleboy/scp-action@master
with:
source: build-root.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST_US_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
debug: true
- name: Upload build-server.tar.gz to us_db
uses: appleboy/scp-action@master
with:
source: build-server.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST_US_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Upload build-web.tar.gz to us_db
uses: appleboy/scp-action@master
with:
source: build-web.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST_US_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}

# Deployment US_DB
- name: Extract build-root.tar.gz to us_db
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }} && rm -rf node_modules && tar -xzf build-root.tar.gz && rm -rf build-root.tar.gz
host: ${{ env.DEV_HOST_US_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Extract build-web.tar.gz to us_db
if: ${{ github.event_name == 'push' }}
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }}/web && rm -rf node_modules && rm -rf build && cd .. && tar -xzf build-web.tar.gz && rm -rf build-web.tar.gz
host: ${{ env.DEV_HOST_US_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Extract build-server.tar.gz to us_db
if: ${{ github.event_name == 'push' }}
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }}/server && rm -rf node_modules && rm -rf dist && cd .. && tar -xzf build-server.tar.gz && rm -rf build-server.tar.gz && git pull origin main --rebase && cd ${{ env.APP_DIR }} && /usr/local/bin/pm2 restart td
host: ${{ env.DEV_HOST_US_DB }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}

# Notification
- name: Success Notification
uses: appleboy/telegram-action@master
with:
to: -700697945
token: ${{ secrets.TG_BOT_TOKEN }}
message: 🎉 Deployed to US_DB
format: markdown
- name: Failed Notification
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: -700697945
token: ${{ secrets.TG_BOT_TOKEN }}
message: 🔥 Deploy to US_DB Failed!
format: markdown

us1:
name: Upload & Deploy to US1
needs: build
Expand Down Expand Up @@ -627,4 +387,4 @@ jobs:
to: -700697945
token: ${{ secrets.TG_BOT_TOKEN }}
message: 🔥 Deploy to US_1 Failed!
format: markdown
format: markdown
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "teledrive",
"version": "1.8.6",
"version": "1.8.7",
"repository": "git@github.com:mgilangjanuar/teledrive.git",
"author": "M Gilang Januar <mgilangjanuar@gmail.com>",
"author": "M Gilang Januar <mgilangjanuar@teledriveapp.com>",
"license": "MIT",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "server",
"version": "1.8.6",
"version": "1.8.7",
"main": "dist/index.js",
"license": "MIT",
"private": true,
Expand Down
10 changes: 5 additions & 5 deletions server/src/api/v1/Documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ When this Policy mentions "We", "Us," and "Our" it refers to TeleDrive and its s
This Privacy Policy is governed by our [Terms of Services](https://teledriveapp.com/terms).
For any questions regarding this Policy or any requests regarding the processing of personal data, please contact us at mgilangjanuar@gmail.com.
For any questions regarding this Policy or any requests regarding the processing of personal data, please contact us at support@teledriveapp.com.
## 1. INFORMATION WE COLLECT FROM YOU
We collect the information You provide to us and this information is necessary for the adequate performance of the contractual arrangement which is in place between You and us and allow us to comply with our legal obligations.
Expand Down Expand Up @@ -90,7 +90,7 @@ We will retain your personal information as long as we need it to provide servic
We have implemented security measures designed to protect the personal information you share with us, including physical, electronic and procedural measures. Among other things, we regularly monitor our systems for possible vulnerabilities and attacks.
Regardless of the measures and efforts taken by us, the transmission of information via internet, email or text message is not completely secure. We do not guarantee the absolute protection and security of your personal information.
We therefore encourage you to avoid providing us or anyone with any sensitive information of which you believe its disclosure could cause you substantial or irreparable harm.
If you have any questions regarding the security of our Site or Services, you are welcome to contact us at mgilangjanuar@gmail.com.
If you have any questions regarding the security of our Site or Services, you are welcome to contact us at security@teledriveapp.com.
## 10. YOUR RIGHTS
Expand Down Expand Up @@ -247,7 +247,7 @@ If you have any questions about this Agreement, please contact us by email or re
TeleDrive
South Jakarta, Indonesia
Indonesia
mgilangjanuar@gmail.com` })
support@teledriveapp.com` })
}

@Endpoint.GET()
Expand All @@ -257,7 +257,7 @@ mgilangjanuar@gmail.com` })
All our clients are very important to us, that's why TeleDrive ("Company"), has created the following Refund Policy to let You know how we handle the refunds for the goods ordered and bought on our website https://teledriveapp.com ("Website").
The terms "You," "Your," and "Yours" refer to the entity/ person/ organization using our Website. When this Policy mentions "we", "us,", and "our" it refers to the Company and its subsidiaries or /and affiliates. The term "goods" refer to any product or item bought on our Website by You.
This Refund Policy is governed by our [Terms of Services](https://teledriveapp.com/terms).
For any questions regarding this Refund Policy or any requests regarding the refunds and returns, please contact us by email mgilangjanuar@gmail.com, phone +6289676721188 or other contacts provided below.
For any questions regarding this Refund Policy or any requests regarding the refunds and returns, please contact us by email refund@teledriveapp.com or other contacts provided below.
You have the right, without giving a reason, to return the goods within 14 days, if it has not been used, damaged or its appearance has not substantially changed, that is, the appearance of the product or its packaging has been made only such alterations as were necessary to inspect the goods received.
The right to withdraw from a distance contract within 14 days without giving a reason does not apply to legal persons (e.g. companies, entrepreneurs).
This Return policy does not limit Your statutory rights to withdraw or rights You may have in relation to incorrect, damaged or defective goods.
Expand All @@ -275,7 +275,7 @@ If You fail to meet the deadlines of our Return policy, we will be unable to off
## Defective goods
In certain cases, such as defective, damaged or wrong goods, you may be required to provide evidence of the issue, such as a photo or video, or to return the item to receive a refund.
You must contact our company at mgilangjanuar@gmail.com within 14 days upon purchase and provide detailed information, such as:
You must contact our company at refund@teledriveapp.com within 14 days upon purchase and provide detailed information, such as:
- Proof of purchase
- Order number
Expand Down
34 changes: 32 additions & 2 deletions server/src/api/v1/Files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export class Files {

@Endpoint.POST('/upload/:id?', { middlewares: [Auth, multer().single('upload')] })
public async upload(req: Request, res: Response): Promise<any> {
const { name, size, mime_type: mimetype, parent_id: parentId, total_part: totalPart, part } = req.query as Record<string, string>
const { name, size, mime_type: mimetype, parent_id: parentId, relative_path: relativePath, total_part: totalPart, part } = req.query as Record<string, string>

if (!name || !size || !mimetype || !part || !totalPart) {
throw { status: 400, body: { error: 'Name, size, mimetype, part, and total part are required' } }
Expand Down Expand Up @@ -397,14 +397,44 @@ export class Files {
type = 'unknown'
}

let currentParentId = parentId
if (relativePath) {
const paths = relativePath.split('/').slice(0, -1) || []
for (const i in paths) {
const path = paths[i]
const findFolder = await Model.createQueryBuilder('files')
.where(`type = :type and name = :name and user_id = :user_id and parent_id ${currentParentId ? '= :parent_id' : 'is null'}`, {
type: 'folder',
name: path,
user_id: req.user.id,
parent_id: currentParentId
})
.getOne()
if (findFolder) {
currentParentId = findFolder.id
} else {
const newFolder = new Model()
newFolder.name = path
newFolder.type = 'folder'
newFolder.user_id = req.user.id
newFolder.mime_type = 'teledrive/folder'
if (currentParentId) {
newFolder.parent_id = currentParentId
}
await newFolder.save()
currentParentId = newFolder.id
}
}
}

model = new Model()
model.name = name,
model.mime_type = mimetype
// model.size = '0'
model.size = size
model.user_id = req.user.id
model.type = type
model.parent_id = parentId as string || null
model.parent_id = currentParentId || null
model.upload_progress = 0
model.file_id = bigInt.randBetween('-1e100', '1e100').toString()
await model.save()
Expand Down
2 changes: 1 addition & 1 deletion server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const rateLimiter = new RateLimiterPostgres({
app.get('/ping', (_, res) => res.send({ pong: true }))
app.get('/security.txt', (_, res) => {
res.setHeader('Content-Type', 'text/plain')
res.send('Contact: mgilangjanuar+tdsecurity@gmail.com\nPreferred-Languages: en, id')
res.send('Contact: security@teledriveapp.com\nPreferred-Languages: en, id')
})
app.use('/api', (req, res, next) => {
rateLimiter.consume(req.headers['cf-connecting-ip'] as string || req.ip).then(() => next()).catch(error => {
Expand Down
Loading

0 comments on commit 5a27186

Please sign in to comment.