Browse Source

catching up with progress from Sites and Soapbox

develop
Rob Colbert 2 years ago
parent
commit
e0eb9f8a03
  1. 6
      .env.default
  2. 10
      .vscode/launch.json
  3. 4
      LICENSE
  4. 23
      NOTES.md
  5. 2
      app/controllers/admin.js
  6. 2
      app/controllers/admin/content-report.js
  7. 2
      app/controllers/admin/host.js
  8. 2
      app/controllers/admin/job-queue.js
  9. 2
      app/controllers/admin/log.js
  10. 2
      app/controllers/admin/newsletter.js
  11. 2
      app/controllers/admin/page.js
  12. 2
      app/controllers/admin/post.js
  13. 2
      app/controllers/admin/settings.js
  14. 2
      app/controllers/admin/user.js
  15. 2
      app/controllers/auth.js
  16. 2
      app/controllers/comment.js
  17. 2
      app/controllers/content-report.js
  18. 2
      app/controllers/home.js
  19. 2
      app/controllers/image.js
  20. 2
      app/controllers/manifest.js
  21. 2
      app/controllers/newsletter.js
  22. 2
      app/controllers/page.js
  23. 2
      app/controllers/post.js
  24. 2
      app/controllers/user.js
  25. 2
      app/controllers/welcome.js
  26. 2
      app/models/category.js
  27. 2
      app/models/chat-message.js
  28. 2
      app/models/comment.js
  29. 2
      app/models/connect-token.js
  30. 2
      app/models/content-report.js
  31. 2
      app/models/content-vote.js
  32. 2
      app/models/csrf-token.js
  33. 2
      app/models/email-blacklist.js
  34. 2
      app/models/email-body.js
  35. 2
      app/models/email.js
  36. 2
      app/models/image.js
  37. 2
      app/models/lib/geo-types.js
  38. 2
      app/models/lib/resource-stats.js
  39. 2
      app/models/log.js
  40. 2
      app/models/net-host-stats.js
  41. 2
      app/models/net-host.js
  42. 2
      app/models/newsletter-recipient.js
  43. 2
      app/models/newsletter.js
  44. 2
      app/models/otp-account.js
  45. 2
      app/models/page.js
  46. 2
      app/models/post.js
  47. 2
      app/models/resource-view.js
  48. 2
      app/models/resource-visit.js
  49. 2
      app/models/user-block.js
  50. 2
      app/models/user-notification.js
  51. 2
      app/models/user.js
  52. 2
      app/services/cache.js
  53. 2
      app/services/chat.js
  54. 2
      app/services/comment.js
  55. 2
      app/services/content-report.js
  56. 2
      app/services/content-vote.js
  57. 2
      app/services/crypto.js
  58. 2
      app/services/csrf-token.js
  59. 2
      app/services/display-engine.js
  60. 2
      app/services/email.js
  61. 2
      app/services/gab-tv.js
  62. 2
      app/services/host-cache.js
  63. 2
      app/services/image.js
  64. 2
      app/services/job-queue.js
  65. 2
      app/services/limiter.js
  66. 2
      app/services/log.js
  67. 2
      app/services/markdown.js
  68. 2
      app/services/media.js
  69. 2
      app/services/minio.js
  70. 2
      app/services/newsletter.js
  71. 2
      app/services/otp-auth.js
  72. 2
      app/services/page.js
  73. 2
      app/services/post.js
  74. 2
      app/services/resource.js
  75. 2
      app/services/session.js
  76. 2
      app/services/sms.js
  77. 2
      app/services/user-notification.js
  78. 2
      app/services/user.js
  79. 14
      app/workers/host-services.js
  80. 113
      app/workers/newsletter.js
  81. 16
      app/workers/reeeper.js
  82. 2
      client/js/index-admin.js
  83. 2
      client/js/index.js
  84. 2
      client/js/site-admin-host-stats-app.js
  85. 2
      client/js/site-app.js
  86. 0
      client/less/site/site-home.less
  87. 1
      client/less/style.less
  88. 4
      config/job-queues.js
  89. 2
      config/limiter.js
  90. 13
      config/site.js
  91. 2
      docs/services.md
  92. 0
      dtp-base.code-workspace
  93. 106
      dtp-webapp-cli.js
  94. 28
      dtp-webapp.js
  95. 2
      lib/client/js/dtp-app.js
  96. 2
      lib/client/js/dtp-display-engine.js
  97. 2
      lib/client/js/dtp-log.js
  98. 2
      lib/client/js/dtp-plugin.js
  99. 2
      lib/client/js/dtp-socket.js
  100. 2
      lib/site-async.js

6
.env.default

@ -22,7 +22,7 @@ MAILGUN_DOMAIN=
#
MONGODB_HOST=localhost:27017
MONGODB_DATABASE=dtp-sites
MONGODB_DATABASE=dtp-webapp
#
# Redis configuration
@ -39,7 +39,7 @@ REDIS_PASSWORD=
MINIO_ENDPOINT=localhost
MINIO_PORT=9000
MINIO_USE_SSL=disabled
MINIO_ACCESS_KEY=dtp-sites
MINIO_ACCESS_KEY=dtp-webapp
MINIO_SECRET_KEY=
MINIO_IMAGE_BUCKET=site-images
MINIO_VIDEO_BUCKET=site-videos
@ -60,7 +60,7 @@ DTP_LOG_CONSOLE=enabled
DTP_LOG_MONGODB=enabled
DTP_LOG_FILE=enabled
DTP_LOG_FILE_PATH=/tmp/dtp-sites/logs
DTP_LOG_FILE_PATH=/tmp/dtp-webapp/logs
DTP_LOG_FILE_NAME_APP=justjoeradio-app.log
DTP_LOG_FILE_NAME_HTTP=justjoeradio-access.log

10
.vscode/launch.json

@ -7,11 +7,11 @@
{
"type": "pwa-node",
"request": "launch",
"name": "web:dtp-sites",
"name": "web:dtp-webapp",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder:dtp-sites}/dtp-sites.js",
"program": "${workspaceFolder:dtp-base}/dtp-webapp.js",
"console": "integratedTerminal",
"env": {
"HTTP_BIND_PORT": "3333"
@ -20,13 +20,13 @@
{
"type": "pwa-node",
"request": "launch",
"name": "cli:dtp-sites",
"name": "cli:dtp-webapp",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder:dtp-sites}/dtp-sites-cli.js",
"program": "${workspaceFolder:dtp-base}/dtp-webapp-cli.js",
"console": "integratedTerminal",
"args": ["--action=reset-indexes", "all"]
}
]
}
}

4
LICENSE

@ -1,4 +1,4 @@
Copyright 2021 Digital Telepresence, LLC
Copyright 2022 DTP Technologies, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -10,4 +10,4 @@ Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.

23
NOTES.md

@ -1,22 +1 @@
Want to tune in live
Want chat
Most Recent Episode
Featured Clips
Replays
About
Contact Us
Forum
Suggestion Box
- "I want to see [name] on the show as a guest"
Merch Store
- T-shirt
- Hat
- Tumbler / coffee mug
Opie & Anthony (Cumia)
restream.io
2022-03-03: Forked from dtp-sites to become new base for all DTP web apps

2
app/controllers/admin.js

@ -1,5 +1,5 @@
// admin.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/admin/content-report.js

@ -1,5 +1,5 @@
// admin/content-report.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/admin/host.js

@ -1,5 +1,5 @@
// admin/host.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/admin/job-queue.js

@ -1,5 +1,5 @@
// admin/job-queue.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/admin/log.js

@ -1,5 +1,5 @@
// admin/log.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/admin/newsletter.js

@ -1,5 +1,5 @@
// admin/newsletter.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/admin/page.js

@ -1,5 +1,5 @@
// admin/page.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/admin/post.js

@ -1,5 +1,5 @@
// admin/post.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/admin/settings.js

@ -1,5 +1,5 @@
// admin/settings.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/admin/user.js

@ -1,5 +1,5 @@
// admin/user.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/auth.js

@ -1,5 +1,5 @@
// auth.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/comment.js

@ -1,5 +1,5 @@
// comment.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/content-report.js

@ -1,5 +1,5 @@
// content-report.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/home.js

@ -1,5 +1,5 @@
// home.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/image.js

@ -1,5 +1,5 @@
// page.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/manifest.js

@ -1,5 +1,5 @@
// manifest.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/newsletter.js

@ -1,5 +1,5 @@
// newsletter.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/page.js

@ -1,5 +1,5 @@
// page.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/post.js

@ -1,5 +1,5 @@
// post.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/user.js

@ -1,5 +1,5 @@
// user.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/controllers/welcome.js

@ -1,5 +1,5 @@
// welcome.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/category.js

