aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts21
-rw-r--r--server/initializers/migrations/0170-actor-follow-score.ts28
2 files changed, 41 insertions, 8 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index c735e6daf..0c139912c 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -9,7 +9,7 @@ import { isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core
9 9
10// --------------------------------------------------------------------------- 10// ---------------------------------------------------------------------------
11 11
12const LAST_MIGRATION_VERSION = 165 12const LAST_MIGRATION_VERSION = 170
13 13
14// --------------------------------------------------------------------------- 14// ---------------------------------------------------------------------------
15 15
@@ -40,12 +40,12 @@ const OAUTH_LIFETIME = {
40 40
41// --------------------------------------------------------------------------- 41// ---------------------------------------------------------------------------
42 42
43// Number of points we add/remove from a friend after a successful/bad request 43// Number of points we add/remove after a successful/bad request
44const SERVERS_SCORE = { 44const ACTOR_FOLLOW_SCORE = {
45 PENALTY: -10, 45 PENALTY: -10,
46 BONUS: 10, 46 BONUS: 10,
47 BASE: 100, 47 BASE: 1000,
48 MAX: 1000 48 MAX: 10000
49} 49}
50 50
51const FOLLOW_STATES: { [ id: string ]: FollowState } = { 51const FOLLOW_STATES: { [ id: string ]: FollowState } = {
@@ -76,6 +76,9 @@ const JOBS_FETCH_LIMIT_PER_CYCLE = {
76// 1 minutes 76// 1 minutes
77let JOBS_FETCHING_INTERVAL = 60000 77let JOBS_FETCHING_INTERVAL = 60000
78 78
79// 1 hour
80let SCHEDULER_INTERVAL = 60000 * 60
81
79// --------------------------------------------------------------------------- 82// ---------------------------------------------------------------------------
80 83
81const CONFIG = { 84const CONFIG = {
@@ -346,7 +349,7 @@ const OPENGRAPH_AND_OEMBED_COMMENT = '<!-- open graph and oembed tags -->'
346 349
347// Special constants for a test instance 350// Special constants for a test instance
348if (isTestInstance() === true) { 351if (isTestInstance() === true) {
349 SERVERS_SCORE.BASE = 20 352 ACTOR_FOLLOW_SCORE.BASE = 20
350 JOBS_FETCHING_INTERVAL = 1000 353 JOBS_FETCHING_INTERVAL = 1000
351 REMOTE_SCHEME.HTTP = 'http' 354 REMOTE_SCHEME.HTTP = 'http'
352 REMOTE_SCHEME.WS = 'ws' 355 REMOTE_SCHEME.WS = 'ws'
@@ -354,6 +357,7 @@ if (isTestInstance() === true) {
354 ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2 357 ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2
355 ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL = 60 // 1 minute 358 ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL = 60 // 1 minute
356 CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB 359 CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB
360 SCHEDULER_INTERVAL = 10000
357} 361}
358 362
359CONFIG.WEBSERVER.URL = sanitizeUrl(CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT) 363CONFIG.WEBSERVER.URL = sanitizeUrl(CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT)
@@ -378,7 +382,7 @@ export {
378 OAUTH_LIFETIME, 382 OAUTH_LIFETIME,
379 OPENGRAPH_AND_OEMBED_COMMENT, 383 OPENGRAPH_AND_OEMBED_COMMENT,
380 PAGINATION_COUNT_DEFAULT, 384 PAGINATION_COUNT_DEFAULT,
381 SERVERS_SCORE, 385 ACTOR_FOLLOW_SCORE,
382 PREVIEWS_SIZE, 386 PREVIEWS_SIZE,
383 REMOTE_SCHEME, 387 REMOTE_SCHEME,
384 FOLLOW_STATES, 388 FOLLOW_STATES,
@@ -396,5 +400,6 @@ export {
396 VIDEO_LICENCES, 400 VIDEO_LICENCES,
397 VIDEO_RATE_TYPES, 401 VIDEO_RATE_TYPES,
398 VIDEO_MIMETYPE_EXT, 402 VIDEO_MIMETYPE_EXT,
399 AVATAR_MIMETYPE_EXT 403 AVATAR_MIMETYPE_EXT,
404 SCHEDULER_INTERVAL
400} 405}
diff --git a/server/initializers/migrations/0170-actor-follow-score.ts b/server/initializers/migrations/0170-actor-follow-score.ts
new file mode 100644
index 000000000..2deabaf98
--- /dev/null
+++ b/server/initializers/migrations/0170-actor-follow-score.ts
@@ -0,0 +1,28 @@
1import * as Sequelize from 'sequelize'
2import { ACTOR_FOLLOW_SCORE } from '../index'
3
4async function up (utils: {
5 transaction: Sequelize.Transaction,
6 queryInterface: Sequelize.QueryInterface,
7 sequelize: Sequelize.Sequelize
8}): Promise<void> {
9 await utils.queryInterface.removeColumn('server', 'score')
10
11 const data = {
12 type: Sequelize.INTEGER,
13 allowNull: false,
14 defaultValue: ACTOR_FOLLOW_SCORE.BASE
15 }
16
17 await utils.queryInterface.addColumn('actorFollow', 'score', data)
18
19}
20
21function down (options) {
22 throw new Error('Not implemented.')
23}
24
25export {
26 up,
27 down
28}