From 3ce470a9b26abfabe8d0143fa7d72b307d23958a Mon Sep 17 00:00:00 2001 From: garrettmills Date: Wed, 2 Sep 2020 08:27:09 -0500 Subject: [PATCH] add support for Gotify push notifications --- Units.flitter.js | 1 + .../app/dash/profile/EditProfile.component.js | 77 +++++++++++++++- app/assets/app/service/Profile.service.js | 13 +++ .../lib/bootstrap/bootstrap-toggle.min.css | 28 ++++++ .../lib/bootstrap/bootstrap-toggle.min.js | 9 ++ app/controllers/api/v1/Profile.controller.js | 92 +++++++++++++++++++ app/jobs/ForeignIPLoginAlert.job.js | 7 ++ app/jobs/PasswordReset.job.js | 9 ++ app/jobs/PasswordResetAlert.job.js | 8 ++ app/jobs/PushNotify.job.js | 31 +++++++ app/models/auth/User.model.js | 2 + app/models/system/NotifyConfig.model.js | 42 +++++++++ app/routing/routers/api/v1/profile.routes.js | 12 +++ config/notify.config.js | 16 ++++ locale/en_US/profile.locale.js | 9 ++ package.json | 1 + yarn.lock | 18 ++++ 17 files changed, 374 insertions(+), 1 deletion(-) create mode 100644 app/assets/lib/bootstrap/bootstrap-toggle.min.css create mode 100644 app/assets/lib/bootstrap/bootstrap-toggle.min.js create mode 100644 app/jobs/PushNotify.job.js create mode 100644 app/models/system/NotifyConfig.model.js create mode 100644 config/notify.config.js diff --git a/Units.flitter.js b/Units.flitter.js index 0d06b3b..1e1a8e7 100644 --- a/Units.flitter.js +++ b/Units.flitter.js @@ -31,6 +31,7 @@ const FlitterUnits = { * Custom units that modify or add functionality that needs to be made * available to the middleware-routing-controller stack. */ + 'Notify' : require('flitter-gotify/src/unit/NotifyUnit.js'), 'Locale' : require('flitter-i18n/src/LocaleUnit'), 'Redis' : require('flitter-redis/src/RedisUnit'), 'Jobs' : require('flitter-jobs/src/JobsUnit'), diff --git a/app/assets/app/dash/profile/EditProfile.component.js b/app/assets/app/dash/profile/EditProfile.component.js index ae0a474..11105f3 100644 --- a/app/assets/app/dash/profile/EditProfile.component.js +++ b/app/assets/app/dash/profile/EditProfile.component.js @@ -142,6 +142,39 @@ const template = ` +
  • +

    {{ t['profile.notifications'] }}

    +

    +

    {{ t['profile.notify_explainer_2'].replace(/APP_NAME/g, app_name) }}

    +
    +
    + +
    +
    + +
    +
    + + +
    +
    +
  • ').html(this.options.on).addClass(this._onstyle+" "+b),d=a('