Skip to content

Commit 66f91d2

Browse files
Merge pull request #138 from OpenSignLabs/staging
v1.0.2
2 parents 3592d57 + 344d945 commit 66f91d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3430
-2029
lines changed

.all-contributorsrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,24 @@
151151
"contributions": [
152152
"code"
153153
]
154+
},
155+
{
156+
"login": "rishabjasrotia",
157+
"name": "Rishab",
158+
"avatar_url": "https://avatars.githubusercontent.com/u/33950743?v=4",
159+
"profile": "https://github.com/rishabjasrotia",
160+
"contributions": [
161+
"code"
162+
]
163+
},
164+
{
165+
"login": "maoo",
166+
"name": "Maurizio Pillitu",
167+
"avatar_url": "https://avatars.githubusercontent.com/u/327285?v=4",
168+
"profile": "https://session.it",
169+
"contributions": [
170+
"bug"
171+
]
154172
}
155173
]
156174
}

.env.local_dev

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Clone the repo and rename this file to .env if you want to run the frontend react app locally for some quick contributions to the project.
2+
# When used as it is, this env config will connect to our hosted UAT backend
3+
# Note that any data in staging will get cleared from time to time and you may have to sign up again and again
4+
5+
# Set CI to false while running the app locally
6+
CI=false
7+
# Set it to the URL form where the app home page will be accessed
8+
PUBLIC_URL=http://localhost:3000
9+
# Set it to true if you want to generate the Sourcemap for debugging
10+
GENERATE_SOURCEMAP=false
11+
# 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)
12+
REACT_APP_SERVERURL=http://localhost:8080/app
13+
# 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.
14+
REACT_APP_APPID=opensignstgn
15+
16+
17+
# Backend ExpressJS config ****************************************************************************************************************************************************************************************
18+
# A 12 character long random app identifier. The value of this should be same as REACT_APP_APPID which is a variable used by Frontend React App.
19+
APP_ID=opensignstgn
20+
# Name of the app. It will be visible in the verification emails sent out.
21+
appName=open_sign_server
22+
# A 12 character long random secret key that allows access to all the data. It is used in Parse dashboard config to view all the data in the database.
23+
MASTER_KEY=XnAadwKxxByMr
24+
# Mongodb URI to connect to
25+
MONGODB_URI=mongodb://host.docker.internal:27017/OpenSignDB
26+
# Path on which APIs should be mounted. Do not change this. This variable shall be removed & value hardcoded in the source code in coming versions.
27+
PARSE_MOUNT=/app
28+
# Set it to the URL from where APIs will be accessible to the NodeJS functions, for local development it should be localhost:3000/api/app (use your local port number instead)
29+
SERVER_URL=http://127.0.0.1:8080/app
30+
31+
# Storage config ************************************************************************************************************************************************************************************************
32+
# Digital ocean space name or AWS S3 bucket name for uploading documents
33+
DO_SPACE=DOSPACENAME
34+
# Digital ocean spaces endpoint or AWS S3 endpoint for uploading documents
35+
DO_ENDPOINT=ams3.digitaloceanspaces.com
36+
# Digital ocean baseurl or AWS S3 base URL
37+
DO_BASEURL=https://DOSPACENAME.ams3.digitaloceanspaces.com
38+
# Digital ocean spaces access key ID or AWS s3 Access key ID for uploading the docs
39+
DO_ACCESS_KEY_ID=
40+
# Digital ocean spaces secret access key or AWS s3 secret access key for uploading the docs
41+
DO_SECRET_ACCESS_KEY=
42+
# Digital ocean spaces region or AWS s3 region
43+
DO_REGION=us-west
44+
# local storage
45+
USE_LOCAL=TRUE
46+
47+
# Email mailgun config (The app will not initialize if any of these 3 variables are not set) *********************************************************************************************************************
48+
MAILGUN_API_KEY=XXXXX
49+
MAILGUN_DOMAIN=mail.yourdomain.com
50+
MAILGUN_SENDER=postmaster@mail.yourdomain.com
51+
52+
# Base64 encoded PFX or p12 document signing certificate file *********************************************************************************************************************
53+
PFX_BASE64=

INSTALLATION.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ or follow below instructions to install it on your own infrastructure.
77

88
- Localhost(Frontend only)
99
- Digital Ocean
10+
- Localhost(Docker)
1011

1112
## Localhost(Frontend only)
1213

@@ -83,3 +84,9 @@ You can install all 3 components on digital ocean using the button below -
8384

