@frangoteam/fuxa-min 1.1.19
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/LICENSE +21 -0
- package/README.md +41 -0
- package/_images/Pipes/P1.svg +39 -0
- package/_images/Tanks/Fl.svg +7 -0
- package/api/alarms/index.js +132 -0
- package/api/auth/index.js +71 -0
- package/api/command/index.js +187 -0
- package/api/daq/index.js +79 -0
- package/api/diagnose/index.js +163 -0
- package/api/index.js +181 -0
- package/api/jwt-helper.js +106 -0
- package/api/plugins/index.js +109 -0
- package/api/projects/index.js +229 -0
- package/api/resources/index.js +118 -0
- package/api/scripts/index.js +82 -0
- package/api/users/index.js +109 -0
- package/dist/3rdpartylicenses.txt +1477 -0
- package/dist/Quicksand-Bold.071154c292aef0b8.woff +0 -0
- package/dist/Quicksand-Bold.6383d6475ed5c40f.woff2 +0 -0
- package/dist/Quicksand-Bold.f07d467887f9cfab.ttf +0 -0
- package/dist/Quicksand-Medium.0982a651e8d4315f.woff +0 -0
- package/dist/Quicksand-Medium.9d2733fbfb9b1be8.ttf +0 -0
- package/dist/Quicksand-Medium.b09302365c586eb2.woff2 +0 -0
- package/dist/Quicksand-Regular.16adf9eecd267273.woff +0 -0
- package/dist/Quicksand-Regular.78819724f6aeff59.woff2 +0 -0
- package/dist/Quicksand-Regular.8829564f0e14bf76.ttf +0 -0
- package/dist/assets/fonts/icomoon.eot +0 -0
- package/dist/assets/fonts/icomoon.svg +19 -0
- package/dist/assets/fonts/icomoon.ttf +0 -0
- package/dist/assets/fonts/icomoon.woff +0 -0
- package/dist/assets/fonts/myicons.eot +0 -0
- package/dist/assets/fonts/myicons.svg +19 -0
- package/dist/assets/fonts/myicons.ttf +0 -0
- package/dist/assets/fonts/myicons.woff +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.ttf +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff +0 -0
- package/dist/assets/fonts/quicksand-bold/Quicksand-Bold.woff2 +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.ttf +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff +0 -0
- package/dist/assets/fonts/quicksand-medium/Quicksand-Medium.woff2 +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.ttf +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff +0 -0
- package/dist/assets/fonts/quicksand-regular/Quicksand-Regular.woff2 +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.svg +10486 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-bold/roboto-bold-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.svg +9998 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-light/roboto-light-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.svg +10487 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-medium/roboto-medium-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.svg +10004 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-regular/roboto-regular-webfont.woff2 +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.svg +10012 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.ttf +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff +0 -0
- package/dist/assets/fonts/roboto-thin/roboto-thin-webfont.woff2 +0 -0
- package/dist/assets/i18n/de.json +1308 -0
- package/dist/assets/i18n/en.json +1438 -0
- package/dist/assets/i18n/es.json +777 -0
- package/dist/assets/i18n/fr.json +1129 -0
- package/dist/assets/i18n/ko.json +774 -0
- package/dist/assets/i18n/pt.json +657 -0
- package/dist/assets/i18n/ru.json +1228 -0
- package/dist/assets/i18n/tr.json +673 -0
- package/dist/assets/i18n/ua.json +614 -0
- package/dist/assets/i18n/zh-cn.json +1252 -0
- package/dist/assets/images/align-bottom.svg +88 -0
- package/dist/assets/images/align-center.svg +86 -0
- package/dist/assets/images/align-left.svg +86 -0
- package/dist/assets/images/align-middle.svg +88 -0
- package/dist/assets/images/align-right.svg +88 -0
- package/dist/assets/images/align-top.svg +88 -0
- package/dist/assets/images/bag.svg +115 -0
- package/dist/assets/images/button.svg +22 -0
- package/dist/assets/images/chart.svg +17 -0
- package/dist/assets/images/circle.svg +84 -0
- package/dist/assets/images/compressor-a.svg +2 -0
- package/dist/assets/images/editvalue.svg +14 -0
- package/dist/assets/images/ellipse.svg +84 -0
- package/dist/assets/images/flip-orizontal.svg +86 -0
- package/dist/assets/images/flip-vertical.svg +82 -0
- package/dist/assets/images/gauge-donut.png +0 -0
- package/dist/assets/images/gauge-mat.png +0 -0
- package/dist/assets/images/gauge-zone.png +0 -0
- package/dist/assets/images/graphbar.svg +18 -0
- package/dist/assets/images/group.svg +91 -0
- package/dist/assets/images/iframe.svg +54 -0
- package/dist/assets/images/image.svg +95 -0
- package/dist/assets/images/led-circle.svg +77 -0
- package/dist/assets/images/line.svg +86 -0
- package/dist/assets/images/linecap-butt.svg +77 -0
- package/dist/assets/images/linecap-round.svg +77 -0
- package/dist/assets/images/linecap-square.svg +82 -0
- package/dist/assets/images/linejoin-bevel.svg +77 -0
- package/dist/assets/images/linejoin-miter.svg +77 -0
- package/dist/assets/images/linejoin-round.svg +77 -0
- package/dist/assets/images/logo.svg +18 -0
- package/dist/assets/images/path.svg +100 -0
- package/dist/assets/images/pencil.svg +98 -0
- package/dist/assets/images/pipe.svg +15 -0
- package/dist/assets/images/progress-v.svg +79 -0
- package/dist/assets/images/rect.svg +84 -0
- package/dist/assets/images/select-pointer.svg +93 -0
- package/dist/assets/images/selectvalue.svg +14 -0
- package/dist/assets/images/semaphore.svg +19 -0
- package/dist/assets/images/slider.svg +17 -0
- package/dist/assets/images/switch.svg +15 -0
- package/dist/assets/images/table.svg +55 -0
- package/dist/assets/images/text.svg +294 -0
- package/dist/assets/images/to-bottom.svg +163 -0
- package/dist/assets/images/to-path.svg +94 -0
- package/dist/assets/images/to-top.svg +163 -0
- package/dist/assets/images/to_top.svg +88 -0
- package/dist/assets/images/todelete.svg +13 -0
- package/dist/assets/images/ungroup.svg +108 -0
- package/dist/assets/images/value.svg +81 -0
- package/dist/assets/images/valve-a.svg +2 -0
- package/dist/assets/images/webcam.svg +16 -0
- package/dist/assets/lib/ext-styles.css +28 -0
- package/dist/assets/lib/gauge/gauge.js +988 -0
- package/dist/assets/lib/gauge/gauge.min.js +1 -0
- package/dist/assets/lib/nouislider/nouislider.min.css +1 -0
- package/dist/assets/lib/nouislider/nouislider.min.js +1 -0
- package/dist/assets/lib/numeral/locales.min.js +7 -0
- package/dist/assets/lib/numeral/numeral.min.js +8 -0
- package/dist/assets/lib/pdfkit-table/index.js +967 -0
- package/dist/assets/lib/svg/raphael.min.js +1 -0
- package/dist/assets/lib/svg/svg.js +5573 -0
- package/dist/assets/lib/svg/svg.min.js +13 -0
- package/dist/assets/lib/svgeditor/extensions/ext-bundle.min.js +1 -0
- package/dist/assets/lib/svgeditor/extensions/ext-html_button.min.css +1 -0
- package/dist/assets/lib/svgeditor/fuxa-editor.min.js +23 -0
- package/dist/assets/lib/svgeditor/jquery-plugin.min.css +2 -0
- package/dist/assets/lib/svgeditor/jquery-plugin.min.js +52 -0
- package/dist/assets/lib/svgeditor/jquery-ui-1.8.17.custom.min.js +54 -0
- package/dist/assets/lib/svgeditor/jquery.min.js +4 -0
- package/dist/assets/lib/svgeditor/shapes/ape-shapes.js +39 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-disc.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-paddle.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-prop.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/agitator-turbo.svg +19 -0
- package/dist/assets/lib/svgeditor/shapes/img/anim-eli.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/anim-piston.svg +14 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifugal.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifugal1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge3.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/centrifuge4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compair.svg +92 -0
- package/dist/assets/lib/svgeditor/shapes/img/compdiaph.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compejector.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compreci.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/compreci2.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-fan.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-piston.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compressor-void.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compring.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/compring2.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/comprotary.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/comprotary2.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/compscrew.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/compsilence.svg +20 -0
- package/dist/assets/lib/svgeditor/shapes/img/compturbo.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher1.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher3.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher4.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher5.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher6.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/crusher7.svg +21 -0
- package/dist/assets/lib/svgeditor/shapes/img/diaph.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier1.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier3.svg +23 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier4.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/drier5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-filter.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-heat.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger-tube.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger6.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger7.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger8.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/exchanger9.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder2.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/feeder3.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/filter2.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/filter3.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting1.svg +67 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting10.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting11.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting12.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting13.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting3.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting6.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting7.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/fitting9.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc1.svg +75 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc2.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc4.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc6.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc7.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/misc8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/motor-simb.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/nozzle.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/nozzle2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi1.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi5.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi6.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/pipi7.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpblower.svg +76 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpcentri1.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpcentri2.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpfeed.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpgear.svg +18 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpgear2.svg +19 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumphidra.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumphorizo.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpjet.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpperis.svg +20 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpscreew.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpscreew2.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpturbi.svg +64 -0
- package/dist/assets/lib/svgeditor/shapes/img/pumpvacuum.svg +72 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-arrow.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-circle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-circleindi.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cloud.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cone.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-corner.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cross.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-cylinder.svg +71 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-delay.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-diamond.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-display.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-docu.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-doublearrow.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-drop.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-halfcircle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-heart.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-looplimit.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-maninput.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-nosymbol.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-octagon.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-offpage.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-or.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-or2.svg +17 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-parallelogram.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-pentagon.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-poval.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-prepara.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-rectangle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-rectindi.svg +16 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-star4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-switch.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-tape.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-tee.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-ticket.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-trape.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-triangle.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/shape-vor.svg +14 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank1.svg +63 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank2.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank3.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank4.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank5.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank6.svg +68 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank7.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank8.svg +15 -0
- package/dist/assets/lib/svgeditor/shapes/img/tank9.svg +21 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-ax.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-bx.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/valve-cx.svg +13 -0
- package/dist/assets/lib/svgeditor/shapes/img/webcam.svg +6 -0
- package/dist/assets/lib/svgeditor/shapes/my-shapes.js +178 -0
- package/dist/assets/lib/svgeditor/shapes/proc-comp-shapes.js +105 -0
- package/dist/assets/lib/svgeditor/shapes/proc-general-shapes.js +60 -0
- package/dist/assets/lib/svgeditor/shapes/proc-pumps-shapes.js +112 -0
- package/dist/assets/lib/svgeditor/shapes/proc-shapes.js +606 -0
- package/dist/assets/lib/svgeditor/shapes/shapes.js +30 -0
- package/dist/assets/lib/svgeditor/svg-editor.min.css +1 -0
- package/dist/assets/lib/uplot/placement.min.js +2 -0
- package/dist/assets/project.demo.fuxap +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/icomoon.86abfb46e057ade8.eot +0 -0
- package/dist/icomoon.c1f8b59bad308d66.woff +0 -0
- package/dist/icomoon.ce427f75e21963af.ttf +0 -0
- package/dist/icomoon.dfb0a89feb346906.svg +19 -0
- package/dist/index.html +50 -0
- package/dist/logo.0e8e64e69250a450.svg +18 -0
- package/dist/main.a356f552d9838b9e.js +1 -0
- package/dist/material-icons-outlined.78a93b2079680a08.woff +0 -0
- package/dist/material-icons-outlined.f86cb7b0aa53f0fe.woff2 +0 -0
- package/dist/material-icons-round.92dc7ca2f4c591e7.woff +0 -0
- package/dist/material-icons-round.b10ec9db5b7fbc74.woff2 +0 -0
- package/dist/material-icons-sharp.3885863ee4746422.woff2 +0 -0
- package/dist/material-icons-sharp.a71cb2bf66c604de.woff +0 -0
- package/dist/material-icons-two-tone.588d63134de807a7.woff +0 -0
- package/dist/material-icons-two-tone.675bd578bd14533e.woff2 +0 -0
- package/dist/material-icons.4ad034d2c499d9b6.woff +0 -0
- package/dist/material-icons.59322316b3fd6063.woff2 +0 -0
- package/dist/polyfills.2696a6f9dc75535e.js +1 -0
- package/dist/roboto-bold-webfont.29ac6158e35aee95.woff +0 -0
- package/dist/roboto-bold-webfont.568ab1fa3f154a77.svg +10486 -0
- package/dist/roboto-bold-webfont.6bcfbdc216b3bc78.woff2 +0 -0
- package/dist/roboto-bold-webfont.7c22a4dfdee2ff33.ttf +0 -0
- package/dist/roboto-light-webfont.13492ec56771eeee.svg +9998 -0
- package/dist/roboto-light-webfont.61fa26c99b07ac83.woff2 +0 -0
- package/dist/roboto-light-webfont.95295ce84942d8ce.ttf +0 -0
- package/dist/roboto-light-webfont.ae19119a2889dfdf.woff +0 -0
- package/dist/roboto-medium-webfont.30344f0411888055.woff +0 -0
- package/dist/roboto-medium-webfont.57fb00cab0317d2d.woff2 +0 -0
- package/dist/roboto-medium-webfont.a40869e060a388c0.ttf +0 -0
- package/dist/roboto-medium-webfont.ea02241c29620c02.svg +10487 -0
- package/dist/roboto-regular-webfont.2b0501b72f5a94d5.ttf +0 -0
- package/dist/roboto-regular-webfont.2ce0ba9a06424965.svg +10004 -0
- package/dist/roboto-regular-webfont.ae47f6f1292d196f.woff2 +0 -0
- package/dist/roboto-regular-webfont.f58066a2d9061006.woff +0 -0
- package/dist/roboto-thin-webfont.0a64479870f676e8.ttf +0 -0
- package/dist/roboto-thin-webfont.0f7221f5c7e972ef.woff2 +0 -0
- package/dist/roboto-thin-webfont.51b221e22714b1fe.svg +10012 -0
- package/dist/roboto-thin-webfont.dac941649dd4eac0.woff +0 -0
- package/dist/runtime.8ef63094e52a66ba.js +1 -0
- package/dist/scripts.1c3385254ff4c93c.js +1 -0
- package/dist/styles.cf8e3cf50d039a5c.css +1 -0
- package/fuxa.js +39 -0
- package/main.js +381 -0
- package/package.json +68 -0
- package/paths.js +44 -0
- package/project.default.json +11 -0
- package/project.demo.fuxap +1 -0
- package/runtime/alarms/alarmstorage.js +205 -0
- package/runtime/alarms/index.js +678 -0
- package/runtime/devices/bacnet/index.js +730 -0
- package/runtime/devices/device-utils.js +95 -0
- package/runtime/devices/device.js +551 -0
- package/runtime/devices/ethernetip/index.js +381 -0
- package/runtime/devices/fuxaserver/index.js +310 -0
- package/runtime/devices/httprequest/index.js +495 -0
- package/runtime/devices/index.js +489 -0
- package/runtime/devices/modbus/datatypes.js +122 -0
- package/runtime/devices/modbus/index.js +730 -0
- package/runtime/devices/mqtt/index.js +618 -0
- package/runtime/devices/odbc/index.js +408 -0
- package/runtime/devices/opcua/index.js +817 -0
- package/runtime/devices/s7/datatypes.js +88 -0
- package/runtime/devices/s7/index.js +702 -0
- package/runtime/devices/template/index.js +141 -0
- package/runtime/events.js +33 -0
- package/runtime/index.js +559 -0
- package/runtime/jobs/cleaner.js +74 -0
- package/runtime/jobs/fonts/LICENSE.txt +202 -0
- package/runtime/jobs/fonts/Roboto-Black.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-BlackItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Bold.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-BoldItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Italic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Light.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-LightItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Medium.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-MediumItalic.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Regular.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-Thin.ttf +0 -0
- package/runtime/jobs/fonts/Roboto-ThinItalic.ttf +0 -0
- package/runtime/jobs/helper/image-generator.js +82 -0
- package/runtime/jobs/index.js +214 -0
- package/runtime/jobs/report.js +353 -0
- package/runtime/logger.js +113 -0
- package/runtime/notificator/index.js +383 -0
- package/runtime/notificator/notifystorage.js +179 -0
- package/runtime/plugins/index.js +255 -0
- package/runtime/project/index.js +959 -0
- package/runtime/project/prjstorage.js +222 -0
- package/runtime/scripts/index.js +313 -0
- package/runtime/scripts/msm.js +146 -0
- package/runtime/storage/calculator.js +227 -0
- package/runtime/storage/daqstorage.js +188 -0
- package/runtime/storage/influxdb/index.js +240 -0
- package/runtime/storage/sqlite/currentstorage.js +144 -0
- package/runtime/storage/sqlite/index.js +695 -0
- package/runtime/storage/tdengine/index.js +106 -0
- package/runtime/users/index.js +123 -0
- package/runtime/users/usrstorage.js +201 -0
- package/runtime/utils.js +284 -0
- package/screenshot/feature-action-move.gif +0 -0
- package/screenshot/fuxa-ani.gif +0 -0
- package/screenshot/fuxa-device.gif +0 -0
- package/screenshot/fuxa-editor.png +0 -0
- package/screenshot/fuxa-hmi.gif +0 -0
- package/screenshot/fuxa-home.png +0 -0
- package/screenshot/fuxa-test.gif +0 -0
- package/settings.default.js +65 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 'api/logs': Diagnose API to GET logs data
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
var express = require("express");
|
|
8
|
+
const authJwt = require('../jwt-helper');
|
|
9
|
+
var runtime;
|
|
10
|
+
var secureFnc;
|
|
11
|
+
var checkGroupsFnc;
|
|
12
|
+
|
|
13
|
+
module.exports = {
|
|
14
|
+
init: function (_runtime, _secureFnc, _checkGroupsFnc) {
|
|
15
|
+
runtime = _runtime;
|
|
16
|
+
secureFnc = _secureFnc;
|
|
17
|
+
checkGroupsFnc = _checkGroupsFnc;
|
|
18
|
+
},
|
|
19
|
+
app: function () {
|
|
20
|
+
var diagnoseApp = express();
|
|
21
|
+
diagnoseApp.use(function (req, res, next) {
|
|
22
|
+
if (!runtime.project) {
|
|
23
|
+
res.status(404).end();
|
|
24
|
+
} else {
|
|
25
|
+
next();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* GET Server logs folder content
|
|
31
|
+
*/
|
|
32
|
+
diagnoseApp.get('/api/logsdir', secureFnc, function (req, res) {
|
|
33
|
+
var groups = checkGroupsFnc(req);
|
|
34
|
+
if (res.statusCode === 403) {
|
|
35
|
+
runtime.logger.error("api get logsdir: Tocken Expired");
|
|
36
|
+
} else if (authJwt.adminGroups.indexOf(groups) === -1) {
|
|
37
|
+
res.status(401).json({ error: "unauthorized_error", message: "Unauthorized!" });
|
|
38
|
+
runtime.logger.error("api get logsdir: Unauthorized!");
|
|
39
|
+
} else {
|
|
40
|
+
try {
|
|
41
|
+
var logPath = runtime.logger.logDir();
|
|
42
|
+
if (!fs.existsSync(logPath)) {
|
|
43
|
+
logPath = path.join(process.cwd(), runtime.logger.logDir());
|
|
44
|
+
}
|
|
45
|
+
var logFiles = fs.readdirSync(logPath);
|
|
46
|
+
res.json(logFiles);
|
|
47
|
+
} catch (err) {
|
|
48
|
+
if (err.code) {
|
|
49
|
+
res.status(400).json({ error: err.code, message: err.message });
|
|
50
|
+
} else {
|
|
51
|
+
res.status(400).json({ error: "unexpected_error", message: err.toString() });
|
|
52
|
+
}
|
|
53
|
+
runtime.logger.error("api get logsdir: " + err.message);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* GET Server logs data
|
|
60
|
+
*/
|
|
61
|
+
diagnoseApp.get('/api/logs', secureFnc, function (req, res) {
|
|
62
|
+
var groups = checkGroupsFnc(req);
|
|
63
|
+
if (res.statusCode === 403) {
|
|
64
|
+
runtime.logger.error("api get logs: Tocken Expired");
|
|
65
|
+
} else if (authJwt.adminGroups.indexOf(groups) === -1) {
|
|
66
|
+
res.status(401).json({ error: "unauthorized_error", message: "Unauthorized!" });
|
|
67
|
+
runtime.logger.error("api get logs: Unauthorized!");
|
|
68
|
+
} else {
|
|
69
|
+
try {
|
|
70
|
+
const fileName = req.query.file.replace(new RegExp('../', 'g'), '');
|
|
71
|
+
var logFileName = fileName || 'fuxa.log';
|
|
72
|
+
var logPath = runtime.logger.logDir();
|
|
73
|
+
if (!fs.existsSync(logPath)) {
|
|
74
|
+
logPath = path.join(process.cwd(), runtime.logger.logDir());
|
|
75
|
+
}
|
|
76
|
+
var logFiles = fs.readdirSync(logPath);
|
|
77
|
+
let logFile = path.join(logPath, logFileName);
|
|
78
|
+
res.header('Content-Type', 'text/plain; charset=utf-8');
|
|
79
|
+
res.download(logFile, (err) => {
|
|
80
|
+
if (err) {
|
|
81
|
+
res.status(500).send({
|
|
82
|
+
message: "Could not download the file. " + err,
|
|
83
|
+
});
|
|
84
|
+
runtime.logger.error("api get logs: " + err);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
} catch (err) {
|
|
88
|
+
if (err.code) {
|
|
89
|
+
res.status(400).json({ error: err.code, message: err.message });
|
|
90
|
+
} else {
|
|
91
|
+
res.status(400).json({ error: "unexpected_error", message: err.toString() });
|
|
92
|
+
}
|
|
93
|
+
runtime.logger.error("api get logs: " + err.message);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* GET Server report folder content
|
|
100
|
+
*/
|
|
101
|
+
diagnoseApp.get('/api/reportsdir', secureFnc, function (req, res) {
|
|
102
|
+
var groups = checkGroupsFnc(req);
|
|
103
|
+
if (res.statusCode === 403) {
|
|
104
|
+
runtime.logger.error("api get reportdir: Tocken Expired");
|
|
105
|
+
} else if (authJwt.adminGroups.indexOf(groups) === -1) {
|
|
106
|
+
res.status(401).json({ error: "unauthorized_error", message: "Unauthorized!" });
|
|
107
|
+
runtime.logger.error("api get reportdir: Unauthorized!");
|
|
108
|
+
} else {
|
|
109
|
+
try {
|
|
110
|
+
var reportPath = runtime.settings.reportsDir;
|
|
111
|
+
if (!fs.existsSync(reportPath)) {
|
|
112
|
+
reportPath = path.join(process.cwd(), runtime.settings.reportsDir);
|
|
113
|
+
}
|
|
114
|
+
var reportFiles = fs.readdirSync(reportPath);
|
|
115
|
+
reportFiles = reportFiles.filter(file => file.startsWith(req.query.name + '_'));
|
|
116
|
+
res.json(reportFiles);
|
|
117
|
+
} catch (err) {
|
|
118
|
+
if (err.code) {
|
|
119
|
+
res.status(400).json({ error: err.code, message: err.message });
|
|
120
|
+
} else {
|
|
121
|
+
res.status(400).json({ error: "unexpected_error", message: err.toString() });
|
|
122
|
+
}
|
|
123
|
+
runtime.logger.error("api get reportdir: " + err.message);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* POST testmail
|
|
130
|
+
* Test SMTP send mail
|
|
131
|
+
*/
|
|
132
|
+
diagnoseApp.post("/api/sendmail", secureFnc, function (req, res, next) {
|
|
133
|
+
var groups = checkGroupsFnc(req);
|
|
134
|
+
if (res.statusCode === 403) {
|
|
135
|
+
runtime.logger.error("api post sendmail: Tocken Expired");
|
|
136
|
+
} else if (authJwt.adminGroups.indexOf(groups) === -1 ) {
|
|
137
|
+
res.status(401).json({error:"unauthorized_error", message: "Unauthorized!"});
|
|
138
|
+
runtime.logger.error("api post sendmail: Unauthorized");
|
|
139
|
+
} else {
|
|
140
|
+
try {
|
|
141
|
+
if (req.body.params.smtp && !req.body.params.smtp.password && runtime.settings.smtp && runtime.settings.smtp.password) {
|
|
142
|
+
req.body.params.smtp.password = runtime.settings.smtp.password;
|
|
143
|
+
}
|
|
144
|
+
runtime.notificatorMgr.sendMail(req.body.params.msg, req.body.params.smtp).then(function() {
|
|
145
|
+
res.end();
|
|
146
|
+
}).catch(function(err) {
|
|
147
|
+
if (err.code) {
|
|
148
|
+
res.status(400).json({error:err.code, message: err.message});
|
|
149
|
+
} else {
|
|
150
|
+
res.status(400).json({error:"unexpected_error", message:err.toString()});
|
|
151
|
+
}
|
|
152
|
+
runtime.logger.error("api post sendmail: " + err.message);
|
|
153
|
+
});
|
|
154
|
+
} catch (error) {
|
|
155
|
+
res.status(400).json({error:"unexpected_error", message:error.toString()});
|
|
156
|
+
runtime.logger.error("api port sendmail: " + error.message);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
return diagnoseApp;
|
|
162
|
+
}
|
|
163
|
+
}
|
package/api/index.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 'api/project': API server initialization and general GET/POST
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
var express = require('express');
|
|
7
|
+
var bodyParser = require('body-parser');
|
|
8
|
+
const authJwt = require('./jwt-helper');
|
|
9
|
+
const rateLimit = require("express-rate-limit");
|
|
10
|
+
|
|
11
|
+
var prjApi = require('./projects');
|
|
12
|
+
var authApi = require('./auth');
|
|
13
|
+
var usersApi = require('./users');
|
|
14
|
+
var alarmsApi = require('./alarms');
|
|
15
|
+
var pluginsApi = require('./plugins');
|
|
16
|
+
var diagnoseApi = require('./diagnose');
|
|
17
|
+
var scriptsApi = require('./scripts');
|
|
18
|
+
var resourcesApi = require('./resources');
|
|
19
|
+
var daqApi = require('./daq');
|
|
20
|
+
var commandApi = require('./command');
|
|
21
|
+
|
|
22
|
+
var apiApp;
|
|
23
|
+
var server;
|
|
24
|
+
var runtime;
|
|
25
|
+
var editor;
|
|
26
|
+
|
|
27
|
+
function init(_server, _runtime) {
|
|
28
|
+
server = _server;
|
|
29
|
+
runtime = _runtime;
|
|
30
|
+
return new Promise(function (resolve, reject) {
|
|
31
|
+
if (runtime.settings.disableServer !== false) {
|
|
32
|
+
apiApp = express();
|
|
33
|
+
|
|
34
|
+
var maxApiRequestSize = runtime.settings.apiMaxLength || '35mb';
|
|
35
|
+
apiApp.use(bodyParser.json({limit:maxApiRequestSize}));
|
|
36
|
+
apiApp.use(bodyParser.urlencoded({limit:maxApiRequestSize,extended:true}));
|
|
37
|
+
authJwt.init(runtime.settings.secureEnabled, runtime.settings.secretCode, runtime.settings.tokenExpiresIn);
|
|
38
|
+
prjApi.init(runtime, authJwt.verifyToken, verifyGroups);
|
|
39
|
+
apiApp.use(prjApi.app());
|
|
40
|
+
usersApi.init(runtime, authJwt.verifyToken, verifyGroups);
|
|
41
|
+
apiApp.use(usersApi.app());
|
|
42
|
+
alarmsApi.init(runtime, authJwt.verifyToken, verifyGroups);
|
|
43
|
+
apiApp.use(alarmsApi.app());
|
|
44
|
+
authApi.init(runtime, authJwt.secretCode, authJwt.tokenExpiresIn);
|
|
45
|
+
apiApp.use(authApi.app());
|
|
46
|
+
pluginsApi.init(runtime, authJwt.verifyToken, verifyGroups);
|
|
47
|
+
apiApp.use(pluginsApi.app());
|
|
48
|
+
diagnoseApi.init(runtime, authJwt.verifyToken, verifyGroups);
|
|
49
|
+
apiApp.use(diagnoseApi.app());
|
|
50
|
+
daqApi.init(runtime, authJwt.verifyToken, verifyGroups);
|
|
51
|
+
apiApp.use(daqApi.app());
|
|
52
|
+
scriptsApi.init(runtime, authJwt.verifyToken, verifyGroups);
|
|
53
|
+
apiApp.use(scriptsApi.app());
|
|
54
|
+
resourcesApi.init(runtime, authJwt.verifyToken, verifyGroups);
|
|
55
|
+
apiApp.use(resourcesApi.app());
|
|
56
|
+
commandApi.init(runtime, authJwt.verifyToken, verifyGroups);
|
|
57
|
+
apiApp.use(commandApi.app());
|
|
58
|
+
|
|
59
|
+
const limiter = rateLimit({
|
|
60
|
+
windowMs: 5 * 60 * 1000, // 5 minutes
|
|
61
|
+
max: 100 // limit each IP to 100 requests per windowMs
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// apply to all requests
|
|
65
|
+
apiApp.use(limiter);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* GET Server setting data
|
|
69
|
+
*/
|
|
70
|
+
apiApp.get('/api/settings', function (req, res) {
|
|
71
|
+
if (runtime.settings) {
|
|
72
|
+
let tosend = JSON.parse(JSON.stringify(runtime.settings));
|
|
73
|
+
delete tosend.secretCode;
|
|
74
|
+
if (tosend.smtp) {
|
|
75
|
+
delete tosend.smtp.password;
|
|
76
|
+
}
|
|
77
|
+
// res.header("Access-Control-Allow-Origin", "*");
|
|
78
|
+
// res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
|
79
|
+
res.json(tosend);
|
|
80
|
+
} else {
|
|
81
|
+
res.status(404).end();
|
|
82
|
+
runtime.logger.error('api get settings: Value Not Found!');
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* POST Server user settings
|
|
88
|
+
*/
|
|
89
|
+
apiApp.post("/api/settings", authJwt.verifyToken, function(req, res, next) {
|
|
90
|
+
var groups = verifyGroups(req);
|
|
91
|
+
if (res.statusCode === 403) {
|
|
92
|
+
runtime.logger.error("api post settings: Tocken Expired");
|
|
93
|
+
} else if (authJwt.adminGroups.indexOf(groups) === -1 ) {
|
|
94
|
+
res.status(401).json({error:"unauthorized_error", message: "Unauthorized!"});
|
|
95
|
+
runtime.logger.error("api post settings: Unauthorized");
|
|
96
|
+
} else {
|
|
97
|
+
try {
|
|
98
|
+
if (req.body.smtp && !req.body.smtp.password && runtime.settings.smtp && runtime.settings.smtp.password) {
|
|
99
|
+
req.body.smtp.password = runtime.settings.smtp.password;
|
|
100
|
+
}
|
|
101
|
+
fs.writeFileSync(runtime.settings.userSettingsFile, JSON.stringify(req.body, null, 4));
|
|
102
|
+
mergeUserSettings(req.body);
|
|
103
|
+
runtime.restart(true).then(function(result) {
|
|
104
|
+
res.end();
|
|
105
|
+
});
|
|
106
|
+
} catch (err) {
|
|
107
|
+
res.status(400).json({ error: "unexpected_error", message: err });
|
|
108
|
+
runtime.logger.error("api post settings: " + err);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* GET Heartbeat to check token
|
|
115
|
+
*/
|
|
116
|
+
apiApp.post('/api/heartbeat', authJwt.verifyToken, function (req, res) {
|
|
117
|
+
if (!runtime.settings.secureEnabled) {
|
|
118
|
+
res.end();
|
|
119
|
+
} else if (res.statusCode === 403) {
|
|
120
|
+
runtime.logger.error("api post heartbeat: Tocken Expired");
|
|
121
|
+
} else if (req.body.params) {
|
|
122
|
+
const token = authJwt.getNewToken(req.headers)
|
|
123
|
+
if (token) {
|
|
124
|
+
res.status(200).json({
|
|
125
|
+
message: 'tokenRefresh',
|
|
126
|
+
token: token
|
|
127
|
+
});
|
|
128
|
+
} else {
|
|
129
|
+
res.end();
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
res.end();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
runtime.logger.info('api: init successful!', true);
|
|
136
|
+
} else {
|
|
137
|
+
}
|
|
138
|
+
resolve();
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function mergeUserSettings(settings) {
|
|
143
|
+
if (settings.language) {
|
|
144
|
+
runtime.settings.language = settings.language;
|
|
145
|
+
}
|
|
146
|
+
runtime.settings.broadcastAll = settings.broadcastAll;
|
|
147
|
+
runtime.settings.secureEnabled = settings.secureEnabled;
|
|
148
|
+
runtime.settings.logFull = settings.logFull;
|
|
149
|
+
if (settings.secureEnabled) {
|
|
150
|
+
runtime.settings.tokenExpiresIn = settings.tokenExpiresIn;
|
|
151
|
+
}
|
|
152
|
+
if (settings.smtp) {
|
|
153
|
+
runtime.settings.smtp = settings.smtp;
|
|
154
|
+
}
|
|
155
|
+
if (settings.daqstore) {
|
|
156
|
+
runtime.settings.daqstore = settings.daqstore;
|
|
157
|
+
}
|
|
158
|
+
if (settings.alarms) {
|
|
159
|
+
runtime.settings.alarms = settings.alarms;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function verifyGroups(req) {
|
|
164
|
+
return (runtime.settings && runtime.settings.secureEnabled) ? ((req.tokenExpired) ? 0 : req.userGroups) : authJwt.adminGroups[0];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function start() {
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function stop() {
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
module.exports = {
|
|
174
|
+
init: init,
|
|
175
|
+
start: start,
|
|
176
|
+
stop: stop,
|
|
177
|
+
|
|
178
|
+
get apiApp() { return apiApp; },
|
|
179
|
+
get server() { return server; },
|
|
180
|
+
get authJwt() { return authJwt; }
|
|
181
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const jwt = require('jsonwebtoken');
|
|
4
|
+
|
|
5
|
+
var secureEnabled = false;
|
|
6
|
+
var secretCode = 'frangoteam751';
|
|
7
|
+
var tokenExpiresIn = 60 * 60; // 60 minutes
|
|
8
|
+
const adminGroups = [-1, 255];
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function init(_secureEnabled, _secretCode, _tokenExpires) {
|
|
12
|
+
secureEnabled = _secureEnabled;
|
|
13
|
+
if (_secretCode) {
|
|
14
|
+
secretCode = _secretCode;
|
|
15
|
+
}
|
|
16
|
+
if (_tokenExpires) {
|
|
17
|
+
tokenExpiresIn = _tokenExpires;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Verify token
|
|
23
|
+
* @param {*} token
|
|
24
|
+
*/
|
|
25
|
+
function verify (token) {
|
|
26
|
+
return new Promise ((resolve, reject) => {
|
|
27
|
+
jwt.verify(token, secretCode, (err, decoded) => {
|
|
28
|
+
if (err) {
|
|
29
|
+
console.error(`verify token error: ${err}`);
|
|
30
|
+
reject(false);
|
|
31
|
+
} else {
|
|
32
|
+
resolve(true);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Verify WebAPI token (take from header)
|
|
40
|
+
* @param {*} req
|
|
41
|
+
* @param {*} res
|
|
42
|
+
* @param {*} next
|
|
43
|
+
*/
|
|
44
|
+
function verifyToken (req, res, next) {
|
|
45
|
+
let token = req.headers['x-access-token'];
|
|
46
|
+
|
|
47
|
+
if (token) {
|
|
48
|
+
jwt.verify(token, secretCode, (err, decoded) => {
|
|
49
|
+
if (err) {
|
|
50
|
+
req.userId = null;
|
|
51
|
+
req.userGroups = null;
|
|
52
|
+
if (err.name === 'TokenExpiredError' || err.name === 'JsonWebTokenError') {
|
|
53
|
+
req.tokenExpired = true;
|
|
54
|
+
res.status(403).json({error:"unauthorized_error", message: "Token Expired!"});
|
|
55
|
+
}
|
|
56
|
+
next();
|
|
57
|
+
} else {
|
|
58
|
+
req.userId = decoded.id;
|
|
59
|
+
req.userGroups = decoded.groups;
|
|
60
|
+
if (req.headers['x-auth-user']) {
|
|
61
|
+
let user = JSON.parse(req.headers['x-auth-user']);
|
|
62
|
+
if (user && user.groups != req.userGroups) {
|
|
63
|
+
res.status(403).json({ error: "unauthorized_error", message: "User Profile Corrupted!" });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
next();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
// notice that no token was provided...}
|
|
71
|
+
req.userId = null;
|
|
72
|
+
req.userGroups = null;
|
|
73
|
+
// if (secureEnabled) {
|
|
74
|
+
// res.status(401).json({ error: "unauthorized_error", message: "Token missing!" });
|
|
75
|
+
// }
|
|
76
|
+
next();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function getNewToken(headers) {
|
|
81
|
+
const authUser = (headers['x-auth-user']) ? JSON.parse(headers['x-auth-user']) : null;
|
|
82
|
+
if (authUser) {
|
|
83
|
+
return jwt.sign({
|
|
84
|
+
id: authUser.user,
|
|
85
|
+
groups: authUser.groups
|
|
86
|
+
},
|
|
87
|
+
secretCode, {
|
|
88
|
+
expiresIn: tokenExpiresIn
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function getTokenExpiresIn() {
|
|
95
|
+
return tokenExpiresIn;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
module.exports = {
|
|
99
|
+
init: init,
|
|
100
|
+
verify: verify,
|
|
101
|
+
verifyToken: verifyToken,
|
|
102
|
+
getNewToken: getNewToken,
|
|
103
|
+
get secretCode() { return secretCode },
|
|
104
|
+
get tokenExpiresIn() { return tokenExpiresIn },
|
|
105
|
+
adminGroups: adminGroups
|
|
106
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 'api/plugin': Plugin API to GET/POST plugin data
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
var express = require("express");
|
|
6
|
+
const authJwt = require('../jwt-helper');
|
|
7
|
+
var runtime;
|
|
8
|
+
var secureFnc;
|
|
9
|
+
var checkGroupsFnc;
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
init: function (_runtime, _secureFnc, _checkGroupsFnc) {
|
|
13
|
+
runtime = _runtime;
|
|
14
|
+
secureFnc = _secureFnc;
|
|
15
|
+
checkGroupsFnc = _checkGroupsFnc;
|
|
16
|
+
},
|
|
17
|
+
app: function () {
|
|
18
|
+
var pluginsApp = express();
|
|
19
|
+
pluginsApp.use(function (req, res, next) {
|
|
20
|
+
if (!runtime.project) {
|
|
21
|
+
res.status(404).end();
|
|
22
|
+
} else {
|
|
23
|
+
next();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* GET supported Plugin and status (installed)
|
|
29
|
+
*/
|
|
30
|
+
pluginsApp.get("/api/plugins", secureFnc, function (req, res) {
|
|
31
|
+
var groups = checkGroupsFnc(req);
|
|
32
|
+
if (res.statusCode === 403) {
|
|
33
|
+
runtime.logger.error("api get plugins: Tocken Expired");
|
|
34
|
+
} else if (authJwt.adminGroups.indexOf(groups) === -1) {
|
|
35
|
+
res.status(401).json({ error: "unauthorized_error", message: "Unauthorized!" });
|
|
36
|
+
runtime.logger.error("api get plugins: Unauthorized!");
|
|
37
|
+
} else {
|
|
38
|
+
runtime.plugins.getPlugins().then(result => {
|
|
39
|
+
// res.header("Access-Control-Allow-Origin", "*");
|
|
40
|
+
// res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
|
41
|
+
if (result) {
|
|
42
|
+
res.json(result);
|
|
43
|
+
} else {
|
|
44
|
+
res.end();
|
|
45
|
+
}
|
|
46
|
+
}).catch(function (err) {
|
|
47
|
+
if (err.code) {
|
|
48
|
+
res.status(400).json({ error: err.code, message: err.message });
|
|
49
|
+
} else {
|
|
50
|
+
res.status(400).json({ error: "unexpected_error", message: err.toString() });
|
|
51
|
+
}
|
|
52
|
+
runtime.logger.error("api get plugins: " + err.message);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* POST Plugin
|
|
59
|
+
* Install the plugin
|
|
60
|
+
*/
|
|
61
|
+
pluginsApp.post("/api/plugins", secureFnc, function (req, res, next) {
|
|
62
|
+
var groups = checkGroupsFnc(req);
|
|
63
|
+
if (res.statusCode === 403) {
|
|
64
|
+
runtime.logger.error("api post plugins: Tocken Expired");
|
|
65
|
+
} else if (authJwt.adminGroups.indexOf(groups) === -1) {
|
|
66
|
+
res.status(401).json({ error: "unauthorized_error", message: "Unauthorized!" });
|
|
67
|
+
runtime.logger.error("api post plugins: Unauthorized");
|
|
68
|
+
} else {
|
|
69
|
+
runtime.plugins.addPlugin(req.body.params, true).then(function (data) {
|
|
70
|
+
runtime.devices.update();
|
|
71
|
+
res.end();
|
|
72
|
+
}).catch(function (err) {
|
|
73
|
+
if (err.code) {
|
|
74
|
+
res.status(400).json({ error: err.code, message: err.message });
|
|
75
|
+
} else {
|
|
76
|
+
res.status(400).json({ error: "unexpected_error", message: err.toString() });
|
|
77
|
+
}
|
|
78
|
+
runtime.logger.error("api install plugins: " + err.message);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* DELETE Plugin
|
|
85
|
+
* Unistall the plugin
|
|
86
|
+
*/
|
|
87
|
+
pluginsApp.delete("/api/plugins", secureFnc, function (req, res, next) {
|
|
88
|
+
var groups = checkGroupsFnc(req);
|
|
89
|
+
if (res.statusCode === 403) {
|
|
90
|
+
runtime.logger.error("api delete plugins: Tocken Expired");
|
|
91
|
+
} else if (authJwt.adminGroups.indexOf(groups) === -1) {
|
|
92
|
+
res.status(401).json({ error: "unauthorized_error", message: "Unauthorized!" });
|
|
93
|
+
runtime.logger.error("api delete plugins: Unauthorized");
|
|
94
|
+
} else {
|
|
95
|
+
runtime.plugins.removePlugin(req.query.param).then(function (data) {
|
|
96
|
+
res.end();
|
|
97
|
+
}).catch(function (err) {
|
|
98
|
+
if (err.code) {
|
|
99
|
+
res.status(400).json({ error: err.code, message: err.message });
|
|
100
|
+
} else {
|
|
101
|
+
res.status(400).json({ error: "unexpected_error", message: err.toString() });
|
|
102
|
+
}
|
|
103
|
+
runtime.logger.error("api delete plugins: " + err.message);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return pluginsApp;
|
|
108
|
+
}
|
|
109
|
+
}
|