diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-03-16 22:29:27 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-03-16 22:29:27 +0100 |
commit | f0f5567b6918fc60c8cab15e13aec03a89a91dfb (patch) | |
tree | 99dfdb9fa8273c9cda1360fd3b6bfccc515bf8be /server/models | |
parent | 5101105ef91bfe478f97546b78b321882da2079c (diff) | |
download | PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.tar.gz PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.tar.zst PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.zip |
Use const/let now we use node 4.2
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/pods.js | 14 | ||||
-rw-r--r-- | server/models/poolRequests.js | 10 | ||||
-rw-r--r-- | server/models/videos.js | 36 |
3 files changed, 30 insertions, 30 deletions
diff --git a/server/models/pods.js b/server/models/pods.js index 57ed20292..4e21001f5 100644 --- a/server/models/pods.js +++ b/server/models/pods.js | |||
@@ -1,22 +1,22 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var mongoose = require('mongoose') | 3 | const mongoose = require('mongoose') |
4 | 4 | ||
5 | var constants = require('../initializers/constants') | 5 | const constants = require('../initializers/constants') |
6 | var logger = require('../helpers/logger') | 6 | const logger = require('../helpers/logger') |
7 | 7 | ||
8 | // --------------------------------------------------------------------------- | 8 | // --------------------------------------------------------------------------- |
9 | 9 | ||
10 | var podsSchema = mongoose.Schema({ | 10 | const podsSchema = mongoose.Schema({ |
11 | url: String, | 11 | url: String, |
12 | publicKey: String, | 12 | publicKey: String, |
13 | score: { type: Number, max: constants.FRIEND_BASE_SCORE } | 13 | score: { type: Number, max: constants.FRIEND_BASE_SCORE } |
14 | }) | 14 | }) |
15 | var PodsDB = mongoose.model('pods', podsSchema) | 15 | const PodsDB = mongoose.model('pods', podsSchema) |
16 | 16 | ||
17 | // --------------------------------------------------------------------------- | 17 | // --------------------------------------------------------------------------- |
18 | 18 | ||
19 | var Pods = { | 19 | const Pods = { |
20 | add: add, | 20 | add: add, |
21 | count: count, | 21 | count: count, |
22 | findByUrl: findByUrl, | 22 | findByUrl: findByUrl, |
@@ -31,7 +31,7 @@ var Pods = { | |||
31 | // TODO: check if the pod is not already a friend | 31 | // TODO: check if the pod is not already a friend |
32 | function add (data, callback) { | 32 | function add (data, callback) { |
33 | if (!callback) callback = function () {} | 33 | if (!callback) callback = function () {} |
34 | var params = { | 34 | const params = { |
35 | url: data.url, | 35 | url: data.url, |
36 | publicKey: data.publicKey, | 36 | publicKey: data.publicKey, |
37 | score: constants.FRIEND_BASE_SCORE | 37 | score: constants.FRIEND_BASE_SCORE |
diff --git a/server/models/poolRequests.js b/server/models/poolRequests.js index 970315597..28093a94c 100644 --- a/server/models/poolRequests.js +++ b/server/models/poolRequests.js | |||
@@ -1,21 +1,21 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var mongoose = require('mongoose') | 3 | const mongoose = require('mongoose') |
4 | 4 | ||
5 | var logger = require('../helpers/logger') | 5 | const logger = require('../helpers/logger') |
6 | 6 | ||
7 | // --------------------------------------------------------------------------- | 7 | // --------------------------------------------------------------------------- |
8 | 8 | ||
9 | var poolRequestsSchema = mongoose.Schema({ | 9 | const poolRequestsSchema = mongoose.Schema({ |
10 | type: String, | 10 | type: String, |
11 | id: String, // Special id to find duplicates (video created we want to remove...) | 11 | id: String, // Special id to find duplicates (video created we want to remove...) |
12 | request: mongoose.Schema.Types.Mixed | 12 | request: mongoose.Schema.Types.Mixed |
13 | }) | 13 | }) |
14 | var PoolRequestsDB = mongoose.model('poolRequests', poolRequestsSchema) | 14 | const PoolRequestsDB = mongoose.model('poolRequests', poolRequestsSchema) |
15 | 15 | ||
16 | // --------------------------------------------------------------------------- | 16 | // --------------------------------------------------------------------------- |
17 | 17 | ||
18 | var PoolRequests = { | 18 | const PoolRequests = { |
19 | create: create, | 19 | create: create, |
20 | findById: findById, | 20 | findById: findById, |
21 | list: list, | 21 | list: list, |
diff --git a/server/models/videos.js b/server/models/videos.js index fd02ec9e1..0141cbb7f 100644 --- a/server/models/videos.js +++ b/server/models/videos.js | |||
@@ -1,33 +1,33 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var async = require('async') | 3 | const async = require('async') |
4 | var config = require('config') | 4 | const config = require('config') |
5 | var dz = require('dezalgo') | 5 | const dz = require('dezalgo') |
6 | var fs = require('fs') | 6 | const fs = require('fs') |
7 | var mongoose = require('mongoose') | 7 | const mongoose = require('mongoose') |
8 | var path = require('path') | 8 | const path = require('path') |
9 | 9 | ||
10 | var logger = require('../helpers/logger') | 10 | const logger = require('../helpers/logger') |
11 | 11 | ||
12 | var http = config.get('webserver.https') === true ? 'https' : 'http' | 12 | const http = config.get('webserver.https') === true ? 'https' : 'http' |
13 | var host = config.get('webserver.host') | 13 | const host = config.get('webserver.host') |
14 | var port = config.get('webserver.port') | 14 | const port = config.get('webserver.port') |
15 | var uploadDir = path.join(__dirname, '..', '..', config.get('storage.uploads')) | 15 | const uploadDir = path.join(__dirname, '..', '..', config.get('storage.uploads')) |
16 | 16 | ||
17 | // --------------------------------------------------------------------------- | 17 | // --------------------------------------------------------------------------- |
18 | 18 | ||
19 | var videosSchema = mongoose.Schema({ | 19 | const videosSchema = mongoose.Schema({ |
20 | name: String, | 20 | name: String, |
21 | namePath: String, | 21 | namePath: String, |
22 | description: String, | 22 | description: String, |
23 | magnetUri: String, | 23 | magnetUri: String, |
24 | podUrl: String | 24 | podUrl: String |
25 | }) | 25 | }) |
26 | var VideosDB = mongoose.model('videos', videosSchema) | 26 | const VideosDB = mongoose.model('videos', videosSchema) |
27 | 27 | ||
28 | // --------------------------------------------------------------------------- | 28 | // --------------------------------------------------------------------------- |
29 | 29 | ||
30 | var Videos = { | 30 | const Videos = { |
31 | add: add, | 31 | add: add, |
32 | addRemotes: addRemotes, | 32 | addRemotes: addRemotes, |
33 | get: get, | 33 | get: get, |
@@ -43,7 +43,7 @@ var Videos = { | |||
43 | function add (video, callback) { | 43 | function add (video, callback) { |
44 | logger.info('Adding %s video to database.', video.name) | 44 | logger.info('Adding %s video to database.', video.name) |
45 | 45 | ||
46 | var params = video | 46 | const params = video |
47 | params.podUrl = http + '://' + host + ':' + port | 47 | params.podUrl = http + '://' + host + ':' + port |
48 | 48 | ||
49 | VideosDB.create(params, function (err, video) { | 49 | VideosDB.create(params, function (err, video) { |
@@ -60,13 +60,13 @@ function add (video, callback) { | |||
60 | function addRemotes (videos, callback) { | 60 | function addRemotes (videos, callback) { |
61 | if (!callback) callback = function () {} | 61 | if (!callback) callback = function () {} |
62 | 62 | ||
63 | var to_add = [] | 63 | const to_add = [] |
64 | 64 | ||
65 | async.each(videos, function (video, callback_each) { | 65 | async.each(videos, function (video, callback_each) { |
66 | callback_each = dz(callback_each) | 66 | callback_each = dz(callback_each) |
67 | logger.debug('Add remote video from pod: %s', video.podUrl) | 67 | logger.debug('Add remote video from pod: %s', video.podUrl) |
68 | 68 | ||
69 | var params = { | 69 | const params = { |
70 | name: video.name, | 70 | name: video.name, |
71 | namePath: null, | 71 | namePath: null, |
72 | description: video.description, | 72 | description: video.description, |
@@ -159,7 +159,7 @@ function removeRemotesOfByMagnetUris (fromUrl, magnetUris, callback) { | |||
159 | return callback(err) | 159 | return callback(err) |
160 | } | 160 | } |
161 | 161 | ||
162 | var to_remove = [] | 162 | const to_remove = [] |
163 | async.each(videos, function (video, callback_async) { | 163 | async.each(videos, function (video, callback_async) { |
164 | callback_async = dz(callback_async) | 164 | callback_async = dz(callback_async) |
165 | 165 | ||