Skip to content

fix: handle server.cjs file (#2184)#2193

Closed
nxglabs wants to merge 47 commits into
stagingfrom
main
Closed

fix: handle server.cjs file (#2184)#2193
nxglabs wants to merge 47 commits into
stagingfrom
main

Conversation

@nxglabs

@nxglabs nxglabs commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

prafull-opensignlabs and others added 30 commits February 21, 2025 12:47
refactor: remove unnecessary code
feat: changes to implement one click deployment
fix: correct public URL, normalize emails, migrate user/orgAdmin logic to cloud function
refactor: remove extra comment from migration
handle undefined placeholders
fix: getting error 'user not found' while deleting user
build(deps): update dependencies and dark mode ui
refactor: remove unnecessary code
Copilot AI review requested due to automatic review settings June 18, 2026 07:53
Comment thread apps/OpenSign/server.cjs
res.writeHead(200, headers);
return res.end();
}
const stream = fs.createReadStream(filePath);
Comment thread apps/OpenSign/server.cjs
return res.end("Bad Request");
}

fs.stat(filePath, (err, stats) => {
Comment thread apps/OpenSign/server.cjs
}
if (stats.isDirectory()) {
const indexInDir = path.join(filePath, "index.html");
return fs.stat(indexInDir, (dirErr, dirStats) => {
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
open-sign Ready Ready Preview, Comment Jun 18, 2026 7:53am

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a custom static server for the OpenSign web build and bundles a broad set of server + client workflow improvements around email delivery, signing order, PDF handling, and UX.

Changes:

  • Replaces serve -s build with a custom server.cjs to correctly serve real files (including .well-known) and only SPA-fallback when paths don’t exist.
  • Adds/extends signing workflow features (strict signing order flag, CC support, audit/completion helpers) and related Parse schema migrations.
  • Improves PDF processing & signing UX (AcroForm/widget cleanup, certificate rendering tweaks, pinch-zoom refactor, modal keyboard positioning, prefill flow hardening).

Reviewed changes

Copilot reviewed 87 out of 94 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
apps/OpenSignServer/utils/workflowUtils.js New workflow helpers for completion + strict-order gating.
apps/OpenSignServer/utils/CountUtils.js Extends document count updates to accept a delta.
apps/OpenSignServer/package.json Dependency bumps for server app.
apps/OpenSignServer/migrationdb/index.js Runs new normalizedEmail unique-index migration.
apps/OpenSignServer/migrationdb/createNormalizedEmailUnqiue.js Adds Mongo migration to create unique index on normalizedEmail.
apps/OpenSignServer/index.js Tightens /files/ path detection for file routing.
apps/OpenSignServer/databases/migrations/20260430000000-add_sendinorderstrict_field.cjs Adds SendInOrderStrict fields to Document/Template schemas.
apps/OpenSignServer/databases/migrations/20260402211408-add_normalizedemail.cjs Adds _User.normalizedEmail field.
apps/OpenSignServer/databases/migrations/20260317000000-create_contracts_templatelinks.cjs Creates contracts_templateLinks class for template link storage.
apps/OpenSignServer/databases/migrations/20260316120000-add_cc_field_cjs.cjs Adds Cc field to Document/Template schemas.
apps/OpenSignServer/cloud/parsefunction/usersignup.js Stores normalizedEmail on signup.
apps/OpenSignServer/cloud/parsefunction/TemplateAfterSave.js Adds object id to template insert logs.
apps/OpenSignServer/cloud/parsefunction/sendSystemMail.js New unified mail sender (SMTP/Mailgun).
apps/OpenSignServer/cloud/parsefunction/sendMailWithAttachment.js Adds CC + closes SMTP transport in finally.
apps/OpenSignServer/cloud/parsefunction/sendMailv3.js Adds CC + closes SMTP transport in finally.
apps/OpenSignServer/cloud/parsefunction/sendMailGmailProvider.js Adds CC header support + improves error logging.
apps/OpenSignServer/cloud/parsefunction/saveAsTemplate.js Copies strict-order + CC; normalizes widget fields when templating.
apps/OpenSignServer/cloud/parsefunction/recreateDocument.js Recreates documents excluding heavy fields; resets widget responses; updates counts.
apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js Strict-order gating + completion logic refactor; switches notify mail to sendSystemMail; CC support.
apps/OpenSignServer/cloud/parsefunction/pdf/GenerateCertificate.js Improves date formatting robustness; sorts audit entries; paginates signer blocks; uses new image paths.
apps/OpenSignServer/cloud/parsefunction/GetTemplate.js Includes Cc pointer data when fetching templates.
apps/OpenSignServer/cloud/parsefunction/getSignedUrl.js Uses /files/-specific checks for local URL logic.
apps/OpenSignServer/cloud/parsefunction/generateCertificatebydocId.js Removes dead/commented legacy code.
apps/OpenSignServer/cloud/parsefunction/DocumentAftersave.js Adds object id to document insert logs.
apps/OpenSignServer/cloud/parsefunction/declinedocument.js Uses sendSystemMail; prevents decline email to creator; blocks decline on completed/archived docs.
apps/OpenSignServer/cloud/parsefunction/createDuplicate.js Copies strict-order + CC to duplicated templates.
apps/OpenSignServer/cloud/parsefunction/createDocumentFromApp.js New cloud function to create docs from app payload.
apps/OpenSignServer/cloud/parsefunction/createBatchDocs.js Adds strict-order + CC propagation; uses sendSystemMail for owner summary; supports count delta updates.
apps/OpenSignServer/cloud/main.js Registers createdocumentfromapp cloud function.
apps/OpenSignServer/cloud/customRoute/docxtopdf.js Tracks uploaded file size for conversion tuning/logging.
apps/OpenSignServer/cloud/customRoute/deleteAccount/deleteUtils.js Sends delete OTP via sendSystemMail.
apps/OpenSignServer/cloud/customRoute/deleteAccount/deleteFileUrl.js Tightens /files/ detection for local delete.
apps/OpenSign/src/utils/widgetUtils.js Refactors hasSignatureWidget helper signature.
apps/OpenSign/src/utils/prefillUtils.js Uses signed URLs for prefill PDF processing; adds template-links updater.
apps/OpenSign/src/utils/acroFieldExtractor.js New utilities to clear AcroForm fields + detect password-protected PDFs.
apps/OpenSign/src/styles/signature.css Adjusts styling (drop-shadow) for signature UI element.
apps/OpenSign/src/reports/template/TemplatesReport.jsx Adds email-not-verified UI handling; translation use via Trans; minor formatting fixes.
apps/OpenSign/src/reports/document/DocumentsReport.jsx Adds email-not-verified UI handling; routes decline through cloud function; adds resend error modal.
apps/OpenSign/src/primitives/PdfDeclineModal.jsx Simplifies decline modal body markup.
apps/OpenSign/src/primitives/ModalUi.jsx Adds bottom-sheet keyboard avoidance via visualViewport; supports configurable dialog id.
apps/OpenSign/src/polyfills.js Adds crypto.randomUUID polyfill.
apps/OpenSign/src/pages/SignyourselfPdf.jsx Memoizes widget modal index; improves drag/drop page handling; integrates scroll context for zoom; minor refactors.
apps/OpenSign/src/pages/Preferences.jsx Removes redundant tooltip in header; minor formatting.
apps/OpenSign/src/pages/PdfRequestFiles.jsx Adds scroll context for zoom; hardens placeholder iteration; improves decline handling; various signing-flow tweaks.
apps/OpenSign/src/pages/Login.jsx Fixes indentation/formatting in handler.
apps/OpenSign/src/pages/Form.jsx Switches PDF preprocessing to password check + AcroForm cleanup; adds strict-order + CC support in form; improves error logging.
apps/OpenSign/src/json/FormJson.js Enables cc option for document/template forms.
apps/OpenSign/src/index.jsx Wraps app in ScrollProvider.
apps/OpenSign/src/hook/usePdfPinchZoom.js Major pinch-zoom refactor: DOM-driven during gesture, commit scale once on end.
apps/OpenSign/src/context/ScrollPdfContext.jsx New scroll ref provider for PDF zoom helpers.
apps/OpenSign/src/context/GuidelinesContext.jsx Refactors guidelines to ref-driven DOM updates + adds canvas-level guidelines.
apps/OpenSign/src/constant/const.js Adds SCALE_STEPS constants.
apps/OpenSign/src/components/shared/fields/SignersInput.jsx Renames z-index prop; adjusts z-index usage in markup.
apps/OpenSign/src/components/shared/fields/SelectSigners.jsx Updates add-signer behavior (captures return).
apps/OpenSign/src/components/pdf/WidgetsValueModal.jsx Improves focus behavior; fixes widget page lookup; normalizes radio labels; sets pageNumber in navigation.
apps/OpenSign/src/components/pdf/WidgetsDragPreview.jsx Fixes drag preview positioning within scrolled/zoomed container; refactors rendering.
apps/OpenSign/src/components/pdf/WidgetNameModal.jsx Adds rotation option for signature/initial widgets.
apps/OpenSign/src/components/pdf/SignerListPlace.jsx Removes large commented-out tooltip block.
apps/OpenSign/src/components/pdf/RenderAllPdfPage.jsx Uses password check + AcroForm cleanup while merging PDFs; improves error handling.
apps/OpenSign/src/components/pdf/RecipientList.jsx Adds i18n hook (translation usage).
apps/OpenSign/src/components/pdf/PrefillWidgetsModal.jsx Prefill widget ordering; avoids overwriting template; safer id attrs; uses redux prefill images.
apps/OpenSign/src/components/pdf/PlaceholderType.jsx Prefill modal isolation; adds signature/initials rotation rendering; scales checkbox/radio layout; safer radio label parsing.
apps/OpenSign/src/components/pdf/PlaceholderCopy.jsx Fixes widget dimension field names (Width/Height).
apps/OpenSign/src/components/pdf/PdfTools.jsx Uses password check + AcroForm cleanup for PDF merge/reorder; improves error logging.
apps/OpenSign/src/components/pdf/PdfHeader.jsx Minor refactor to reuse finish label; adds viewer gating placeholders (currently hardcoded false).
apps/OpenSign/src/components/pdf/Guidelines.jsx Ref-driven guideline elements registered per page.
apps/OpenSign/src/components/pdf/EditTemplate.jsx Adds strict-order + CC editing support.
apps/OpenSign/src/components/pdf/DragGridLinesLayer.js Updates guideline layer to canvas-level + correct scaling/scroll math.
apps/OpenSign/src/components/pdf/CanvasGuidelines.jsx New canvas-level guidelines component.
apps/OpenSign/src/components/pdf/AddRoleModal.jsx Imports useState (component likely updated).
apps/OpenSign/src/components/Header.jsx Minor indentation/formatting fix.
apps/OpenSign/src/components/bulksend/components/PrefillWidgets.jsx Sorts prefill widgets by page/yPosition for stable order.
apps/OpenSign/src/components/bulksend/BulkSendUi.jsx Uses shared hasSignatureWidget helper; clarifies role behavior.
apps/OpenSign/server.cjs New custom Node static server for production build.
apps/OpenSign/public/serve.json Adds rewrite rule to preserve /.well-known/* paths.
apps/OpenSign/public/locales/es/translation.json Adds many new i18n keys; fixes “team-enabled” key casing; new strict order + CC + offline signing strings.
apps/OpenSign/public/locales/en/translation.json Adds many new i18n keys; fixes “team-enabled” key casing; new strict order + CC + offline signing strings.
apps/OpenSign/package.json Updates dependencies; replaces serve start command with node server.cjs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +17 to +21
// A placeholder participates in completion unless it is a prefill entry or a viewer.
export function isCompletionRelevant(placeholder) {
if (!isParticipantBasic(placeholder)) return false;
return true;
}
Comment on lines +90 to 99
activity
) {
try {
const UserPtr = { __type: 'Pointer', className: className, objectId: userId };
const auditActivity = 'Signed';
const obj = {
UserPtr: UserPtr,
SignedUrl: url,
Activity: 'Signed',
Activity: auditActivity,
ipAddress: ipAddress,
Comment on lines +118 to +120
// Count both Signed and Approved entries; only signer/approver
// placeholders count toward completion (viewers and prefill excluded).
const auditTrail = updateAuditTrail.filter(x => COMPLETION_ACTIVITIES.includes(x.Activity));
Comment on lines +9 to +16
if (docsCount) {
const count = contractUser.get('DocumentCount')
? contractUser.get('DocumentCount') + Number(docsCount)
: 0 + Number(docsCount);
contractUser.set('DocumentCount', count);
} else {
contractUser.increment('DocumentCount', 1);
}
Comment on lines 7 to 10
async function saveUser(userDetails) {
const normalizedEmail = normalizeEmail(userDetails.email.toLowerCase().replace(/\s/g, ''));
const userQuery = new Parse.Query(Parse.User);
userQuery.equalTo('username', userDetails.email);
Comment on lines 156 to +168
@@ -163,7 +163,9 @@ const SignersInput = (props) => {
</span>
</label>
<div className="flex gap-x-[5px]">
<div className="w-full z-40">
<div
className={`w-full z-[${props?.zindex ? props.zindex : 40}]`}
>
Comment on lines +20 to +23
if (migrationExists) {
console.log(' INFO The unqiue index for normalizedEmail is already present.');
return;
}
Comment on lines +37 to +42
details: 'Created unique index on NormalizedEmail',
});

console.log(' SUCCESS The unqiue index for normalizedEmail is already created.');
} catch (error) {
console.log(' ERROR Running unqiue index for normalizedEmail migration:', error);
Comment thread apps/OpenSign/server.cjs
Comment on lines +4 to +8
// Tiny static file server for the production build.
// - Serves real files from ./build (including dotfile dirs like .well-known)
// - Falls back to /index.html only when the requested path does not exist
// (SPA client-side routing).
const http = require("node:http");
Comment on lines +91 to +93
// update documentCount in Users and tenant account
setDocumentCount(doc?.ExtUserPtr?.id);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants