aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-09 11:45:19 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit7cd4d2ba10106c10602c86f74f55743ded588896 (patch)
tree81f0dd7a7ef763511158d1035f3e09e09d5dcd2c /server/initializers
parent8d76959e11ab7172040853fa4fadaf8d53e6aa12 (diff)
downloadPeerTube-7cd4d2ba10106c10602c86f74f55743ded588896.tar.gz
PeerTube-7cd4d2ba10106c10602c86f74f55743ded588896.tar.zst
PeerTube-7cd4d2ba10106c10602c86f74f55743ded588896.zip
WIP plugins: add theme support
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/checker-before-init.ts3
-rw-r--r--server/initializers/config.ts3
-rw-r--r--server/initializers/constants.ts5
-rw-r--r--server/initializers/migrations/0400-user-theme.ts25
4 files changed, 34 insertions, 2 deletions
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts
index 1f5ec20df..c94bca2f8 100644
--- a/server/initializers/checker-before-init.ts
+++ b/server/initializers/checker-before-init.ts
@@ -29,7 +29,8 @@ function checkMissedConfig () {
29 'followers.instance.enabled', 'followers.instance.manual_approval', 29 'followers.instance.enabled', 'followers.instance.manual_approval',
30 'tracker.enabled', 'tracker.private', 'tracker.reject_too_many_announces', 30 'tracker.enabled', 'tracker.private', 'tracker.reject_too_many_announces',
31 'history.videos.max_age', 'views.videos.remote.max_age', 31 'history.videos.max_age', 'views.videos.remote.max_age',
32 'rates_limit.login.window', 'rates_limit.login.max', 'rates_limit.ask_send_email.window', 'rates_limit.ask_send_email.max' 32 'rates_limit.login.window', 'rates_limit.login.max', 'rates_limit.ask_send_email.window', 'rates_limit.ask_send_email.max',
33 'theme.default'
33 ] 34 ]
34 const requiredAlternatives = [ 35 const requiredAlternatives = [
35 [ // set 36 [ // set
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 6737edcd6..dfc4bea21 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -224,6 +224,9 @@ const CONFIG = {
224 get ENABLED () { return config.get<boolean>('followers.instance.enabled') }, 224 get ENABLED () { return config.get<boolean>('followers.instance.enabled') },
225 get MANUAL_APPROVAL () { return config.get<boolean>('followers.instance.manual_approval') } 225 get MANUAL_APPROVAL () { return config.get<boolean>('followers.instance.manual_approval') }
226 } 226 }
227 },
228 THEME: {
229 get DEFAULT () { return config.get<string>('theme.default') }
227 } 230 }
228} 231}
229 232
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 8ceefbd0e..9d61ed537 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 = 395 17const LAST_MIGRATION_VERSION = 400
18 18
19// --------------------------------------------------------------------------- 19// ---------------------------------------------------------------------------
20 20
@@ -585,6 +585,8 @@ const P2P_MEDIA_LOADER_PEER_VERSION = 2
585const PLUGIN_GLOBAL_CSS_FILE_NAME = 'plugins-global.css' 585const PLUGIN_GLOBAL_CSS_FILE_NAME = 'plugins-global.css'
586const PLUGIN_GLOBAL_CSS_PATH = join(CONFIG.STORAGE.TMP_DIR, PLUGIN_GLOBAL_CSS_FILE_NAME) 586const PLUGIN_GLOBAL_CSS_PATH = join(CONFIG.STORAGE.TMP_DIR, PLUGIN_GLOBAL_CSS_FILE_NAME)
587 587
588const DEFAULT_THEME = 'default'
589
588// --------------------------------------------------------------------------- 590// ---------------------------------------------------------------------------
589 591
590// Special constants for a test instance 592// Special constants for a test instance
@@ -667,6 +669,7 @@ export {
667 HLS_STREAMING_PLAYLIST_DIRECTORY, 669 HLS_STREAMING_PLAYLIST_DIRECTORY,
668 FEEDS, 670 FEEDS,
669 JOB_TTL, 671 JOB_TTL,
672 DEFAULT_THEME,
670 NSFW_POLICY_TYPES, 673 NSFW_POLICY_TYPES,
671 STATIC_MAX_AGE, 674 STATIC_MAX_AGE,
672 STATIC_PATHS, 675 STATIC_PATHS,
diff --git a/server/initializers/migrations/0400-user-theme.ts b/server/initializers/migrations/0400-user-theme.ts
new file mode 100644
index 000000000..2c1763890
--- /dev/null
+++ b/server/initializers/migrations/0400-user-theme.ts
@@ -0,0 +1,25 @@
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: false,
12 defaultValue: 'default'
13 }
14
15 await utils.queryInterface.addColumn('user', 'theme', data)
16}
17
18function down (options) {
19 throw new Error('Not implemented.')
20}
21
22export {
23 up,
24 down
25}