diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 6232158..557ee19 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -64,3 +64,45 @@ jobs: - name: Restart Node 2 run: | curl -X POST ${{ secrets.WEBHOOK_DOMAIN }}/hooks/restart-app-2 + + + - name: Setup Node.js environment + uses: actions/setup-node@v2.4.1 + + - name: Discord Webhook for Main + if: github.ref == 'refs/heads/main' + run: | + PACKAGE_VERSION=$(node -p "require('./package.json').version") + COMMIT_LINK="https://github.com/${{ github.repository }}/commit/${{ github.sha }}" + curl -X POST ${{ secrets.DISCORD_WEBHOOK }} \ + -H "Content-Type: application/json" \ + -d '{ + "embeds": [{ + "title": "New Production Version deployed on solun.pm", + "url": "https://solun.pm", + "description": "[Changes]('$COMMIT_LINK')", + "fields": [ + { "name": "Version", "value": "'$PACKAGE_VERSION'", "inline": false } + ], + "color": 255 + }] + }' + + - name: Discord Webhook for Dev + if: github.ref == 'refs/heads/dev' + run: | + PACKAGE_VERSION=$(node -p "require('./package.json').version") + COMMIT_LINK="https://github.com/${{ github.repository }}/commit/${{ github.sha }}" + curl -X POST ${{ secrets.DISCORD_WEBHOOK }} \ + -H "Content-Type: application/json" \ + -d '{ + "embeds": [{ + "title": "New Development Version deployed on dev.solun.pm", + "url": "https://dev.solun.pm", + "description": "[Changes]('$COMMIT_LINK')", + "fields": [ + { "name": "Version", "value": "'$PACKAGE_VERSION'", "inline": false } + ], + "color": 16753920 + }] + }' diff --git a/app/file/page.tsx b/app/file/page.tsx index 3b6a03f..b7cbece 100644 --- a/app/file/page.tsx +++ b/app/file/page.tsx @@ -115,7 +115,6 @@ function UploadFile() { const passwordSet = password !== ""; const encrypted_password = passwordSet ? await hashPassword(password) : null; - if (files.length > 0) { const formData = new FormData(); formData.append('file', files[0]); @@ -143,7 +142,7 @@ function UploadFile() { setUploadLink(data.link); setUploadCreated(true); } else { - alert(data.message); + toast.error(data.message); } } catch (err) { toast.error('There was an error uploading your file'); diff --git a/app/msg/[...data]/page.tsx b/app/msg/[...data]/page.tsx index 5c4e380..a95b7c4 100644 --- a/app/msg/[...data]/page.tsx +++ b/app/msg/[...data]/page.tsx @@ -69,11 +69,15 @@ function ViewMessage({ params }: { params: { data: string[] } }) { async function handleViewMessage(secretKey: string) { setLoading(true); setError(""); - const data = { + + const data: any = { id, password, - secret: secretKey, }; + + if(secretKey === ""){ + data.secret = secretKey; + } const res = await fetch(process.env.NEXT_PUBLIC_API_DOMAIN + '/message/receive', { method: "POST", headers: { @@ -86,7 +90,7 @@ function ViewMessage({ params }: { params: { data: string[] } }) { toast.error(result.message); } else { const serect_key = result.secret || secretKey; - const decryptedMessage = await decrypt(result.message, serect_key); + const decryptedMessage = await decrypt(result.message, serect_key as string); setMessage(decryptedMessage); setShowMessage(true); diff --git a/app/msg/page.tsx b/app/msg/page.tsx index 72ea0f2..3e08ef9 100644 --- a/app/msg/page.tsx +++ b/app/msg/page.tsx @@ -109,7 +109,7 @@ function CreateMessage() { const passwordSet = password !== ""; const encrypted_password = passwordSet ? await hashPassword(password) : null; - const dbSecretKey = endToEndEncryption ? secret_key : null; + const dbSecretKey = endToEndEncryption ? null : secret_key; const data = { mid, @@ -133,7 +133,11 @@ function CreateMessage() { submitButton.innerHTML = 'Create'; } else { setMessageCreated(true); - setMessageLink(result.link); + let resultLink = result.link; + if (dbSecretKey === null) { + resultLink += `${secret_key}/`; + } + setMessageLink(resultLink); } } }; diff --git a/package-lock.json b/package-lock.json index c4ef049..79823f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "solun", - "version": "0.1.3", + "version": "0.3.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "solun", - "version": "0.1.3", + "version": "0.3.5", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.4.0", "@fortawesome/free-solid-svg-icons": "^6.4.0", diff --git a/package.json b/package.json index c8a327e..46d74cd 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,14 @@ { "name": "solun", - "version": "0.1.3", + "version": "0.3.5", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "next lint", + "version": "git add .", + "postversion": "git push" }, "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.4.0", diff --git a/robots.txt b/public/robots.txt similarity index 100% rename from robots.txt rename to public/robots.txt