@syngrisi/syngrisi 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -0
- package/LICENSE.md +9 -0
- package/README.md +139 -0
- package/config.js +17 -0
- package/dist/config.js +16 -0
- package/dist/src/server/models/index.js +508 -0
- package/dist/src/server/models/plugins/index.js +4 -0
- package/dist/src/server/models/plugins/paginate.plugin.js +76 -0
- package/dist/src/server/models/plugins/paginateDistinct.plugin.js +76 -0
- package/dist/src/server/models/plugins/toJSON.plugin.js +39 -0
- package/dist/src/server/schemas/createCheck.shema.js +17 -0
- package/dist/src/server/schemas/getBaseline.shema.js +12 -0
- package/dist/src/server/utils/paramsGuard.js +18 -0
- package/dist/src/tasks/backup.js +68 -0
- package/dist/src/tasks/lib/common.js +14 -0
- package/dist/src/tasks/lib/utils.js +14 -0
- package/dist/src/tasks/migrations/2.0.migration.js +86 -0
- package/dist/src/tasks/migrations/2.0.migration_mql.js +57 -0
- package/dist/src/tasks/reindex.js +28 -0
- package/dist/src/tasks/restore.js +86 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/docker-compose.yml +70 -0
- package/mvc/views/react/admin/index.html +22 -0
- package/mvc/views/react/assets/LogicalGroup.95929360.js +15993 -0
- package/mvc/views/react/assets/PasswordInput.8a73fdd2.js +299 -0
- package/mvc/views/react/assets/admin.94703bdc.js +14448 -0
- package/mvc/views/react/assets/auth.748478ef.js +673 -0
- package/mvc/views/react/assets/bg_2_0_dark_L2.3a31edc0.png +0 -0
- package/mvc/views/react/assets/favicon.bf5828d5.svg +7 -0
- package/mvc/views/react/assets/index.a5606313.css +23 -0
- package/mvc/views/react/assets/roboto-v30-latin-100.0f303f31.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-100.34e9582c.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-500.9ce7f3ac.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-500.b0195382.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-700.e0fd57c0.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-700.f5aebdfe.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-regular.f2abf7fb.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-regular.f6734f81.woff2 +0 -0
- package/mvc/views/react/assets/root.136e0ea3.js +25451 -0
- package/mvc/views/react/assets/use-form.57ebe175.js +24472 -0
- package/mvc/views/react/assets/use-form.ecb4391b.css +36 -0
- package/mvc/views/react/auth/index.html +22 -0
- package/mvc/views/react/index.html +19 -0
- package/mvc/views/react/index2/index.html +21 -0
- package/package.json +144 -0
- package/server.js +166 -0
- package/src/server/controllers/app.controller.js +21 -0
- package/src/server/controllers/auth.controller.js +156 -0
- package/src/server/controllers/baseline.controller.js +24 -0
- package/src/server/controllers/check.controller.js +56 -0
- package/src/server/controllers/client.controller.js +173 -0
- package/src/server/controllers/index.js +12 -0
- package/src/server/controllers/logs.controller.js +30 -0
- package/src/server/controllers/runs.controller.js +25 -0
- package/src/server/controllers/settings.controller.js +23 -0
- package/src/server/controllers/snapshots.controller.js +17 -0
- package/src/server/controllers/suite.controller.js +24 -0
- package/src/server/controllers/tasks.controller.js +47 -0
- package/src/server/controllers/test.controller.js +70 -0
- package/src/server/controllers/users.controller.js +79 -0
- package/src/server/data/custom_devices.json +8 -0
- package/src/server/data/devices.json +773 -0
- package/src/server/data/get_devices.sh +2 -0
- package/src/server/lib/AppSettings.js +56 -0
- package/src/server/lib/admin.json +9 -0
- package/src/server/lib/comparator.js +147 -0
- package/src/server/lib/compareImagesNode.js +60 -0
- package/src/server/lib/dbItems.js +215 -0
- package/src/server/lib/ensureLogin/ensureLoggedIn.js +223 -0
- package/src/server/lib/ensureLogin/ensureLoggedOut.js +44 -0
- package/src/server/lib/getElementsByPixPositionsFromDump.js +72 -0
- package/src/server/lib/guest.json +9 -0
- package/src/server/lib/initialAppSettings.json +18 -0
- package/src/server/lib/logger.js +95 -0
- package/src/server/lib/onStart.js +53 -0
- package/src/server/lib/parseDiff.js.bak +72 -0
- package/src/server/lib/testAdmin.json +9 -0
- package/src/server/lib/testUsers.json +41 -0
- package/src/server/middlewares/authorization.js +50 -0
- package/src/server/middlewares/disableCors.js +19 -0
- package/src/server/models/index.js +534 -0
- package/src/server/models/plugins/index.js +3 -0
- package/src/server/models/plugins/paginate.plugin.js +83 -0
- package/src/server/models/plugins/paginateDistinct.plugin.js +80 -0
- package/src/server/models/plugins/toJSON.plugin.js +44 -0
- package/src/server/routes/ui/admin.js +20 -0
- package/src/server/routes/ui/auth.js +15 -0
- package/src/server/routes/ui/index.js +19 -0
- package/src/server/routes/v1/app.route.js +9 -0
- package/src/server/routes/v1/auth.route.js +12 -0
- package/src/server/routes/v1/baselines.route.js +14 -0
- package/src/server/routes/v1/checks.route.js +25 -0
- package/src/server/routes/v1/client.route.js +39 -0
- package/src/server/routes/v1/index.js +82 -0
- package/src/server/routes/v1/logs.route.js +16 -0
- package/src/server/routes/v1/runs.route.js +15 -0
- package/src/server/routes/v1/settings.route.js +23 -0
- package/src/server/routes/v1/snapshots.route.js +11 -0
- package/src/server/routes/v1/suites.route.js +15 -0
- package/src/server/routes/v1/tasks.route.js +59 -0
- package/src/server/routes/v1/test.route.js +20 -0
- package/src/server/routes/v1/test_distinct.route.js +14 -0
- package/src/server/routes/v1/users.route.js +36 -0
- package/src/server/schemas/createCheck.shema.ts +17 -0
- package/src/server/schemas/getBaseline.shema.ts +12 -0
- package/src/server/services/app.service.js +23 -0
- package/src/server/services/check.service.js +178 -0
- package/src/server/services/client.service.js +648 -0
- package/src/server/services/generic.service.js +51 -0
- package/src/server/services/index.js +12 -0
- package/src/server/services/logs.service.js +38 -0
- package/src/server/services/run.service.js +40 -0
- package/src/server/services/suite.service.js +39 -0
- package/src/server/services/tasks.service.js +536 -0
- package/src/server/services/test.service.js +72 -0
- package/src/server/services/user.service.js +128 -0
- package/src/server/utils/ApiError.js +14 -0
- package/src/server/utils/catchAsync.js +8 -0
- package/src/server/utils/check.js +58 -0
- package/src/server/utils/dateToISO8601.js +2 -0
- package/src/server/utils/deserializeIfJSON.js +9 -0
- package/src/server/utils/formatISOToDateTime.js +6 -0
- package/src/server/utils/index.js +10 -0
- package/src/server/utils/isJSON.js +6 -0
- package/src/server/utils/paramsGuard.ts +15 -0
- package/src/server/utils/pick.js +15 -0
- package/src/server/utils/prettyCheckParams.js +13 -0
- package/src/server/utils/snapshots.js +73 -0
- package/src/server/utils/subDays.js +7 -0
- package/src/server/utils/tests.js +36 -0
- package/src/server/utils/utils.js +146 -0
- package/src/tasks/backup.js.bak +84 -0
- package/src/tasks/backup.ts +53 -0
- package/src/tasks/lib/common.js +24 -0
- package/src/tasks/lib/utils.js +15 -0
- package/src/tasks/migrations/2.0.migration.js +86 -0
- package/src/tasks/migrations/2.0.migration.ts +95 -0
- package/src/tasks/migrations/2.0.migration_mql.js +63 -0
- package/src/tasks/reindex.js +36 -0
- package/src/tasks/restore.js.bak +100 -0
- package/src/tasks/restore.ts +75 -0
- package/src/ui-app/.eslintrc.json +119 -0
- package/src/ui-app/README.md +15 -0
- package/src/ui-app/admin/AdminLayout.tsx +38 -0
- package/src/ui-app/admin/App.tsx +108 -0
- package/src/ui-app/admin/AppContext.ts +3 -0
- package/src/ui-app/admin/components/Header/AdminHeader.tsx +148 -0
- package/src/ui-app/admin/components/Logs/AdminLogs.tsx +142 -0
- package/src/ui-app/admin/components/Logs/RefreshActionIcon.tsx +60 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTable.tsx +81 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableFilter.tsx +170 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableHeads.tsx +50 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableRows.tsx +207 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableSettings.tsx +95 -0
- package/src/ui-app/admin/components/Logs/Table/InfinityScrollSkeleton.tsx +77 -0
- package/src/ui-app/admin/components/Logs/Table/InfinityScrollSkeletonFIller.tsx +57 -0
- package/src/ui-app/admin/components/Logs/Table/PagesCountAffix.tsx +61 -0
- package/src/ui-app/admin/components/Logs/Table/adminLogsCreateStyle.tsx +36 -0
- package/src/ui-app/admin/components/Logs/Table/adminLogsTableColumns.ts +52 -0
- package/src/ui-app/admin/components/Logs/UnfoldActionIcon.tsx +39 -0
- package/src/ui-app/admin/components/Navbar/AdminNavbar.tsx +50 -0
- package/src/ui-app/admin/components/Navbar/NavbarLinksGroup.tsx +104 -0
- package/src/ui-app/admin/components/Settings/AdminSettings.tsx +51 -0
- package/src/ui-app/admin/components/Settings/Forms/Boolean.tsx +59 -0
- package/src/ui-app/admin/components/Settings/Forms/FormWrapper.tsx +45 -0
- package/src/ui-app/admin/components/Settings/Forms/index.tsx +5 -0
- package/src/ui-app/admin/components/Settings/Forms/interfaces.tsx +17 -0
- package/src/ui-app/admin/components/Tasks/Task.tsx +138 -0
- package/src/ui-app/admin/components/Tasks/TaskWrapper.tsx +11 -0
- package/src/ui-app/admin/components/Tasks/tasksList.ts +59 -0
- package/src/ui-app/admin/components/Users/AdminUsers.tsx +182 -0
- package/src/ui-app/admin/components/Users/UserAddForm.tsx +137 -0
- package/src/ui-app/admin/components/Users/UserForm.tsx +196 -0
- package/src/ui-app/admin/hooks/useParams.tsx +18 -0
- package/src/ui-app/admin/index.html +17 -0
- package/src/ui-app/admin/main.tsx +24 -0
- package/src/ui-app/asserts/css/auth/index.css +23 -0
- package/src/ui-app/asserts/css/styles.css +36 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.svg +313 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.svg +305 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.svg +309 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.svg +308 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.woff2 +0 -0
- package/src/ui-app/asserts/images/background.jpg +0 -0
- package/src/ui-app/asserts/images/bg_2_0_dark_L2.png +0 -0
- package/src/ui-app/asserts/images/favicon.svg +7 -0
- package/src/ui-app/auth/App.tsx +82 -0
- package/src/ui-app/auth/commonStyles.tsx +26 -0
- package/src/ui-app/auth/components/AuthFooter.tsx +51 -0
- package/src/ui-app/auth/components/AuthLogo.tsx +58 -0
- package/src/ui-app/auth/components/ChangePasswordForm.tsx +216 -0
- package/src/ui-app/auth/components/ChangePasswordSuccessForm.tsx +38 -0
- package/src/ui-app/auth/components/LoginForm.tsx +148 -0
- package/src/ui-app/auth/components/LogoutForm.tsx +89 -0
- package/src/ui-app/auth/components/ToggleThemeButton.tsx +41 -0
- package/src/ui-app/auth/components/change-password/Bars.tsx +45 -0
- package/src/ui-app/auth/components/change-password/PasswordRequirement.tsx +14 -0
- package/src/ui-app/auth/components/change-password/requirements.tsx +6 -0
- package/src/ui-app/auth/index.html +17 -0
- package/src/ui-app/auth/main.tsx +12 -0
- package/src/ui-app/auth/routes.tsx +26 -0
- package/src/ui-app/config.ts +15 -0
- package/src/ui-app/index.html +12 -0
- package/src/ui-app/index2/App.tsx +162 -0
- package/src/ui-app/index2/AppContext.ts +3 -0
- package/src/ui-app/index2/IndexLayout.tsx +34 -0
- package/src/ui-app/index2/components/Header/HeaderIndex.tsx +248 -0
- package/src/ui-app/index2/components/Header/QuickFilter.tsx +312 -0
- package/src/ui-app/index2/components/Navbar/Items/AcceptStatusItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/BaseItemWrapper.tsx +94 -0
- package/src/ui-app/index2/components/Navbar/Items/BrowserItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/PlatformItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveItemModalAsk.tsx +71 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveItemPopover.tsx +58 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveSuiteModalAsk.tsx +61 -0
- package/src/ui-app/index2/components/Navbar/Items/RunItem.tsx +149 -0
- package/src/ui-app/index2/components/Navbar/Items/StatusItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/SuiteItem.tsx +109 -0
- package/src/ui-app/index2/components/Navbar/Items/index.tsx +6 -0
- package/src/ui-app/index2/components/Navbar/NavbarFilter.tsx +93 -0
- package/src/ui-app/index2/components/Navbar/NavbarGroupBySelect.tsx +83 -0
- package/src/ui-app/index2/components/Navbar/NavbarIndex.tsx +247 -0
- package/src/ui-app/index2/components/Navbar/NavbarItems.tsx +38 -0
- package/src/ui-app/index2/components/Navbar/NavbarSort.tsx +105 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/RunsDummySkeleton.tsx +27 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SimpleDummySkeleton.tsx +23 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SkeletonWrapper.tsx +45 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SuitesDummySkeleton.tsx +27 -0
- package/src/ui-app/index2/components/Tests/Table/AcceptTestModalAsk.tsx +68 -0
- package/src/ui-app/index2/components/Tests/Table/AcceptTestsButton.tsx +44 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Branch.tsx +35 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/BrowserName.tsx +33 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/BrowserVersion.tsx +31 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/CellWrapper.tsx +49 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Os.tsx +32 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/StartDate.tsx +34 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Status.tsx +50 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/ViewPort.tsx +46 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/AcceptButton.tsx +142 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/Check.tsx +281 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/Canvas.tsx +36 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/helpers.ts +72 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/mainView.ts +495 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/sideToSideView.ts +398 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/simpleView.ts +21 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/CheckDetails.tsx +237 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Header.tsx +221 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedCheckItem.tsx +167 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedCheckSort.tsx +81 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecks.tsx +197 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecksItems.tsx +31 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecksSkeleton.tsx +37 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/HighlightButton.tsx +56 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/RegionsToolbar.tsx +150 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ScreenshotDetails.tsx +137 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/Toolbar.tsx +101 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ViewSegmentedControl.tsx +159 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ZoomToolbar.tsx +326 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/highlightDiff.ts +167 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/hooks/useRelatedChecks.tsx +43 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckModal.tsx +119 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/Checks.tsx +91 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/ChecksSkeleton.tsx +21 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/PreviewCheckTooltipLabel.tsx +121 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/RemoveButton.tsx +63 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/ViewPortLabel.tsx +94 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/checkSizes.ts +27 -0
- package/src/ui-app/index2/components/Tests/Table/Filter.tsx +179 -0
- package/src/ui-app/index2/components/Tests/Table/Heads.tsx +54 -0
- package/src/ui-app/index2/components/Tests/Table/InfinityScrollSkeleton.tsx +71 -0
- package/src/ui-app/index2/components/Tests/Table/PagesCountAffix.tsx +61 -0
- package/src/ui-app/index2/components/Tests/Table/RefreshActionIcon.tsx +65 -0
- package/src/ui-app/index2/components/Tests/Table/RemoveTestModalAsk.tsx +66 -0
- package/src/ui-app/index2/components/Tests/Table/RemoveTestsButton.tsx +43 -0
- package/src/ui-app/index2/components/Tests/Table/Row.tsx +128 -0
- package/src/ui-app/index2/components/Tests/Table/Rows.tsx +87 -0
- package/src/ui-app/index2/components/Tests/Table/Settings.tsx +121 -0
- package/src/ui-app/index2/components/Tests/Table/TestsTable.tsx +140 -0
- package/src/ui-app/index2/components/Tests/Table/UnfoldActionIcon.tsx +39 -0
- package/src/ui-app/index2/components/Tests/Table/tableColumns.ts +80 -0
- package/src/ui-app/index2/components/Tests/Table/testsCreateStyle.tsx +35 -0
- package/src/ui-app/index2/components/Tests/Tests.tsx +157 -0
- package/src/ui-app/index2/hooks/useIndexSubpageEffect.tsx +14 -0
- package/src/ui-app/index2/hooks/useNavbarActiveItems.tsx +66 -0
- package/src/ui-app/index2/hooks/useParams.tsx +25 -0
- package/src/ui-app/index2/index.html +17 -0
- package/src/ui-app/index2/main.tsx +33 -0
- package/src/ui-app/package-lock.json +6150 -0
- package/src/ui-app/package.json +58 -0
- package/src/ui-app/shared/components/ActionPopoverIcon.tsx +116 -0
- package/src/ui-app/shared/components/Check/AcceptedStatusIcon.tsx +51 -0
- package/src/ui-app/shared/components/Check/BrowserIcon.tsx +50 -0
- package/src/ui-app/shared/components/Check/OsIcon.tsx +73 -0
- package/src/ui-app/shared/components/Check/Status.tsx +37 -0
- package/src/ui-app/shared/components/Check/StatusIcon.tsx +66 -0
- package/src/ui-app/shared/components/Email.tsx +83 -0
- package/src/ui-app/shared/components/Header/ApiKeyModalAsk.tsx +31 -0
- package/src/ui-app/shared/components/Header/ApiKeyModalResult.tsx +89 -0
- package/src/ui-app/shared/components/Header/HeaderLogo.tsx +82 -0
- package/src/ui-app/shared/components/Header/UserInfoModal.tsx +92 -0
- package/src/ui-app/shared/components/Header/UserMenu.tsx +151 -0
- package/src/ui-app/shared/components/Password.tsx +95 -0
- package/src/ui-app/shared/components/RelativeDrawer.tsx +43 -0
- package/src/ui-app/shared/components/SafeSelect.tsx +95 -0
- package/src/ui-app/shared/components/Tests/StatusesRing.tsx +66 -0
- package/src/ui-app/shared/components/ToggleThemeButton.tsx +33 -0
- package/src/ui-app/shared/components/Users/LabelUser.tsx +60 -0
- package/src/ui-app/shared/components/errors/ErrorFallback.tsx +66 -0
- package/src/ui-app/shared/components/filter/AcceptedFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/BrowserNameFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/CommonDistinctFilter.tsx +104 -0
- package/src/ui-app/shared/components/filter/DateFilter.tsx +54 -0
- package/src/ui-app/shared/components/filter/FilterWrapper.tsx +80 -0
- package/src/ui-app/shared/components/filter/IdFilter.tsx +60 -0
- package/src/ui-app/shared/components/filter/LogLevelFilter.tsx +77 -0
- package/src/ui-app/shared/components/filter/LogicalGroup.tsx +179 -0
- package/src/ui-app/shared/components/filter/OsFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/StatusFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/StringFilter.tsx +55 -0
- package/src/ui-app/shared/components/filter/index.ts +19 -0
- package/src/ui-app/shared/components/heaserLinks.tsx +4 -0
- package/src/ui-app/shared/hooks/index.ts +3 -0
- package/src/ui-app/shared/hooks/useColorSheme.ts +22 -0
- package/src/ui-app/shared/hooks/useDistinctLogQuery.tsx +33 -0
- package/src/ui-app/shared/hooks/useDistinctQuery.tsx +37 -0
- package/src/ui-app/shared/hooks/useInfinityScroll.tsx +163 -0
- package/src/ui-app/shared/hooks/useInfinityScrollRelatedChecks.tsx +60 -0
- package/src/ui-app/shared/hooks/useNavProgressFetchEffect.tsx +17 -0
- package/src/ui-app/shared/hooks/useSubpageEffect.tsx +28 -0
- package/src/ui-app/shared/hooks/user.hooks.ts +49 -0
- package/src/ui-app/shared/interfaces/ILog.tsx +13 -0
- package/src/ui-app/shared/interfaces/IUser.tsx +13 -0
- package/src/ui-app/shared/interfaces/logQueries.tsx +31 -0
- package/src/ui-app/shared/navigation/interfaces.tsx +7 -0
- package/src/ui-app/shared/navigation/navigationData.tsx +191 -0
- package/src/ui-app/shared/services/checks.service.ts +39 -0
- package/src/ui-app/shared/services/generic.service.ts +115 -0
- package/src/ui-app/shared/services/index.ts +6 -0
- package/src/ui-app/shared/services/runs.service.ts +20 -0
- package/src/ui-app/shared/services/suites.service.ts +20 -0
- package/src/ui-app/shared/services/tests.service.ts +39 -0
- package/src/ui-app/shared/services/users.service.ts +29 -0
- package/src/ui-app/shared/utils/Logger.ts +12 -0
- package/src/ui-app/shared/utils/SearchParams.ts +17 -0
- package/src/ui-app/shared/utils/filters.tsx +14 -0
- package/src/ui-app/shared/utils/index.ts +5 -0
- package/src/ui-app/shared/utils/utils.tsx +70 -0
- package/src/ui-app/stub.html +12 -0
- package/src/ui-app/stub.tsx +58 -0
- package/src/ui-app/stubDemoColors.tsx +47 -0
- package/src/ui-app/stubDemoNav.tsx +41 -0
- package/src/ui-app/tsconfig.json +21 -0
- package/src/ui-app/tsconfig.node.json +12 -0
- package/static/A.png +0 -0
- package/static/B.png +0 -0
- package/static/affected.html +39 -0
- package/static/affected_2.html +40 -0
- package/static/data/custom_devices.json +14 -0
- package/static/grids/desktop-higher.html +72 -0
- package/static/grids/desktop-wider.html +72 -0
- package/static/grids/desktop.html +61 -0
- package/static/grids/fit-in-view.html +62 -0
- package/static/js/canvasjs.min.js.bak +957 -0
- package/static/js/chart.js.bak +92 -0
- package/static/js/jquery-3.3.1.slim.js.bak +8269 -0
- package/static/js/jquery-3.3.1.slim.min.js.bak +2 -0
- package/static/js/moment.min.js.bak +2 -0
- package/static/low_diff_0.png +0 -0
- package/static/low_diff_1.png +0 -0
- package/static/vShift.png +0 -0
- package/static/vShift_bottom.png +0 -0
- package/static/vShift_top.png +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* roboto-100 - latin */
|
|
2
|
+
@font-face {
|
|
3
|
+
font-family: 'Roboto';
|
|
4
|
+
font-style: normal;
|
|
5
|
+
font-weight: 100;
|
|
6
|
+
src: local(''),
|
|
7
|
+
url('/assets/roboto-v30-latin-100.0f303f31.woff2') format('woff2'),
|
|
8
|
+
url('/assets/roboto-v30-latin-100.34e9582c.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
9
|
+
}
|
|
10
|
+
/* roboto-regular - latin */
|
|
11
|
+
@font-face {
|
|
12
|
+
font-family: 'Roboto';
|
|
13
|
+
font-style: normal;
|
|
14
|
+
font-weight: 400;
|
|
15
|
+
src: local(''),
|
|
16
|
+
url('/assets/roboto-v30-latin-regular.f6734f81.woff2') format('woff2'),
|
|
17
|
+
url('/assets/roboto-v30-latin-regular.f2abf7fb.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
18
|
+
}
|
|
19
|
+
/* roboto-500 - latin */
|
|
20
|
+
@font-face {
|
|
21
|
+
font-family: 'Roboto';
|
|
22
|
+
font-style: normal;
|
|
23
|
+
font-weight: 500;
|
|
24
|
+
src: local(''),
|
|
25
|
+
url('/assets/roboto-v30-latin-500.b0195382.woff2') format('woff2'),
|
|
26
|
+
url('/assets/roboto-v30-latin-500.9ce7f3ac.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
27
|
+
}
|
|
28
|
+
/* roboto-700 - latin */
|
|
29
|
+
@font-face {
|
|
30
|
+
font-family: 'Roboto';
|
|
31
|
+
font-style: normal;
|
|
32
|
+
font-weight: 700;
|
|
33
|
+
src: local(''),
|
|
34
|
+
url('/assets/roboto-v30-latin-700.f5aebdfe.woff2') format('woff2'),
|
|
35
|
+
url('/assets/roboto-v30-latin-700.e0fd57c0.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
36
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" style="height: 100%">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport"
|
|
6
|
+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
8
|
+
|
|
9
|
+
<link rel="icon" href="/assets/favicon.bf5828d5.svg">
|
|
10
|
+
<title>Syngrisi</title>
|
|
11
|
+
<script type="module" crossorigin src="/assets/auth.748478ef.js"></script>
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/use-form.57ebe175.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/PasswordInput.8a73fdd2.js">
|
|
14
|
+
<link rel="stylesheet" href="/assets/use-form.ecb4391b.css">
|
|
15
|
+
<link rel="stylesheet" href="/assets/index.a5606313.css">
|
|
16
|
+
</head>
|
|
17
|
+
<div></div>
|
|
18
|
+
<body>
|
|
19
|
+
<div id="root" style="position: relative; overflow-y: scroll; height: 100%"></div>
|
|
20
|
+
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" style="height: 100%">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport"
|
|
6
|
+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
8
|
+
|
|
9
|
+
<link rel="icon" href="./assets/favicon.bf5828d5.svg">
|
|
10
|
+
<title>Syngrisi</title>
|
|
11
|
+
<script type="module" crossorigin src="./assets/admin.7a155b5d.js"></script>
|
|
12
|
+
<link rel="stylesheet" href="./assets/index.3caeb454.css">
|
|
13
|
+
</head>
|
|
14
|
+
<div></div>
|
|
15
|
+
<body>
|
|
16
|
+
<div id="root" style="position: relative; overflow-y: scroll; height: 100%"></div>
|
|
17
|
+
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" style="height: 100%">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport"
|
|
6
|
+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
8
|
+
|
|
9
|
+
<link rel="icon" href="/assets/favicon.bf5828d5.svg">
|
|
10
|
+
<title>Syngrisi</title>
|
|
11
|
+
<script type="module" crossorigin src="/assets/root.136e0ea3.js"></script>
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/use-form.57ebe175.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/LogicalGroup.95929360.js">
|
|
14
|
+
<link rel="stylesheet" href="/assets/use-form.ecb4391b.css">
|
|
15
|
+
</head>
|
|
16
|
+
<div></div>
|
|
17
|
+
<body style="overflow-y: hidden">
|
|
18
|
+
<div id="root" style="position: relative; height: 100%"></div>
|
|
19
|
+
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@syngrisi/syngrisi",
|
|
3
|
+
"version": "2.2.1",
|
|
4
|
+
"description": "Syngrisi - Visual Testing Tool",
|
|
5
|
+
"main": "server.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"sy": "server.js"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/syngrisi/syngrisi"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"src",
|
|
18
|
+
"dist",
|
|
19
|
+
"mvc",
|
|
20
|
+
"static",
|
|
21
|
+
"src/tasks",
|
|
22
|
+
"config.js",
|
|
23
|
+
"server.js",
|
|
24
|
+
"docker-compose.yml",
|
|
25
|
+
".nvmrc"
|
|
26
|
+
],
|
|
27
|
+
"homepage": "https://github.com/syngrisi/syngrisi/tree/main/packages/syngrisi",
|
|
28
|
+
"keywords": [
|
|
29
|
+
"testing",
|
|
30
|
+
"regression",
|
|
31
|
+
"visual",
|
|
32
|
+
"screenshots",
|
|
33
|
+
"comparison"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"clean:server": "rm -rf dist",
|
|
37
|
+
"build:ui": "rm -rf mvc/views/react/assets && cross-env VITE_ROOT_PATH='./src/ui-app/' vite build",
|
|
38
|
+
"build:server": "npm run clean:server && tsc -b --verbose",
|
|
39
|
+
"build": "npm run build:ui && npm run build:server",
|
|
40
|
+
"install:server": "npm i",
|
|
41
|
+
"install:ui": "cd src/ui-app && npm i && cd --",
|
|
42
|
+
"install:all": "npm run install:server && npm run install:ui",
|
|
43
|
+
"test": "npm run build && cd tests && npm run test",
|
|
44
|
+
"test:docker": "cd tests && npm run test:docker",
|
|
45
|
+
"smoke": "cd tests && npm run smoke",
|
|
46
|
+
"dev": "cross-env VITE_SYNGRISI_BASED_URL='http://localhost:3000' VITE_INDEX_ROUTE='index2/' vite",
|
|
47
|
+
"dev:admin": "cross-env VITE_SYNGRISI_BASED_URL='http://localhost:3000' VITE_INDEX_ROUTE='admin/' vite/' vite #(!) open http://localhost:8080/admin/ ",
|
|
48
|
+
"build:watch": "cross-env VITE_ROOT_PATH='./src/ui-app/' vite build --watch",
|
|
49
|
+
"pub": "np --yolo --no-publish",
|
|
50
|
+
"starttest": "node server.js",
|
|
51
|
+
"tasks:reindex": "node src/tasks/reindex.js",
|
|
52
|
+
"tasks:backup": "node dist/src/tasks/backup.js",
|
|
53
|
+
"tasks:restore": "node dist/src/tasks/restore.js",
|
|
54
|
+
"tasks:migration_2_0": "node src/tasks/migrations/2.0.migration.js",
|
|
55
|
+
"startservice": "forever start -l forever.log -o out.log -e err.log server.js",
|
|
56
|
+
"start": "nodemon --ignore 'mvc/views/lib/*.js' --ignore 'tests' server.js",
|
|
57
|
+
"clean": "read -p \"Are you sure you want to clean the project? [y/n] \" REPLY; if [[ $REPLY =~ ^[Yy]$ ]]; then mongosh SyngrisiDb --eval \"db.dropDatabase();\" && rm -f ./baselines/*.png; fi",
|
|
58
|
+
"start_test": "cross-env SYNGRISI_DB_URI='mongodb://localhost/SyngrisiDbTest' nodemon server.js",
|
|
59
|
+
"clear_test": "mongosh SyngrisiDbTest$CID --eval \"db.dropDatabase();\" && rm -rf ./baselinesTest/$CID",
|
|
60
|
+
"clear_test_db_only": "mongosh SyngrisiDbTest$CID --eval \"db.dropDatabase();\"",
|
|
61
|
+
"docker_clear_test": "rm -rf ./data/db_data && rm -rf ./baselinesTest/$CID",
|
|
62
|
+
"docker_clear_test_db_only": "rm -rf ./data/db_data",
|
|
63
|
+
"clear_test_screenshots_only": "rm -rf ./baselinesTest/$CID/*",
|
|
64
|
+
"deadfile:be": "npx deadfile ./server.js --exclude tests src/tasks backups data docs mvc/views/react src/ui-app baseline*",
|
|
65
|
+
"deadfile:fe": "deadfile ./mvc/views/react/index2/index.html ./mvc/views/react/auth/index.html --dir ./mvc/views/react",
|
|
66
|
+
"pkglist": "npx npm-packlist # list of files that will be published in syngrisi package, show the files section"
|
|
67
|
+
},
|
|
68
|
+
"author": {
|
|
69
|
+
"name": "Viktar Silakou",
|
|
70
|
+
"email": "1105714@gmail.com"
|
|
71
|
+
},
|
|
72
|
+
"bugs": {
|
|
73
|
+
"url": "https://github.com/syngrisi/syngrisi/issues"
|
|
74
|
+
},
|
|
75
|
+
"license": "MIT",
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@inquirer/prompts": "^3.3.0",
|
|
78
|
+
"@syngrisi/node-resemble.js": "^2.1.36-alpha.0",
|
|
79
|
+
"body-parser": "^1.19.0",
|
|
80
|
+
"bottleneck": "^2.19.5",
|
|
81
|
+
"bson": "^5.5.1",
|
|
82
|
+
"chalk": "^4.1.2",
|
|
83
|
+
"compression": "^1.7.4",
|
|
84
|
+
"connect-mongo": "^5.1.0",
|
|
85
|
+
"cookie-parser": "^1.4.6",
|
|
86
|
+
"dotenv": "^16.0.0",
|
|
87
|
+
"express": "^4.18.2",
|
|
88
|
+
"express-fileupload": "^1.4.0",
|
|
89
|
+
"express-session": "^1.17.1",
|
|
90
|
+
"hasha": "^5.1.0",
|
|
91
|
+
"http-status": "^1.5.2",
|
|
92
|
+
"mongoose": "^7.6.4",
|
|
93
|
+
"nodemon": "^3.0.1",
|
|
94
|
+
"p-queue": "^6.4.0",
|
|
95
|
+
"passport": "^0.6.0",
|
|
96
|
+
"passport-local": "^1.0.0",
|
|
97
|
+
"passport-local-mongoose": "^8.0.0",
|
|
98
|
+
"pino": "^8.16.1",
|
|
99
|
+
"pino-http": "^8.5.1",
|
|
100
|
+
"string-table": "^0.1.5",
|
|
101
|
+
"uuid-apikey": "^1.5.2",
|
|
102
|
+
"winston": "^3.11.0",
|
|
103
|
+
"winston-mongodb": "^5.1.1",
|
|
104
|
+
"zod": "^3.22.4"
|
|
105
|
+
},
|
|
106
|
+
"devDependencies": {
|
|
107
|
+
"@types/fabric": "^4.5.12",
|
|
108
|
+
"@types/jquery": "^3.5.14",
|
|
109
|
+
"@types/mongoose": "^5.11.97",
|
|
110
|
+
"@types/node": "^20.9.0",
|
|
111
|
+
"@types/react": "^18.0.15",
|
|
112
|
+
"@types/react-dom": "^18.0.6",
|
|
113
|
+
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
|
114
|
+
"@typescript-eslint/parser": "^6.11.0",
|
|
115
|
+
"@vitejs/plugin-react": "^2.0.0",
|
|
116
|
+
"babel-eslint": "^10.1.0",
|
|
117
|
+
"c8": "^8.0.1",
|
|
118
|
+
"cross-env": "^7.0.3",
|
|
119
|
+
"eslint": "^8.53.0",
|
|
120
|
+
"form-data": "^4.0.0",
|
|
121
|
+
"parcel": "^2.10.2",
|
|
122
|
+
"sass": "^1.54.0",
|
|
123
|
+
"typescript": "^5.2.2",
|
|
124
|
+
"vite": "^3.0.9"
|
|
125
|
+
},
|
|
126
|
+
"nyc": {
|
|
127
|
+
"all": true,
|
|
128
|
+
"include": [
|
|
129
|
+
"src/server/**/*.js"
|
|
130
|
+
],
|
|
131
|
+
"exclude": [
|
|
132
|
+
"**/*.test.js",
|
|
133
|
+
"coverage/**",
|
|
134
|
+
"node_modules/**"
|
|
135
|
+
],
|
|
136
|
+
"reporter": [
|
|
137
|
+
"json"
|
|
138
|
+
],
|
|
139
|
+
"extension": [
|
|
140
|
+
".js"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
"gitHead": "a0d3926ab3ce0c104e75f1e41f3be19211442142"
|
|
144
|
+
}
|
package/server.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const v8 = require('v8');
|
|
3
|
+
const express = require('express');
|
|
4
|
+
const cookieParser = require('cookie-parser');
|
|
5
|
+
const MongoStore = require('connect-mongo');
|
|
6
|
+
const chalk = require('chalk');
|
|
7
|
+
const session = require('express-session');
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
|
|
10
|
+
const app = express();
|
|
11
|
+
const mongoose = require('mongoose');
|
|
12
|
+
const bodyParser = require('body-parser');
|
|
13
|
+
const fileUpload = require('express-fileupload');
|
|
14
|
+
const pino = require('pino');
|
|
15
|
+
const path = require('path');
|
|
16
|
+
const compression = require('compression');
|
|
17
|
+
const passport = require('passport');
|
|
18
|
+
const PQueue = require('p-queue').default;
|
|
19
|
+
|
|
20
|
+
global.queue = new PQueue({ concurrency: 1 });
|
|
21
|
+
|
|
22
|
+
const LocalStrategy = require('passport-local').Strategy;
|
|
23
|
+
const pinoLogger = require('pino-http');
|
|
24
|
+
|
|
25
|
+
const { User } = require('./src/server/models');
|
|
26
|
+
const { AppSettings } = require('./src/server/lib/AppSettings');
|
|
27
|
+
|
|
28
|
+
global.AppSettings = new AppSettings();
|
|
29
|
+
|
|
30
|
+
const { config } = require('./config');
|
|
31
|
+
const { Logger } = require('./src/server/lib/logger');
|
|
32
|
+
|
|
33
|
+
const { disableCors } = require('./src/server/middlewares/disableCors');
|
|
34
|
+
|
|
35
|
+
global.log = new Logger({ dbConnectionString: config.connectionString });
|
|
36
|
+
// object-container for bottleneck instances
|
|
37
|
+
global.limiter = {};
|
|
38
|
+
|
|
39
|
+
this.logMeta = { scope: 'entrypoint' };
|
|
40
|
+
log.info('Init the application', this);
|
|
41
|
+
|
|
42
|
+
const coverage = process.env.SYNGRISI_COVERAGE === 'true';
|
|
43
|
+
process.on('SIGINT', () => {
|
|
44
|
+
if (coverage) {
|
|
45
|
+
log.info('take coverage');
|
|
46
|
+
v8.takeCoverage();
|
|
47
|
+
v8.stopCoverage();
|
|
48
|
+
}
|
|
49
|
+
console.log('Program shutting down (Ctrl+C).');
|
|
50
|
+
process.exit(1);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
function compressionFilter(req, res) {
|
|
54
|
+
if (req.headers['x-no-compression']) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return compression.filter(req, res);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
app.use(compression({ filter: compressionFilter }));
|
|
61
|
+
|
|
62
|
+
app.use(disableCors);
|
|
63
|
+
|
|
64
|
+
const storeSessionKey = process.env.SYNGRISI_SESSION_STORE_KEY || require('crypto')
|
|
65
|
+
.randomBytes(64)
|
|
66
|
+
.toString('hex');
|
|
67
|
+
|
|
68
|
+
const expressSession = session({
|
|
69
|
+
secret: storeSessionKey,
|
|
70
|
+
resave: true,
|
|
71
|
+
saveUninitialized: false,
|
|
72
|
+
cookie: { secure: false },
|
|
73
|
+
store: MongoStore.create({ mongoUrl: config.connectionString }),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
app.use(expressSession);
|
|
77
|
+
|
|
78
|
+
log.info('Init passport', this);
|
|
79
|
+
app.use(passport.initialize());
|
|
80
|
+
// app.use(session({
|
|
81
|
+
// store: MongoStore.create({ mongoUrl: 'mongodb://localhost/test-app' }),
|
|
82
|
+
// secret: storeSessionKey,
|
|
83
|
+
// resave: true,
|
|
84
|
+
// saveUninitialized: true,
|
|
85
|
+
// }));
|
|
86
|
+
app.use(passport.session());
|
|
87
|
+
passport.use(new LocalStrategy(User.authenticate()));
|
|
88
|
+
passport.serializeUser(User.serializeUser());
|
|
89
|
+
passport.deserializeUser(User.deserializeUser());
|
|
90
|
+
|
|
91
|
+
app.use(bodyParser.json());
|
|
92
|
+
app.use(bodyParser.urlencoded({ extended: true }));
|
|
93
|
+
|
|
94
|
+
if (config.enableHttpLogger === 'true') {
|
|
95
|
+
app.use(pinoLogger(
|
|
96
|
+
{
|
|
97
|
+
name: 'vrs',
|
|
98
|
+
autoLogging: true,
|
|
99
|
+
useLevel: 'info',
|
|
100
|
+
},
|
|
101
|
+
pino.destination(config.httpLoggerFilePath))
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
app.use(cookieParser());
|
|
106
|
+
|
|
107
|
+
app.use(fileUpload({
|
|
108
|
+
limits: { fileSize: 50 * 1024 * 1024 },
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
const viewPath = path.join(__dirname, 'mvc/views');
|
|
112
|
+
|
|
113
|
+
app.set('views', viewPath);
|
|
114
|
+
app.set('view engine', 'ejs');
|
|
115
|
+
|
|
116
|
+
app.use(express.json({ limit: '50mb' }));
|
|
117
|
+
|
|
118
|
+
app.use('/snapshoots', express.static(path.join(process.cwd(), config.defaultImagesPath)));
|
|
119
|
+
|
|
120
|
+
app.use('/static', express.static(`${__dirname}/static`));
|
|
121
|
+
app.use('/assets', express.static(`${__dirname}/mvc/views/react/assets`));
|
|
122
|
+
const routes = require('./src/server/routes/v1');
|
|
123
|
+
|
|
124
|
+
app.use('/v1', routes);
|
|
125
|
+
|
|
126
|
+
app.use('/auth', require('./src/server/routes/ui/auth'));
|
|
127
|
+
app.use('/admin*', require('./src/server/routes/ui/admin'));
|
|
128
|
+
app.use('/', require('./src/server/routes/ui'));
|
|
129
|
+
|
|
130
|
+
app.use((req, res) => {
|
|
131
|
+
res.status(404)
|
|
132
|
+
.json({ url: `${req.originalUrl} not found` });
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
log.info('Connect to database', this);
|
|
136
|
+
|
|
137
|
+
mongoose.Promise = global.Promise;
|
|
138
|
+
|
|
139
|
+
let server;
|
|
140
|
+
mongoose.set('strictQuery', false);
|
|
141
|
+
// mongoose instance connection url connection
|
|
142
|
+
mongoose.connect(config.connectionString, { useUnifiedTopology: true })
|
|
143
|
+
.then(async () => {
|
|
144
|
+
log.info('Connected to MongoDB');
|
|
145
|
+
log.debug('run onStart jobs', this);
|
|
146
|
+
const startUp = await require('./src/server/lib/onStart');
|
|
147
|
+
startUp.createTempDir();
|
|
148
|
+
await startUp.createBasicUsers();
|
|
149
|
+
await startUp.createInitialSettings();
|
|
150
|
+
if (process.env.SYNGRISI_TEST_MODE === '1') await startUp.createTestsUsers();
|
|
151
|
+
|
|
152
|
+
log.info('Get Application version', this);
|
|
153
|
+
global.version = require('./package.json').version;
|
|
154
|
+
|
|
155
|
+
log.info('Load devices list', this);
|
|
156
|
+
global.devices = require('./src/server/data/devices.json');
|
|
157
|
+
|
|
158
|
+
if (fs.existsSync('./src/data/custom_devices.json')) {
|
|
159
|
+
global.devices = [...global.devices, ...require('./src/server/data/custom_devices.json')];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
server = app.listen(config.port, () => {
|
|
163
|
+
log.info(chalk.green(`Syngrisi version: ${chalk.blue(global.version)} started at http://localhost:${config.port}`), this);
|
|
164
|
+
log.info(chalk.whiteBright('Press <Ctrl+C> to exit'), this);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const httpStatus = require('http-status');
|
|
2
|
+
const catchAsync = require('../utils/catchAsync');
|
|
3
|
+
const pick = require('../utils/pick');
|
|
4
|
+
const { appService } = require('../services');
|
|
5
|
+
|
|
6
|
+
const info = catchAsync(async (req, res) => {
|
|
7
|
+
res.status(httpStatus.OK)
|
|
8
|
+
.json({ version: global.version });
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const get = catchAsync(async (req, res) => {
|
|
12
|
+
const filter = req.query.filter ? JSON.parse(pick(req.query, ['filter']).filter) : {};
|
|
13
|
+
const options = pick(req.query, ['sortBy', 'limit', 'page']);
|
|
14
|
+
const result = await appService.get(filter, options);
|
|
15
|
+
res.send(result);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
module.exports = {
|
|
19
|
+
info,
|
|
20
|
+
get,
|
|
21
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
const httpStatus = require('http-status');
|
|
2
|
+
const passport = require('passport');
|
|
3
|
+
const hasha = require('hasha');
|
|
4
|
+
const uuidAPIKey = require('uuid-apikey');
|
|
5
|
+
const { User } = require('../models');
|
|
6
|
+
const catchAsync = require('../utils/catchAsync');
|
|
7
|
+
|
|
8
|
+
function getApiKey() {
|
|
9
|
+
return uuidAPIKey.create().apiKey;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const $this = this;
|
|
13
|
+
$this.logMeta = {
|
|
14
|
+
scope: 'authentication',
|
|
15
|
+
msgType: 'AUTHENTICATION',
|
|
16
|
+
};
|
|
17
|
+
// const { authService, userService, tokenService, emailService } = require('../services');
|
|
18
|
+
|
|
19
|
+
const apikey = catchAsync(async (req, res, next) => {
|
|
20
|
+
const apiKey = getApiKey();
|
|
21
|
+
log.debug(
|
|
22
|
+
`generate API Key for user: '${req.user.username}'`,
|
|
23
|
+
$this,
|
|
24
|
+
{ user: req.user.username, scope: 'apikey', msgType: 'GENERATE_API' }
|
|
25
|
+
);
|
|
26
|
+
const hash = hasha(apiKey);
|
|
27
|
+
const user = await User.findOne({ username: req.user.username });
|
|
28
|
+
user.apiKey = hash;
|
|
29
|
+
await user.save();
|
|
30
|
+
res.status(200)
|
|
31
|
+
.json({ apikey: apiKey });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const login = catchAsync(async (req, res, next) => {
|
|
35
|
+
const logOpts = {
|
|
36
|
+
scope: 'login',
|
|
37
|
+
msgType: 'AUTHENTICATION',
|
|
38
|
+
};
|
|
39
|
+
passport.authenticate('local',
|
|
40
|
+
(err, user, info) => {
|
|
41
|
+
if (err) {
|
|
42
|
+
log.error(`Authentication error: '${err}'`, this, logOpts);
|
|
43
|
+
return res.status(httpStatus.UNAUTHORIZED)
|
|
44
|
+
.json({ message: 'authentication error' });
|
|
45
|
+
}
|
|
46
|
+
if (!user) {
|
|
47
|
+
log.error(`Authentication error: '${info.message}'`, this, logOpts);
|
|
48
|
+
return res.status(httpStatus.UNAUTHORIZED)
|
|
49
|
+
.json({ message: `Authentication error: '${info.message}'` });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
req.logIn(user, (e) => {
|
|
53
|
+
if (e) {
|
|
54
|
+
log.error(e.stack || e.toString());
|
|
55
|
+
return next(e);
|
|
56
|
+
}
|
|
57
|
+
log.info('user is logged in', this, { user: user.username });
|
|
58
|
+
return res.status(200)
|
|
59
|
+
.json({ message: 'success' });
|
|
60
|
+
});
|
|
61
|
+
})(req, res, next);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const logout = catchAsync(async (req, res) => {
|
|
65
|
+
const logOpts = {
|
|
66
|
+
scope: 'logout',
|
|
67
|
+
msgType: 'AUTHENTICATION',
|
|
68
|
+
};
|
|
69
|
+
try {
|
|
70
|
+
log.debug(`try to log out user: '${req?.user?.username}'`, $this, logOpts);
|
|
71
|
+
await req.logout(
|
|
72
|
+
{},
|
|
73
|
+
() => res.status(httpStatus.OK)
|
|
74
|
+
.json({ message: 'success' })
|
|
75
|
+
);
|
|
76
|
+
} catch (e) {
|
|
77
|
+
log.error(e.stack || e.toString());
|
|
78
|
+
res.status(httpStatus.INTERNAL_SERVER_ERROR)
|
|
79
|
+
.json({ message: 'fail' });
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const changePassword = catchAsync(async (req, res) => {
|
|
84
|
+
const logOpts = {
|
|
85
|
+
scope: 'changePassword',
|
|
86
|
+
msgType: 'CHANGE_PASSWORD',
|
|
87
|
+
itemType: 'user',
|
|
88
|
+
ref: req?.user?.username,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const {
|
|
92
|
+
currentPassword,
|
|
93
|
+
newPassword,
|
|
94
|
+
// newPasswordConfirmation,
|
|
95
|
+
} = req.body;
|
|
96
|
+
|
|
97
|
+
const username = req?.user?.username;
|
|
98
|
+
|
|
99
|
+
log.debug(`change password for '${username}', params: '${JSON.stringify(req.body)}'`, this, logOpts);
|
|
100
|
+
|
|
101
|
+
const user = await User.findOne({ username });
|
|
102
|
+
if (!user) {
|
|
103
|
+
log.error('user is not logged in', this, logOpts);
|
|
104
|
+
return res.status(httpStatus.UNAUTHORIZED)
|
|
105
|
+
.json({ message: 'user is not logged in' });
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
try {
|
|
109
|
+
await user.changePassword(currentPassword, newPassword);
|
|
110
|
+
} catch (e) {
|
|
111
|
+
log.error(e.stack || e.toString(), this, logOpts);
|
|
112
|
+
return res.status(httpStatus.INTERNAL_SERVER_ERROR)
|
|
113
|
+
.json({ message: e.toString() });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
log.debug(`password was successfully changed for user: ${req.user.username}`, this, logOpts);
|
|
117
|
+
return res.status(200)
|
|
118
|
+
.json({ message: 'success' });
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const changePasswordFirstRun = catchAsync(async (req, res) => {
|
|
122
|
+
const logOpts = {
|
|
123
|
+
scope: 'changePasswordFirstRun',
|
|
124
|
+
msgType: 'CHANGE_PASSWORD_FIRST_RUN',
|
|
125
|
+
itemType: 'user',
|
|
126
|
+
ref: req?.user?.username,
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const { newPassword } = req.body;
|
|
130
|
+
|
|
131
|
+
if ((await global.AppSettings.isAuthEnabled()) && ((await global.AppSettings.isFirstRun()))) {
|
|
132
|
+
log.debug(`first run, change password for default 'Administrator', params: '${JSON.stringify(req.body)}'`, $this, logOpts);
|
|
133
|
+
const user = await User.findOne({ username: 'Administrator' })
|
|
134
|
+
.exec();
|
|
135
|
+
logOpts.ref = user?.username;
|
|
136
|
+
|
|
137
|
+
await user.setPassword(newPassword);
|
|
138
|
+
await user.save();
|
|
139
|
+
log.debug('password was successfully changed for default Administrator', $this, logOpts);
|
|
140
|
+
await global.AppSettings.set('first_run', false);
|
|
141
|
+
return res.status(200)
|
|
142
|
+
.json({ message: 'success' });
|
|
143
|
+
}
|
|
144
|
+
log.error(`trying to use first run API with no first run state, auth: '${await global.AppSettings.isAuthEnabled()}', `
|
|
145
|
+
+ `global settings: '${(await global.AppSettings.get('first_run'))}'`, $this, logOpts);
|
|
146
|
+
return res.status(httpStatus.FORBIDDEN)
|
|
147
|
+
.json({ message: 'forbidden' });
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
module.exports = {
|
|
151
|
+
login,
|
|
152
|
+
changePassword,
|
|
153
|
+
changePasswordFirstRun,
|
|
154
|
+
logout,
|
|
155
|
+
apikey,
|
|
156
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const httpStatus = require('http-status');
|
|
2
|
+
const catchAsync = require('../utils/catchAsync');
|
|
3
|
+
const { genericService } = require('../services');
|
|
4
|
+
const { deserializeIfJSON, pick } = require('../utils');
|
|
5
|
+
const ApiError = require('../utils/ApiError');
|
|
6
|
+
|
|
7
|
+
const get = catchAsync(async (req, res) => {
|
|
8
|
+
const filter = req.query.filter ? deserializeIfJSON(pick(req.query, ['filter']).filter) : {};
|
|
9
|
+
const options = pick(req.query, ['sortBy', 'limit', 'page', 'populate']);
|
|
10
|
+
const result = await genericService.get('VRSBaseline', filter, options);
|
|
11
|
+
res.send(result);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const put = catchAsync(async (req, res) => {
|
|
15
|
+
const { id } = req.params;
|
|
16
|
+
if (!id) throw new ApiError(httpStatus.BAD_REQUEST, 'Cannot update the baseline - Id not found');
|
|
17
|
+
const result = await genericService.put('VRSBaseline', id, req.body, req?.user);
|
|
18
|
+
res.send(result);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
module.exports = {
|
|
22
|
+
get,
|
|
23
|
+
put,
|
|
24
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const httpStatus = require('http-status');
|
|
2
|
+
const ApiError = require('../utils/ApiError');
|
|
3
|
+
const catchAsync = require('../utils/catchAsync');
|
|
4
|
+
const { genericService, checkService } = require('../services');
|
|
5
|
+
const { deserializeIfJSON, pick } = require('../utils');
|
|
6
|
+
const { removeEmptyProperties } = require('../utils/utils');
|
|
7
|
+
|
|
8
|
+
const get = catchAsync(async (req, res) => {
|
|
9
|
+
const filter = req.query.filter ? deserializeIfJSON(pick(req.query, ['filter']).filter) : {};
|
|
10
|
+
if (req.user?.role === 'user') {
|
|
11
|
+
filter.creatorUsername = req.user?.username;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const options = pick(req.query, ['sortBy', 'limit', 'page', 'populate']);
|
|
15
|
+
const result = await genericService.get('VRSCheck', filter, options);
|
|
16
|
+
res.send(result);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const getViaPost = catchAsync(async (req, res) => {
|
|
20
|
+
const filter = req.body.filter ? pick(req.body, ['filter']).filter : {};
|
|
21
|
+
const options = req.body.options ? pick(req.body, ['options']).options : {};
|
|
22
|
+
const result = await genericService.get('VRSCheck', filter, options);
|
|
23
|
+
res.send(result);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const update = catchAsync(async (req, res) => {
|
|
27
|
+
const { id } = req.params;
|
|
28
|
+
if (!id) throw new ApiError(httpStatus.BAD_REQUEST, 'Cannot accept the check - Id not found');
|
|
29
|
+
const opts = removeEmptyProperties(req.body);
|
|
30
|
+
const user = req?.user?.username;
|
|
31
|
+
const result = await checkService.update(id, opts, user);
|
|
32
|
+
res.send(result);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const accept = catchAsync(async (req, res) => {
|
|
36
|
+
const { id } = req.params;
|
|
37
|
+
if (!id) throw new ApiError(httpStatus.BAD_REQUEST, 'Cannot accept the check - Id not found');
|
|
38
|
+
if (!req.body.baselineId) throw new ApiError(httpStatus.BAD_REQUEST, `Cannot accept the check: ${id} - new Baseline Id not found`);
|
|
39
|
+
const result = await checkService.accept(id, req.body.baselineId, req?.user);
|
|
40
|
+
res.send(result);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const remove = catchAsync(async (req, res) => {
|
|
44
|
+
const { id } = req.params;
|
|
45
|
+
if (!id) throw new ApiError(httpStatus.BAD_REQUEST, 'Cannot remove the check - Id not found');
|
|
46
|
+
const result = await checkService.remove(id, req?.user);
|
|
47
|
+
res.send(result);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
module.exports = {
|
|
51
|
+
getViaPost,
|
|
52
|
+
get,
|
|
53
|
+
accept,
|
|
54
|
+
remove,
|
|
55
|
+
update,
|
|
56
|
+
};
|