@ -1,5 +1,5 @@
// category.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/chat-message.js

@ -1,5 +1,5 @@
// chat-message.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License Apache-2.0
'use strict';

2
app/models/comment.js

@ -1,5 +1,5 @@
// comment.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/connect-token.js

@ -1,5 +1,5 @@
// connect-token.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/content-report.js

@ -1,5 +1,5 @@
// content-report.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/content-vote.js

@ -1,5 +1,5 @@
// content-vote.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/csrf-token.js

@ -1,5 +1,5 @@
// csrf-token.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/email-blacklist.js

@ -1,5 +1,5 @@
// email-blacklist.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/email-body.js

@ -1,5 +1,5 @@
// email-body.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/email.js

@ -1,5 +1,5 @@
// email.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/image.js

@ -1,5 +1,5 @@
// image.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/lib/geo-types.js

@ -1,5 +1,5 @@
// geo-types.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/lib/resource-stats.js

@ -1,5 +1,5 @@
// lib/resource-stats.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/log.js

@ -1,5 +1,5 @@
// log.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/net-host-stats.js

@ -1,5 +1,5 @@
// net-host-stats.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/net-host.js

@ -1,5 +1,5 @@
// net-host.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/newsletter-recipient.js

@ -1,5 +1,5 @@
// newsletter-recipient.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/newsletter.js

@ -1,5 +1,5 @@
// newsletter.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/otp-account.js

@ -1,5 +1,5 @@
// otp-account.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/page.js

@ -1,5 +1,5 @@
// page.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/post.js

@ -1,5 +1,5 @@
// post.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/resource-view.js

@ -1,5 +1,5 @@
// resource-view.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/resource-visit.js

@ -1,5 +1,5 @@
// resource-visit.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/user-block.js

@ -1,5 +1,5 @@
// user-block.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/user-notification.js

@ -1,5 +1,5 @@
// user-notification.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/models/user.js

@ -1,5 +1,5 @@
// user.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/cache.js

@ -1,5 +1,5 @@
// cache.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/chat.js

@ -1,5 +1,5 @@
// chat.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/comment.js

@ -1,5 +1,5 @@
// comment.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/content-report.js

@ -1,5 +1,5 @@
// content-report.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/content-vote.js

@ -1,5 +1,5 @@
// content-vote.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/crypto.js

@ -1,5 +1,5 @@
// crypto.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/csrf-token.js

@ -1,5 +1,5 @@
// csrf-token.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/display-engine.js

@ -1,5 +1,5 @@
// display-engine.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/email.js

@ -1,5 +1,5 @@
// email.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/gab-tv.js

@ -1,5 +1,5 @@
// gab-tv.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/host-cache.js

@ -1,5 +1,5 @@
// host-cache.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/image.js

@ -1,5 +1,5 @@
// minio.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/job-queue.js

@ -1,5 +1,5 @@
// job-queue.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/limiter.js

@ -1,5 +1,5 @@
// limiter.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/log.js

@ -1,5 +1,5 @@
// log.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/markdown.js

@ -1,5 +1,5 @@
// markdown.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/media.js

@ -1,5 +1,5 @@
// article.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/minio.js

@ -1,5 +1,5 @@
// minio.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/newsletter.js

@ -1,5 +1,5 @@
// newsletter.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/otp-auth.js

@ -1,5 +1,5 @@
// otp-auth.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/page.js

@ -1,5 +1,5 @@
// page.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/post.js

@ -1,5 +1,5 @@
// post.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/resource.js

@ -1,5 +1,5 @@
// resource.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/session.js

@ -1,5 +1,5 @@
// session.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/sms.js

@ -1,5 +1,5 @@
// sms.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/user-notification.js

@ -1,5 +1,5 @@
// user-notification.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
app/services/user.js

@ -1,5 +1,5 @@
// user.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

14
app/workers/host-services.js

