Merge branch 'staging' of https://github.com/OpenSignLabs/OpenSign into raktima-opensignlabs-patch-12

This commit is contained in:
RaktimaNXG
2024-08-13 17:00:15 +05:30
27 changed files with 54291 additions and 17904 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ PUBLIC_URL=http://localhost:3000
# Set it to true if you want to generate the Sourcemap for debugging
GENERATE_SOURCEMAP=false
# Set it to the URL from where APIs will be accessible, for local development it should be localhost:3000/api/app (use your local port number instead)
REACT_APP_SERVERURL=http://localhost:8080/app
# REACT_APP_SERVERURL=http://localhost:8080/app
# A 12 character long random app identifier. The value of this should be same as APP_ID which is a variable used by backend API.
REACT_APP_APPID=opensign
@@ -46,7 +46,7 @@ USE_LOCAL=true
MAILGUN_API_KEY=
MAILGUN_DOMAIN=mail.yourdomain.com
MAILGUN_SENDER=postmaster@mail.yourdomain.com
SMTP_ENABLE=
SMTP_ENABLE=true
SMTP_HOST=smtp.yourhost.com
SMTP_PORT=443
SMTP_USER_EMAIL=mailer@yourdomain.com
+1 -1
View File
@@ -2,7 +2,7 @@ name: ci
on:
push:
branches:
- 'staging'
- 'main'
jobs:
docker:
+7
View File
@@ -0,0 +1,7 @@
{$HOST_URL} {
reverse_proxy client:3000
handle_path /app/* {
reverse_proxy server:8080
rewrite * /app{uri}
}
}
+4 -2
View File
@@ -1,8 +1,10 @@
build:
@echo "Building with HOST_URL=${HOST_URL}"
cp .env.local_dev .env
cd apps/OpenSign && cp ../../.env.local_dev .env && npm install && npm run build
docker compose up --build --force-recreate
HOST_URL=${HOST_URL} docker compose up --build --force-recreate
run:
@echo "Building with HOST_URL=${HOST_URL}"
cp .env.local_dev .env
docker compose up -d
docker compose up -d
+7 -1
View File
@@ -75,7 +75,13 @@ Welcome to OpenSign, the premier open source docusign alternative - document e-s
### Installation
Please refer to the [Installation Guide](INSTALLATION.md) for detailed instructions on how to install OpenSign on your system.
The simplest way to install OpenSign on your own server is using official docker images by running the following command -
```
export HOST_URL=https://opensign.yourdomain.com && curl --remote-name-all https://raw.githubusercontent.com/OpenSignLabs/OpenSign/docker_beta/docker-compose.yml https://raw.githubusercontent.com/OpenSignLabs/OpenSign/docker_beta/Caddyfile https://raw.githubusercontent.com/OpenSignLabs/OpenSign/docker_beta/.env.local_dev && mv .env.local_dev .env.prod && docker compose up --force-recreate
```
Make sure that you have `Docker` and `git` installed before you run this command -
Please refer to the [Installation Guide](https://docs.opensignlabs.com/docs/self-host/docker/run-locally/) for detailed instructions on how to install OpenSign on your system.
---
Binary file not shown.
@@ -592,7 +592,8 @@
"expired-doc-title":"Expired Document",
"expired-on-mssg" :"This document expired on {{expiredDate}} and is no longer available to sign.",
"signature-validate-alert":"Please confirm that you have selected at least {{minRequiredCount}} checkboxes.",
"signature-validate-alert-2" :"Ensure this field is accurately filled and meets all requirements."
"signature-validate-alert-2" :"Ensure this field is accurately filled and meets all requirements.",
"user-name-exist":"user name already exist"
@@ -591,7 +591,8 @@
"expired-doc-title" :"Document expiré",
"expired-on-mssg" :"Ce document a expiré le {{expiredDate}} et n'est plus disponible pour signature.",
"signature-validate-alert":"Veuillez confirmer que vous avez coché au moins {{minRequiredCount}} cases.",
"signature-validate-alert-2" :"Assurez-vous que ce champ est rempli avec précision et répond à toutes les exigences."
"signature-validate-alert-2" :"Assurez-vous que ce champ est rempli avec précision et répond à toutes les exigences.",
"user-name-exist" :"le nom d'utilisateur existe déjà"
File diff suppressed because one or more lines are too long
Binary file not shown.
+2 -3
View File
@@ -20,6 +20,7 @@ import SSOVerify from "./pages/SSOVerify";
import Loader from "./primitives/Loader";
import TeamList from "./pages/TeamList";
import UserList from "./pages/UserList";
import { serverUrl_fn } from "./constant/appinfo";
const DebugPdf = lazy(() => import("./pages/DebugPdf"));
const ForgetPassword = lazy(() => import("./pages/ForgetPassword"));
const GuestLogin = lazy(() => import("./pages/GuestLogin"));
@@ -53,9 +54,7 @@ function App() {
const appId = process.env.REACT_APP_APPID
? process.env.REACT_APP_APPID
: "opensign";
const baseurl = process.env.REACT_APP_SERVERURL
? process.env.REACT_APP_SERVERURL
: window.location.origin + "/api/app";
const baseurl = serverUrl_fn();
try {
localStorage.setItem("baseUrl", `${baseurl}/`);
localStorage.setItem("parseAppId", appId);
+9 -5
View File
@@ -1033,7 +1033,9 @@ export const addInitialData = (signerPos, setXyPostion, value, userId) => {
//function for embed document id
export const embedDocId = async (pdfDoc, documentId, allPages) => {
// `fontBytes` is used to embed custom font in pdf
const fontBytes = await fileasbytes("/font/times.ttf");
const fontBytes = await fileasbytes(
"https://cdn.opensignlabs.com/webfonts/times.ttf"
);
pdfDoc.registerFontkit(fontkit);
const font = await pdfDoc.embedFont(fontBytes, { subset: true });
for (let i = 0; i < allPages; i++) {
@@ -1266,7 +1268,9 @@ export const multiSignEmbed = async (
containerWH
) => {
// `fontBytes` is used to embed custom font in pdf
const fontBytes = await fileasbytes("/font/times.ttf");
const fontBytes = await fileasbytes(
"https://cdn.opensignlabs.com/webfonts/times.ttf"
);
pdfDoc.registerFontkit(fontkit);
const font = await pdfDoc.embedFont(fontBytes, { subset: true });
for (let item of widgets) {
@@ -1934,14 +1938,14 @@ export function replaceMailVaribles(subject, body, variables) {
return result;
}
export const copytoData = (text) => {
export const copytoData = (url) => {
// navigator.clipboard.writeText(text);
if (navigator.clipboard) {
navigator.clipboard.writeText(text);
navigator.clipboard.writeText(url);
} else {
// Fallback for browsers that don't support navigator.clipboard
const textArea = document.createElement("textarea");
textArea.value = text;
textArea.value = url;
document.body.appendChild(textArea);
textArea.select();
document.execCommand("copy");
+16 -3
View File
@@ -1,10 +1,23 @@
import logo from "../assets/images/logo.png";
import { isEnableSubscription } from "./const";
export function serverUrl_fn() {
let baseUrl;
if (isEnableSubscription) {
baseUrl = process.env.REACT_APP_SERVERURL
? process.env.REACT_APP_SERVERURL
: window.location.origin + "/api/app";
} else {
baseUrl = process.env.REACT_APP_SERVERURL
? process.env.REACT_APP_SERVERURL
: window.location.origin + "/app";
}
return baseUrl;
}
export const appInfo = {
applogo: logo,
appId: process.env.REACT_APP_APPID ? process.env.REACT_APP_APPID : "opensign",
baseUrl: process.env.REACT_APP_SERVERURL
? process.env.REACT_APP_SERVERURL
: window.location.origin + "/api/app",
baseUrl: serverUrl_fn(),
defaultRole: "contracts_User",
fbAppId: process.env.REACT_APP_FBAPPID
? `${process.env.REACT_APP_FBAPPID}`
+2 -4
View File
@@ -1,11 +1,9 @@
import axios from "axios";
import { serverUrl_fn } from "./appinfo";
const parseAppId = process.env.REACT_APP_APPID
? process.env.REACT_APP_APPID
: "opensign";
const serverUrl = process.env.REACT_APP_SERVERURL
? process.env.REACT_APP_SERVERURL
: window.location.origin + "/api/app";
const serverUrl = serverUrl_fn()
export const SaveFileSize = async (size, imageUrl, tenantId) => {
//checking server url and save file's size
const tenantPtr = {
+2 -3
View File
@@ -17,14 +17,13 @@ import DragElement from "./components/pdf/DragElement";
import TagManager from "react-gtm-module";
import Parse from "parse";
import "./polyfills";
import { serverUrl_fn } from "./constant/appinfo";
import "./i18n";
const appId = process.env.REACT_APP_APPID
? process.env.REACT_APP_APPID
: "opensign";
const serverUrl = process.env.REACT_APP_SERVERURL
? process.env.REACT_APP_SERVERURL
: window.location.origin + "/api/app";
const serverUrl = serverUrl_fn();
Parse.initialize(appId);
Parse.serverURL = serverUrl;
+6 -1
View File
@@ -1699,7 +1699,12 @@ function PlaceHolderSign() {
};
const handleCloseSendmailModal = () => {
setIsSendAlert({});
setIsAlreadyPlace({ status: true, message: t("document-signed-alert-8") });
if (isSendAlert.mssg === "confirm") {
setIsAlreadyPlace({
status: true,
message: t("document-signed-alert-8")
});
}
};
return (
<>
+62 -20
View File
@@ -11,13 +11,17 @@ import { isEnableSubscription, isStaging } from "../constant/const";
import {
checkIsSubscribed,
checkIsSubscribedTeam,
handleSendOTP
copytoData,
handleSendOTP,
openInNewTab
} from "../constant/Utils";
import Upgrade from "../primitives/Upgrade";
import ModalUi from "../primitives/ModalUi";
import Loader from "../primitives/Loader";
import { useTranslation } from "react-i18next";
import SelectLanguage from "../components/pdf/SelectLanguage";
import { RWebShare } from "react-web-share";
import Alert from "../primitives/Alert";
function UserProfile() {
const navigate = useNavigate();
@@ -35,6 +39,7 @@ function UserProfile() {
const [isDisableDocId, setIsDisableDocId] = useState(false);
const [isSubscribe, setIsSubscribe] = useState(false);
const [isUpgrade, setIsUpgrade] = useState(false);
const [isAlert, setIsAlert] = useState({});
const [publicUserName, setPublicUserName] = useState(
extendUser && extendUser?.[0]?.UserName
);
@@ -49,12 +54,13 @@ function UserProfile() {
const [otp, setOtp] = useState("");
const [otpLoader, setOtpLoader] = useState(false);
const [isEmailVerified, setIsEmailVerified] = useState(false);
const [userNameError, setUserNameError] = useState("");
const [tagLine, setTagLine] = useState(
extendUser && extendUser?.[0]?.Tagline
);
const [isTeam, setIsTeam] = useState(false);
const getPublicUrl = isStaging
? `https://staging.opensign.me/${extendUser?.[0]?.UserName}`
: `https://opensign.me/${extendUser?.[0]?.UserName}`;
useEffect(() => {
getUserDetail();
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -103,9 +109,12 @@ function UserProfile() {
});
if (res) {
setIsLoader(false);
setUserNameError("user name already exist");
setIsAlert({
type: "danger",
message: t("user-name-exist")
});
setTimeout(() => {
setUserNameError("");
setIsAlert({});
}, 3000);
return res;
}
@@ -197,7 +206,6 @@ function UserProfile() {
const extRes = JSON.stringify(json);
localStorage.setItem("Extand_Class", extRes);
previousPublicUserName.current = publicUserName;
// console.log("updateRes ", updateRes);
} catch (e) {
console.log("error in save data in contracts_Users class");
}
@@ -312,6 +320,16 @@ function UserProfile() {
setJobTitle(extendUser?.[0]?.JobTitle);
setIsDisableDocId(extendUser?.[0]?.HeaderDocId);
};
const copytoclipboard = () => {
copytoData(getPublicUrl);
setIsAlert({
type: "success",
message: t("copied")
});
setTimeout(() => {
setIsAlert({});
}, 3000);
};
return (
<React.Fragment>
@@ -322,11 +340,12 @@ function UserProfile() {
</div>
) : (
<div className="flex justify-center items-center w-full relative">
{userNameError && (
<div className="z-[1000] fixed top-[50%] transform border-[1px] text-sm border-[#f0a8a8] bg-[#f4bebe] text-[#c42121] rounded py-[.75rem] px-[1.25rem]">
{userNameError}
</div>
{isAlert && (
<Alert className="z-[1000] fixed top-[10%]" type={isAlert.type}>
{isAlert.message}
</Alert>
)}
<div className="bg-base-100 text-base-content flex flex-col justify-center shadow-md rounded-box w-[450px]">
<div className="flex flex-col justify-center items-center my-4">
<div className="w-[200px] h-[200px] overflow-hidden rounded-full">
@@ -476,10 +495,7 @@ function UserProfile() {
/>
</span>
<div className="flex md:flex-row flex-col md:items-center">
<span className="mb-1 md:mb-1">
{isStaging ? "staging.opensign.me/" : " opensign.me/"}
</span>
{editmode ? (
{editmode || !extendUser?.[0]?.UserName ? (
<input
maxLength={40}
style={{
@@ -496,12 +512,38 @@ function UserProfile() {
className="op-input op-input-bordered focus:outline-none hover:border-base-content op-input-xs"
/>
) : (
<input
value={extendUser?.[0]?.UserName}
disabled
placeholder="enter user name"
className="op-input op-input-bordered op-input-xs"
/>
<div className="flex flex-row gap-1 items-center justify-between md:justify-start">
<span
rel="noreferrer"
target="_blank"
onClick={() => {
openInNewTab(getPublicUrl);
}}
className="cursor-pointer underline hover:text-blue-800 w-[200px] md:w-[150px] whitespace-nowrap overflow-hidden text-ellipsis"
>
{isStaging
? `staging.opensign.me/${extendUser?.[0]?.UserName}`
: `opensign.me/${extendUser?.[0]?.UserName}`}
</span>
<div className="flex items-center gap-2">
<RWebShare
data={{
url: getPublicUrl,
title: "Sign url"
}}
>
<button className="op-btn op-btn-primary op-btn-outline op-btn-xs md:op-btn-sm ">
<i className="fa-light fa-share-from-square"></i>{" "}
</button>
</RWebShare>
<button
className="op-btn op-btn-primary op-btn-outline op-btn-xs md:op-btn-sm"
onClick={() => copytoclipboard()}
>
<i className="fa-light fa-link"></i>{" "}
</button>
</div>
</div>
)}
</div>
</li>
+9 -3
View File
@@ -1,6 +1,6 @@
import React from "react";
const Alert = ({ children, type }) => {
const Alert = ({ children, type, className }) => {
const textcolor = type ? theme(type) : theme();
function theme(color) {
switch (color) {
@@ -18,8 +18,14 @@ const Alert = ({ children, type }) => {
}
return (
children && (
<div className="z-[1000] fixed top-20 left-1/2 transform -translate-x-1/2 text-sm">
<div className={`op-alert ${textcolor}`}>
<div
className={`${
className
? className
: "z-[1000] fixed top-20 left-1/2 transform -translate-x-1/2 text-sm"
} `}
>
<div className={`op-alert ${textcolor} flex items-center`}>
<span>{children}</span>
</div>
</div>
@@ -27,6 +27,7 @@ import BulkSendUi from "../components/BulkSendUi";
import Loader from "./Loader";
import Select from "react-select";
import SubscribeCard from "./SubscribeCard";
import { serverUrl_fn } from "../constant/appinfo";
import { useTranslation } from "react-i18next";
const ReportTable = (props) => {
@@ -395,9 +396,7 @@ const ReportTable = (props) => {
Templates: "contracts_Template"
};
try {
const serverUrl = process.env.REACT_APP_SERVERURL
? process.env.REACT_APP_SERVERURL
: window.location.origin + "/api/app";
const serverUrl = serverUrl_fn()
const cls = clsObj[props.ReportName] || "contracts_Document";
const url = serverUrl + `/classes/${cls}/`;
const body =
@@ -475,7 +474,7 @@ const ReportTable = (props) => {
};
const copytoclipboard = (share) => {
navigator.clipboard.writeText(share.url);
copytoData(share.url);
setCopied({ ...copied, [share.email]: true });
};
//function to handle revoke/decline docment
@@ -919,7 +918,7 @@ const ReportTable = (props) => {
const handlePublicChange = async (e, item) => {
const getPlaceholder = item?.Placeholders;
//checking index for public role
const getIndex = getPlaceholder.findIndex((obj) => !obj.signerObjId);
const getIndex = getPlaceholder?.findIndex((obj) => !obj?.signerObjId);
//conditon to check empty role is exist or not
if (getPlaceholder && getPlaceholder.length > 0 && getIndex >= 0) {
const signers = item?.Signers;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+24 -65
View File
@@ -1,9 +1,6 @@
import axios from 'axios';
import dotenv from 'dotenv';
dotenv.config();
const appId = process.env.APP_ID;
const serverUrl = process.env.SERVER_URL;
export const cloudServerUrl = 'http://localhost:8080/app';
export function customAPIurl() {
const url = new URL(cloudServerUrl);
@@ -38,17 +35,12 @@ export function replaceMailVaribles(subject, body, variables) {
replacedBody = replacedBody.replace(regex, variables[variable]);
}
}
const result = {
subject: replacedSubject,
body: replacedBody,
};
const result = { subject: replacedSubject, body: replacedBody };
return result;
}
export const saveFileUsage = async (size, imageUrl, userId) => {
export const saveFileUsage = async (size, fileUrl, userId) => {
//checking server url and save file's size
try {
const tenantQuery = new Parse.Query('partners_Tenant');
tenantQuery.equalTo('UserId', {
@@ -58,53 +50,28 @@ export const saveFileUsage = async (size, imageUrl, userId) => {
});
const tenant = await tenantQuery.first();
if (tenant) {
const tenantPtr = {
__type: 'Pointer',
className: 'partners_Tenant',
objectId: tenant.id,
};
const _tenantPtr = JSON.stringify(tenantPtr);
const tenantPtr = { __type: 'Pointer', className: 'partners_Tenant', objectId: tenant.id };
try {
const res = await axios.get(
`${serverUrl}/classes/partners_TenantCredits?where={"PartnersTenant":${_tenantPtr}}`,
{
headers: {
'Content-Type': 'application/json',
'X-Parse-Application-Id': appId,
},
}
);
const response = res.data.results;
let data;
// console.log("response", response);
if (response && response.length > 0) {
data = {
usedStorage: response[0].usedStorage ? response[0].usedStorage + size : size,
};
await axios.put(
`${serverUrl}/classes/partners_TenantCredits/${response[0].objectId}`,
data,
{
headers: {
'Content-Type': 'application/json',
'X-Parse-Application-Id': appId,
},
}
);
const tenantCredits = new Parse.Query('partners_TenantCredits');
tenantCredits.equalTo('PartnersTenant', tenantPtr);
const res = await tenantCredits.first({ useMasterKey: true });
if (res) {
const response = JSON.parse(JSON.stringify(res));
const usedStorage = response?.usedStorage ? response.usedStorage + size : size;
const updateCredit = new Parse.Object('partners_TenantCredits');
updateCredit.id = res.id;
updateCredit.set('usedStorage', usedStorage);
await updateCredit.save(null, { useMasterKey: true });
} else {
data = { usedStorage: size, PartnersTenant: tenantPtr };
await axios.post(`${serverUrl}/classes/partners_TenantCredits`, data, {
headers: {
'Content-Type': 'application/json',
'X-Parse-Application-Id': appId,
},
});
const newCredit = new Parse.Object('partners_TenantCredits');
newCredit.set('usedStorage', size);
newCredit.set('PartnersTenant', tenantPtr);
await newCredit.save(null, { useMasterKey: true });
}
} catch (err) {
console.log('err in save usage', err);
}
saveDataFile(size, imageUrl, tenantPtr);
saveDataFile(size, fileUrl, tenantPtr);
}
} catch (err) {
console.log('err in fetch tenant Id', err);
@@ -112,21 +79,13 @@ export const saveFileUsage = async (size, imageUrl, userId) => {
};
//function for save fileUrl and file size in particular client db class partners_DataFiles
const saveDataFile = async (size, imageUrl, tenantPtr) => {
const data = {
FileUrl: imageUrl,
FileSize: size,
TenantPtr: tenantPtr,
};
// console.log("data save",file, data)
const saveDataFile = async (size, fileUrl, tenantPtr) => {
try {
await axios.post(`${serverUrl}/classes/partners_DataFiles`, data, {
headers: {
'Content-Type': 'application/json',
'X-Parse-Application-Id': appId,
},
});
const newDataFiles = new Parse.Object('partners_DataFiles');
newDataFiles.set('FileUrl', fileUrl);
newDataFiles.set('FileSize', size);
newDataFiles.set('TenantPtr', tenantPtr);
await newDataFiles.save(null, { useMasterKey: true });
} catch (err) {
console.log('error in save usage ', err);
}
@@ -28,7 +28,7 @@ const refreshAccessToken = async refreshToken => {
// Function to create a raw email message
const makeEmail = async (to, from, subject, html, url, pdfName) => {
const protocol = new URL(process.env.SERVER_URL);
const publicUrl = new URL(process.env.SERVER_URL);
const htmlContent = html;
const boundary = 'boundary_' + Date.now().toString(16);
let str;
@@ -37,13 +37,15 @@ const makeEmail = async (to, from, subject, html, url, pdfName) => {
let Pdf = fs.createWriteStream('test.pdf');
const writeToLocalDisk = () => {
return new Promise((resolve, reject) => {
if (useLocal !== 'true' && protocol.hostname !== 'localhost') {
if (useLocal !== 'true') {
https.get(url, async function (response) {
response.pipe(Pdf);
response.on('end', () => resolve('success'));
});
} else {
http.get(url, async function (response) {
const path = new URL(url)?.pathname;
const localurl = 'http://localhost:8080' + path;
http.get(localurl, async function (response) {
response.pipe(Pdf);
response.on('end', () => resolve('success'));
});
@@ -7,7 +7,7 @@ import { smtpenable, smtpsecure, updateMailCount, useLocal } from '../../Utils.j
import sendMailGmailProvider from './sendMailGmailProvider.js';
import { createTransport } from 'nodemailer';
async function sendMailProvider(req) {
const protocol = new URL(process.env.SERVER_URL);
const mailgunApiKey = process.env.MAILGUN_API_KEY;
try {
let transporterSMTP;
let mailgunClient;
@@ -23,24 +23,25 @@ async function sendMailProvider(req) {
},
});
} else {
const mailgun = new Mailgun(formData);
mailgunClient = mailgun.client({
username: 'api',
key: process.env.MAILGUN_API_KEY,
});
mailgunDomain = process.env.MAILGUN_DOMAIN;
if (mailgunApiKey) {
const mailgun = new Mailgun(formData);
mailgunClient = mailgun.client({ username: 'api', key: mailgunApiKey });
mailgunDomain = process.env.MAILGUN_DOMAIN;
}
}
if (req.params.url) {
let Pdf = fs.createWriteStream('test.pdf');
const writeToLocalDisk = () => {
return new Promise((resolve, reject) => {
if (useLocal !== 'true' && protocol.hostname !== 'localhost') {
if (useLocal !== 'true') {
https.get(req.params.url, async function (response) {
response.pipe(Pdf);
response.on('end', () => resolve('success'));
});
} else {
http.get(req.params.url, async function (response) {
const path = new URL(req.params.url)?.pathname;
const localurl = 'http://localhost:8080' + path;
http.get(localurl, async function (response) {
response.pipe(Pdf);
response.on('end', () => resolve('success'));
});
@@ -108,20 +109,27 @@ async function sendMailProvider(req) {
return { status: 'success' };
}
} else {
const res = await mailgunClient.messages.create(mailgunDomain, messageParams);
console.log('Res ', res);
if (res.status === 200) {
if (req.params?.extUserId) {
await updateMailCount(req.params.extUserId);
if (mailgunApiKey) {
const res = await mailgunClient.messages.create(mailgunDomain, messageParams);
console.log('Res ', res);
if (res.status === 200) {
if (req.params?.extUserId) {
await updateMailCount(req.params.extUserId);
}
try {
fs.unlinkSync('./exports/certificate.pdf');
} catch (err) {
console.log('Err in unlink certificate sendmailv3');
}
return { status: 'success' };
}
} else {
try {
fs.unlinkSync('./exports/certificate.pdf');
} catch (err) {
console.log('Err in unlink certificate sendmailv3');
}
return {
status: 'success',
};
return { status: 'error' };
}
}
}
@@ -147,13 +155,17 @@ async function sendMailProvider(req) {
return { status: 'success' };
}
} else {
const res = await mailgunClient.messages.create(mailgunDomain, messageParams);
console.log('Res ', res);
if (res.status === 200) {
if (req.params?.extUserId) {
await updateMailCount(req.params.extUserId);
if (mailgunApiKey) {
const res = await mailgunClient.messages.create(mailgunDomain, messageParams);
console.log('Res ', res);
if (res.status === 200) {
if (req.params?.extUserId) {
await updateMailCount(req.params.extUserId);
}
return { status: 'success' };
}
return { status: 'success' };
} else {
return { status: 'error' };
}
}
}
+1 -1
View File
@@ -92,7 +92,7 @@ export const config = {
cloud: function () {
import('./cloud/main.js');
},
appId: process.env.APP_ID || 'myAppId',
appId: process.env.APP_ID || 'opensign',
logLevel: ['error'],
maxLimit: 500,
maxUploadSize: '30mb',
+1 -1
View File
@@ -2,7 +2,7 @@
FROM mongo:latest
# Create a directory to host initialization scripts
RUN mkdir -p /docker-entrypoint-initdb.d
# RUN mkdir -p /docker-entrypoint-initdb.d
# Copy default data JSON files to the initialization directory
# COPY ./default-data/*.json /docker-entrypoint-initdb.d/
+29 -32
View File
@@ -1,31 +1,20 @@
version: '3.7'
services:
server:
build:
context: ./apps/OpenSignServer
dockerfile: Dockerfile
image: opensignserver-image
image: opensign/opensignserver:main
container_name: OpenSignServer-container
command: /usr/src/app/node_modules/.bin/nodemon server.js
volumes:
- ./apps/OpenSignServer/:/usr/src/app
- /usr/src/app/node_modules
ports:
- "8080:8080"
depends_on:
- mongo
env_file: .env
env_file: .env.prod
environment:
- NODE_ENV=development
- NODE_ENV=production
- SERVER_URL=${HOST_URL:-https://localhost:3001/app}
networks:
- app-network
mongo:
build:
context: ./apps/mongo
dockerfile: Dockerfile
image: mongo:latest
container_name: mongo-container
image: opensign-mongo
volumes:
- data-volume:/data/db
ports:
@@ -33,29 +22,37 @@ services:
networks:
- app-network
client:
build:
context: ./apps/OpenSign
dockerfile: Dockerfile
image: opensign-image
image: opensign/opensign:main
container_name: OpenSign-container
command: npm start
env_file: .env
volumes:
- ./apps/OpenSign/:/usr/app
- /usr/app/node_modules
depends_on:
- server
env_file: .env.prod
ports:
- "3000:3000"
networks:
- app-network
caddy:
image: caddy:latest
container_name: caddy-container
ports:
- "3001:3001"
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
networks:
- app-network
environment:
- HOST_URL=${HOST_URL:-localhost:3001}
networks:
app-network:
driver: bridge
app-network:
driver: bridge
volumes:
data-volume:
node_modules:
web-root:
driver: local
data-volume:
web-root:
caddy_data:
caddy_config: