aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/checker-before-init.ts2
-rw-r--r--server/initializers/constants.ts9
-rw-r--r--server/initializers/migrations/0350-video-blacklist-type.ts64
3 files changed, 73 insertions, 2 deletions
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts
index ef12b3eea..e26f38564 100644
--- a/server/initializers/checker-before-init.ts
+++ b/server/initializers/checker-before-init.ts
@@ -20,7 +20,7 @@ function checkMissedConfig () {
20 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist', 20 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist',
21 'redundancy.videos.strategies', 'redundancy.videos.check_interval', 21 'redundancy.videos.strategies', 'redundancy.videos.check_interval',
22 'transcoding.enabled', 'transcoding.threads', 'transcoding.allow_additional_extensions', 22 'transcoding.enabled', 'transcoding.threads', 'transcoding.allow_additional_extensions',
23 'import.videos.http.enabled', 'import.videos.torrent.enabled', 23 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'auto_blacklist.videos.of_users.enabled',
24 'trending.videos.interval_days', 24 'trending.videos.interval_days',
25 'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route', 25 'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route',
26 'instance.is_nsfw', 'instance.default_nsfw_policy', 'instance.robots', 'instance.securitytxt', 26 'instance.is_nsfw', 'instance.default_nsfw_policy', 'instance.robots', 'instance.securitytxt',
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index ff0ade17a..f59d3ef7a 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -18,7 +18,7 @@ let config: IConfig = require('config')
18 18
19// --------------------------------------------------------------------------- 19// ---------------------------------------------------------------------------
20 20
21const LAST_MIGRATION_VERSION = 345 21const LAST_MIGRATION_VERSION = 350
22 22
23// --------------------------------------------------------------------------- 23// ---------------------------------------------------------------------------
24 24
@@ -288,6 +288,13 @@ const CONFIG = {
288 } 288 }
289 } 289 }
290 }, 290 },
291 AUTO_BLACKLIST: {
292 VIDEOS: {
293 OF_USERS: {
294 get ENABLED () { return config.get<boolean>('auto_blacklist.videos.of_users.enabled') }
295 }
296 }
297 },
291 CACHE: { 298 CACHE: {
292 PREVIEWS: { 299 PREVIEWS: {
293 get SIZE () { return config.get<number>('cache.previews.size') } 300 get SIZE () { return config.get<number>('cache.previews.size') }
diff --git a/server/initializers/migrations/0350-video-blacklist-type.ts b/server/initializers/migrations/0350-video-blacklist-type.ts
new file mode 100644
index 000000000..4849020ef
--- /dev/null
+++ b/server/initializers/migrations/0350-video-blacklist-type.ts
@@ -0,0 +1,64 @@
1import * as Sequelize from 'sequelize'
2import { VideoBlacklistType } from '../../../shared/models/videos'
3
4async function up (utils: {
5 transaction: Sequelize.Transaction,
6 queryInterface: Sequelize.QueryInterface,
7 sequelize: Sequelize.Sequelize,
8 db: any
9}): Promise<void> {
10 {
11 const data = {
12 type: Sequelize.INTEGER,
13 allowNull: true,
14 defaultValue: null
15 }
16
17 await utils.queryInterface.addColumn('videoBlacklist', 'type', data)
18 }
19
20 {
21 const query = 'UPDATE "videoBlacklist" SET "type" = ' + VideoBlacklistType.MANUAL
22 await utils.sequelize.query(query)
23 }
24
25 {
26 const data = {
27 type: Sequelize.INTEGER,
28 allowNull: false,
29 defaultValue: null
30 }
31 await utils.queryInterface.changeColumn('videoBlacklist', 'type', data)
32 }
33
34 {
35 const data = {
36 type: Sequelize.INTEGER,
37 defaultValue: null,
38 allowNull: true
39 }
40 await utils.queryInterface.addColumn('userNotificationSetting', 'videoAutoBlacklistAsModerator', data)
41 }
42
43 {
44 const query = 'UPDATE "userNotificationSetting" SET "videoAutoBlacklistAsModerator" = 3'
45 await utils.sequelize.query(query)
46 }
47
48 {
49 const data = {
50 type: Sequelize.INTEGER,
51 defaultValue: null,
52 allowNull: false
53 }
54 await utils.queryInterface.changeColumn('userNotificationSetting', 'videoAutoBlacklistAsModerator', data)
55 }
56}
57function down (options) {
58 throw new Error('Not implemented.')
59}
60
61export {
62 up,
63 down
64}