8485
Visit below link if you face any issues while following the above instructions -
8586
- https://repost.aws/knowledge-center/create-access-key
87+
88+
89+
## Localhost(Docker)
90+
91+
Below are the steps to follow -
92+
- Execute `make build`

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build:
2+
cp .env.local_dev .env
3+
docker compose up -d

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
<div align="center">
44

5-
The free open source alternative to DocuSign | PandaDoc | SignNow | Adobe Sign | Smartwaiver | SignRequest | HelloSign | Zoho sign.
5+
The free and open source alternative to DocuSign
66

77
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/opensignlabs/opensign.svg)](http://isitmaintained.com/project/opensignlabs/opensign "Average time to resolve an issue")
88
[![All Contributors](https://img.shields.io/github/all-contributors/opensignlabs/opensign?color=ee8449&style=flat-square)](#contributors)
@@ -23,7 +23,7 @@ The free open source alternative to DocuSign | PandaDoc | SignNow | Adobe Sign |
2323
<a href="https://www.linkedin.com/company/opensign%E2%84%A2/about/">LinkedIn</a>
2424

2525

26-
## An Open-Source Alternative to DocuSign, PandaDoc, SignNow, Adobe Sign, Smartwaiver, SignRequest, and HelloSign
26+
## An open-source document e-signing solution
2727

2828
---
2929
</div>
@@ -122,6 +122,8 @@ We would like to thank all our contributors and users for their support and feed
122122
<tr>
123123
<td align="center" valign="top" width="14.28%"><a href="https://github.com/VishakhaSainani"><img src="https://avatars.githubusercontent.com/u/113436770?v=4?s=100" width="100px;" alt="VishakhaSainani"/><br /><sub><b>VishakhaSainani</b></sub></a><br /><a href="#code-VishakhaSainani" title="Code">💻</a></td>
124124
<td align="center" valign="top" width="14.28%"><a href="https://github.com/andrew-opensignlabs"><img src="https://avatars.githubusercontent.com/u/148278535?v=4?s=100" width="100px;" alt="Andrew"/><br /><sub><b>Andrew</b></sub></a><br /><a href="#code-andrew-opensignlabs" title="Code">💻</a></td>
125+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rishabjasrotia"><img src="https://avatars.githubusercontent.com/u/33950743?v=4?s=100" width="100px;" alt="Rishab"/><br /><sub><b>Rishab</b></sub></a><br /><a href="#code-rishabjasrotia" title="Code">💻</a></td>
126+
<td align="center" valign="top" width="14.28%"><a href="https://session.it"><img src="https://avatars.githubusercontent.com/u/327285?v=4?s=100" width="100px;" alt="Maurizio Pillitu"/><br /><sub><b>Maurizio Pillitu</b></sub></a><br /><a href="#bug-maoo" title="Bug reports">🐛</a></td>
125127
</tr>
126128
</tbody>
127129
</table>

apps/OpenSign/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ FROM node:16
55
WORKDIR /usr/src/app
66

77
# Copy package.json and package-lock.json first to leverage Docker cache
8-
COPY apps/OpenSign/package*.json ./
8+
COPY ./package*.json ./
99

1010
# Install application dependencies
1111
RUN npm install
1212

1313
# Copy the current directory contents into the container
14-
COPY apps/OpenSign/ .
15-
COPY apps/OpenSign/.husky .
14+
COPY ./ .
15+
COPY ./.husky .
1616

1717
# Make port 3000 available to the world outside this container
1818
EXPOSE 3000

apps/OpenSign/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
},
4242
"scripts": {
4343
"start": "mf-cra start",
44-
"build": "npm run micro && CI=false && mf-cra build",
44+
"start-prod": "serve -s build",
45+
"build": "rm -rf public/mfbuild && npm run micro && CI=false && mf-cra build",
4546
"micro": "cd ../../microfrontends/SignDocuments && npm install && npm run build",
4647
"test": "react-scripts test",
4748
"eject": "react-scripts eject",
@@ -84,4 +85,4 @@
8485
"pretty-quick": "^3.1.3",
8586
"tailwindcss": "^3.3.3"
8687
}
87-
}
88+
}

apps/OpenSign/public/mfbuild/.gitkeep

Whitespace-only changes.

