Skip to content

Commit 4a5b35e

Browse files
Merge pull request #1818 from OpenSignLabs/updates-15966812948
fix: handle undefine appId
2 parents 7204183 + 7930a8f commit 4a5b35e

File tree

16 files changed

+36
-31
lines changed

16 files changed

+36
-31
lines changed

apps/OpenSign/src/components/pdf/WidgetsValueModal.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,17 +694,20 @@ function WidgetsValueModal(props) {
694694
}
695695
}
696696
if (isTab === "type") {
697+
//trim user name or typed name value to show in initial signature
697698
const trimmedName = typedSignature
698699
? typedSignature?.trim()
699700
: currentUserName?.trim();
701+
//get full name of user
702+
const fullUserName = typedSignature || currentUserName
700703
const firstCharacter = trimmedName?.charAt(0);
701704
const userName =
702705
currWidgetsDetails?.type === "initials"
703706
? firstCharacter
704-
: typedSignature;
707+
: fullUserName;
705708
const signatureValue = currWidgetsDetails?.typeSignature;
706709
setTypedSignature(signatureValue || userName || "");
707-
convertToImg(fontSelect, userName);
710+
convertToImg(fontSelect, signatureValue || userName || "");
708711
}
709712
// eslint-disable-next-line react-hooks/exhaustive-deps
710713
}, [isTab]);

apps/OpenSignServer/Utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import axios from 'axios';
77
dotenv.config();
88

99
export const cloudServerUrl = 'http://localhost:8080/app';
10+
export const serverAppId = process.env.APP_ID || 'opensign';
1011
export const appName = 'OpenSign™';
1112

1213
export const MAX_NAME_LENGTH = 250;

apps/OpenSignServer/cloud/customRoute/docxtopdf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import axios from 'axios';
33
import multer from 'multer';
44
import libre from 'libreoffice-convert';
55
import util from 'node:util';
6-
import { cloudServerUrl, getSecureUrl } from '../../Utils.js';
6+
import { cloudServerUrl, getSecureUrl, serverAppId } from '../../Utils.js';
77

88
libre.convertAsync = util.promisify(libre.convert);
99

@@ -29,7 +29,7 @@ function generatePdfName(length) {
2929

3030
export default async function docxtopdf(req, res) {
3131
const serverUrl = cloudServerUrl;
32-
const appId = process.env.APP_ID;
32+
const appId = serverAppId;
3333
const masterKey = process.env.MASTER_KEY;
3434
const inputPath = req.file.path;
3535
const name = generatePdfName(16);

apps/OpenSignServer/cloud/customRoute/uploadFile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import multer from 'multer';
33
import multerS3 from 'multer-s3';
44
import aws from 'aws-sdk';
55
import dotenv from 'dotenv';
6-
import { cloudServerUrl, useLocal } from '../../Utils.js';
6+
import { cloudServerUrl, serverAppId, useLocal } from '../../Utils.js';
77
dotenv.config();
88

99
function sanitizeFileName(fileName) {
@@ -50,7 +50,7 @@ async function uploadFile(req, res) {
5050
const DO_SPACE = process.env.DO_SPACE;
5151

5252
const parseBaseUrl = cloudServerUrl; //process.env.SERVER_URL;
53-
const parseAppId = process.env.APP_ID;
53+
const parseAppId = serverAppId;
5454
let fileStorage;
5555
if (useLocal === 'true') {
5656
fileStorage = multer.diskStorage({

apps/OpenSignServer/cloud/parsefunction/AddAdmin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
2-
import { cloudServerUrl } from '../../Utils.js';
2+
import { cloudServerUrl, serverAppId } from '../../Utils.js';
33
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
4-
const APPID = process.env.APP_ID;
4+
const APPID = serverAppId;
55
const masterKEY = process.env.MASTER_KEY;
66
async function addTeamAndOrg(extUser) {
77
try {

apps/OpenSignServer/cloud/parsefunction/AuthLoginAsMail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import axios from 'axios';
2-
import { cloudServerUrl } from '../../Utils.js';
2+
import { cloudServerUrl, serverAppId } from '../../Utils.js';
33
async function AuthLoginAsMail(request) {
44
try {
55
//function for login user using user objectId without touching user's password
66
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
7-
const APPID = process.env.APP_ID;
7+
const APPID = serverAppId;
88
const masterKEY = process.env.MASTER_KEY;
99

1010
let otpN = request.params.otp;

apps/OpenSignServer/cloud/parsefunction/ForwardDoc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios from 'axios';
2-
import { appName, cloudServerUrl } from '../../Utils.js';
2+
import { appName, cloudServerUrl, serverAppId } from '../../Utils.js';
33

44
export default async function forwardDoc(request) {
55
try {
@@ -58,7 +58,7 @@ export default async function forwardDoc(request) {
5858
mailRes = await axios.post(`${cloudServerUrl}/functions/sendmailv3`, params, {
5959
headers: {
6060
'Content-Type': 'application/json',
61-
'X-Parse-Application-Id': process.env.APP_ID,
61+
'X-Parse-Application-Id': serverAppId,
6262
'X-Parse-Master-Key': process.env.MASTER_KEY,
6363
},
6464
});

apps/OpenSignServer/cloud/parsefunction/GetTemplate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios from 'axios';
2-
import { cloudServerUrl } from '../../Utils.js';
2+
import { cloudServerUrl, serverAppId } from '../../Utils.js';
33

44
export default async function GetTemplate(request) {
55
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
@@ -10,7 +10,7 @@ export default async function GetTemplate(request) {
1010
if (sessiontoken) {
1111
const userRes = await axios.get(serverUrl + '/users/me', {
1212
headers: {
13-
'X-Parse-Application-Id': process.env.APP_ID,
13+
'X-Parse-Application-Id': serverAppId,
1414
'X-Parse-Session-Token': sessiontoken,
1515
},
1616
});

apps/OpenSignServer/cloud/parsefunction/createBatchContact.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios from 'axios';
2-
import { cloudServerUrl } from '../../Utils.js';
3-
const appId = process.env.APP_ID;
2+
import { cloudServerUrl, serverAppId } from '../../Utils.js';
3+
const appId = serverAppId;
44
const masterkey = process.env.MASTER_KEY;
55
export default async function createBatchContact(req) {
66
if (!req?.user) {

apps/OpenSignServer/cloud/parsefunction/createBatchDocs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
2-
import { cloudServerUrl, mailTemplate, replaceMailVaribles } from '../../Utils.js';
2+
import { cloudServerUrl, mailTemplate, replaceMailVaribles, serverAppId } from '../../Utils.js';
33
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
4-
const appId = process.env.APP_ID;
4+
const appId = serverAppId;
55
async function deductcount(docsCount, extUserId) {
66
try {
77
const extCls = new Parse.Object('contracts_Users');

0 commit comments

Comments
 (0)