aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts8
-rw-r--r--server/initializers/migrations/0280-webtorrent-policy-user.ts16
2 files changed, 9 insertions, 15 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index f56763a16..c3e4fcede 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -7,7 +7,6 @@ import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS }
7// Do not use barrels, remain constants as independent as possible 7// Do not use barrels, remain constants as independent as possible
8import { buildPath, isTestInstance, parseDuration, parseBytes, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' 8import { buildPath, isTestInstance, parseDuration, parseBytes, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
9import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' 9import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
10import { WebTorrentPolicyType } from '../../shared/models/users/user-webtorrent-policy.type'
11import { invert } from 'lodash' 10import { invert } from 'lodash'
12import { CronRepeatOptions, EveryRepeatOptions } from 'bull' 11import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
13import * as bytes from 'bytes' 12import * as bytes from 'bytes'
@@ -547,12 +546,6 @@ const NSFW_POLICY_TYPES: { [ id: string]: NSFWPolicyType } = {
547 DISPLAY: 'display' 546 DISPLAY: 'display'
548} 547}
549 548
550const WEBTORRENT_POLICY_TYPES: { [ id: string]: WebTorrentPolicyType } = {
551 ENABLE: 'enable',
552 DISABLE: 'disable',
553 DISABLE_ON_MOBILE: 'disable_on_mobile'
554}
555
556// --------------------------------------------------------------------------- 549// ---------------------------------------------------------------------------
557 550
558// Express static paths (router) 551// Express static paths (router)
@@ -705,7 +698,6 @@ export {
705 FEEDS, 698 FEEDS,
706 JOB_TTL, 699 JOB_TTL,
707 NSFW_POLICY_TYPES, 700 NSFW_POLICY_TYPES,
708 WEBTORRENT_POLICY_TYPES,
709 TORRENT_MIMETYPE_EXT, 701 TORRENT_MIMETYPE_EXT,
710 STATIC_MAX_AGE, 702 STATIC_MAX_AGE,
711 STATIC_PATHS, 703 STATIC_PATHS,
diff --git a/server/initializers/migrations/0280-webtorrent-policy-user.ts b/server/initializers/migrations/0280-webtorrent-policy-user.ts
index d24f6709e..e6488356a 100644
--- a/server/initializers/migrations/0280-webtorrent-policy-user.ts
+++ b/server/initializers/migrations/0280-webtorrent-policy-user.ts
@@ -1,6 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { values } from 'lodash'
3import { WEBTORRENT_POLICY_TYPES } from '../constants'
4 2
5async function up (utils: { 3async function up (utils: {
6 transaction: Sequelize.Transaction 4 transaction: Sequelize.Transaction
@@ -9,18 +7,22 @@ async function up (utils: {
9}): Promise<any> { 7}): Promise<any> {
10 { 8 {
11 const data = { 9 const data = {
12 type: Sequelize.ENUM(values(WEBTORRENT_POLICY_TYPES)), 10 type: Sequelize.BOOLEAN,
13 allowNull: false, 11 allowNull: false,
14 defaultValue: 'enable' 12 defaultValue: true
15 } 13 }
16 14
17 await utils.queryInterface.addColumn('user', 'webTorrentPolicy', data) 15 await utils.queryInterface.addColumn('user', 'webTorrentEnabled', data)
18 } 16 }
19 17
20} 18}
21 19
22function down (options) { 20async function down (utils: {
23 throw new Error('Not implemented.') 21 transaction: Sequelize.Transaction
22 queryInterface: Sequelize.QueryInterface
23 sequelize: Sequelize.Sequelize
24}): Promise<any> {
25 await utils.queryInterface.removeColumn('user', 'webTorrentEnabled')
24} 26}
25 27
26export { up, down } 28export { up, down }