apps/OpenSign/src/components/ReportMicroapp.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ const MicroappModal = () => {
1515
// console.log("value ", key + ":" + value);
1616

1717
if (key === "remoteUrl") {
18-
obj = { ...obj, [key]: atob(value) };
18+
const url = window.location.origin + "/mfbuild/remoteEntry.js";
19+
// console.log("atob(value) ", atob(value))
20+
obj = { ...obj, [key]: url };
1921
} else {
2022
if (key === "moduleToLoad") {
2123
obj = { ...obj, [key]: "./" + value };
@@ -45,9 +47,9 @@ const MicroappModal = () => {
4547
>
4648
Back
4749
</button>
48-
{localStorage.getItem('domain') && (
50+
{localStorage.getItem("domain") && (
4951
<p className="flex-1 w-full text-sm md:text-base text-black text-center">
50-
{localStorage.getItem('domain') === "contracts" ? "Document":""}
52+
{localStorage.getItem("domain") === "contracts" ? "Document" : ""}
5153
</p>
5254
)}
5355
</div>

apps/OpenSign/src/components/fields/FileUpload.js

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React, { useState, useEffect } from "react";
22
import { SaveFileSize } from "../../constant/saveFileSize";
3-
// import Parse from "parse";
4-
// import sanitizeFileName from "../../primitives/sanitizeFileName";
5-
import axios from "axios";
3+
import Parse from "parse";
4+
import sanitizeFileName from "../../primitives/sanitizeFileName";
65

76
const FileUpload = (props) => {
87
const [parseBaseUrl] = useState(localStorage.getItem("baseUrl"));
@@ -69,53 +68,44 @@ const FileUpload = (props) => {
6968
};
7069

7170
const handleFileUpload = async (file) => {
71+
Parse.serverURL = parseBaseUrl;
72+
Parse.initialize(parseAppId);
7273
setfileload(true);
73-
const file_url = parseBaseUrl.slice(0, -4);
74-
const url = `${file_url}file_upload`;
75-
const formData = new FormData();
76-
formData.append("file", file);
77-
const config = {
78-
headers: {
79-
"content-type": "multipart/form-data",
80-
"X-Parse-Application-Id": parseAppId
81-
},
82-
onUploadProgress: function (progressEvent) {
83-
var percentCompleted = Math.round(
84-
(progressEvent.loaded * 100) / progressEvent.total
85-
);
86-
setpercentage(percentCompleted);
87-
}
88-
};
74+
const size = file.size;
75+
const fileName = file.name;
76+
const name = sanitizeFileName(fileName);
77+
const pdfFile = file;
78+
const parseFile = new Parse.File(name, pdfFile);
8979

9080
try {
91-
await axios
92-
.post(url, formData, config)
93-
.then((res) => {
94-
if (res.data.status === "Error") {
95-
alert(res.data.message);
81+
const response = await parseFile.save({
82+
progress: (progressValue, loaded, total, { type }) => {
83+
if (type === "upload" && progressValue !== null) {
84+
const percentCompleted = Math.round((loaded * 100) / total);
85+
console.log("percentCompleted ", percentCompleted);
86+
setpercentage(percentCompleted);
9687
}
97-
setFileUpload(res.data.imageUrl);
98-
props.onChange(res.data.imageUrl);
99-
setfileload(false);
100-
setpercentage(0);
88+
}
89+
});
10190

102-
if (res.data.imageUrl) {
103-
SaveFileSize(file.size, res.data.imageUrl);
104-
return res.data.imageUrl;
105-
}
106-
})
107-
.catch((err) => {
108-
alert(`${err.message}`);
109-
setfileload(false);
110-
setpercentage(0);
111-
});
91+
setFileUpload(response.url());
92+
props.onChange(response.url());
93+
setfileload(false);
94+
// The response object will contain information about the uploaded file
95+
// console.log("File uploaded:", response);
96+
97+
// You can access the URL of the uploaded file using response.url()
98+
// console.log("File URL:", response.url());
99+
if (response.url()) {
100+
SaveFileSize(size, response.url());
101+
return response.url();
102+
}
112103
} catch (error) {
113-
alert(error.message);
114104
setfileload(false);
115105
setpercentage(0);
106+
console.error("Error uploading file:", error);
116107
}
117108
};
118-
119109
let fileView =
120110
props.formData &&
121111
props.schema.uploadtype === "s3viajw" ? null : props.formData &&
@@ -124,7 +114,7 @@ const FileUpload = (props) => {
124114
<a
125115
href={props.formData}
126116
title={props.formData}
127-
style={{ paddingBottom: "10px", color: "blue"}}
117+
style={{ paddingBottom: "10px", color: "blue" }}
128118
>
129119
Download
130120
</a>

apps/OpenSign/src/routes/RemoteApp.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ export default function RemoteAppContainer() {
6565
// console.log("value ", key + ":" + value);
6666

6767
if (key === "remoteUrl") {
68-
obj = { ...obj, [key]: atob(value) };
68+
const url = window.location.origin + "/mfbuild/remoteEntry.js";
69+
// console.log("atob(value) ", atob(value))
70+
obj = { ...obj, [key]: url };
6971
} else {
7072
if (key === "moduleToLoad") {
7173
obj = { ...obj, [key]: "./" + value };

apps/OpenSignServer/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM node:16
55
WORKDIR /usr/src/app
66

77
# Copy package.json and package-lock.json first to leverage Docker cache
8-
COPY apps/OpenSignServer/package*.json ./
8+
COPY ./package*.json ./
99

1010
# Install application dependencies
1111
RUN npm install
@@ -14,7 +14,7 @@ RUN npm install
1414
# RUN apk add --no-cache make gcc g++ python3
1515

1616
# Copy the current directory contents into the container
17-
COPY apps/OpenSignServer/ .
17+
COPY ./ .
1818

1919
# Make port 8080 available to the world outside this container
2020
EXPOSE 8080
@@ -24,4 +24,4 @@ EXPOSE 8080
2424
# ENV DATABASE_URL mongodb://db:27017
2525

2626
# Run the application
27-
CMD ["npm", "start"]
27+
ENTRYPOINT npm start

apps/OpenSignServer/index.js

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,31 @@ import formData from 'form-data';
1414
import Mailgun from 'mailgun.js';
1515
import { ApiPayloadConverter } from 'parse-server-api-mail-adapter';
1616
import S3Adapter from 'parse-server-s3-adapter';
17+
import FSFilesAdapter from 'parse-server-fs-adapter';
1718
import AWS from 'aws-sdk';
1819
import { app as customRoute } from './cloud/customRoute/customApp.js';
1920

2021
const spacesEndpoint = new AWS.Endpoint(process.env.DO_ENDPOINT);
2122
// console.log("configuration ", configuration);
22-
const s3Options = {
23-
bucket: process.env.DO_SPACE, // globalConfig.S3FilesAdapter.bucket,
24-
baseUrl: process.env.DO_BASEURL,
25-
region: process.env.DO_REGION,
26-
directAccess: true,
27-
preserveFileName: true,
28-
s3overrides: {
29-
accessKeyId: process.env.DO_ACCESS_KEY_ID,
30-
secretAccessKey: process.env.DO_SECRET_ACCESS_KEY,
31-
endpoint: spacesEndpoint,
32-
},
33-
};
23+
if (process.env.USE_LOCAL !== "TRUE") {
24+
const s3Options = {
25+
bucket: process.env.DO_SPACE, // globalConfig.S3FilesAdapter.bucket,
26+
baseUrl: process.env.DO_BASEURL,
27+
region: process.env.DO_REGION,
28+
directAccess: true,
29+
preserveFileName: true,
30+
s3overrides: {
31+
accessKeyId: process.env.DO_ACCESS_KEY_ID,
32+
secretAccessKey: process.env.DO_SECRET_ACCESS_KEY,
33+
endpoint: spacesEndpoint,
34+
},
35+
};
36+
var fsAdapter = new S3Adapter(s3Options);
37+
} else {
38+
var fsAdapter = new FSFilesAdapter({
39+
"filesSubDirectory": "files" // optional, defaults to ./files
40+
});
41+
}
3442

3543
let mailgunClient;
3644
let mailgunDomain;
@@ -55,6 +63,7 @@ export const config = {
5563
publicServerURL: process.env.SERVER_URL || 'http://localhost:8080/app',
5664
// Your apps name. This will appear in the subject and body of the emails that are sent.
5765
appName: 'Open Sign',
66+
allowClientClassCreation: false,
5867
emailAdapter: process.env.MAILGUN_API_KEY
5968
? {
6069
module: 'parse-server-api-mail-adapter',
@@ -85,7 +94,7 @@ export const config = {
8594
},
8695
}
8796
: null,
88-
filesAdapter: new S3Adapter(s3Options),
97+
filesAdapter: fsAdapter,
8998
auth: {
9099
google: {
91100
enabled: true,

0 commit comments

Comments
 (0)