cyberia 2.8.885
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/.dockerignore +15 -0
- package/.env.development +45 -0
- package/.env.production +50 -0
- package/.env.test +45 -0
- package/.github/workflows/engine-cyberia.cd.yml +31 -0
- package/.github/workflows/engine-cyberia.ci.yml +60 -0
- package/.github/workflows/ghpkg.ci.yml +87 -0
- package/.github/workflows/npmpkg.ci.yml +72 -0
- package/.github/workflows/publish.ci.yml +84 -0
- package/.github/workflows/publish.cyberia.ci.yml +84 -0
- package/.github/workflows/pwa-microservices-template-page.cd.yml +72 -0
- package/.github/workflows/pwa-microservices-template-test.ci.yml +33 -0
- package/.github/workflows/release.cd.yml +37 -0
- package/.nycrc +9 -0
- package/.prettierignore +13 -0
- package/.prettierrc +9 -0
- package/.vscode/extensions.json +51 -0
- package/.vscode/settings.json +87 -0
- package/AUTHORS.md +21 -0
- package/CHANGELOG.md +205 -0
- package/Dockerfile +28 -0
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/bin/build.js +209 -0
- package/bin/cron.js +47 -0
- package/bin/cyberia.js +145 -0
- package/bin/db.js +199 -0
- package/bin/deploy.js +1293 -0
- package/bin/file.js +197 -0
- package/bin/hwt.js +49 -0
- package/bin/index.js +145 -0
- package/bin/ssl.js +63 -0
- package/bin/util.js +80 -0
- package/bin/vs.js +74 -0
- package/cli.md +714 -0
- package/conf.js +204 -0
- package/deployment.yaml +138 -0
- package/jsconfig.json +7 -0
- package/jsdoc.json +32 -0
- package/manifests/deployment/adminer/deployment.yaml +32 -0
- package/manifests/deployment/adminer/kustomization.yaml +7 -0
- package/manifests/deployment/adminer/service.yaml +13 -0
- package/manifests/deployment/dd-default-development/deployment.yaml +167 -0
- package/manifests/deployment/dd-default-development/proxy.yaml +46 -0
- package/manifests/deployment/dd-test-development/deployment.yaml +174 -0
- package/manifests/deployment/dd-test-development/proxy.yaml +51 -0
- package/manifests/deployment/fastapi/backend-deployment.yml +120 -0
- package/manifests/deployment/fastapi/backend-service.yml +19 -0
- package/manifests/deployment/fastapi/frontend-deployment.yml +54 -0
- package/manifests/deployment/fastapi/frontend-service.yml +15 -0
- package/manifests/deployment/fastapi/initial_data.sh +56 -0
- package/manifests/deployment/kafka/deployment.yaml +69 -0
- package/manifests/deployment/mongo-express/deployment.yaml +60 -0
- package/manifests/deployment/phpmyadmin/deployment.yaml +54 -0
- package/manifests/deployment/spark/spark-pi-py.yaml +21 -0
- package/manifests/deployment/tensorflow/tf-gpu-test.yaml +65 -0
- package/manifests/envoy-service-nodeport.yaml +23 -0
- package/manifests/grafana/deployment.yaml +57 -0
- package/manifests/grafana/kustomization.yaml +7 -0
- package/manifests/grafana/pvc.yaml +12 -0
- package/manifests/grafana/service.yaml +14 -0
- package/manifests/kind-config-dev.yaml +12 -0
- package/manifests/kind-config.yaml +12 -0
- package/manifests/kubeadm-calico-config.yaml +119 -0
- package/manifests/kubelet-config.yaml +65 -0
- package/manifests/letsencrypt-prod.yaml +15 -0
- package/manifests/lxd/lxd-admin-profile.yaml +17 -0
- package/manifests/lxd/lxd-preseed.yaml +30 -0
- package/manifests/lxd/underpost-setup.sh +163 -0
- package/manifests/mariadb/config.yaml +10 -0
- package/manifests/mariadb/kustomization.yaml +9 -0
- package/manifests/mariadb/pv.yaml +12 -0
- package/manifests/mariadb/pvc.yaml +10 -0
- package/manifests/mariadb/secret.yaml +8 -0
- package/manifests/mariadb/service.yaml +10 -0
- package/manifests/mariadb/statefulset.yaml +56 -0
- package/manifests/mariadb/storage-class.yaml +10 -0
- package/manifests/mongodb/backup-access.yaml +16 -0
- package/manifests/mongodb/backup-cronjob.yaml +42 -0
- package/manifests/mongodb/backup-pv-pvc.yaml +22 -0
- package/manifests/mongodb/configmap.yaml +26 -0
- package/manifests/mongodb/headless-service.yaml +10 -0
- package/manifests/mongodb/kustomization.yaml +11 -0
- package/manifests/mongodb/pv-pvc.yaml +23 -0
- package/manifests/mongodb/statefulset.yaml +126 -0
- package/manifests/mongodb/storage-class.yaml +9 -0
- package/manifests/mongodb-4.4/kustomization.yaml +7 -0
- package/manifests/mongodb-4.4/pv-pvc.yaml +23 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +63 -0
- package/manifests/mysql/kustomization.yaml +7 -0
- package/manifests/mysql/pv-pvc.yaml +27 -0
- package/manifests/mysql/statefulset.yaml +55 -0
- package/manifests/postgresql/configmap.yaml +9 -0
- package/manifests/postgresql/kustomization.yaml +10 -0
- package/manifests/postgresql/pv.yaml +15 -0
- package/manifests/postgresql/pvc.yaml +13 -0
- package/manifests/postgresql/service.yaml +10 -0
- package/manifests/postgresql/statefulset.yaml +37 -0
- package/manifests/prometheus/deployment.yaml +82 -0
- package/manifests/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/service.yaml +11 -0
- package/manifests/valkey/statefulset.yaml +38 -0
- package/nodemon.json +6 -0
- package/package.json +118 -0
- package/proxy.yaml +35 -0
- package/scripts/device-scan.sh +43 -0
- package/scripts/gpu-diag.sh +19 -0
- package/scripts/maas-setup.sh +120 -0
- package/scripts/nat-iptables.sh +26 -0
- package/scripts/nvim.sh +91 -0
- package/scripts/snap-clean.sh +26 -0
- package/scripts/ssh-cluster-info.sh +14 -0
- package/scripts/ssl.sh +164 -0
- package/src/api/blockchain/blockchain.controller.js +51 -0
- package/src/api/blockchain/blockchain.model.js +90 -0
- package/src/api/blockchain/blockchain.router.js +21 -0
- package/src/api/blockchain/blockchain.service.js +24 -0
- package/src/api/core/core.controller.js +69 -0
- package/src/api/core/core.model.js +11 -0
- package/src/api/core/core.router.js +24 -0
- package/src/api/core/core.service.js +35 -0
- package/src/api/crypto/crypto.controller.js +51 -0
- package/src/api/crypto/crypto.model.js +23 -0
- package/src/api/crypto/crypto.router.js +20 -0
- package/src/api/crypto/crypto.service.js +64 -0
- package/src/api/default/default.controller.js +74 -0
- package/src/api/default/default.model.js +20 -0
- package/src/api/default/default.router.js +27 -0
- package/src/api/default/default.service.js +40 -0
- package/src/api/document/document.controller.js +66 -0
- package/src/api/document/document.model.js +51 -0
- package/src/api/document/document.router.js +24 -0
- package/src/api/document/document.service.js +133 -0
- package/src/api/file/file.controller.js +67 -0
- package/src/api/file/file.model.js +19 -0
- package/src/api/file/file.router.js +22 -0
- package/src/api/file/file.service.js +100 -0
- package/src/api/instance/instance.controller.js +69 -0
- package/src/api/instance/instance.model.js +40 -0
- package/src/api/instance/instance.router.js +34 -0
- package/src/api/instance/instance.service.js +70 -0
- package/src/api/ipfs/ipfs.controller.js +51 -0
- package/src/api/ipfs/ipfs.model.js +17 -0
- package/src/api/ipfs/ipfs.router.js +20 -0
- package/src/api/ipfs/ipfs.service.js +25 -0
- package/src/api/object-layer/README.md +85 -0
- package/src/api/object-layer/object-layer.controller.js +69 -0
- package/src/api/object-layer/object-layer.model.js +181 -0
- package/src/api/object-layer/object-layer.router.js +29 -0
- package/src/api/object-layer/object-layer.service.js +49 -0
- package/src/api/test/test.controller.js +59 -0
- package/src/api/test/test.model.js +14 -0
- package/src/api/test/test.router.js +21 -0
- package/src/api/test/test.service.js +35 -0
- package/src/api/user/postman_collection.json +216 -0
- package/src/api/user/user.build.js +16 -0
- package/src/api/user/user.controller.js +35 -0
- package/src/api/user/user.model.js +100 -0
- package/src/api/user/user.router.js +400 -0
- package/src/api/user/user.service.js +500 -0
- package/src/api.js +23 -0
- package/src/cli/baremetal.js +1310 -0
- package/src/cli/cloud-init.js +548 -0
- package/src/cli/cluster.js +834 -0
- package/src/cli/cron.js +95 -0
- package/src/cli/db.js +414 -0
- package/src/cli/deploy.js +661 -0
- package/src/cli/env.js +101 -0
- package/src/cli/fs.js +256 -0
- package/src/cli/image.js +156 -0
- package/src/cli/index.js +436 -0
- package/src/cli/lxd.js +402 -0
- package/src/cli/monitor.js +260 -0
- package/src/cli/repository.js +274 -0
- package/src/cli/run.js +728 -0
- package/src/cli/script.js +85 -0
- package/src/cli/secrets.js +71 -0
- package/src/cli/ssh.js +46 -0
- package/src/cli/test.js +159 -0
- package/src/client/Cyberia.index.js +50 -0
- package/src/client/CyberiaAdmin.index.js +34 -0
- package/src/client/CyberiaPortal.index.js +36 -0
- package/src/client/Default.index.js +84 -0
- package/src/client/components/core/404.js +20 -0
- package/src/client/components/core/500.js +20 -0
- package/src/client/components/core/Account.js +326 -0
- package/src/client/components/core/AgGrid.js +191 -0
- package/src/client/components/core/Alert.js +77 -0
- package/src/client/components/core/Auth.js +342 -0
- package/src/client/components/core/Badge.js +32 -0
- package/src/client/components/core/Blockchain.js +41 -0
- package/src/client/components/core/Blog.js +9 -0
- package/src/client/components/core/BtnIcon.js +111 -0
- package/src/client/components/core/CalendarCore.js +464 -0
- package/src/client/components/core/Chat.js +64 -0
- package/src/client/components/core/ColorPalette.js +5267 -0
- package/src/client/components/core/CommonJs.js +1010 -0
- package/src/client/components/core/Content.js +196 -0
- package/src/client/components/core/Css.js +1099 -0
- package/src/client/components/core/CssCore.js +882 -0
- package/src/client/components/core/D3Chart.js +44 -0
- package/src/client/components/core/Docs.js +376 -0
- package/src/client/components/core/DropDown.js +223 -0
- package/src/client/components/core/EventsUI.js +133 -0
- package/src/client/components/core/FileExplorer.js +707 -0
- package/src/client/components/core/FullScreen.js +36 -0
- package/src/client/components/core/Input.js +383 -0
- package/src/client/components/core/JoyStick.js +80 -0
- package/src/client/components/core/Keyboard.js +73 -0
- package/src/client/components/core/LoadingAnimation.js +159 -0
- package/src/client/components/core/LogIn.js +190 -0
- package/src/client/components/core/LogOut.js +63 -0
- package/src/client/components/core/Logger.js +29 -0
- package/src/client/components/core/Modal.js +2494 -0
- package/src/client/components/core/NotificationManager.js +84 -0
- package/src/client/components/core/ObjectLayerEngine.js +1229 -0
- package/src/client/components/core/ObjectLayerEngineModal.js +443 -0
- package/src/client/components/core/Pagination.js +207 -0
- package/src/client/components/core/Panel.js +772 -0
- package/src/client/components/core/PanelForm.js +627 -0
- package/src/client/components/core/Polyhedron.js +162 -0
- package/src/client/components/core/Recover.js +207 -0
- package/src/client/components/core/Responsive.js +82 -0
- package/src/client/components/core/RichText.js +43 -0
- package/src/client/components/core/Router.js +317 -0
- package/src/client/components/core/Scroll.js +76 -0
- package/src/client/components/core/SignUp.js +125 -0
- package/src/client/components/core/SocketIo.js +74 -0
- package/src/client/components/core/Stream.js +113 -0
- package/src/client/components/core/ToggleSwitch.js +101 -0
- package/src/client/components/core/ToolTip.js +90 -0
- package/src/client/components/core/Translate.js +522 -0
- package/src/client/components/core/Validator.js +115 -0
- package/src/client/components/core/VanillaJs.js +423 -0
- package/src/client/components/core/Wallet.js +106 -0
- package/src/client/components/core/WebComponent.js +44 -0
- package/src/client/components/core/Webhook.js +25 -0
- package/src/client/components/core/Worker.js +371 -0
- package/src/client/components/core/windowGetDimensions.js +269 -0
- package/src/client/components/cyberia/BagCyberia.js +1253 -0
- package/src/client/components/cyberia/BiomeCyberia.js +130 -0
- package/src/client/components/cyberia/CharacterCyberia.js +321 -0
- package/src/client/components/cyberia/CommonCyberia.js +1834 -0
- package/src/client/components/cyberia/CssCyberia.js +816 -0
- package/src/client/components/cyberia/ElementPreviewCyberia.js +183 -0
- package/src/client/components/cyberia/ElementsCyberia.js +146 -0
- package/src/client/components/cyberia/InteractionPanelCyberia.js +1043 -0
- package/src/client/components/cyberia/JoyStickCyberia.js +53 -0
- package/src/client/components/cyberia/LogInCyberia.js +68 -0
- package/src/client/components/cyberia/LogOutCyberia.js +24 -0
- package/src/client/components/cyberia/MainUserCyberia.js +424 -0
- package/src/client/components/cyberia/MapCyberia.js +160 -0
- package/src/client/components/cyberia/MatrixCyberia.js +147 -0
- package/src/client/components/cyberia/MenuCyberia.js +575 -0
- package/src/client/components/cyberia/PixiCyberia.js +1639 -0
- package/src/client/components/cyberia/PointAndClickMovementCyberia.js +146 -0
- package/src/client/components/cyberia/QuestCyberia.js +1420 -0
- package/src/client/components/cyberia/RoutesCyberia.js +47 -0
- package/src/client/components/cyberia/SettingsCyberia.js +16 -0
- package/src/client/components/cyberia/SignUpCyberia.js +14 -0
- package/src/client/components/cyberia/SkillCyberia.js +124 -0
- package/src/client/components/cyberia/SocketIoCyberia.js +211 -0
- package/src/client/components/cyberia/TileCyberia.js +685 -0
- package/src/client/components/cyberia/TranslateCyberia.js +96 -0
- package/src/client/components/cyberia/UniverseCyberia.js +14 -0
- package/src/client/components/cyberia/WebhookCyberia.js +13 -0
- package/src/client/components/cyberia/WikiCyberia.js +144 -0
- package/src/client/components/cyberia/WorldCyberia.js +680 -0
- package/src/client/components/cyberia-admin/BiomeCyberiaAdmin.js +978 -0
- package/src/client/components/cyberia-admin/CommonCyberiaAdmin.js +29 -0
- package/src/client/components/cyberia-admin/CssCyberiaAdmin.js +15 -0
- package/src/client/components/cyberia-admin/ElementsCyberiaAdmin.js +38 -0
- package/src/client/components/cyberia-admin/InstanceEngineCyberiaAdmin.js +180 -0
- package/src/client/components/cyberia-admin/LogInCyberiaAdmin.js +34 -0
- package/src/client/components/cyberia-admin/LogOutCyberiaAdmin.js +24 -0
- package/src/client/components/cyberia-admin/MenuCyberiaAdmin.js +660 -0
- package/src/client/components/cyberia-admin/RoutesCyberiaAdmin.js +57 -0
- package/src/client/components/cyberia-admin/ServerCyberiaAdmin.js +129 -0
- package/src/client/components/cyberia-admin/SettingsCyberiaAdmin.js +16 -0
- package/src/client/components/cyberia-admin/SignUpCyberiaAdmin.js +11 -0
- package/src/client/components/cyberia-admin/SocketIoCyberiaAdmin.js +53 -0
- package/src/client/components/cyberia-admin/TranslateCyberiaAdmin.js +7 -0
- package/src/client/components/cyberia-biome/CityCyberiaBiome.js +209 -0
- package/src/client/components/cyberia-biome/CityInteriorCyberiaBiome.js +253 -0
- package/src/client/components/cyberia-biome/ColorChaosCyberiaBiome.js +26 -0
- package/src/client/components/cyberia-biome/ForestCyberiaBiome.js +191 -0
- package/src/client/components/cyberia-biome/GridBaseCyberiaBiome.js +364 -0
- package/src/client/components/cyberia-biome/SeedCityCyberiaBiome.js +347 -0
- package/src/client/components/cyberia-biome/ShopCyberiaBiome.js +12 -0
- package/src/client/components/cyberia-biome/SpaceCyberiaBiome.js +58 -0
- package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +29 -0
- package/src/client/components/cyberia-portal/CssCyberiaPortal.js +132 -0
- package/src/client/components/cyberia-portal/ElementsCyberiaPortal.js +38 -0
- package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +18 -0
- package/src/client/components/cyberia-portal/LogOutCyberiaPortal.js +12 -0
- package/src/client/components/cyberia-portal/MenuCyberiaPortal.js +487 -0
- package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +45 -0
- package/src/client/components/cyberia-portal/ServerCyberiaPortal.js +136 -0
- package/src/client/components/cyberia-portal/SettingsCyberiaPortal.js +16 -0
- package/src/client/components/cyberia-portal/SignUpCyberiaPortal.js +11 -0
- package/src/client/components/cyberia-portal/SocketIoCyberiaPortal.js +52 -0
- package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +12 -0
- package/src/client/components/default/CommonDefault.js +29 -0
- package/src/client/components/default/CssDefault.js +27 -0
- package/src/client/components/default/ElementsDefault.js +38 -0
- package/src/client/components/default/LogInDefault.js +14 -0
- package/src/client/components/default/LogOutDefault.js +10 -0
- package/src/client/components/default/MenuDefault.js +743 -0
- package/src/client/components/default/RoutesDefault.js +48 -0
- package/src/client/components/default/SettingsDefault.js +16 -0
- package/src/client/components/default/SignUpDefault.js +9 -0
- package/src/client/components/default/SocketIoDefault.js +54 -0
- package/src/client/components/default/TranslateDefault.js +7 -0
- package/src/client/public/default/android-chrome-144x144.png +0 -0
- package/src/client/public/default/android-chrome-192x192.png +0 -0
- package/src/client/public/default/android-chrome-256x256.png +0 -0
- package/src/client/public/default/android-chrome-36x36.png +0 -0
- package/src/client/public/default/android-chrome-384x384.png +0 -0
- package/src/client/public/default/android-chrome-48x48.png +0 -0
- package/src/client/public/default/android-chrome-512x512.png +0 -0
- package/src/client/public/default/android-chrome-72x72.png +0 -0
- package/src/client/public/default/android-chrome-96x96.png +0 -0
- package/src/client/public/default/apple-touch-icon-1024x1024.png +0 -0
- package/src/client/public/default/apple-touch-icon-114x114-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-114x114.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144.png +0 -0
- package/src/client/public/default/apple-touch-icon-152x152-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-152x152.png +0 -0
- package/src/client/public/default/apple-touch-icon-167x167.png +0 -0
- package/src/client/public/default/apple-touch-icon-180x180-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-180x180.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72.png +0 -0
- package/src/client/public/default/apple-touch-icon-76x76-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-76x76.png +0 -0
- package/src/client/public/default/apple-touch-icon-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1125x2436.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1136x640.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1170x2532.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1179x2556.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1242x2208.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1242x2688.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1284x2778.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1290x2796.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1334x750.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1488x2266.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1536x2048.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1620x2160.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1640x2160.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1668x2224.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1668x2388.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1792x828.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2048x1536.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2048x2732.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2160x1620.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2160x1640.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2208x1242.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2224x1668.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2266x1488.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2388x1668.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2436x1125.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2532x1170.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2556x1179.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2688x1242.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2732x2048.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2778x1284.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2796x1290.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-640x1136.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-750x1334.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-828x1792.png +0 -0
- package/src/client/public/default/assets/background/dark.jpg +0 -0
- package/src/client/public/default/assets/background/dark.svg +557 -0
- package/src/client/public/default/assets/background/white.jpg +0 -0
- package/src/client/public/default/assets/background/white0-min.jpg +0 -0
- package/src/client/public/default/assets/background/white0.jpg +0 -0
- package/src/client/public/default/assets/logo/base-icon.png +0 -0
- package/src/client/public/default/assets/logo/underpost.gif +0 -0
- package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-default-avatar.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
- package/src/client/public/default/browserconfig.xml +12 -0
- package/src/client/public/default/favicon-16x16.png +0 -0
- package/src/client/public/default/favicon-32x32.png +0 -0
- package/src/client/public/default/favicon-48x48.png +0 -0
- package/src/client/public/default/favicon.ico +0 -0
- package/src/client/public/default/manifest.webmanifest +69 -0
- package/src/client/public/default/mstile-144x144.png +0 -0
- package/src/client/public/default/mstile-150x150.png +0 -0
- package/src/client/public/default/mstile-310x150.png +0 -0
- package/src/client/public/default/mstile-310x310.png +0 -0
- package/src/client/public/default/mstile-70x70.png +0 -0
- package/src/client/public/default/plantuml/client-conf.svg +1 -0
- package/src/client/public/default/plantuml/client-schema.svg +1 -0
- package/src/client/public/default/plantuml/cron-conf.svg +1 -0
- package/src/client/public/default/plantuml/cron-schema.svg +1 -0
- package/src/client/public/default/plantuml/server-conf.svg +1 -0
- package/src/client/public/default/plantuml/server-schema.svg +1 -0
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
- package/src/client/public/default/safari-pinned-tab.svg +24 -0
- package/src/client/public/default/site.webmanifest +69 -0
- package/src/client/public/default/sitemap +148 -0
- package/src/client/public/default/yandex-browser-50x50.png +0 -0
- package/src/client/public/default/yandex-browser-manifest.json +9 -0
- package/src/client/public/doc/favicon.ico +0 -0
- package/src/client/public/doc/sitemap +148 -0
- package/src/client/public/test/favicon.ico +0 -0
- package/src/client/public/test/sitemap +148 -0
- package/src/client/services/blockchain/blockchain.service.js +73 -0
- package/src/client/services/core/core.service.js +165 -0
- package/src/client/services/crypto/crypto.service.js +73 -0
- package/src/client/services/default/default.management.js +450 -0
- package/src/client/services/default/default.service.js +98 -0
- package/src/client/services/document/document.service.js +97 -0
- package/src/client/services/file/file.service.js +72 -0
- package/src/client/services/instance/instance.management.js +78 -0
- package/src/client/services/instance/instance.service.js +97 -0
- package/src/client/services/ipfs/ipfs.service.js +73 -0
- package/src/client/services/object-layer/object-layer.service.js +93 -0
- package/src/client/services/test/test.service.js +73 -0
- package/src/client/services/user/user.management.js +56 -0
- package/src/client/services/user/user.service.js +108 -0
- package/src/client/ssr/Render.js +237 -0
- package/src/client/ssr/body/404.js +73 -0
- package/src/client/ssr/body/500.js +72 -0
- package/src/client/ssr/body/CacheControl.js +114 -0
- package/src/client/ssr/body/CyberiaDefaultSplashScreen.js +90 -0
- package/src/client/ssr/body/CyberiaSplashScreenLore.js +424 -0
- package/src/client/ssr/body/DefaultSplashScreen.js +90 -0
- package/src/client/ssr/email/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/email/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/head/Css.js +241 -0
- package/src/client/ssr/head/CyberiaAdminScripts.js +6 -0
- package/src/client/ssr/head/CyberiaPortalScripts.js +6 -0
- package/src/client/ssr/head/CyberiaScripts.js +6 -0
- package/src/client/ssr/head/DefaultScripts.js +6 -0
- package/src/client/ssr/head/Microdata.js +11 -0
- package/src/client/ssr/head/Production.js +1 -0
- package/src/client/ssr/head/Pwa.js +146 -0
- package/src/client/ssr/head/Seo.js +15 -0
- package/src/client/ssr/mailer/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/mailer/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/offline/Maintenance.js +63 -0
- package/src/client/ssr/offline/NoNetworkConnection.js +67 -0
- package/src/client/ssr/pages/404.js +12 -0
- package/src/client/ssr/pages/500.js +12 -0
- package/src/client/ssr/pages/Test.js +198 -0
- package/src/client/ssr/pages/maintenance.js +14 -0
- package/src/client/ssr/pages/offline.js +21 -0
- package/src/client/sw/default.sw.js +108 -0
- package/src/client/sw/template.sw.js +84 -0
- package/src/client.build.js +22 -0
- package/src/client.dev.js +24 -0
- package/src/db/DataBaseProvider.js +98 -0
- package/src/db/mariadb/MariaDB.js +66 -0
- package/src/db/mongo/MongooseDB.js +70 -0
- package/src/index.js +198 -0
- package/src/mailer/EmailRender.js +116 -0
- package/src/mailer/MailerProvider.js +213 -0
- package/src/monitor.js +24 -0
- package/src/proxy.js +22 -0
- package/src/runtime/express/Express.js +256 -0
- package/src/runtime/lampp/Dockerfile +50 -0
- package/src/runtime/lampp/Lampp.js +343 -0
- package/src/server/auth.js +689 -0
- package/src/server/backup.js +96 -0
- package/src/server/client-build-docs.js +205 -0
- package/src/server/client-build-live.js +109 -0
- package/src/server/client-build.js +690 -0
- package/src/server/client-dev-server.js +87 -0
- package/src/server/client-formatted.js +87 -0
- package/src/server/client-icons.js +108 -0
- package/src/server/conf.js +1071 -0
- package/src/server/crypto.js +210 -0
- package/src/server/dns.js +276 -0
- package/src/server/downloader.js +74 -0
- package/src/server/json-schema.js +77 -0
- package/src/server/logger.js +197 -0
- package/src/server/network.js +72 -0
- package/src/server/object-layer.js +294 -0
- package/src/server/peer.js +69 -0
- package/src/server/process.js +171 -0
- package/src/server/proxy.js +110 -0
- package/src/server/runtime.js +170 -0
- package/src/server/ssr.js +127 -0
- package/src/server/start.js +161 -0
- package/src/server/tls.js +251 -0
- package/src/server/valkey.js +293 -0
- package/src/server.js +25 -0
- package/src/ws/IoInterface.js +139 -0
- package/src/ws/IoServer.js +88 -0
- package/src/ws/core/channels/core.ws.chat.js +23 -0
- package/src/ws/core/channels/core.ws.mailer.js +35 -0
- package/src/ws/core/channels/core.ws.stream.js +31 -0
- package/src/ws/core/core.ws.connection.js +62 -0
- package/src/ws/core/core.ws.emit.js +53 -0
- package/src/ws/core/core.ws.server.js +76 -0
- package/src/ws/core/management/core.ws.chat.js +8 -0
- package/src/ws/core/management/core.ws.mailer.js +16 -0
- package/src/ws/core/management/core.ws.stream.js +8 -0
- package/src/ws/cyberia/channels/cyberia.ws.bot.js +56 -0
- package/src/ws/cyberia/channels/cyberia.ws.skill.js +51 -0
- package/src/ws/cyberia/channels/cyberia.ws.user.js +437 -0
- package/src/ws/cyberia/cyberia.ws.connection.js +36 -0
- package/src/ws/cyberia/cyberia.ws.emit.js +14 -0
- package/src/ws/cyberia/cyberia.ws.server.js +67 -0
- package/src/ws/cyberia/management/cyberia.ws.bot.js +669 -0
- package/src/ws/cyberia/management/cyberia.ws.skill.js +441 -0
- package/src/ws/cyberia/management/cyberia.ws.user.js +188 -0
- package/src/ws/default/channels/default.ws.main.js +16 -0
- package/src/ws/default/default.ws.connection.js +22 -0
- package/src/ws/default/default.ws.emit.js +14 -0
- package/src/ws/default/default.ws.server.js +20 -0
- package/src/ws/default/management/default.ws.main.js +8 -0
- package/test/api.test.js +53 -0
- package/test/crypto.test.js +117 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility class for authentication state management and session lifecycle control.
|
|
3
|
+
* This class is designed to be used as a singleton instance (exported as 'Auth').
|
|
4
|
+
* @module src/client/components/core/Auth.js
|
|
5
|
+
* @namespace AuthClient
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { UserMock, UserService } from '../../services/user/user.service.js';
|
|
9
|
+
import { Account } from './Account.js';
|
|
10
|
+
import { loggerFactory } from './Logger.js';
|
|
11
|
+
import { LogIn } from './LogIn.js';
|
|
12
|
+
import { LogOut } from './LogOut.js';
|
|
13
|
+
import { NotificationManager } from './NotificationManager.js';
|
|
14
|
+
import { Translate } from './Translate.js';
|
|
15
|
+
import { s } from './VanillaJs.js';
|
|
16
|
+
|
|
17
|
+
const logger = loggerFactory(import.meta, { trace: true });
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Manages user authentication state, tokens, and session lifecycle.
|
|
21
|
+
* @memberof AuthClient
|
|
22
|
+
*/
|
|
23
|
+
class Auth {
|
|
24
|
+
/**
|
|
25
|
+
* The current user access token (JWT).
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
#token = '';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The token for anonymous guest sessions.
|
|
33
|
+
* @type {string}
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
#guestToken = '';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Timeout ID for the token refresh schedule.
|
|
40
|
+
* @type {number | undefined}
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
#refreshTimeout;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Creates an instance of Auth.
|
|
47
|
+
*/
|
|
48
|
+
constructor() {
|
|
49
|
+
// Private fields are initialized above.
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// --- Token Management ---
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Sets the user's access token.
|
|
56
|
+
* @memberof AuthClient.Auth
|
|
57
|
+
* @param {string} [value=''] - The JWT token value.
|
|
58
|
+
* @returns {string} The set token value.
|
|
59
|
+
*/
|
|
60
|
+
setToken(value = '') {
|
|
61
|
+
return (this.#token = value);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Clears the user's access token.
|
|
66
|
+
* @memberof AuthClient.Auth
|
|
67
|
+
* @returns {string} An empty string.
|
|
68
|
+
*/
|
|
69
|
+
deleteToken() {
|
|
70
|
+
return (this.#token = '');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Gets the user's access token.
|
|
75
|
+
* @memberof AuthClient.Auth
|
|
76
|
+
* @returns {string} The JWT token.
|
|
77
|
+
*/
|
|
78
|
+
getToken() {
|
|
79
|
+
return this.#token;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Sets the anonymous guest token.
|
|
84
|
+
* @memberof AuthClient.Auth
|
|
85
|
+
* @param {string} [value=''] - The guest token value.
|
|
86
|
+
* @returns {string} The set guest token value.
|
|
87
|
+
*/
|
|
88
|
+
setGuestToken(value = '') {
|
|
89
|
+
return (this.#guestToken = value);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Clears the anonymous guest token.
|
|
94
|
+
* @memberof AuthClient.Auth
|
|
95
|
+
* @returns {string} An empty string.
|
|
96
|
+
*/
|
|
97
|
+
deleteGuestToken() {
|
|
98
|
+
return (this.#guestToken = '');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Gets the anonymous guest token.
|
|
103
|
+
* @memberof AuthClient.Auth
|
|
104
|
+
* @returns {string} The guest token.
|
|
105
|
+
*/
|
|
106
|
+
getGuestToken() {
|
|
107
|
+
return this.#guestToken;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Generates the JWT header string (e.g., "Bearer [token]") using the active token (user or guest).
|
|
112
|
+
* @memberof AuthClient.Auth
|
|
113
|
+
* @returns {string} The Bearer token string or an empty string.
|
|
114
|
+
*/
|
|
115
|
+
getJWT() {
|
|
116
|
+
if (this.getToken()) return `Bearer ${this.getToken()}`;
|
|
117
|
+
if (this.getGuestToken()) return `Bearer ${this.getGuestToken()}`;
|
|
118
|
+
return '';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Decodes the payload section of a JWT token.
|
|
123
|
+
* @static
|
|
124
|
+
* @memberof AuthClient.Auth
|
|
125
|
+
* @param {string} token - The JWT string.
|
|
126
|
+
* @returns {object | null} The decoded JWT payload object, or null on failure.
|
|
127
|
+
*/
|
|
128
|
+
static decodeJwt(token) {
|
|
129
|
+
try {
|
|
130
|
+
// Uses atob for base64 decoding of the middle part of the JWT
|
|
131
|
+
return JSON.parse(atob(token.split('.')[1]));
|
|
132
|
+
} catch (e) {
|
|
133
|
+
logger.error('Failed to decode JWT:', e);
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// --- Session Management ---
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Schedules the access token to be refreshed shortly before it expires.
|
|
142
|
+
* Clears any existing refresh timeout before setting a new one.
|
|
143
|
+
* @memberof AuthClient.Auth
|
|
144
|
+
* @returns {void}
|
|
145
|
+
*/
|
|
146
|
+
scheduleTokenRefresh() {
|
|
147
|
+
if (this.#refreshTimeout) {
|
|
148
|
+
clearTimeout(this.#refreshTimeout);
|
|
149
|
+
this.#refreshTimeout = undefined;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const currentToken = this.getToken();
|
|
153
|
+
if (!currentToken) return;
|
|
154
|
+
|
|
155
|
+
const payload = Auth.decodeJwt(currentToken);
|
|
156
|
+
if (!payload || !payload.refreshExpiresAt) return; // Requires refreshExpiresAt in milliseconds
|
|
157
|
+
|
|
158
|
+
const expiresIn = payload.refreshExpiresAt - Date.now();
|
|
159
|
+
const refreshBuffer = 2 * 60 * 1000; // 2 minutes buffer before expiry
|
|
160
|
+
const refreshIn = expiresIn - refreshBuffer;
|
|
161
|
+
|
|
162
|
+
logger.info(`Token refresh scheduled in ${refreshIn / (1000 * 60)} minutes`);
|
|
163
|
+
|
|
164
|
+
if (refreshIn <= 0) {
|
|
165
|
+
logger.warn('Token already expired or too close to expiry, skipping refresh schedule.');
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
this.#refreshTimeout = setTimeout(async () => {
|
|
170
|
+
const { data, status } = await UserService.get({ id: 'auth' }); // API call to get a fresh token
|
|
171
|
+
if (status === 'success' && data?.token) {
|
|
172
|
+
logger.info('Successfully refreshed access token.');
|
|
173
|
+
this.setToken(data.token);
|
|
174
|
+
localStorage.setItem('jwt', data.token);
|
|
175
|
+
this.scheduleTokenRefresh(); // Schedule the next refresh
|
|
176
|
+
} else {
|
|
177
|
+
logger.warn('Token refresh failed, attempting session out.');
|
|
178
|
+
this.sessionOut();
|
|
179
|
+
}
|
|
180
|
+
}, refreshIn);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Establishes a user session (logged-in) or falls back to a guest session.
|
|
185
|
+
* It attempts to use the provided token or a token from localStorage ('jwt').
|
|
186
|
+
* @memberof AuthClient.Auth
|
|
187
|
+
* @param {object} [userServicePayload] - Payload from a successful login/signup call to UserService.
|
|
188
|
+
* @returns {Promise<{user: object}>} A promise resolving to the current user object.
|
|
189
|
+
*/
|
|
190
|
+
async sessionIn(userServicePayload) {
|
|
191
|
+
try {
|
|
192
|
+
let token = userServicePayload?.data?.token || localStorage.getItem('jwt');
|
|
193
|
+
|
|
194
|
+
if (token) {
|
|
195
|
+
this.setToken(token);
|
|
196
|
+
|
|
197
|
+
const result = userServicePayload
|
|
198
|
+
? userServicePayload // From login/signup
|
|
199
|
+
: await UserService.get({ id: 'auth' }); // Verify token with backend
|
|
200
|
+
|
|
201
|
+
const { status, data, message } = result;
|
|
202
|
+
|
|
203
|
+
if (status === 'success' && data.token) {
|
|
204
|
+
// A valid user token was found/refreshed
|
|
205
|
+
this.setToken(data.token);
|
|
206
|
+
localStorage.setItem('jwt', data.token);
|
|
207
|
+
this.renderSessionUI();
|
|
208
|
+
await LogIn.Trigger({ user: data.user });
|
|
209
|
+
await Account.updateForm(data.user);
|
|
210
|
+
this.scheduleTokenRefresh();
|
|
211
|
+
return { user: data.user };
|
|
212
|
+
} else if (message && message.match('expired')) {
|
|
213
|
+
logger.warn('User session token expired.');
|
|
214
|
+
// Redirect to login modal and push notification
|
|
215
|
+
setTimeout(() => {
|
|
216
|
+
s(`.main-btn-log-in`).click();
|
|
217
|
+
NotificationManager.Push({
|
|
218
|
+
html: Translate.Render(`expired-session`),
|
|
219
|
+
status: 'warning',
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Cleanup failed user session attempt
|
|
226
|
+
this.deleteToken();
|
|
227
|
+
localStorage.removeItem('jwt');
|
|
228
|
+
|
|
229
|
+
// Anon guest session attempt
|
|
230
|
+
let guestToken = localStorage.getItem('jwt.g');
|
|
231
|
+
if (guestToken) {
|
|
232
|
+
this.setGuestToken(guestToken);
|
|
233
|
+
let { data, status, message } = await UserService.get({ id: 'auth' }); // Verify guest token
|
|
234
|
+
if (status === 'success' && data.token) {
|
|
235
|
+
// Guest token is valid and refreshed
|
|
236
|
+
this.setGuestToken(data.token);
|
|
237
|
+
localStorage.setItem('jwt.g', data.token);
|
|
238
|
+
await LogIn.Trigger(data);
|
|
239
|
+
await Account.updateForm(data.user);
|
|
240
|
+
return data;
|
|
241
|
+
} else {
|
|
242
|
+
logger.error(`Guest token validation failed: ${message}`);
|
|
243
|
+
// Fall through to full sessionOut to re-create guest session
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// If all attempts fail, create a new guest session (which calls sessionIn recursively)
|
|
248
|
+
return await this.sessionOut();
|
|
249
|
+
} catch (error) {
|
|
250
|
+
logger.error('Error during sessionIn process:', error);
|
|
251
|
+
// Fallback to a mock user object
|
|
252
|
+
return { user: UserMock.default };
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Ends the current user session (logout) and initiates a new anonymous guest session.
|
|
258
|
+
* @memberof AuthClient.Auth
|
|
259
|
+
* @returns {Promise<object>} A promise resolving to the newly created guest session data.
|
|
260
|
+
*/
|
|
261
|
+
async sessionOut() {
|
|
262
|
+
// 1. End User Session
|
|
263
|
+
try {
|
|
264
|
+
const result = await UserService.delete({ id: 'logout' });
|
|
265
|
+
localStorage.removeItem('jwt');
|
|
266
|
+
this.deleteToken();
|
|
267
|
+
if (this.#refreshTimeout) {
|
|
268
|
+
clearTimeout(this.#refreshTimeout);
|
|
269
|
+
this.#refreshTimeout = undefined;
|
|
270
|
+
}
|
|
271
|
+
this.renderGuestUi();
|
|
272
|
+
// Reset user data in the LogIn state/model
|
|
273
|
+
LogIn.Scope.user.main.model.user = {};
|
|
274
|
+
await LogOut.Trigger(result);
|
|
275
|
+
} catch (error) {
|
|
276
|
+
logger.error('Error during user logout:', error);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// 2. Start Guest Session
|
|
280
|
+
try {
|
|
281
|
+
localStorage.removeItem('jwt.g');
|
|
282
|
+
this.deleteGuestToken();
|
|
283
|
+
const result = await UserService.post({ id: 'guest' }); // Request a new guest token
|
|
284
|
+
|
|
285
|
+
if (result.status === 'success' && result.data.token) {
|
|
286
|
+
localStorage.setItem('jwt.g', result.data.token);
|
|
287
|
+
this.setGuestToken(result.data.token);
|
|
288
|
+
// Recursively call sessionIn to complete the guest login process (UI update, etc.)
|
|
289
|
+
return await this.sessionIn();
|
|
290
|
+
} else {
|
|
291
|
+
logger.error('Failed to get a new guest token.');
|
|
292
|
+
return { user: UserMock.default };
|
|
293
|
+
}
|
|
294
|
+
} catch (error) {
|
|
295
|
+
logger.error('Error during guest session creation:', error);
|
|
296
|
+
return { user: UserMock.default };
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// --- UI Rendering ---
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Renders the UI for a logged-in user (hides Log In/Sign Up, shows Log Out/Account).
|
|
304
|
+
* Also closes any active login/signup modals.
|
|
305
|
+
* @memberof AuthClient.Auth
|
|
306
|
+
* @returns {void}
|
|
307
|
+
*/
|
|
308
|
+
renderSessionUI() {
|
|
309
|
+
s(`.main-btn-log-in`).style.display = 'none';
|
|
310
|
+
s(`.main-btn-sign-up`).style.display = 'none';
|
|
311
|
+
s(`.main-btn-log-out`).style.display = null;
|
|
312
|
+
s(`.main-btn-account`).style.display = null;
|
|
313
|
+
setTimeout(() => {
|
|
314
|
+
// Close any open login/signup modals
|
|
315
|
+
if (s(`.modal-log-in`)) s(`.btn-close-modal-log-in`).click();
|
|
316
|
+
if (s(`.modal-sign-up`)) s(`.btn-close-modal-sign-up`).click();
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Renders the UI for a guest user (shows Log In/Sign Up, hides Log Out/Account).
|
|
322
|
+
* Also closes any active logout/account modals.
|
|
323
|
+
* @memberof AuthClient.Auth
|
|
324
|
+
* @returns {void}
|
|
325
|
+
*/
|
|
326
|
+
renderGuestUi() {
|
|
327
|
+
s(`.main-btn-log-in`).style.display = null;
|
|
328
|
+
s(`.main-btn-sign-up`).style.display = null;
|
|
329
|
+
s(`.main-btn-log-out`).style.display = 'none';
|
|
330
|
+
s(`.main-btn-account`).style.display = 'none';
|
|
331
|
+
setTimeout(() => {
|
|
332
|
+
// Close any open logout/account modals
|
|
333
|
+
if (s(`.modal-log-out`)) s(`.btn-close-modal-log-out`).click();
|
|
334
|
+
if (s(`.modal-account`)) s(`.btn-close-modal-account`).click();
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Export a singleton instance of the Auth class to maintain the original utility object access pattern.
|
|
340
|
+
const AuthSingleton = new Auth();
|
|
341
|
+
|
|
342
|
+
export { AuthSingleton as Auth };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getId, getIsoDate } from './CommonJs.js';
|
|
2
|
+
import { Css, renderCssAttr, Themes } from './Css.js';
|
|
3
|
+
import { Modal } from './Modal.js';
|
|
4
|
+
import { append, prepend, s } from './VanillaJs.js';
|
|
5
|
+
|
|
6
|
+
const Badge = {
|
|
7
|
+
Tokens: {},
|
|
8
|
+
Render: async function (options = { id: '', type: 'circle-red', classList: '', text: '', style: '' }) {
|
|
9
|
+
if (!options.id) options.id = getId(this.Tokens, 'badge-');
|
|
10
|
+
else options.id = 'badge-' + options.id;
|
|
11
|
+
if (options && options.style && !options.style.color) options.style.color = 'white';
|
|
12
|
+
if (!options.classList) options.classList = '';
|
|
13
|
+
|
|
14
|
+
const { id, type } = options;
|
|
15
|
+
this.Tokens[id] = { ...options };
|
|
16
|
+
|
|
17
|
+
switch (type) {
|
|
18
|
+
case 'circle-red':
|
|
19
|
+
options.classList += ' badge-notification-circle-red ';
|
|
20
|
+
break;
|
|
21
|
+
|
|
22
|
+
default:
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return html`<div class="badge wfm ${options.classList} ${id}" style="${renderCssAttr(options)}">
|
|
27
|
+
<div class="badge-text">${options?.text ? options.text : 'B'}</div>
|
|
28
|
+
</div>`;
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { Badge };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BlockChainService } from '../../services/blockchain/blockchain.service.js';
|
|
2
|
+
import { BtnIcon } from './BtnIcon.js';
|
|
3
|
+
import { dynamicCol } from './Css.js';
|
|
4
|
+
import { EventsUI } from './EventsUI.js';
|
|
5
|
+
import { Input } from './Input.js';
|
|
6
|
+
import { Translate } from './Translate.js';
|
|
7
|
+
|
|
8
|
+
const BlockChainManagement = {
|
|
9
|
+
Render: async function (options) {
|
|
10
|
+
setTimeout(() => {
|
|
11
|
+
EventsUI.onClick(`.btn-upload-blockchain`, async () => {
|
|
12
|
+
// const { result, status } = new BlockChainService.post();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return html` ${dynamicCol({ containerSelector: options.idModal, id: 'blockchain' })}
|
|
16
|
+
<div class="fl">
|
|
17
|
+
<div class="in fll blockchain-col-a">
|
|
18
|
+
<div class="in section-mp">
|
|
19
|
+
<div class="in sub-title-modal"><i class="fa-solid fa-sliders"></i> ${Translate.Render('config')}</div>
|
|
20
|
+
<div class="in">
|
|
21
|
+
${await Input.Render({
|
|
22
|
+
id: `blockchain-seed`,
|
|
23
|
+
label: html`<i class="fa-solid fa-pen-to-square"></i> ${Translate.Render('blockchain-seed')}`,
|
|
24
|
+
containerClass: 'section-mp width-mini-box input-container',
|
|
25
|
+
placeholder: true,
|
|
26
|
+
})}
|
|
27
|
+
${await BtnIcon.Render({
|
|
28
|
+
class: `inl section-mp btn-custom btn-upload-blockchain`,
|
|
29
|
+
label: html`<i class="fas fa-plus"></i> ${Translate.Render(`create`)}`,
|
|
30
|
+
})}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="in fll blockchain-col-b">
|
|
35
|
+
<div class="in section-mp"></div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>`;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { BlockChainManagement };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { getId, s4 } from './CommonJs.js';
|
|
2
|
+
import { renderCssAttr } from './Css.js';
|
|
3
|
+
import { ToolTip } from './ToolTip.js';
|
|
4
|
+
import { getAllChildNodes, htmlStrSanitize, s } from './VanillaJs.js';
|
|
5
|
+
|
|
6
|
+
const BtnIcon = {
|
|
7
|
+
Tokens: {},
|
|
8
|
+
Render: async function (
|
|
9
|
+
options = {
|
|
10
|
+
class: '',
|
|
11
|
+
type: '',
|
|
12
|
+
style: '',
|
|
13
|
+
attrs: '',
|
|
14
|
+
label: '',
|
|
15
|
+
labelStyle: '',
|
|
16
|
+
tabHref: '',
|
|
17
|
+
tooltipHtml: '',
|
|
18
|
+
useVisibilityHover: false,
|
|
19
|
+
useMenuBtn: false,
|
|
20
|
+
},
|
|
21
|
+
) {
|
|
22
|
+
const tokenId = getId(this.Tokens, 'btn-token-');
|
|
23
|
+
if (options.useMenuBtn) options.class += ' main-menu-btn-selector';
|
|
24
|
+
this.Tokens[tokenId] = { ...options };
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
if (s(`.a-${tokenId}`)) s(`.a-${tokenId}`).onclick = (e) => e.preventDefault();
|
|
27
|
+
});
|
|
28
|
+
let label = html` ${options.label}
|
|
29
|
+
${options.handleContainerClass
|
|
30
|
+
? html` <div class="abs ${options.handleContainerClass}">
|
|
31
|
+
<div class="abs center">
|
|
32
|
+
<i class="fas fa-grip-vertical"></i>
|
|
33
|
+
</div>
|
|
34
|
+
</div>`
|
|
35
|
+
: ''}`;
|
|
36
|
+
let render = html`<button
|
|
37
|
+
${options?.class ? `class="${options.class} ${tokenId}"` : ''}
|
|
38
|
+
${options?.type ? `type="${options.type}"` : `type="button"`}
|
|
39
|
+
${options?.style ? `style="${options.style}"` : ''}
|
|
40
|
+
${options?.attrs ? `${options.attrs}` : ''}
|
|
41
|
+
>
|
|
42
|
+
<div class="BtnIcon-label">
|
|
43
|
+
${options.tabHref
|
|
44
|
+
? html`<a
|
|
45
|
+
class="abs a-btn a-${tokenId}"
|
|
46
|
+
href="${options.tabHref}"
|
|
47
|
+
style="${renderCssAttr({ style: { width: '100%', height: '100%', top: '0%', left: '0%' } })}"
|
|
48
|
+
>
|
|
49
|
+
<span class="in btn-label-content" ${options?.labelStyle ? `style='${options.labelStyle}'` : ''}>
|
|
50
|
+
${label}</span
|
|
51
|
+
></a
|
|
52
|
+
>`
|
|
53
|
+
: label}
|
|
54
|
+
</div>
|
|
55
|
+
<label class="hide">${htmlStrSanitize(options.label) ? htmlStrSanitize(options.label) : tokenId}</label>
|
|
56
|
+
</button>`;
|
|
57
|
+
if (options.tooltipHtml)
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
if (s(`.${tokenId}`))
|
|
60
|
+
ToolTip.Render({
|
|
61
|
+
container: `.${tokenId}`,
|
|
62
|
+
id: tokenId,
|
|
63
|
+
htmlRender: options.tooltipHtml,
|
|
64
|
+
useVisibilityHover: !!options.useVisibilityHover,
|
|
65
|
+
useMenuBtn: !!options.useMenuBtn,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
return render;
|
|
69
|
+
},
|
|
70
|
+
// https://developer.mozilla.org/en-US/docs/Games/Techniques/Control_mechanisms/Mobile_touch
|
|
71
|
+
TouchTokens: {},
|
|
72
|
+
RenderTouch: async function (options = { id: '', Events: {} }) {
|
|
73
|
+
const { id } = options;
|
|
74
|
+
this.TouchTokens[id] = { Events: {}, ...options };
|
|
75
|
+
setTimeout(() => {
|
|
76
|
+
const triggerTouchEvents = () => {
|
|
77
|
+
for (const event of Object.keys(this.TouchTokens[id].Events)) this.TouchTokens[id].Events[event]();
|
|
78
|
+
};
|
|
79
|
+
if (s(`.${id}`)) {
|
|
80
|
+
s(`.${id}`).addEventListener('touchstart', () => {
|
|
81
|
+
// handleStart
|
|
82
|
+
triggerTouchEvents();
|
|
83
|
+
});
|
|
84
|
+
s(`.${id}`).addEventListener('touchmove', () => {
|
|
85
|
+
// handleMove
|
|
86
|
+
triggerTouchEvents();
|
|
87
|
+
});
|
|
88
|
+
s(`.${id}`).addEventListener('touchend', () => {
|
|
89
|
+
// handleEnd
|
|
90
|
+
triggerTouchEvents();
|
|
91
|
+
});
|
|
92
|
+
s(`.${id}`).addEventListener('touchcancel', () => {
|
|
93
|
+
// handleCancel
|
|
94
|
+
triggerTouchEvents();
|
|
95
|
+
});
|
|
96
|
+
s(`.${id}`).onclick = triggerTouchEvents;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return html` <canvas
|
|
100
|
+
class="abs ${id}"
|
|
101
|
+
style="${renderCssAttr({ style: { width: '100%', height: '100%', top: '0px', left: '0px', border: 'none' } })}"
|
|
102
|
+
>
|
|
103
|
+
</canvas>`;
|
|
104
|
+
},
|
|
105
|
+
findLabel: (el) =>
|
|
106
|
+
getAllChildNodes(el).find((e) => {
|
|
107
|
+
return e.classList && Array.from(e.classList).find((e) => e.match('BtnIcon-label'));
|
|
108
|
+
}),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export { BtnIcon };
|