aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/config.ts30
-rw-r--r--server/initializers/constants.ts9
-rw-r--r--server/initializers/migrations/0425-nullable-actor-fields.ts26
-rw-r--r--server/initializers/migrations/0425-user-modals.ts40
-rw-r--r--server/initializers/migrations/0430-auto-follow-notification-setting.ts40
5 files changed, 144 insertions, 1 deletions
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 510f7d64d..164d714d6 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -209,6 +209,19 @@ const CONFIG = {
209 get SHORT_DESCRIPTION () { return config.get<string>('instance.short_description') }, 209 get SHORT_DESCRIPTION () { return config.get<string>('instance.short_description') },
210 get DESCRIPTION () { return config.get<string>('instance.description') }, 210 get DESCRIPTION () { return config.get<string>('instance.description') },
211 get TERMS () { return config.get<string>('instance.terms') }, 211 get TERMS () { return config.get<string>('instance.terms') },
212 get CODE_OF_CONDUCT () { return config.get<string>('instance.code_of_conduct') },
213
214 get CREATION_REASON () { return config.get<string>('instance.creation_reason') },
215
216 get MODERATION_INFORMATION () { return config.get<string>('instance.moderation_information') },
217 get ADMINISTRATOR () { return config.get<string>('instance.administrator') },
218 get MAINTENANCE_LIFETIME () { return config.get<string>('instance.maintenance_lifetime') },
219 get BUSINESS_MODEL () { return config.get<string>('instance.business_model') },
220 get HARDWARE_INFORMATION () { return config.get<string>('instance.hardware_information') },
221
222 get LANGUAGES () { return config.get<string[]>('instance.languages') || [] },
223 get CATEGORIES () { return config.get<number[]>('instance.categories') || [] },
224
212 get IS_NSFW () { return config.get<boolean>('instance.is_nsfw') }, 225 get IS_NSFW () { return config.get<boolean>('instance.is_nsfw') },
213 get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') }, 226 get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') },
214 get DEFAULT_NSFW_POLICY () { return config.get<NSFWPolicyType>('instance.default_nsfw_policy') }, 227 get DEFAULT_NSFW_POLICY () { return config.get<NSFWPolicyType>('instance.default_nsfw_policy') },
@@ -232,6 +245,23 @@ const CONFIG = {
232 get MANUAL_APPROVAL () { return config.get<boolean>('followers.instance.manual_approval') } 245 get MANUAL_APPROVAL () { return config.get<boolean>('followers.instance.manual_approval') }
233 } 246 }
234 }, 247 },
248 FOLLOWINGS: {
249 INSTANCE: {
250 AUTO_FOLLOW_BACK: {
251 get ENABLED () {
252 return config.get<boolean>('followings.instance.auto_follow_back.enabled')
253 }
254 },
255 AUTO_FOLLOW_INDEX: {
256 get ENABLED () {
257 return config.get<boolean>('followings.instance.auto_follow_index.enabled')
258 },
259 get INDEX_URL () {
260 return config.get<string>('followings.instance.auto_follow_index.index_url')
261 }
262 }
263 }
264 },
235 THEME: { 265 THEME: {
236 get DEFAULT () { return config.get<string>('theme.default') } 266 get DEFAULT () { return config.get<string>('theme.default') }
237 } 267 }
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 3dc178b11..01d4f1d74 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -14,7 +14,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
14 14
15// --------------------------------------------------------------------------- 15// ---------------------------------------------------------------------------
16 16
17const LAST_MIGRATION_VERSION = 420 17const LAST_MIGRATION_VERSION = 430
18 18
19// --------------------------------------------------------------------------- 19// ---------------------------------------------------------------------------
20 20
@@ -168,10 +168,15 @@ const SCHEDULER_INTERVALS_MS = {
168 updateVideos: 60000, // 1 minute 168 updateVideos: 60000, // 1 minute
169 youtubeDLUpdate: 60000 * 60 * 24, // 1 day 169 youtubeDLUpdate: 60000 * 60 * 24, // 1 day
170 checkPlugins: CONFIG.PLUGINS.INDEX.CHECK_LATEST_VERSIONS_INTERVAL, 170 checkPlugins: CONFIG.PLUGINS.INDEX.CHECK_LATEST_VERSIONS_INTERVAL,
171 autoFollowIndexInstances: 60000 * 60 * 24, // 1 day
171 removeOldViews: 60000 * 60 * 24, // 1 day 172 removeOldViews: 60000 * 60 * 24, // 1 day
172 removeOldHistory: 60000 * 60 * 24 // 1 day 173 removeOldHistory: 60000 * 60 * 24 // 1 day
173} 174}
174 175
176const INSTANCES_INDEX = {
177 HOSTS_PATH: '/api/v1/instances/hosts'
178}
179
175// --------------------------------------------------------------------------- 180// ---------------------------------------------------------------------------
176 181
177const CONSTRAINTS_FIELDS = { 182const CONSTRAINTS_FIELDS = {
@@ -633,6 +638,7 @@ if (isTestInstance() === true) {
633 SCHEDULER_INTERVALS_MS.removeOldHistory = 5000 638 SCHEDULER_INTERVALS_MS.removeOldHistory = 5000
634 SCHEDULER_INTERVALS_MS.removeOldViews = 5000 639 SCHEDULER_INTERVALS_MS.removeOldViews = 5000
635 SCHEDULER_INTERVALS_MS.updateVideos = 5000 640 SCHEDULER_INTERVALS_MS.updateVideos = 5000
641 SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000
636 REPEAT_JOBS[ 'videos-views' ] = { every: 5000 } 642 REPEAT_JOBS[ 'videos-views' ] = { every: 5000 }
637 643
638 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1 644 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1
@@ -683,6 +689,7 @@ export {
683 PREVIEWS_SIZE, 689 PREVIEWS_SIZE,
684 REMOTE_SCHEME, 690 REMOTE_SCHEME,
685 FOLLOW_STATES, 691 FOLLOW_STATES,
692 INSTANCES_INDEX,
686 DEFAULT_USER_THEME_NAME, 693 DEFAULT_USER_THEME_NAME,
687 SERVER_ACTOR_NAME, 694 SERVER_ACTOR_NAME,
688 PLUGIN_GLOBAL_CSS_FILE_NAME, 695 PLUGIN_GLOBAL_CSS_FILE_NAME,
diff --git a/server/initializers/migrations/0425-nullable-actor-fields.ts b/server/initializers/migrations/0425-nullable-actor-fields.ts
new file mode 100644
index 000000000..4e5f9e6ab
--- /dev/null
+++ b/server/initializers/migrations/0425-nullable-actor-fields.ts
@@ -0,0 +1,26 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction,
5 queryInterface: Sequelize.QueryInterface,
6 sequelize: Sequelize.Sequelize,
7 db: any
8}): Promise<void> {
9 const data = {
10 type: Sequelize.STRING,
11 allowNull: true
12 }
13
14 await utils.queryInterface.changeColumn('actor', 'outboxUrl', data)
15 await utils.queryInterface.changeColumn('actor', 'followersUrl', data)
16 await utils.queryInterface.changeColumn('actor', 'followingUrl', data)
17}
18
19function down (options) {
20 throw new Error('Not implemented.')
21}
22
23export {
24 up,
25 down
26}
diff --git a/server/initializers/migrations/0425-user-modals.ts b/server/initializers/migrations/0425-user-modals.ts
new file mode 100644
index 000000000..5c2aa85b5
--- /dev/null
+++ b/server/initializers/migrations/0425-user-modals.ts
@@ -0,0 +1,40 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction,
5 queryInterface: Sequelize.QueryInterface,
6 sequelize: Sequelize.Sequelize,
7 db: any
8}): Promise<void> {
9 {
10 const data = {
11 type: Sequelize.BOOLEAN,
12 allowNull: false,
13 defaultValue: false
14 }
15
16 await utils.queryInterface.addColumn('user', 'noInstanceConfigWarningModal', data)
17 }
18
19 {
20 const data = {
21 type: Sequelize.BOOLEAN,
22 allowNull: false,
23 defaultValue: true
24 }
25
26 await utils.queryInterface.addColumn('user', 'noWelcomeModal', data)
27 data.defaultValue = false
28
29 await utils.queryInterface.changeColumn('user', 'noWelcomeModal', data)
30 }
31}
32
33function down (options) {
34 throw new Error('Not implemented.')
35}
36
37export {
38 up,
39 down
40}
diff --git a/server/initializers/migrations/0430-auto-follow-notification-setting.ts b/server/initializers/migrations/0430-auto-follow-notification-setting.ts
new file mode 100644
index 000000000..034bdd46d
--- /dev/null
+++ b/server/initializers/migrations/0430-auto-follow-notification-setting.ts
@@ -0,0 +1,40 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction,
5 queryInterface: Sequelize.QueryInterface,
6 sequelize: Sequelize.Sequelize,
7 db: any
8}): Promise<void> {
9 {
10 const data = {
11 type: Sequelize.INTEGER,
12 defaultValue: null,
13 allowNull: true
14 }
15 await utils.queryInterface.addColumn('userNotificationSetting', 'autoInstanceFollowing', data)
16 }
17
18 {
19 const query = 'UPDATE "userNotificationSetting" SET "autoInstanceFollowing" = 1'
20 await utils.sequelize.query(query)
21 }
22
23 {
24 const data = {
25 type: Sequelize.INTEGER,
26 defaultValue: null,
27 allowNull: false
28 }
29 await utils.queryInterface.changeColumn('userNotificationSetting', 'autoInstanceFollowing', data)
30 }
31}
32
33function down (options) {
34 throw new Error('Not implemented.')
35}
36
37export {
38 up,
39 down
40}