@ -1,5 +1,5 @@
// host-services.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
@ -585,6 +585,18 @@ module.expireNetHosts = async ( ) => {
(async ( ) => {
try {
process.on('unhandledRejection', (error, p) => {
module.log.error('Unhandled rejection', {
error: error,
promise: p,
stack: error.stack
});
});
process.on('warning', (error) => {
module.log.alert('warning', { error });
});
process.once('SIGINT', async ( ) => {
module.log.info('SIGINT received');
module.log.info('requesting shutdown...');

113
app/workers/newsletter.js

@ -1,113 +0,0 @@
// newsletter.js
// Copyright (C) 2021 Digital Telepresence, LLC
// License: Apache-2.0
'use strict';
const DTP_COMPONENT_NAME = 'newsletter';
const path = require('path');
require('dotenv').config({ path: path.resolve(__dirname, '..', '..', '.env') });
const mongoose = require('mongoose');
const { SitePlatform, SiteLog } = require(path.join(__dirname, '..', '..', 'lib', 'site-lib'));
module.pkg = require(path.resolve(__dirname, '..', '..', 'package.json'));
module.config = {
componentName: DTP_COMPONENT_NAME,
root: path.resolve(__dirname, '..', '..'),
};
module.log = new SiteLog(module, module.config.componentName);
module.sendNewsletter = async (job) => {
module.log.info('newsletter email job received', { data: job.data });
const NewsletterRecipient = mongoose.model('NewsletterRecipient');
try {
/*
* Create one Bull Queue job per email to be delivered.
*/
await NewsletterRecipient
.find({ 'flags.isVerified': true, 'flags.isOptIn': true, 'flags.isRejected': false })
.lean()
.cursor()
.eachAsync(async (recipient) => {
try {
const jobData = {
newsletterId: job.data.newsletterId,
recipient: recipient.address,
};
const jobOptions = {
attempts: 3,
};
await module.jobQueue.add('email-send', jobData, jobOptions);
} catch (error) {
module.log.error('failed to create newsletter email job');
// but continue
}
}, { parallel: 4 });
} catch (error) {
module.log('failed to send newsletter', { newsletterId: job.data.newsletterId, error });
throw error; // throw error to Bull so it can report in job reports
}
};
module.sendNewsletterEmail = async (job) => {
const { newsletter: newsletterService, email: emailService } = module.services;
const { newsletterId, recipient } = job.data;
try {
let newsletter = module.newsletters[newsletterId];
if (!newsletter) {
newsletter = await newsletterService.getById(newsletterId);
module.newsletters[newsletterId] = newsletter; //TODO: clean up memory leak of newsletter (remove when all emails are sent)
}
if (!newsletter) {
throw new Error('newsletter not found');
}
const response = await emailService.send({
from: '[email protected]',
to: recipient,
subject: newsletter.title,
html: newsletter.content.html,
text: newsletter.content.text,
});
job.log(`newsletter email sent: ${response}`);
} catch (error) {
module.error('failed to send newsletter email', { newsletterId, recipient, error });
throw error; // throw error to Bull so it can report in job reports
}
};
(async ( ) => {
try {
/*
* Platform startup
*/
await SitePlatform.startPlatform(module);
const { jobQueue: jobQueueService } = module.services;
module.jobQueue = await jobQueueService.getJobQueue('newsletter', {
attempts: 3,
});
module.jobQueue.process('email', module.sendNewsletter);
module.jobQueue.process('email-send', module.sendNewsletterEmail);
/*
* Worker startup
*/
module.log.info(`${module.pkg.name} v${module.pkg.version} Newsletter worker started`);
} catch (error) {
module.log.error('failed to start Newsletter worker', { error });
process.exit(-1);
}
})();

16
app/workers/reeeper.js

@ -1,5 +1,5 @@
// host-services.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
@ -46,11 +46,23 @@ module.expireCrashedHosts = async ( ) => {
(async ( ) => {
try {
process.on('unhandledRejection', (error, p) => {
module.log.error('Unhandled rejection', {
error: error,
promise: p,
stack: error.stack
});
});
process.on('warning', (error) => {
module.log.alert('warning', { error });
});
process.once('SIGINT', async ( ) => {
module.log.info('SIGINT received');
module.log.info('requesting shutdown...');
const exitCode = await SitePlatform.shutdown();
process.nextTick(( ) => {
process.exit(exitCode);
});

2
client/js/index-admin.js

@ -1,5 +1,5 @@
// index-admin.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
client/js/index.js

@ -1,5 +1,5 @@
// index.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
client/js/site-admin-host-stats-app.js

@ -1,5 +1,5 @@
// dtp-site-app.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
client/js/site-app.js

@ -1,5 +1,5 @@
// site-app.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

0
client/less/site/site-home.less

1
client/less/style.less

@ -15,7 +15,6 @@
@import "site/dashboard.less";
@import "site/site.less";
@import "site/site-home.less";
@import "site/form.less";
@import "site/button.less";

4
config/job-queues.js

@ -1,11 +1,11 @@
// job-queues.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
module.exports = {
// 'dvr-ingest': {
// 'queue-name': {
// attempts: 3,
// },
};

2
config/limiter.js

@ -1,5 +1,5 @@
// limiter.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

13
config/site.js

@ -0,0 +1,13 @@
// site.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache 2.0
'use strict';
module.exports = {
name: process.env.DTP_SITE_NAME,
description: process.env.DTP_SITE_DESCRIPTION,
domain: process.env.DTP_SITE_DOMAIN,
domainKey: process.env.DTP_SITE_DOMAIN_KEY,
company: process.env.DTP_SITE_COMPANY || 'Digital Telepresence, LLC',
};

2
docs/services.md

@ -1,4 +1,4 @@
# DTP Sites: Services
# DTP Base: Services
Services are common logic implemented in a centralized location made accessible to the rest of the application to perform tasks in a common way. They live in [app/services](app/services), and are scripts that export a specific structure that identifies the service and provides a way to create, start, and stop them.

0
dtp-sites.code-workspace → dtp-base.code-workspace

106
dtp-sites-cli.js → dtp-webapp-cli.js

@ -1,9 +1,11 @@
// dtp-sites-cli.js
// Copyright (C) 2021 Digital Telepresence, LLC
// dtp-webapp-cli.js
// Copryright (C) DTP Technologies, LLC
// License: Apache-2.0
'use strict';
const DTP_COMPONENT_NAME = 'webapp-cli';
require('dotenv').config();
const path = require('path');
@ -16,17 +18,12 @@ const {
SiteLog,
} = require(path.join(__dirname, 'lib', 'site-lib'));
module.pkg = require(path.join(__dirname, 'package.json'));
module.rootPath = __dirname;
module.pkg = require(path.join(module.rootPath, 'package.json'));
module.config = {
componentName: 'sites-cli',
root: __dirname,
site: {
name: process.env.DTP_SITE_NAME,
description: process.env.DTP_SITE_DESCRIPTION,
domain: process.env.DTP_SITE_DOMAIN,
domainKey: process.env.DTP_SITE_DOMAIN_KEY,
company: process.env.DTP_SITE_COMPANY || 'Digital Telepresence, LLC',
},
componentName: DTP_COMPONENT_NAME,
root: module.rootPath,
site: require(path.join(module.rootPath, 'config', 'site')),
};
module.log = new SiteLog(module, module.config.componentName);
@ -79,12 +76,6 @@ module.revokePermission = async (target, permission) => {
}
};
module.dvrIngest = async (episodeId) => {
const jobQueue = module.services.jobQueue.getJobQueue('dvr-ingest', module.config.jobQueues['dvr-ingest']);
const job = await jobQueue.add({ episodeId });
module.log.info('job created', { id: job.id });
};
module.deleteOtpAccount = async (target) => {
const { otpAuth: otpAuthService } = module.services;
const User = mongoose.model('User');
@ -116,6 +107,67 @@ module.resetIndexes = async ( ) => {
}
};
module.resetPassword = async (username) => {
const { user: userService } = module.services;
const User = mongoose.model('User');
const user = await User
.findOne({
username_lc: username.trim().toLowerCase(),
})
.lean();
if (!user) {
throw new Error('user not found');
}
const password = generatePassword(8, true);
module.log.info('updating user password', { username, password });
await userService.updatePassword(user, password);
};
module.sendWelcomeEmail = async (username) => {
const User = mongoose.model('User');
if (username === 'all') {
await User
.find()
.select('+flags +optIn')
.cursor()
.eachAsync(module.sendUserWelcomeEmail, 4);
} else {
const user = await User
.findOne({
username_lc: username.trim().toLowerCase(),
})
.select('+flags +optIn')
.lean();
if (!user) {
throw new Error('user not found');
}
await module.sendUserWelcomeEmail(user);
}
};
module.sendUserWelcomeEmail = async (user) => {
const { user: userService } = module.services;
if (user.flags.isEmailVerified) {
module.log.alert('user is email-verified (aboring welcome email)', {
user: user._id,
username: user.username,
});
return;
}
module.log.info('sending welcome email', {
user: user._id,
username: user.username,
email: user.email,
});
await userService.sendWelcomeEmail(user);
};
/*
* SERVER INIT
*/
@ -130,21 +182,21 @@ module.resetIndexes = async ( ) => {
short: 'a',
type: 'string',
description: 'The action to perform',
example: 'sites-cli --action=grant --permission=moderator email email ...',
example: 'dtp-webapp-cli --action=grant --permission=moderator email email ...',
},
{
name: 'permission',
short: 'p',
type: 'string',
description: 'The permission(s) being added or removed',
example: 'sites-cli --action=grant --permission=admin email email ...'
example: 'dtp-webapp-cli --action=grant --permission=admin email email ...'
},
]);
try {
await SitePlatform.startPlatform(module);
} catch (error) {
module.log.error('failed to start DTP Sites platform', { error });
module.log.error(`failed to start DTP ${DTP_COMPONENT_NAME} platform`, { error });
return;
}
@ -162,10 +214,6 @@ module.resetIndexes = async ( ) => {
await module.revokePermission(target, module.app.options.permission);
break;
case 'dvr-ingest':
await module.dvrIngest(target);
break;
case 'make-bucket':
await module.makeBucket(target);
break;
@ -174,10 +222,18 @@ module.resetIndexes = async ( ) => {
await module.deleteOtpAccount(target);
break;
case 'reset-password':
await module.resetPassword(target);
break;
case 'reset-indexes':
await module.resetIndexes();
break;
case 'welcome-email':
await module.sendWelcomeEmail(target);
break;
default:
throw new Error(`invalid action: ${module.app.options.action}`);
}

28
dtp-sites.js → dtp-webapp.js

@ -1,26 +1,23 @@
// dtp-sites.js
// Copryright (C) Digital Telepresence, LLC
// dtp-webapp.js
// Copryright (C) DTP Technologies, LLC
// Licence: Apache-2.0
'use strict';
const DTP_COMPONENT_NAME = 'webapp';
require('dotenv').config();
const path = require('path');
const { SitePlatform, SiteLog } = require(path.join(__dirname, 'lib', 'site-lib'));
module.pkg = require(path.join(__dirname, 'package.json'));
module.rootPath = __dirname;
module.pkg = require(path.join(module.rootPath, 'package.json'));
module.config = {
componentName: 'sites',
root: __dirname,
site: {
name: process.env.DTP_SITE_NAME,
description: process.env.DTP_SITE_DESCRIPTION,
domain: process.env.DTP_SITE_DOMAIN,
domainKey: process.env.DTP_SITE_DOMAIN_KEY,
company: process.env.DTP_SITE_COMPANY || 'Digital Telepresence, LLC',
},
componentName: DTP_COMPONENT_NAME,
root: module.rootPath,
site: require(path.join(module.rootPath, 'config', 'site')),
http: {
address: process.env.HTTP_BIND_ADDRESS,
port: parseInt(process.env.HTTP_BIND_PORT, 10),
@ -29,6 +26,10 @@ module.config = {
module.log = new SiteLog(module, module.config.componentName);
module.shutdown = async ( ) => {
};
(async ( ) => {
process.on('unhandledRejection', (error, p) => {
@ -46,6 +47,7 @@ module.log = new SiteLog(module, module.config.componentName);
process.once('SIGINT', async ( ) => {
module.log.info('SIGINT received');
module.log.info('requesting shutdown...');
await module.shutdown();
const exitCode = await SitePlatform.shutdown();
process.nextTick(( ) => {
process.exit(exitCode);
@ -61,7 +63,7 @@ module.log = new SiteLog(module, module.config.componentName);
await SitePlatform.startPlatform(module);
await SitePlatform.startWebServer(module);
} catch (error) {
module.log.error('failed to start DTP Sites web server', { error });
module.log.error(`failed to start DTP ${DTP_COMPONENT_NAME}`, { error });
process.exit(-1);
}

2
lib/client/js/dtp-app.js

@ -1,5 +1,5 @@
// dtp-app.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
lib/client/js/dtp-display-engine.js

@ -1,5 +1,5 @@
// dtp-display-engine.js
// Copyright (C) 2021 Digital Telepresence, Inc.
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
lib/client/js/dtp-log.js

@ -1,5 +1,5 @@
// dtpweb-log.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
lib/client/js/dtp-plugin.js

@ -1,5 +1,5 @@
// dtp-plugin.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
/**

2
lib/client/js/dtp-socket.js

@ -1,5 +1,5 @@
// dtpweb-socket.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

2
lib/site-async.js

@ -1,5 +1,5 @@
// site-async.js
// Copyright (C) 2021 Digital Telepresence, LLC
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save