From 63281188a3cf00acce2974b691db1e330d6b1d46 Mon Sep 17 00:00:00 2001 From: skarab42 Date: Sun, 28 Feb 2021 10:32:13 +0100 Subject: [PATCH] feat: Add channel:read:subscriptions scope (#176) --- .../db/seeders/20201212134826-default-settings.js | 10 +--------- .../seeders/20210228083955-add-twitch-sub-scope.js | 14 ++++++++++++++ app/server/db/twitch-scopes.js | 8 ++++++++ 3 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 app/server/db/seeders/20210228083955-add-twitch-sub-scope.js create mode 100644 app/server/db/twitch-scopes.js diff --git a/app/server/db/seeders/20201212134826-default-settings.js b/app/server/db/seeders/20201212134826-default-settings.js index c6050d70..103e9f1a 100644 --- a/app/server/db/seeders/20201212134826-default-settings.js +++ b/app/server/db/seeders/20201212134826-default-settings.js @@ -1,13 +1,5 @@ const setting = require("../setting"); - -const scope = [ - "user:read:email", - "chat:read", - "chat:edit", - "channel:read:redemptions", - "channel:manage:redemptions", - "bits:read", -]; +const scope = require("../twitch-scopes"); module.exports = { up: async ({ context }) => { diff --git a/app/server/db/seeders/20210228083955-add-twitch-sub-scope.js b/app/server/db/seeders/20210228083955-add-twitch-sub-scope.js new file mode 100644 index 00000000..5cd4e0b8 --- /dev/null +++ b/app/server/db/seeders/20210228083955-add-twitch-sub-scope.js @@ -0,0 +1,14 @@ +const scope = require("../twitch-scopes"); +const Setting = require("../Models/Setting"); + +const newScope = [...scope, "channel:read:subscriptions"]; + +module.exports = { + up: async () => { + await Setting.update( + { value: JSON.stringify(newScope) }, + { where: { key: "twitch.scope" } } + ); + }, + down: async () => {}, +}; diff --git a/app/server/db/twitch-scopes.js b/app/server/db/twitch-scopes.js new file mode 100644 index 00000000..46804e8e --- /dev/null +++ b/app/server/db/twitch-scopes.js @@ -0,0 +1,8 @@ +module.exports = [ + "user:read:email", + "chat:read", + "chat:edit", + "channel:read:redemptions", + "channel:manage:redemptions", + "bits:read", +];